@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | **/ |
| 27 | 27 | |
| 28 | 28 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 29 | - return; |
|
| 29 | + return; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | * Code PHP si cet argument est présent, sinon null |
| 49 | 49 | **/ |
| 50 | 50 | function interprete_argument_balise($n, $p) { |
| 51 | - if (($p->param) && (!$p->param[0][0]) && (count($p->param[0]) > $n)) { |
|
| 52 | - return calculer_liste($p->param[0][$n], |
|
| 53 | - $p->descr, |
|
| 54 | - $p->boucles, |
|
| 55 | - $p->id_boucle); |
|
| 56 | - } else { |
|
| 57 | - return null; |
|
| 58 | - } |
|
| 51 | + if (($p->param) && (!$p->param[0][0]) && (count($p->param[0]) > $n)) { |
|
| 52 | + return calculer_liste($p->param[0][$n], |
|
| 53 | + $p->descr, |
|
| 54 | + $p->boucles, |
|
| 55 | + $p->id_boucle); |
|
| 56 | + } else { |
|
| 57 | + return null; |
|
| 58 | + } |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | * Pile complétée par le code à générer |
| 76 | 76 | **/ |
| 77 | 77 | function balise_NOM_SITE_SPIP_dist($p) { |
| 78 | - $p->code = "\$GLOBALS['meta']['nom_site']"; |
|
| 78 | + $p->code = "\$GLOBALS['meta']['nom_site']"; |
|
| 79 | 79 | |
| 80 | - #$p->interdire_scripts = true; |
|
| 81 | - return $p; |
|
| 80 | + #$p->interdire_scripts = true; |
|
| 81 | + return $p; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | * Pile complétée par le code à générer |
| 95 | 95 | **/ |
| 96 | 96 | function balise_EMAIL_WEBMASTER_dist($p) { |
| 97 | - $p->code = "\$GLOBALS['meta']['email_webmaster']"; |
|
| 97 | + $p->code = "\$GLOBALS['meta']['email_webmaster']"; |
|
| 98 | 98 | |
| 99 | - #$p->interdire_scripts = true; |
|
| 100 | - return $p; |
|
| 99 | + #$p->interdire_scripts = true; |
|
| 100 | + return $p; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -113,10 +113,10 @@ discard block |
||
| 113 | 113 | * Pile complétée par le code à générer |
| 114 | 114 | **/ |
| 115 | 115 | function balise_DESCRIPTIF_SITE_SPIP_dist($p) { |
| 116 | - $p->code = "\$GLOBALS['meta']['descriptif_site']"; |
|
| 116 | + $p->code = "\$GLOBALS['meta']['descriptif_site']"; |
|
| 117 | 117 | |
| 118 | - #$p->interdire_scripts = true; |
|
| 119 | - return $p; |
|
| 118 | + #$p->interdire_scripts = true; |
|
| 119 | + return $p; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | * Pile complétée par le code à générer |
| 138 | 138 | **/ |
| 139 | 139 | function balise_CHARSET_dist($p) { |
| 140 | - $p->code = "\$GLOBALS['meta']['charset']"; |
|
| 140 | + $p->code = "\$GLOBALS['meta']['charset']"; |
|
| 141 | 141 | |
| 142 | - #$p->interdire_scripts = true; |
|
| 143 | - return $p; |
|
| 142 | + #$p->interdire_scripts = true; |
|
| 143 | + return $p; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | * Pile complétée par le code à générer |
| 166 | 166 | **/ |
| 167 | 167 | function balise_LANG_LEFT_dist($p) { |
| 168 | - $_lang = champ_sql('lang', $p); |
|
| 169 | - $p->code = "lang_dir($_lang, 'left','right')"; |
|
| 170 | - $p->interdire_scripts = false; |
|
| 168 | + $_lang = champ_sql('lang', $p); |
|
| 169 | + $p->code = "lang_dir($_lang, 'left','right')"; |
|
| 170 | + $p->interdire_scripts = false; |
|
| 171 | 171 | |
| 172 | - return $p; |
|
| 172 | + return $p; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | * Pile complétée par le code à générer |
| 190 | 190 | **/ |
| 191 | 191 | function balise_LANG_RIGHT_dist($p) { |
| 192 | - $_lang = champ_sql('lang', $p); |
|
| 193 | - $p->code = "lang_dir($_lang, 'right','left')"; |
|
| 194 | - $p->interdire_scripts = false; |
|
| 192 | + $_lang = champ_sql('lang', $p); |
|
| 193 | + $p->code = "lang_dir($_lang, 'right','left')"; |
|
| 194 | + $p->interdire_scripts = false; |
|
| 195 | 195 | |
| 196 | - return $p; |
|
| 196 | + return $p; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | * Pile complétée par le code à générer |
| 219 | 219 | **/ |
| 220 | 220 | function balise_LANG_DIR_dist($p) { |
| 221 | - $_lang = champ_sql('lang', $p); |
|
| 222 | - $p->code = "lang_dir($_lang, 'ltr','rtl')"; |
|
| 223 | - $p->interdire_scripts = false; |
|
| 221 | + $_lang = champ_sql('lang', $p); |
|
| 222 | + $p->code = "lang_dir($_lang, 'ltr','rtl')"; |
|
| 223 | + $p->interdire_scripts = false; |
|
| 224 | 224 | |
| 225 | - return $p; |
|
| 225 | + return $p; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | |
@@ -239,10 +239,10 @@ discard block |
||
| 239 | 239 | * Pile complétée par le code à générer |
| 240 | 240 | **/ |
| 241 | 241 | function balise_PUCE_dist($p) { |
| 242 | - $p->code = "definir_puce()"; |
|
| 243 | - $p->interdire_scripts = false; |
|
| 242 | + $p->code = "definir_puce()"; |
|
| 243 | + $p->interdire_scripts = false; |
|
| 244 | 244 | |
| 245 | - return $p; |
|
| 245 | + return $p; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
@@ -266,12 +266,12 @@ discard block |
||
| 266 | 266 | * Pile completée du code PHP d'exécution de la balise |
| 267 | 267 | */ |
| 268 | 268 | function balise_DATE_dist($p) { |
| 269 | - $d = champ_sql('date', $p); |
|
| 269 | + $d = champ_sql('date', $p); |
|
| 270 | 270 | # if ($d === "@\$Pile[0]['date']") |
| 271 | 271 | # $d = "isset(\$Pile[0]['date']) ? $d : time()"; |
| 272 | - $p->code = $d; |
|
| 272 | + $p->code = $d; |
|
| 273 | 273 | |
| 274 | - return $p; |
|
| 274 | + return $p; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -291,13 +291,13 @@ discard block |
||
| 291 | 291 | * Pile completée du code PHP d'exécution de la balise |
| 292 | 292 | */ |
| 293 | 293 | function balise_DATE_REDAC_dist($p) { |
| 294 | - $d = champ_sql('date_redac', $p); |
|
| 294 | + $d = champ_sql('date_redac', $p); |
|
| 295 | 295 | # if ($d === "@\$Pile[0]['date_redac']") |
| 296 | 296 | # $d = "isset(\$Pile[0]['date_redac']) ? $d : time()"; |
| 297 | - $p->code = $d; |
|
| 298 | - $p->interdire_scripts = false; |
|
| 297 | + $p->code = $d; |
|
| 298 | + $p->interdire_scripts = false; |
|
| 299 | 299 | |
| 300 | - return $p; |
|
| 300 | + return $p; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
@@ -316,10 +316,10 @@ discard block |
||
| 316 | 316 | * Pile completée du code PHP d'exécution de la balise |
| 317 | 317 | */ |
| 318 | 318 | function balise_DATE_MODIF_dist($p) { |
| 319 | - $p->code = champ_sql('date_modif', $p); |
|
| 320 | - $p->interdire_scripts = false; |
|
| 319 | + $p->code = champ_sql('date_modif', $p); |
|
| 320 | + $p->interdire_scripts = false; |
|
| 321 | 321 | |
| 322 | - return $p; |
|
| 322 | + return $p; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -337,13 +337,13 @@ discard block |
||
| 337 | 337 | * Pile completée du code PHP d'exécution de la balise |
| 338 | 338 | */ |
| 339 | 339 | function balise_DATE_NOUVEAUTES_dist($p) { |
| 340 | - $p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui' |
|
| 340 | + $p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui' |
|
| 341 | 341 | AND isset(\$GLOBALS['meta']['dernier_envoi_neuf'])) ? |
| 342 | 342 | \$GLOBALS['meta']['dernier_envoi_neuf'] : |
| 343 | 343 | \"'0000-00-00'\")"; |
| 344 | - $p->interdire_scripts = false; |
|
| 344 | + $p->interdire_scripts = false; |
|
| 345 | 345 | |
| 346 | - return $p; |
|
| 346 | + return $p; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | |
@@ -362,11 +362,11 @@ discard block |
||
| 362 | 362 | * Pile completée du code PHP d'exécution de la balise |
| 363 | 363 | */ |
| 364 | 364 | function balise_DOSSIER_SQUELETTE_dist($p) { |
| 365 | - $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
|
| 366 | - $p->code = "_DIR_RACINE . '$code'" . |
|
| 367 | - $p->interdire_scripts = false; |
|
| 365 | + $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
|
| 366 | + $p->code = "_DIR_RACINE . '$code'" . |
|
| 367 | + $p->interdire_scripts = false; |
|
| 368 | 368 | |
| 369 | - return $p; |
|
| 369 | + return $p; |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /** |
@@ -381,11 +381,11 @@ discard block |
||
| 381 | 381 | * Pile completée du code PHP d'exécution de la balise |
| 382 | 382 | */ |
| 383 | 383 | function balise_SQUELETTE_dist($p) { |
| 384 | - $code = addslashes($p->descr['sourcefile']); |
|
| 385 | - $p->code = "'$code'" . |
|
| 386 | - $p->interdire_scripts = false; |
|
| 384 | + $code = addslashes($p->descr['sourcefile']); |
|
| 385 | + $p->code = "'$code'" . |
|
| 386 | + $p->interdire_scripts = false; |
|
| 387 | 387 | |
| 388 | - return $p; |
|
| 388 | + return $p; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | /** |
@@ -404,10 +404,10 @@ discard block |
||
| 404 | 404 | * Pile completée du code PHP d'exécution de la balise |
| 405 | 405 | */ |
| 406 | 406 | function balise_SPIP_VERSION_dist($p) { |
| 407 | - $p->code = "spip_version()"; |
|
| 408 | - $p->interdire_scripts = false; |
|
| 407 | + $p->code = "spip_version()"; |
|
| 408 | + $p->interdire_scripts = false; |
|
| 409 | 409 | |
| 410 | - return $p; |
|
| 410 | + return $p; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | |
@@ -433,18 +433,18 @@ discard block |
||
| 433 | 433 | * Pile complétée par le code à générer |
| 434 | 434 | **/ |
| 435 | 435 | function balise_NOM_SITE_dist($p) { |
| 436 | - if (!$p->etoile) { |
|
| 437 | - $p->code = "supprimer_numero(calculer_url(" . |
|
| 438 | - champ_sql('url_site', $p) . "," . |
|
| 439 | - champ_sql('nom_site', $p) . |
|
| 440 | - ", 'titre', \$connect, false))"; |
|
| 441 | - } else { |
|
| 442 | - $p->code = champ_sql('nom_site', $p); |
|
| 443 | - } |
|
| 436 | + if (!$p->etoile) { |
|
| 437 | + $p->code = "supprimer_numero(calculer_url(" . |
|
| 438 | + champ_sql('url_site', $p) . "," . |
|
| 439 | + champ_sql('nom_site', $p) . |
|
| 440 | + ", 'titre', \$connect, false))"; |
|
| 441 | + } else { |
|
| 442 | + $p->code = champ_sql('nom_site', $p); |
|
| 443 | + } |
|
| 444 | 444 | |
| 445 | - $p->interdire_scripts = true; |
|
| 445 | + $p->interdire_scripts = true; |
|
| 446 | 446 | |
| 447 | - return $p; |
|
| 447 | + return $p; |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | |
@@ -461,11 +461,11 @@ discard block |
||
| 461 | 461 | * Pile complétée par le code à générer |
| 462 | 462 | **/ |
| 463 | 463 | function balise_NOTES_dist($p) { |
| 464 | - // Recuperer les notes |
|
| 465 | - $p->code = 'calculer_notes()'; |
|
| 464 | + // Recuperer les notes |
|
| 465 | + $p->code = 'calculer_notes()'; |
|
| 466 | 466 | |
| 467 | - #$p->interdire_scripts = true; |
|
| 468 | - return $p; |
|
| 467 | + #$p->interdire_scripts = true; |
|
| 468 | + return $p; |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | |
@@ -487,10 +487,10 @@ discard block |
||
| 487 | 487 | * Pile complétée par le code à générer |
| 488 | 488 | **/ |
| 489 | 489 | function balise_RECHERCHE_dist($p) { |
| 490 | - $p->code = 'entites_html(_request("recherche"))'; |
|
| 491 | - $p->interdire_scripts = false; |
|
| 490 | + $p->code = 'entites_html(_request("recherche"))'; |
|
| 491 | + $p->interdire_scripts = false; |
|
| 492 | 492 | |
| 493 | - return $p; |
|
| 493 | + return $p; |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | |
@@ -508,20 +508,20 @@ discard block |
||
| 508 | 508 | * Pile complétée par le code à générer |
| 509 | 509 | **/ |
| 510 | 510 | function balise_COMPTEUR_BOUCLE_dist($p) { |
| 511 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->descr['id_mere']; |
|
| 512 | - if ($b === '') { |
|
| 513 | - $msg = array( |
|
| 514 | - 'zbug_champ_hors_boucle', |
|
| 515 | - array('champ' => '#COMPTEUR_BOUCLE') |
|
| 516 | - ); |
|
| 517 | - erreur_squelette($msg, $p); |
|
| 518 | - } else { |
|
| 519 | - $p->code = "\$Numrows['$b']['compteur_boucle']"; |
|
| 520 | - $p->boucles[$b]->cptrows = true; |
|
| 521 | - $p->interdire_scripts = false; |
|
| 511 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->descr['id_mere']; |
|
| 512 | + if ($b === '') { |
|
| 513 | + $msg = array( |
|
| 514 | + 'zbug_champ_hors_boucle', |
|
| 515 | + array('champ' => '#COMPTEUR_BOUCLE') |
|
| 516 | + ); |
|
| 517 | + erreur_squelette($msg, $p); |
|
| 518 | + } else { |
|
| 519 | + $p->code = "\$Numrows['$b']['compteur_boucle']"; |
|
| 520 | + $p->boucles[$b]->cptrows = true; |
|
| 521 | + $p->interdire_scripts = false; |
|
| 522 | 522 | |
| 523 | - return $p; |
|
| 524 | - } |
|
| 523 | + return $p; |
|
| 524 | + } |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | /** |
@@ -539,20 +539,20 @@ discard block |
||
| 539 | 539 | * Pile complétée par le code à générer |
| 540 | 540 | **/ |
| 541 | 541 | function balise_TOTAL_BOUCLE_dist($p) { |
| 542 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->descr['id_mere']; |
|
| 543 | - if ($b === '' || !isset($p->boucles[$b])) { |
|
| 544 | - $msg = array( |
|
| 545 | - 'zbug_champ_hors_boucle', |
|
| 546 | - array('champ' => "#$b" . 'TOTAL_BOUCLE') |
|
| 547 | - ); |
|
| 548 | - erreur_squelette($msg, $p); |
|
| 549 | - } else { |
|
| 550 | - $p->code = "\$Numrows['$b']['total']"; |
|
| 551 | - $p->boucles[$b]->numrows = true; |
|
| 552 | - $p->interdire_scripts = false; |
|
| 553 | - } |
|
| 542 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->descr['id_mere']; |
|
| 543 | + if ($b === '' || !isset($p->boucles[$b])) { |
|
| 544 | + $msg = array( |
|
| 545 | + 'zbug_champ_hors_boucle', |
|
| 546 | + array('champ' => "#$b" . 'TOTAL_BOUCLE') |
|
| 547 | + ); |
|
| 548 | + erreur_squelette($msg, $p); |
|
| 549 | + } else { |
|
| 550 | + $p->code = "\$Numrows['$b']['total']"; |
|
| 551 | + $p->boucles[$b]->numrows = true; |
|
| 552 | + $p->interdire_scripts = false; |
|
| 553 | + } |
|
| 554 | 554 | |
| 555 | - return $p; |
|
| 555 | + return $p; |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | * Pile complétée par le code à générer |
| 573 | 573 | **/ |
| 574 | 574 | function balise_POINTS_dist($p) { |
| 575 | - return rindex_pile($p, 'points', 'recherche'); |
|
| 575 | + return rindex_pile($p, 'points', 'recherche'); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | |
@@ -593,12 +593,12 @@ discard block |
||
| 593 | 593 | * Pile complétée par le code à générer |
| 594 | 594 | **/ |
| 595 | 595 | function balise_POPULARITE_ABSOLUE_dist($p) { |
| 596 | - $p->code = 'ceil(' . |
|
| 597 | - champ_sql('popularite', $p) . |
|
| 598 | - ')'; |
|
| 599 | - $p->interdire_scripts = false; |
|
| 596 | + $p->code = 'ceil(' . |
|
| 597 | + champ_sql('popularite', $p) . |
|
| 598 | + ')'; |
|
| 599 | + $p->interdire_scripts = false; |
|
| 600 | 600 | |
| 601 | - return $p; |
|
| 601 | + return $p; |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | /** |
@@ -618,10 +618,10 @@ discard block |
||
| 618 | 618 | * Pile complétée par le code à générer |
| 619 | 619 | **/ |
| 620 | 620 | function balise_POPULARITE_SITE_dist($p) { |
| 621 | - $p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])'; |
|
| 622 | - $p->interdire_scripts = false; |
|
| 621 | + $p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])'; |
|
| 622 | + $p->interdire_scripts = false; |
|
| 623 | 623 | |
| 624 | - return $p; |
|
| 624 | + return $p; |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | /** |
@@ -642,10 +642,10 @@ discard block |
||
| 642 | 642 | * Pile complétée par le code à générer |
| 643 | 643 | **/ |
| 644 | 644 | function balise_POPULARITE_MAX_dist($p) { |
| 645 | - $p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])'; |
|
| 646 | - $p->interdire_scripts = false; |
|
| 645 | + $p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])'; |
|
| 646 | + $p->interdire_scripts = false; |
|
| 647 | 647 | |
| 648 | - return $p; |
|
| 648 | + return $p; |
|
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | |
@@ -671,14 +671,14 @@ discard block |
||
| 671 | 671 | * Pile complétée par le code à générer |
| 672 | 672 | **/ |
| 673 | 673 | function balise_VALEUR_dist($p) { |
| 674 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 675 | - $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b);; |
|
| 676 | - if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 677 | - $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 678 | - } |
|
| 679 | - $p->interdire_scripts = true; |
|
| 674 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 675 | + $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b);; |
|
| 676 | + if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 677 | + $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 678 | + } |
|
| 679 | + $p->interdire_scripts = true; |
|
| 680 | 680 | |
| 681 | - return $p; |
|
| 681 | + return $p; |
|
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | /** |
@@ -707,17 +707,17 @@ discard block |
||
| 707 | 707 | * Pile complétée par le code à générer |
| 708 | 708 | **/ |
| 709 | 709 | function balise_EXPOSE_dist($p) { |
| 710 | - $on = "'on'"; |
|
| 711 | - $off = "''"; |
|
| 712 | - if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 713 | - $on = $v; |
|
| 714 | - if (($v = interprete_argument_balise(2, $p)) !== null) { |
|
| 715 | - $off = $v; |
|
| 716 | - } |
|
| 710 | + $on = "'on'"; |
|
| 711 | + $off = "''"; |
|
| 712 | + if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 713 | + $on = $v; |
|
| 714 | + if (($v = interprete_argument_balise(2, $p)) !== null) { |
|
| 715 | + $off = $v; |
|
| 716 | + } |
|
| 717 | 717 | |
| 718 | - } |
|
| 718 | + } |
|
| 719 | 719 | |
| 720 | - return calculer_balise_expose($p, $on, $off); |
|
| 720 | + return calculer_balise_expose($p, $on, $off); |
|
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | /** |
@@ -735,36 +735,36 @@ discard block |
||
| 735 | 735 | * Pile complétée par le code à générer |
| 736 | 736 | **/ |
| 737 | 737 | function calculer_balise_expose($p, $on, $off) { |
| 738 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 739 | - if (empty($p->boucles[$b]->primary)) { |
|
| 740 | - $msg = array('zbug_champ_hors_boucle', array('champ' => '#EXPOSER')); |
|
| 741 | - erreur_squelette($msg, $p); |
|
| 742 | - } else { |
|
| 738 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 739 | + if (empty($p->boucles[$b]->primary)) { |
|
| 740 | + $msg = array('zbug_champ_hors_boucle', array('champ' => '#EXPOSER')); |
|
| 741 | + erreur_squelette($msg, $p); |
|
| 742 | + } else { |
|
| 743 | 743 | |
| 744 | - $key = $p->boucles[$b]->primary; |
|
| 745 | - $type = $p->boucles[$p->id_boucle]->primary; |
|
| 746 | - $desc = $p->boucles[$b]->show; |
|
| 747 | - $connect = sql_quote($p->boucles[$b]->sql_serveur); |
|
| 744 | + $key = $p->boucles[$b]->primary; |
|
| 745 | + $type = $p->boucles[$p->id_boucle]->primary; |
|
| 746 | + $desc = $p->boucles[$b]->show; |
|
| 747 | + $connect = sql_quote($p->boucles[$b]->sql_serveur); |
|
| 748 | 748 | |
| 749 | - // Ne pas utiliser champ_sql, on jongle avec le nom boucle explicite |
|
| 750 | - $c = index_pile($p->id_boucle, $type, $p->boucles); |
|
| 749 | + // Ne pas utiliser champ_sql, on jongle avec le nom boucle explicite |
|
| 750 | + $c = index_pile($p->id_boucle, $type, $p->boucles); |
|
| 751 | 751 | |
| 752 | - if (isset($desc['field']['id_parent'])) { |
|
| 753 | - $parent = 0; // pour if (!$parent) dans calculer_expose |
|
| 754 | - } elseif (isset($desc['field']['id_rubrique'])) { |
|
| 755 | - $parent = index_pile($p->id_boucle, 'id_rubrique', $p->boucles, $b); |
|
| 756 | - } elseif (isset($desc['field']['id_groupe'])) { |
|
| 757 | - $parent = index_pile($p->id_boucle, 'id_groupe', $p->boucles, $b); |
|
| 758 | - } else { |
|
| 759 | - $parent = "''"; |
|
| 760 | - } |
|
| 752 | + if (isset($desc['field']['id_parent'])) { |
|
| 753 | + $parent = 0; // pour if (!$parent) dans calculer_expose |
|
| 754 | + } elseif (isset($desc['field']['id_rubrique'])) { |
|
| 755 | + $parent = index_pile($p->id_boucle, 'id_rubrique', $p->boucles, $b); |
|
| 756 | + } elseif (isset($desc['field']['id_groupe'])) { |
|
| 757 | + $parent = index_pile($p->id_boucle, 'id_groupe', $p->boucles, $b); |
|
| 758 | + } else { |
|
| 759 | + $parent = "''"; |
|
| 760 | + } |
|
| 761 | 761 | |
| 762 | - $p->code = "(calcul_exposer($c, '$type', \$Pile[0], $parent, '$key', $connect) ? $on : $off)"; |
|
| 763 | - } |
|
| 762 | + $p->code = "(calcul_exposer($c, '$type', \$Pile[0], $parent, '$key', $connect) ? $on : $off)"; |
|
| 763 | + } |
|
| 764 | 764 | |
| 765 | - $p->interdire_scripts = false; |
|
| 765 | + $p->interdire_scripts = false; |
|
| 766 | 766 | |
| 767 | - return $p; |
|
| 767 | + return $p; |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | |
@@ -802,47 +802,47 @@ discard block |
||
| 802 | 802 | **/ |
| 803 | 803 | function balise_INTRODUCTION_dist($p) { |
| 804 | 804 | |
| 805 | - $type = $p->type_requete; |
|
| 806 | - |
|
| 807 | - $_texte = champ_sql('texte', $p); |
|
| 808 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 809 | - $desc = $trouver_table(table_objet_sql($type)); |
|
| 810 | - $_descriptif = "''"; |
|
| 811 | - if ($desc and isset($desc['field']['descriptif'])) { |
|
| 812 | - // notamment articles et rubriques mais aussi tout nouvel objet concerne |
|
| 813 | - $_descriptif = champ_sql('descriptif', $p); |
|
| 814 | - } |
|
| 815 | - |
|
| 816 | - // notamment les articles mais aussi tout nouvel objet concerne |
|
| 817 | - if ($desc and isset($desc['field']['chapo'])) { |
|
| 818 | - $_chapo = champ_sql('chapo', $p); |
|
| 819 | - $_texte = "(strlen($_descriptif)) |
|
| 805 | + $type = $p->type_requete; |
|
| 806 | + |
|
| 807 | + $_texte = champ_sql('texte', $p); |
|
| 808 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 809 | + $desc = $trouver_table(table_objet_sql($type)); |
|
| 810 | + $_descriptif = "''"; |
|
| 811 | + if ($desc and isset($desc['field']['descriptif'])) { |
|
| 812 | + // notamment articles et rubriques mais aussi tout nouvel objet concerne |
|
| 813 | + $_descriptif = champ_sql('descriptif', $p); |
|
| 814 | + } |
|
| 815 | + |
|
| 816 | + // notamment les articles mais aussi tout nouvel objet concerne |
|
| 817 | + if ($desc and isset($desc['field']['chapo'])) { |
|
| 818 | + $_chapo = champ_sql('chapo', $p); |
|
| 819 | + $_texte = "(strlen($_descriptif)) |
|
| 820 | 820 | ? '' |
| 821 | 821 | : $_chapo . \"\\n\\n\" . $_texte"; |
| 822 | - } |
|
| 822 | + } |
|
| 823 | 823 | |
| 824 | - // longueur en parametre, ou valeur par defaut |
|
| 825 | - $longueur_defaut = objet_info($type, 'introduction_longueur'); |
|
| 826 | - if (!$longueur_defaut) { |
|
| 827 | - $longueur_defaut = 600; |
|
| 828 | - } |
|
| 824 | + // longueur en parametre, ou valeur par defaut |
|
| 825 | + $longueur_defaut = objet_info($type, 'introduction_longueur'); |
|
| 826 | + if (!$longueur_defaut) { |
|
| 827 | + $longueur_defaut = 600; |
|
| 828 | + } |
|
| 829 | 829 | |
| 830 | - $_suite = 'null'; |
|
| 831 | - $_longueur = $longueur_defaut; |
|
| 832 | - if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 833 | - $_longueur = 'is_numeric(' . $v . ')?intval(' . $v . '):' . $longueur_defaut; |
|
| 834 | - $_suite = '!is_numeric(' . $v . ')?' . $v . ':null'; |
|
| 835 | - } |
|
| 836 | - if (($v2 = interprete_argument_balise(2, $p)) !== null) { |
|
| 837 | - $_suite = $v2; |
|
| 838 | - } |
|
| 830 | + $_suite = 'null'; |
|
| 831 | + $_longueur = $longueur_defaut; |
|
| 832 | + if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 833 | + $_longueur = 'is_numeric(' . $v . ')?intval(' . $v . '):' . $longueur_defaut; |
|
| 834 | + $_suite = '!is_numeric(' . $v . ')?' . $v . ':null'; |
|
| 835 | + } |
|
| 836 | + if (($v2 = interprete_argument_balise(2, $p)) !== null) { |
|
| 837 | + $_suite = $v2; |
|
| 838 | + } |
|
| 839 | 839 | |
| 840 | - $f = chercher_filtre('introduction'); |
|
| 841 | - $p->code = "$f($_descriptif, $_texte, $_longueur, \$connect, $_suite)"; |
|
| 840 | + $f = chercher_filtre('introduction'); |
|
| 841 | + $p->code = "$f($_descriptif, $_texte, $_longueur, \$connect, $_suite)"; |
|
| 842 | 842 | |
| 843 | - #$p->interdire_scripts = true; |
|
| 844 | - $p->etoile = '*'; // propre est deja fait dans le calcul de l'intro |
|
| 845 | - return $p; |
|
| 843 | + #$p->interdire_scripts = true; |
|
| 844 | + $p->etoile = '*'; // propre est deja fait dans le calcul de l'intro |
|
| 845 | + return $p; |
|
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | |
@@ -862,15 +862,15 @@ discard block |
||
| 862 | 862 | * Pile complétée par le code à générer |
| 863 | 863 | **/ |
| 864 | 864 | function balise_LANG_dist($p) { |
| 865 | - $_lang = champ_sql('lang', $p); |
|
| 866 | - if (!$p->etoile) { |
|
| 867 | - $p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])"; |
|
| 868 | - } else { |
|
| 869 | - $p->code = "spip_htmlentities($_lang)"; |
|
| 870 | - } |
|
| 871 | - $p->interdire_scripts = false; |
|
| 865 | + $_lang = champ_sql('lang', $p); |
|
| 866 | + if (!$p->etoile) { |
|
| 867 | + $p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])"; |
|
| 868 | + } else { |
|
| 869 | + $p->code = "spip_htmlentities($_lang)"; |
|
| 870 | + } |
|
| 871 | + $p->interdire_scripts = false; |
|
| 872 | 872 | |
| 873 | - return $p; |
|
| 873 | + return $p; |
|
| 874 | 874 | } |
| 875 | 875 | |
| 876 | 876 | /** |
@@ -892,44 +892,44 @@ discard block |
||
| 892 | 892 | * Pile complétée par le code à générer |
| 893 | 893 | */ |
| 894 | 894 | function balise_LESAUTEURS_dist($p) { |
| 895 | - // Cherche le champ 'lesauteurs' dans la pile |
|
| 896 | - $_lesauteurs = champ_sql('lesauteurs', $p, false); |
|
| 897 | - |
|
| 898 | - // Si le champ n'existe pas (cas de spip_articles), on applique |
|
| 899 | - // le modele lesauteurs.html en passant id_article dans le contexte; |
|
| 900 | - // dans le cas contraire on prend le champ 'lesauteurs' |
|
| 901 | - // (cf extension sites/) |
|
| 902 | - if ($_lesauteurs |
|
| 903 | - and $_lesauteurs != '@$Pile[0][\'lesauteurs\']' |
|
| 904 | - ) { |
|
| 905 | - $p->code = "safehtml($_lesauteurs)"; |
|
| 906 | - // $p->interdire_scripts = true; |
|
| 907 | - } else { |
|
| 908 | - if (!$p->id_boucle) { |
|
| 909 | - $connect = ''; |
|
| 910 | - $objet = 'article'; |
|
| 911 | - $id_table_objet = 'id_article'; |
|
| 912 | - } else { |
|
| 913 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 914 | - $connect = $p->boucles[$b]->sql_serveur; |
|
| 915 | - $type_boucle = $p->boucles[$b]->type_requete; |
|
| 916 | - $objet = objet_type($type_boucle); |
|
| 917 | - $id_table_objet = id_table_objet($type_boucle); |
|
| 918 | - } |
|
| 919 | - $c = memoriser_contexte_compil($p); |
|
| 920 | - |
|
| 921 | - $p->code = sprintf(CODE_RECUPERER_FOND, "'modeles/lesauteurs'", |
|
| 922 | - "array('objet'=>'" . $objet . |
|
| 923 | - "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 924 | - ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 925 | - ($objet == 'article' ? "" : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 926 | - ")", |
|
| 927 | - "'trim'=>true, 'compil'=>array($c)", |
|
| 928 | - _q($connect)); |
|
| 929 | - $p->interdire_scripts = false; // securite apposee par recuperer_fond() |
|
| 930 | - } |
|
| 931 | - |
|
| 932 | - return $p; |
|
| 895 | + // Cherche le champ 'lesauteurs' dans la pile |
|
| 896 | + $_lesauteurs = champ_sql('lesauteurs', $p, false); |
|
| 897 | + |
|
| 898 | + // Si le champ n'existe pas (cas de spip_articles), on applique |
|
| 899 | + // le modele lesauteurs.html en passant id_article dans le contexte; |
|
| 900 | + // dans le cas contraire on prend le champ 'lesauteurs' |
|
| 901 | + // (cf extension sites/) |
|
| 902 | + if ($_lesauteurs |
|
| 903 | + and $_lesauteurs != '@$Pile[0][\'lesauteurs\']' |
|
| 904 | + ) { |
|
| 905 | + $p->code = "safehtml($_lesauteurs)"; |
|
| 906 | + // $p->interdire_scripts = true; |
|
| 907 | + } else { |
|
| 908 | + if (!$p->id_boucle) { |
|
| 909 | + $connect = ''; |
|
| 910 | + $objet = 'article'; |
|
| 911 | + $id_table_objet = 'id_article'; |
|
| 912 | + } else { |
|
| 913 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 914 | + $connect = $p->boucles[$b]->sql_serveur; |
|
| 915 | + $type_boucle = $p->boucles[$b]->type_requete; |
|
| 916 | + $objet = objet_type($type_boucle); |
|
| 917 | + $id_table_objet = id_table_objet($type_boucle); |
|
| 918 | + } |
|
| 919 | + $c = memoriser_contexte_compil($p); |
|
| 920 | + |
|
| 921 | + $p->code = sprintf(CODE_RECUPERER_FOND, "'modeles/lesauteurs'", |
|
| 922 | + "array('objet'=>'" . $objet . |
|
| 923 | + "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 924 | + ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 925 | + ($objet == 'article' ? "" : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 926 | + ")", |
|
| 927 | + "'trim'=>true, 'compil'=>array($c)", |
|
| 928 | + _q($connect)); |
|
| 929 | + $p->interdire_scripts = false; // securite apposee par recuperer_fond() |
|
| 930 | + } |
|
| 931 | + |
|
| 932 | + return $p; |
|
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | |
@@ -956,62 +956,62 @@ discard block |
||
| 956 | 956 | * Pile complétée par le code à générer |
| 957 | 957 | */ |
| 958 | 958 | function balise_RANG_dist($p) { |
| 959 | - $b = index_boucle($p); |
|
| 960 | - if ($b === '') { |
|
| 961 | - $msg = array( |
|
| 962 | - 'zbug_champ_hors_boucle', |
|
| 963 | - array('champ' => '#RANG') |
|
| 964 | - ); |
|
| 965 | - erreur_squelette($msg, $p); |
|
| 966 | - } else { |
|
| 967 | - // chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql) |
|
| 968 | - // dans la boucle immediatement englobante uniquement |
|
| 969 | - // sinon on compose le champ calcule |
|
| 970 | - $_rang = champ_sql('rang', $p, '', false); |
|
| 971 | - |
|
| 972 | - // si pas trouve de champ sql rang : |
|
| 973 | - if (!$_rang or $_rang == "''") { |
|
| 974 | - $boucle = &$p->boucles[$b]; |
|
| 975 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 976 | - $desc = $trouver_table($boucle->id_table); |
|
| 977 | - $_titre = ''; # où extraire le numero ? |
|
| 959 | + $b = index_boucle($p); |
|
| 960 | + if ($b === '') { |
|
| 961 | + $msg = array( |
|
| 962 | + 'zbug_champ_hors_boucle', |
|
| 963 | + array('champ' => '#RANG') |
|
| 964 | + ); |
|
| 965 | + erreur_squelette($msg, $p); |
|
| 966 | + } else { |
|
| 967 | + // chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql) |
|
| 968 | + // dans la boucle immediatement englobante uniquement |
|
| 969 | + // sinon on compose le champ calcule |
|
| 970 | + $_rang = champ_sql('rang', $p, '', false); |
|
| 971 | + |
|
| 972 | + // si pas trouve de champ sql rang : |
|
| 973 | + if (!$_rang or $_rang == "''") { |
|
| 974 | + $boucle = &$p->boucles[$b]; |
|
| 975 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 976 | + $desc = $trouver_table($boucle->id_table); |
|
| 977 | + $_titre = ''; # où extraire le numero ? |
|
| 978 | 978 | |
| 979 | - if (isset($desc['titre'])) { |
|
| 980 | - $t = $desc['titre']; |
|
| 981 | - if ( |
|
| 982 | - // Soit on trouve avec la déclaration de la lang AVANT |
|
| 983 | - preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m) |
|
| 984 | - // Soit on prend depuis le début |
|
| 985 | - or preg_match(';^(.*?titre)\s*(,|$);', $t, $m) |
|
| 986 | - ) { |
|
| 987 | - $m = preg_replace(',as\s+titre$,i', '', $m[1]); |
|
| 988 | - $m = trim($m); |
|
| 989 | - if ($m != "''") { |
|
| 990 | - if (!preg_match(",\W,", $m)) { |
|
| 991 | - $m = $boucle->id_table . ".$m"; |
|
| 992 | - } |
|
| 979 | + if (isset($desc['titre'])) { |
|
| 980 | + $t = $desc['titre']; |
|
| 981 | + if ( |
|
| 982 | + // Soit on trouve avec la déclaration de la lang AVANT |
|
| 983 | + preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m) |
|
| 984 | + // Soit on prend depuis le début |
|
| 985 | + or preg_match(';^(.*?titre)\s*(,|$);', $t, $m) |
|
| 986 | + ) { |
|
| 987 | + $m = preg_replace(',as\s+titre$,i', '', $m[1]); |
|
| 988 | + $m = trim($m); |
|
| 989 | + if ($m != "''") { |
|
| 990 | + if (!preg_match(",\W,", $m)) { |
|
| 991 | + $m = $boucle->id_table . ".$m"; |
|
| 992 | + } |
|
| 993 | 993 | |
| 994 | - $m .= " AS titre_rang"; |
|
| 994 | + $m .= " AS titre_rang"; |
|
| 995 | 995 | |
| 996 | - $boucle->select[] = $m; |
|
| 997 | - $_titre = '$Pile[$SP][\'titre_rang\']'; |
|
| 998 | - } |
|
| 999 | - } |
|
| 1000 | - } |
|
| 996 | + $boucle->select[] = $m; |
|
| 997 | + $_titre = '$Pile[$SP][\'titre_rang\']'; |
|
| 998 | + } |
|
| 999 | + } |
|
| 1000 | + } |
|
| 1001 | 1001 | |
| 1002 | - // si on n'a rien trouvé, on utilise le champ titre classique |
|
| 1003 | - if (!$_titre) { |
|
| 1004 | - $_titre = champ_sql('titre', $p); |
|
| 1005 | - } |
|
| 1002 | + // si on n'a rien trouvé, on utilise le champ titre classique |
|
| 1003 | + if (!$_titre) { |
|
| 1004 | + $_titre = champ_sql('titre', $p); |
|
| 1005 | + } |
|
| 1006 | 1006 | |
| 1007 | - $_rang = "recuperer_numero($_titre)"; |
|
| 1008 | - } |
|
| 1007 | + $_rang = "recuperer_numero($_titre)"; |
|
| 1008 | + } |
|
| 1009 | 1009 | |
| 1010 | - $p->code = $_rang; |
|
| 1011 | - $p->interdire_scripts = false; |
|
| 1012 | - } |
|
| 1010 | + $p->code = $_rang; |
|
| 1011 | + $p->interdire_scripts = false; |
|
| 1012 | + } |
|
| 1013 | 1013 | |
| 1014 | - return $p; |
|
| 1014 | + return $p; |
|
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | |
@@ -1033,12 +1033,12 @@ discard block |
||
| 1033 | 1033 | * Pile complétée par le code à générer |
| 1034 | 1034 | **/ |
| 1035 | 1035 | function balise_POPULARITE_dist($p) { |
| 1036 | - $_popularite = champ_sql('popularite', $p); |
|
| 1037 | - $p->code = "(ceil(min(100, 100 * $_popularite |
|
| 1036 | + $_popularite = champ_sql('popularite', $p); |
|
| 1037 | + $p->code = "(ceil(min(100, 100 * $_popularite |
|
| 1038 | 1038 | / max(1 , 0 + \$GLOBALS['meta']['popularite_max']))))"; |
| 1039 | - $p->interdire_scripts = false; |
|
| 1039 | + $p->interdire_scripts = false; |
|
| 1040 | 1040 | |
| 1041 | - return $p; |
|
| 1041 | + return $p; |
|
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | 1044 | /** |
@@ -1085,65 +1085,65 @@ discard block |
||
| 1085 | 1085 | * Pile complétée par le code à générer |
| 1086 | 1086 | */ |
| 1087 | 1087 | function balise_PAGINATION_dist($p, $liste = 'true') { |
| 1088 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->descr['id_mere']; |
|
| 1089 | - |
|
| 1090 | - // s'il n'y a pas de nom de boucle, on ne peut pas paginer |
|
| 1091 | - if ($b === '') { |
|
| 1092 | - $msg = array( |
|
| 1093 | - 'zbug_champ_hors_boucle', |
|
| 1094 | - array('champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION') |
|
| 1095 | - ); |
|
| 1096 | - erreur_squelette($msg, $p); |
|
| 1097 | - |
|
| 1098 | - return $p; |
|
| 1099 | - } |
|
| 1100 | - |
|
| 1101 | - // s'il n'y a pas de mode_partie, c'est qu'on se trouve |
|
| 1102 | - // dans un boucle recursive ou qu'on a oublie le critere {pagination} |
|
| 1103 | - if (!$p->boucles[$b]->mode_partie) { |
|
| 1104 | - if (!$p->boucles[$b]->table_optionnelle) { |
|
| 1105 | - $msg = array( |
|
| 1106 | - 'zbug_pagination_sans_critere', |
|
| 1107 | - array('champ' => '#PAGINATION') |
|
| 1108 | - ); |
|
| 1109 | - erreur_squelette($msg, $p); |
|
| 1110 | - } |
|
| 1111 | - |
|
| 1112 | - return $p; |
|
| 1113 | - } |
|
| 1114 | - |
|
| 1115 | - // a priori true |
|
| 1116 | - // si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise |
|
| 1117 | - // si true, les arguments simples (sans truc=chose) vont degager |
|
| 1118 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false); |
|
| 1119 | - if (count($_contexte)) { |
|
| 1120 | - $key = key($_contexte); |
|
| 1121 | - if (is_numeric($key)) { |
|
| 1122 | - array_shift($_contexte); |
|
| 1123 | - $__modele = interprete_argument_balise(1, $p); |
|
| 1124 | - } |
|
| 1125 | - } |
|
| 1126 | - |
|
| 1127 | - if (count($_contexte)) { |
|
| 1128 | - $code_contexte = implode(',', $_contexte); |
|
| 1129 | - } else { |
|
| 1130 | - $code_contexte = ''; |
|
| 1131 | - } |
|
| 1132 | - |
|
| 1133 | - $connect = $p->boucles[$b]->sql_serveur; |
|
| 1134 | - $pas = $p->boucles[$b]->total_parties; |
|
| 1135 | - $f_pagination = chercher_filtre('pagination'); |
|
| 1136 | - $type = $p->boucles[$b]->modificateur['debut_nom']; |
|
| 1137 | - $modif = ($type[0] !== "'") ? "'debut'.$type" |
|
| 1138 | - : ("'debut" . substr($type, 1)); |
|
| 1139 | - |
|
| 1140 | - $p->code = sprintf(CODE_PAGINATION, $f_pagination, $b, $type, $modif, $pas, $liste, |
|
| 1141 | - ((isset($__modele) and $__modele) ? $__modele : "''"), _q($connect), $code_contexte); |
|
| 1142 | - |
|
| 1143 | - $p->boucles[$b]->numrows = true; |
|
| 1144 | - $p->interdire_scripts = false; |
|
| 1145 | - |
|
| 1146 | - return $p; |
|
| 1088 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->descr['id_mere']; |
|
| 1089 | + |
|
| 1090 | + // s'il n'y a pas de nom de boucle, on ne peut pas paginer |
|
| 1091 | + if ($b === '') { |
|
| 1092 | + $msg = array( |
|
| 1093 | + 'zbug_champ_hors_boucle', |
|
| 1094 | + array('champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION') |
|
| 1095 | + ); |
|
| 1096 | + erreur_squelette($msg, $p); |
|
| 1097 | + |
|
| 1098 | + return $p; |
|
| 1099 | + } |
|
| 1100 | + |
|
| 1101 | + // s'il n'y a pas de mode_partie, c'est qu'on se trouve |
|
| 1102 | + // dans un boucle recursive ou qu'on a oublie le critere {pagination} |
|
| 1103 | + if (!$p->boucles[$b]->mode_partie) { |
|
| 1104 | + if (!$p->boucles[$b]->table_optionnelle) { |
|
| 1105 | + $msg = array( |
|
| 1106 | + 'zbug_pagination_sans_critere', |
|
| 1107 | + array('champ' => '#PAGINATION') |
|
| 1108 | + ); |
|
| 1109 | + erreur_squelette($msg, $p); |
|
| 1110 | + } |
|
| 1111 | + |
|
| 1112 | + return $p; |
|
| 1113 | + } |
|
| 1114 | + |
|
| 1115 | + // a priori true |
|
| 1116 | + // si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise |
|
| 1117 | + // si true, les arguments simples (sans truc=chose) vont degager |
|
| 1118 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false); |
|
| 1119 | + if (count($_contexte)) { |
|
| 1120 | + $key = key($_contexte); |
|
| 1121 | + if (is_numeric($key)) { |
|
| 1122 | + array_shift($_contexte); |
|
| 1123 | + $__modele = interprete_argument_balise(1, $p); |
|
| 1124 | + } |
|
| 1125 | + } |
|
| 1126 | + |
|
| 1127 | + if (count($_contexte)) { |
|
| 1128 | + $code_contexte = implode(',', $_contexte); |
|
| 1129 | + } else { |
|
| 1130 | + $code_contexte = ''; |
|
| 1131 | + } |
|
| 1132 | + |
|
| 1133 | + $connect = $p->boucles[$b]->sql_serveur; |
|
| 1134 | + $pas = $p->boucles[$b]->total_parties; |
|
| 1135 | + $f_pagination = chercher_filtre('pagination'); |
|
| 1136 | + $type = $p->boucles[$b]->modificateur['debut_nom']; |
|
| 1137 | + $modif = ($type[0] !== "'") ? "'debut'.$type" |
|
| 1138 | + : ("'debut" . substr($type, 1)); |
|
| 1139 | + |
|
| 1140 | + $p->code = sprintf(CODE_PAGINATION, $f_pagination, $b, $type, $modif, $pas, $liste, |
|
| 1141 | + ((isset($__modele) and $__modele) ? $__modele : "''"), _q($connect), $code_contexte); |
|
| 1142 | + |
|
| 1143 | + $p->boucles[$b]->numrows = true; |
|
| 1144 | + $p->interdire_scripts = false; |
|
| 1145 | + |
|
| 1146 | + return $p; |
|
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | 1149 | |
@@ -1170,11 +1170,11 @@ discard block |
||
| 1170 | 1170 | * Pile complétée par le code à générer |
| 1171 | 1171 | **/ |
| 1172 | 1172 | function balise_ANCRE_PAGINATION_dist($p) { |
| 1173 | - if ($f = charger_fonction('PAGINATION', 'balise', true)) { |
|
| 1174 | - return $f($p, $liste = 'false'); |
|
| 1175 | - } else { |
|
| 1176 | - return null; |
|
| 1177 | - } // ou une erreur ? |
|
| 1173 | + if ($f = charger_fonction('PAGINATION', 'balise', true)) { |
|
| 1174 | + return $f($p, $liste = 'false'); |
|
| 1175 | + } else { |
|
| 1176 | + return null; |
|
| 1177 | + } // ou une erreur ? |
|
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | |
@@ -1195,21 +1195,21 @@ discard block |
||
| 1195 | 1195 | * Pile complétée par le code à générer |
| 1196 | 1196 | **/ |
| 1197 | 1197 | function balise_GRAND_TOTAL_dist($p) { |
| 1198 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->descr['id_mere']; |
|
| 1199 | - if ($b === '' || !isset($p->boucles[$b])) { |
|
| 1200 | - $msg = array( |
|
| 1201 | - 'zbug_champ_hors_boucle', |
|
| 1202 | - array('champ' => "#$b" . 'TOTAL_BOUCLE') |
|
| 1203 | - ); |
|
| 1204 | - erreur_squelette($msg, $p); |
|
| 1205 | - } else { |
|
| 1206 | - $p->code = "(isset(\$Numrows['$b']['grand_total']) |
|
| 1198 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->descr['id_mere']; |
|
| 1199 | + if ($b === '' || !isset($p->boucles[$b])) { |
|
| 1200 | + $msg = array( |
|
| 1201 | + 'zbug_champ_hors_boucle', |
|
| 1202 | + array('champ' => "#$b" . 'TOTAL_BOUCLE') |
|
| 1203 | + ); |
|
| 1204 | + erreur_squelette($msg, $p); |
|
| 1205 | + } else { |
|
| 1206 | + $p->code = "(isset(\$Numrows['$b']['grand_total']) |
|
| 1207 | 1207 | ? \$Numrows['$b']['grand_total'] : \$Numrows['$b']['total'])"; |
| 1208 | - $p->boucles[$b]->numrows = true; |
|
| 1209 | - $p->interdire_scripts = false; |
|
| 1210 | - } |
|
| 1208 | + $p->boucles[$b]->numrows = true; |
|
| 1209 | + $p->interdire_scripts = false; |
|
| 1210 | + } |
|
| 1211 | 1211 | |
| 1212 | - return $p; |
|
| 1212 | + return $p; |
|
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | |
@@ -1237,10 +1237,10 @@ discard block |
||
| 1237 | 1237 | * Pile complétée par le code à générer |
| 1238 | 1238 | **/ |
| 1239 | 1239 | function balise_SELF_dist($p) { |
| 1240 | - $p->code = 'self()'; |
|
| 1241 | - $p->interdire_scripts = false; |
|
| 1240 | + $p->code = 'self()'; |
|
| 1241 | + $p->interdire_scripts = false; |
|
| 1242 | 1242 | |
| 1243 | - return $p; |
|
| 1243 | + return $p; |
|
| 1244 | 1244 | } |
| 1245 | 1245 | |
| 1246 | 1246 | |
@@ -1267,17 +1267,17 @@ discard block |
||
| 1267 | 1267 | * Pile complétée par le code à générer |
| 1268 | 1268 | **/ |
| 1269 | 1269 | function balise_CHEMIN_dist($p) { |
| 1270 | - $arg = interprete_argument_balise(1, $p); |
|
| 1271 | - if (!$arg) { |
|
| 1272 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' CHEMIN')); |
|
| 1273 | - erreur_squelette($msg, $p); |
|
| 1274 | - } else { |
|
| 1275 | - $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1276 | - } |
|
| 1270 | + $arg = interprete_argument_balise(1, $p); |
|
| 1271 | + if (!$arg) { |
|
| 1272 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' CHEMIN')); |
|
| 1273 | + erreur_squelette($msg, $p); |
|
| 1274 | + } else { |
|
| 1275 | + $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1276 | + } |
|
| 1277 | 1277 | |
| 1278 | - $p->interdire_scripts = false; |
|
| 1278 | + $p->interdire_scripts = false; |
|
| 1279 | 1279 | |
| 1280 | - return $p; |
|
| 1280 | + return $p; |
|
| 1281 | 1281 | } |
| 1282 | 1282 | |
| 1283 | 1283 | /** |
@@ -1302,16 +1302,16 @@ discard block |
||
| 1302 | 1302 | * Pile complétée par le code à générer |
| 1303 | 1303 | **/ |
| 1304 | 1304 | function balise_CHEMIN_IMAGE_dist($p) { |
| 1305 | - $arg = interprete_argument_balise(1, $p); |
|
| 1306 | - if (!$arg) { |
|
| 1307 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' CHEMIN_IMAGE')); |
|
| 1308 | - erreur_squelette($msg, $p); |
|
| 1309 | - } else { |
|
| 1310 | - $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1311 | - } |
|
| 1305 | + $arg = interprete_argument_balise(1, $p); |
|
| 1306 | + if (!$arg) { |
|
| 1307 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' CHEMIN_IMAGE')); |
|
| 1308 | + erreur_squelette($msg, $p); |
|
| 1309 | + } else { |
|
| 1310 | + $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1311 | + } |
|
| 1312 | 1312 | |
| 1313 | - #$p->interdire_scripts = true; |
|
| 1314 | - return $p; |
|
| 1313 | + #$p->interdire_scripts = true; |
|
| 1314 | + return $p; |
|
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | |
@@ -1349,36 +1349,36 @@ discard block |
||
| 1349 | 1349 | **/ |
| 1350 | 1350 | function balise_ENV_dist($p, $src = null) { |
| 1351 | 1351 | |
| 1352 | - // cle du tableau desiree |
|
| 1353 | - $_nom = interprete_argument_balise(1, $p); |
|
| 1354 | - // valeur par defaut |
|
| 1355 | - $_sinon = interprete_argument_balise(2, $p); |
|
| 1352 | + // cle du tableau desiree |
|
| 1353 | + $_nom = interprete_argument_balise(1, $p); |
|
| 1354 | + // valeur par defaut |
|
| 1355 | + $_sinon = interprete_argument_balise(2, $p); |
|
| 1356 | 1356 | |
| 1357 | - // $src est un tableau de donnees sources eventuellement transmis |
|
| 1358 | - // en absence, on utilise l'environnement du squelette $Pile[0] |
|
| 1357 | + // $src est un tableau de donnees sources eventuellement transmis |
|
| 1358 | + // en absence, on utilise l'environnement du squelette $Pile[0] |
|
| 1359 | 1359 | |
| 1360 | - if (!$_nom) { |
|
| 1361 | - // cas de #ENV sans argument : on retourne le serialize() du tableau |
|
| 1362 | - // une belle fonction [(#ENV|affiche_env)] serait pratique |
|
| 1363 | - if ($src) { |
|
| 1364 | - $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1365 | - } else { |
|
| 1366 | - $p->code = '@serialize($Pile[0])'; |
|
| 1367 | - } |
|
| 1368 | - } else { |
|
| 1369 | - if (!$src) { |
|
| 1370 | - $src = '@$Pile[0]'; |
|
| 1371 | - } |
|
| 1372 | - if ($_sinon) { |
|
| 1373 | - $p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)"; |
|
| 1374 | - } else { |
|
| 1375 | - $p->code = "table_valeur($src, (string)$_nom, null)"; |
|
| 1376 | - } |
|
| 1377 | - } |
|
| 1360 | + if (!$_nom) { |
|
| 1361 | + // cas de #ENV sans argument : on retourne le serialize() du tableau |
|
| 1362 | + // une belle fonction [(#ENV|affiche_env)] serait pratique |
|
| 1363 | + if ($src) { |
|
| 1364 | + $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1365 | + } else { |
|
| 1366 | + $p->code = '@serialize($Pile[0])'; |
|
| 1367 | + } |
|
| 1368 | + } else { |
|
| 1369 | + if (!$src) { |
|
| 1370 | + $src = '@$Pile[0]'; |
|
| 1371 | + } |
|
| 1372 | + if ($_sinon) { |
|
| 1373 | + $p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)"; |
|
| 1374 | + } else { |
|
| 1375 | + $p->code = "table_valeur($src, (string)$_nom, null)"; |
|
| 1376 | + } |
|
| 1377 | + } |
|
| 1378 | 1378 | |
| 1379 | - #$p->interdire_scripts = true; |
|
| 1379 | + #$p->interdire_scripts = true; |
|
| 1380 | 1380 | |
| 1381 | - return $p; |
|
| 1381 | + return $p; |
|
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | /** |
@@ -1408,16 +1408,16 @@ discard block |
||
| 1408 | 1408 | * Pile completée du code PHP d'exécution de la balise |
| 1409 | 1409 | */ |
| 1410 | 1410 | function balise_CONFIG_dist($p) { |
| 1411 | - if (!$arg = interprete_argument_balise(1, $p)) { |
|
| 1412 | - $arg = "''"; |
|
| 1413 | - } |
|
| 1414 | - $_sinon = interprete_argument_balise(2, $p); |
|
| 1415 | - $_unserialize = sinon(interprete_argument_balise(3, $p), "false"); |
|
| 1411 | + if (!$arg = interprete_argument_balise(1, $p)) { |
|
| 1412 | + $arg = "''"; |
|
| 1413 | + } |
|
| 1414 | + $_sinon = interprete_argument_balise(2, $p); |
|
| 1415 | + $_unserialize = sinon(interprete_argument_balise(3, $p), "false"); |
|
| 1416 | 1416 | |
| 1417 | - $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1418 | - ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1417 | + $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1418 | + ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1419 | 1419 | |
| 1420 | - return $p; |
|
| 1420 | + return $p; |
|
| 1421 | 1421 | } |
| 1422 | 1422 | |
| 1423 | 1423 | |
@@ -1440,10 +1440,10 @@ discard block |
||
| 1440 | 1440 | * Pile completée du code PHP d'exécution de la balise |
| 1441 | 1441 | */ |
| 1442 | 1442 | function balise_CONNECT_dist($p) { |
| 1443 | - $p->code = '($connect ? $connect : NULL)'; |
|
| 1444 | - $p->interdire_scripts = false; |
|
| 1443 | + $p->code = '($connect ? $connect : NULL)'; |
|
| 1444 | + $p->interdire_scripts = false; |
|
| 1445 | 1445 | |
| 1446 | - return $p; |
|
| 1446 | + return $p; |
|
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | 1449 | |
@@ -1471,15 +1471,15 @@ discard block |
||
| 1471 | 1471 | * Pile completée du code PHP d'exécution de la balise |
| 1472 | 1472 | **/ |
| 1473 | 1473 | function balise_SESSION_dist($p) { |
| 1474 | - $p->descr['session'] = true; |
|
| 1474 | + $p->descr['session'] = true; |
|
| 1475 | 1475 | |
| 1476 | - $f = function_exists('balise_ENV') |
|
| 1477 | - ? 'balise_ENV' |
|
| 1478 | - : 'balise_ENV_dist'; |
|
| 1476 | + $f = function_exists('balise_ENV') |
|
| 1477 | + ? 'balise_ENV' |
|
| 1478 | + : 'balise_ENV_dist'; |
|
| 1479 | 1479 | |
| 1480 | - $p = $f($p, '$GLOBALS["visiteur_session"]'); |
|
| 1480 | + $p = $f($p, '$GLOBALS["visiteur_session"]'); |
|
| 1481 | 1481 | |
| 1482 | - return $p; |
|
| 1482 | + return $p; |
|
| 1483 | 1483 | } |
| 1484 | 1484 | |
| 1485 | 1485 | |
@@ -1502,18 +1502,18 @@ discard block |
||
| 1502 | 1502 | * Pile completée du code PHP d'exécution de la balise |
| 1503 | 1503 | **/ |
| 1504 | 1504 | function balise_SESSION_SET_dist($p) { |
| 1505 | - $_nom = interprete_argument_balise(1, $p); |
|
| 1506 | - $_val = interprete_argument_balise(2, $p); |
|
| 1507 | - if (!$_nom or !$_val) { |
|
| 1508 | - $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'SESSION_SET')); |
|
| 1509 | - erreur_squelette($err_b_s_a, $p); |
|
| 1510 | - } else { |
|
| 1511 | - $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1512 | - } |
|
| 1505 | + $_nom = interprete_argument_balise(1, $p); |
|
| 1506 | + $_val = interprete_argument_balise(2, $p); |
|
| 1507 | + if (!$_nom or !$_val) { |
|
| 1508 | + $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'SESSION_SET')); |
|
| 1509 | + erreur_squelette($err_b_s_a, $p); |
|
| 1510 | + } else { |
|
| 1511 | + $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1512 | + } |
|
| 1513 | 1513 | |
| 1514 | - $p->interdire_scripts = false; |
|
| 1514 | + $p->interdire_scripts = false; |
|
| 1515 | 1515 | |
| 1516 | - return $p; |
|
| 1516 | + return $p; |
|
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | 1519 | |
@@ -1544,25 +1544,25 @@ discard block |
||
| 1544 | 1544 | * Pile completée du code PHP d'exécution de la balise |
| 1545 | 1545 | **/ |
| 1546 | 1546 | function balise_EVAL_dist($p) { |
| 1547 | - $php = interprete_argument_balise(1, $p); |
|
| 1548 | - if ($php) { |
|
| 1549 | - # optimisation sur les #EVAL{une expression sans #BALISE} |
|
| 1550 | - # attention au commentaire "// x signes" qui precede |
|
| 1551 | - if (preg_match(",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms", |
|
| 1552 | - $php, $r)) { |
|
| 1553 | - $p->code = /* $r[1]. */ |
|
| 1554 | - '(' . $r[2] . ')'; |
|
| 1555 | - } else { |
|
| 1556 | - $p->code = "eval('return '.$php.';')"; |
|
| 1557 | - } |
|
| 1558 | - } else { |
|
| 1559 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' EVAL')); |
|
| 1560 | - erreur_squelette($msg, $p); |
|
| 1561 | - } |
|
| 1547 | + $php = interprete_argument_balise(1, $p); |
|
| 1548 | + if ($php) { |
|
| 1549 | + # optimisation sur les #EVAL{une expression sans #BALISE} |
|
| 1550 | + # attention au commentaire "// x signes" qui precede |
|
| 1551 | + if (preg_match(",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms", |
|
| 1552 | + $php, $r)) { |
|
| 1553 | + $p->code = /* $r[1]. */ |
|
| 1554 | + '(' . $r[2] . ')'; |
|
| 1555 | + } else { |
|
| 1556 | + $p->code = "eval('return '.$php.';')"; |
|
| 1557 | + } |
|
| 1558 | + } else { |
|
| 1559 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' EVAL')); |
|
| 1560 | + erreur_squelette($msg, $p); |
|
| 1561 | + } |
|
| 1562 | 1562 | |
| 1563 | - #$p->interdire_scripts = true; |
|
| 1563 | + #$p->interdire_scripts = true; |
|
| 1564 | 1564 | |
| 1565 | - return $p; |
|
| 1565 | + return $p; |
|
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | 1568 | |
@@ -1592,18 +1592,18 @@ discard block |
||
| 1592 | 1592 | **/ |
| 1593 | 1593 | function balise_CHAMP_SQL_dist($p) { |
| 1594 | 1594 | |
| 1595 | - if ($p->param |
|
| 1596 | - and isset($p->param[0][1][0]) |
|
| 1597 | - and $champ = ($p->param[0][1][0]->texte) |
|
| 1598 | - ) { |
|
| 1599 | - $p->code = champ_sql($champ, $p); |
|
| 1600 | - } else { |
|
| 1601 | - $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => ' CHAMP_SQL')); |
|
| 1602 | - erreur_squelette($err_b_s_a, $p); |
|
| 1603 | - } |
|
| 1595 | + if ($p->param |
|
| 1596 | + and isset($p->param[0][1][0]) |
|
| 1597 | + and $champ = ($p->param[0][1][0]->texte) |
|
| 1598 | + ) { |
|
| 1599 | + $p->code = champ_sql($champ, $p); |
|
| 1600 | + } else { |
|
| 1601 | + $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => ' CHAMP_SQL')); |
|
| 1602 | + erreur_squelette($err_b_s_a, $p); |
|
| 1603 | + } |
|
| 1604 | 1604 | |
| 1605 | - #$p->interdire_scripts = true; |
|
| 1606 | - return $p; |
|
| 1605 | + #$p->interdire_scripts = true; |
|
| 1606 | + return $p; |
|
| 1607 | 1607 | } |
| 1608 | 1608 | |
| 1609 | 1609 | /** |
@@ -1629,13 +1629,13 @@ discard block |
||
| 1629 | 1629 | * Pile complétée par le code à générer |
| 1630 | 1630 | **/ |
| 1631 | 1631 | function balise_VAL_dist($p) { |
| 1632 | - $p->code = interprete_argument_balise(1, $p); |
|
| 1633 | - if (!strlen($p->code)) { |
|
| 1634 | - $p->code = "''"; |
|
| 1635 | - } |
|
| 1636 | - $p->interdire_scripts = false; |
|
| 1632 | + $p->code = interprete_argument_balise(1, $p); |
|
| 1633 | + if (!strlen($p->code)) { |
|
| 1634 | + $p->code = "''"; |
|
| 1635 | + } |
|
| 1636 | + $p->interdire_scripts = false; |
|
| 1637 | 1637 | |
| 1638 | - return $p; |
|
| 1638 | + return $p; |
|
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | 1641 | /** |
@@ -1681,10 +1681,10 @@ discard block |
||
| 1681 | 1681 | * Pile complétée par le code à générer |
| 1682 | 1682 | **/ |
| 1683 | 1683 | function balise_REM_dist($p) { |
| 1684 | - $p->code = "''"; |
|
| 1685 | - $p->interdire_scripts = false; |
|
| 1684 | + $p->code = "''"; |
|
| 1685 | + $p->interdire_scripts = false; |
|
| 1686 | 1686 | |
| 1687 | - return $p; |
|
| 1687 | + return $p; |
|
| 1688 | 1688 | } |
| 1689 | 1689 | |
| 1690 | 1690 | |
@@ -1708,18 +1708,18 @@ discard block |
||
| 1708 | 1708 | **/ |
| 1709 | 1709 | function balise_HTTP_HEADER_dist($p) { |
| 1710 | 1710 | |
| 1711 | - $header = interprete_argument_balise(1, $p); |
|
| 1712 | - if (!$header) { |
|
| 1713 | - $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'HTTP_HEADER')); |
|
| 1714 | - erreur_squelette($err_b_s_a, $p); |
|
| 1715 | - } else { |
|
| 1716 | - $p->code = "'<'.'?php header(' . _q(" |
|
| 1717 | - . $header |
|
| 1718 | - . ") . '); ?'.'>'"; |
|
| 1719 | - } |
|
| 1720 | - $p->interdire_scripts = false; |
|
| 1711 | + $header = interprete_argument_balise(1, $p); |
|
| 1712 | + if (!$header) { |
|
| 1713 | + $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'HTTP_HEADER')); |
|
| 1714 | + erreur_squelette($err_b_s_a, $p); |
|
| 1715 | + } else { |
|
| 1716 | + $p->code = "'<'.'?php header(' . _q(" |
|
| 1717 | + . $header |
|
| 1718 | + . ") . '); ?'.'>'"; |
|
| 1719 | + } |
|
| 1720 | + $p->interdire_scripts = false; |
|
| 1721 | 1721 | |
| 1722 | - return $p; |
|
| 1722 | + return $p; |
|
| 1723 | 1723 | } |
| 1724 | 1724 | |
| 1725 | 1725 | |
@@ -1744,20 +1744,20 @@ discard block |
||
| 1744 | 1744 | * Pile complétée par le code à générer |
| 1745 | 1745 | **/ |
| 1746 | 1746 | function balise_FILTRE_dist($p) { |
| 1747 | - if ($p->param) { |
|
| 1748 | - $args = array(); |
|
| 1749 | - foreach ($p->param as $i => $ignore) { |
|
| 1750 | - $args[] = interprete_argument_balise($i + 1, $p); |
|
| 1751 | - } |
|
| 1752 | - $p->code = "'<' . '" |
|
| 1753 | - . '?php header("X-Spip-Filtre: \'.' |
|
| 1754 | - . join('.\'|\'.', $args) |
|
| 1755 | - . " . '\"); ?'.'>'"; |
|
| 1747 | + if ($p->param) { |
|
| 1748 | + $args = array(); |
|
| 1749 | + foreach ($p->param as $i => $ignore) { |
|
| 1750 | + $args[] = interprete_argument_balise($i + 1, $p); |
|
| 1751 | + } |
|
| 1752 | + $p->code = "'<' . '" |
|
| 1753 | + . '?php header("X-Spip-Filtre: \'.' |
|
| 1754 | + . join('.\'|\'.', $args) |
|
| 1755 | + . " . '\"); ?'.'>'"; |
|
| 1756 | 1756 | |
| 1757 | - $p->interdire_scripts = false; |
|
| 1757 | + $p->interdire_scripts = false; |
|
| 1758 | 1758 | |
| 1759 | - return $p; |
|
| 1760 | - } |
|
| 1759 | + return $p; |
|
| 1760 | + } |
|
| 1761 | 1761 | } |
| 1762 | 1762 | |
| 1763 | 1763 | |
@@ -1793,53 +1793,53 @@ discard block |
||
| 1793 | 1793 | **/ |
| 1794 | 1794 | function balise_CACHE_dist($p) { |
| 1795 | 1795 | |
| 1796 | - if ($p->param) { |
|
| 1797 | - $duree = valeur_numerique($p->param[0][1][0]->texte); |
|
| 1798 | - |
|
| 1799 | - // noter la duree du cache dans un entete proprietaire |
|
| 1800 | - |
|
| 1801 | - $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1802 | - . $duree |
|
| 1803 | - . '"); ?' . "'.'>'"; |
|
| 1804 | - |
|
| 1805 | - // Remplir le header Cache-Control |
|
| 1806 | - // cas #CACHE{0} |
|
| 1807 | - if ($duree == 0) { |
|
| 1808 | - $code .= ".'<'.'" |
|
| 1809 | - . '?php header("Cache-Control: no-cache, must-revalidate"); ?' |
|
| 1810 | - . "'.'><'.'" |
|
| 1811 | - . '?php header("Pragma: no-cache"); ?' |
|
| 1812 | - . "'.'>'"; |
|
| 1813 | - } |
|
| 1814 | - |
|
| 1815 | - // recuperer les parametres suivants |
|
| 1816 | - $i = 1; |
|
| 1817 | - while (isset($p->param[0][++$i])) { |
|
| 1818 | - $pa = ($p->param[0][$i][0]->texte); |
|
| 1819 | - |
|
| 1820 | - if ($pa == 'cache-client' |
|
| 1821 | - and $duree > 0 |
|
| 1822 | - ) { |
|
| 1823 | - $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1824 | - . $duree |
|
| 1825 | - . '"); ?' . "'.'>'"; |
|
| 1826 | - // il semble logique, si on cache-client, de ne pas invalider |
|
| 1827 | - $pa = 'statique'; |
|
| 1828 | - } |
|
| 1829 | - |
|
| 1830 | - if ($pa == 'statique' |
|
| 1831 | - and $duree > 0 |
|
| 1832 | - ) { |
|
| 1833 | - $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1834 | - } |
|
| 1835 | - } |
|
| 1836 | - } else { |
|
| 1837 | - $code = "''"; |
|
| 1838 | - } |
|
| 1839 | - $p->code = $code; |
|
| 1840 | - $p->interdire_scripts = false; |
|
| 1841 | - |
|
| 1842 | - return $p; |
|
| 1796 | + if ($p->param) { |
|
| 1797 | + $duree = valeur_numerique($p->param[0][1][0]->texte); |
|
| 1798 | + |
|
| 1799 | + // noter la duree du cache dans un entete proprietaire |
|
| 1800 | + |
|
| 1801 | + $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1802 | + . $duree |
|
| 1803 | + . '"); ?' . "'.'>'"; |
|
| 1804 | + |
|
| 1805 | + // Remplir le header Cache-Control |
|
| 1806 | + // cas #CACHE{0} |
|
| 1807 | + if ($duree == 0) { |
|
| 1808 | + $code .= ".'<'.'" |
|
| 1809 | + . '?php header("Cache-Control: no-cache, must-revalidate"); ?' |
|
| 1810 | + . "'.'><'.'" |
|
| 1811 | + . '?php header("Pragma: no-cache"); ?' |
|
| 1812 | + . "'.'>'"; |
|
| 1813 | + } |
|
| 1814 | + |
|
| 1815 | + // recuperer les parametres suivants |
|
| 1816 | + $i = 1; |
|
| 1817 | + while (isset($p->param[0][++$i])) { |
|
| 1818 | + $pa = ($p->param[0][$i][0]->texte); |
|
| 1819 | + |
|
| 1820 | + if ($pa == 'cache-client' |
|
| 1821 | + and $duree > 0 |
|
| 1822 | + ) { |
|
| 1823 | + $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1824 | + . $duree |
|
| 1825 | + . '"); ?' . "'.'>'"; |
|
| 1826 | + // il semble logique, si on cache-client, de ne pas invalider |
|
| 1827 | + $pa = 'statique'; |
|
| 1828 | + } |
|
| 1829 | + |
|
| 1830 | + if ($pa == 'statique' |
|
| 1831 | + and $duree > 0 |
|
| 1832 | + ) { |
|
| 1833 | + $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1834 | + } |
|
| 1835 | + } |
|
| 1836 | + } else { |
|
| 1837 | + $code = "''"; |
|
| 1838 | + } |
|
| 1839 | + $p->code = $code; |
|
| 1840 | + $p->interdire_scripts = false; |
|
| 1841 | + |
|
| 1842 | + return $p; |
|
| 1843 | 1843 | } |
| 1844 | 1844 | |
| 1845 | 1845 | |
@@ -1871,13 +1871,13 @@ discard block |
||
| 1871 | 1871 | * Pile complétée par le code à générer |
| 1872 | 1872 | */ |
| 1873 | 1873 | function balise_INSERT_HEAD_dist($p) { |
| 1874 | - $p->code = "'<'.'" |
|
| 1875 | - . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?' |
|
| 1876 | - . "'.'>'"; |
|
| 1877 | - $p->code .= ". pipeline('insert_head','<!-- insert_head -->')"; |
|
| 1878 | - $p->interdire_scripts = false; |
|
| 1874 | + $p->code = "'<'.'" |
|
| 1875 | + . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?' |
|
| 1876 | + . "'.'>'"; |
|
| 1877 | + $p->code .= ". pipeline('insert_head','<!-- insert_head -->')"; |
|
| 1878 | + $p->interdire_scripts = false; |
|
| 1879 | 1879 | |
| 1880 | - return $p; |
|
| 1880 | + return $p; |
|
| 1881 | 1881 | } |
| 1882 | 1882 | |
| 1883 | 1883 | /** |
@@ -1895,10 +1895,10 @@ discard block |
||
| 1895 | 1895 | * Pile complétée par le code à générer |
| 1896 | 1896 | */ |
| 1897 | 1897 | function balise_INSERT_HEAD_CSS_dist($p) { |
| 1898 | - $p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')"; |
|
| 1899 | - $p->interdire_scripts = false; |
|
| 1898 | + $p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')"; |
|
| 1899 | + $p->interdire_scripts = false; |
|
| 1900 | 1900 | |
| 1901 | - return $p; |
|
| 1901 | + return $p; |
|
| 1902 | 1902 | } |
| 1903 | 1903 | |
| 1904 | 1904 | /** |
@@ -1913,11 +1913,11 @@ discard block |
||
| 1913 | 1913 | * Pile complétée par le code à générer |
| 1914 | 1914 | **/ |
| 1915 | 1915 | function balise_INCLUDE_dist($p) { |
| 1916 | - if (function_exists('balise_INCLURE')) { |
|
| 1917 | - return balise_INCLURE($p); |
|
| 1918 | - } else { |
|
| 1919 | - return balise_INCLURE_dist($p); |
|
| 1920 | - } |
|
| 1916 | + if (function_exists('balise_INCLURE')) { |
|
| 1917 | + return balise_INCLURE($p); |
|
| 1918 | + } else { |
|
| 1919 | + return balise_INCLURE_dist($p); |
|
| 1920 | + } |
|
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | 1923 | /** |
@@ -1951,68 +1951,68 @@ discard block |
||
| 1951 | 1951 | * Pile complétée par le code à générer |
| 1952 | 1952 | **/ |
| 1953 | 1953 | function balise_INCLURE_dist($p) { |
| 1954 | - $id_boucle = $p->id_boucle; |
|
| 1955 | - // la lang n'est pas passe de facon automatique par argumenter |
|
| 1956 | - // mais le sera pas recuperer_fond, sauf si etoile=>true est passe |
|
| 1957 | - // en option |
|
| 1958 | - |
|
| 1959 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false); |
|
| 1960 | - |
|
| 1961 | - // erreur de syntaxe = fond absent |
|
| 1962 | - // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 1963 | - if (!$_contexte) { |
|
| 1964 | - $contexte = array(); |
|
| 1965 | - } |
|
| 1966 | - |
|
| 1967 | - if (isset($_contexte['fond'])) { |
|
| 1968 | - |
|
| 1969 | - $f = $_contexte['fond']; |
|
| 1970 | - // toujours vrai : |
|
| 1971 | - if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) { |
|
| 1972 | - $f = $r[1]; |
|
| 1973 | - unset($_contexte['fond']); |
|
| 1974 | - } else { |
|
| 1975 | - spip_log("compilation de #INCLURE a revoir"); |
|
| 1976 | - } |
|
| 1977 | - |
|
| 1978 | - // #INCLURE{doublons} |
|
| 1979 | - if (isset($_contexte['doublons'])) { |
|
| 1980 | - $_contexte['doublons'] = "'doublons' => \$doublons"; |
|
| 1981 | - } |
|
| 1982 | - |
|
| 1983 | - // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 1984 | - $flag_env = false; |
|
| 1985 | - if (isset($_contexte['env']) or isset($_contexte['self'])) { |
|
| 1986 | - $flag_env = true; |
|
| 1987 | - unset($_contexte['env']); |
|
| 1988 | - } |
|
| 1989 | - |
|
| 1990 | - $_options = array(); |
|
| 1991 | - if (isset($_contexte['ajax'])) { |
|
| 1992 | - $_options[] = preg_replace(",=>(.*)$,ims", '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 1993 | - unset($_contexte['ajax']); |
|
| 1994 | - } |
|
| 1995 | - if ($p->etoile) { |
|
| 1996 | - $_options[] = "'etoile'=>true"; |
|
| 1997 | - } |
|
| 1998 | - $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ")"; |
|
| 1999 | - |
|
| 2000 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2001 | - if ($flag_env) { |
|
| 2002 | - $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2003 | - } |
|
| 2004 | - |
|
| 2005 | - $p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect')"); |
|
| 2006 | - |
|
| 2007 | - } elseif (!isset($_contexte[1])) { |
|
| 2008 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' INCLURE')); |
|
| 2009 | - erreur_squelette($msg, $p); |
|
| 2010 | - } else { |
|
| 2011 | - $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2012 | - } |
|
| 2013 | - |
|
| 2014 | - $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
|
| 2015 | - return $p; |
|
| 1954 | + $id_boucle = $p->id_boucle; |
|
| 1955 | + // la lang n'est pas passe de facon automatique par argumenter |
|
| 1956 | + // mais le sera pas recuperer_fond, sauf si etoile=>true est passe |
|
| 1957 | + // en option |
|
| 1958 | + |
|
| 1959 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false); |
|
| 1960 | + |
|
| 1961 | + // erreur de syntaxe = fond absent |
|
| 1962 | + // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 1963 | + if (!$_contexte) { |
|
| 1964 | + $contexte = array(); |
|
| 1965 | + } |
|
| 1966 | + |
|
| 1967 | + if (isset($_contexte['fond'])) { |
|
| 1968 | + |
|
| 1969 | + $f = $_contexte['fond']; |
|
| 1970 | + // toujours vrai : |
|
| 1971 | + if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) { |
|
| 1972 | + $f = $r[1]; |
|
| 1973 | + unset($_contexte['fond']); |
|
| 1974 | + } else { |
|
| 1975 | + spip_log("compilation de #INCLURE a revoir"); |
|
| 1976 | + } |
|
| 1977 | + |
|
| 1978 | + // #INCLURE{doublons} |
|
| 1979 | + if (isset($_contexte['doublons'])) { |
|
| 1980 | + $_contexte['doublons'] = "'doublons' => \$doublons"; |
|
| 1981 | + } |
|
| 1982 | + |
|
| 1983 | + // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 1984 | + $flag_env = false; |
|
| 1985 | + if (isset($_contexte['env']) or isset($_contexte['self'])) { |
|
| 1986 | + $flag_env = true; |
|
| 1987 | + unset($_contexte['env']); |
|
| 1988 | + } |
|
| 1989 | + |
|
| 1990 | + $_options = array(); |
|
| 1991 | + if (isset($_contexte['ajax'])) { |
|
| 1992 | + $_options[] = preg_replace(",=>(.*)$,ims", '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 1993 | + unset($_contexte['ajax']); |
|
| 1994 | + } |
|
| 1995 | + if ($p->etoile) { |
|
| 1996 | + $_options[] = "'etoile'=>true"; |
|
| 1997 | + } |
|
| 1998 | + $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ")"; |
|
| 1999 | + |
|
| 2000 | + $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2001 | + if ($flag_env) { |
|
| 2002 | + $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2003 | + } |
|
| 2004 | + |
|
| 2005 | + $p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect')"); |
|
| 2006 | + |
|
| 2007 | + } elseif (!isset($_contexte[1])) { |
|
| 2008 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' INCLURE')); |
|
| 2009 | + erreur_squelette($msg, $p); |
|
| 2010 | + } else { |
|
| 2011 | + $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2012 | + } |
|
| 2013 | + |
|
| 2014 | + $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
|
| 2015 | + return $p; |
|
| 2016 | 2016 | } |
| 2017 | 2017 | |
| 2018 | 2018 | |
@@ -2040,69 +2040,69 @@ discard block |
||
| 2040 | 2040 | **/ |
| 2041 | 2041 | function balise_MODELE_dist($p) { |
| 2042 | 2042 | |
| 2043 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false); |
|
| 2044 | - |
|
| 2045 | - // erreur de syntaxe = fond absent |
|
| 2046 | - // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 2047 | - if (!$_contexte) { |
|
| 2048 | - $_contexte = array(); |
|
| 2049 | - } |
|
| 2050 | - |
|
| 2051 | - if (!isset($_contexte[1])) { |
|
| 2052 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' MODELE')); |
|
| 2053 | - erreur_squelette($msg, $p); |
|
| 2054 | - } else { |
|
| 2055 | - $nom = $_contexte[1]; |
|
| 2056 | - unset($_contexte[1]); |
|
| 2057 | - |
|
| 2058 | - if (preg_match("/^\s*'[^']*'/s", $nom)) { |
|
| 2059 | - $nom = "'modeles/" . substr($nom, 1); |
|
| 2060 | - } else { |
|
| 2061 | - $nom = "'modeles/' . $nom"; |
|
| 2062 | - } |
|
| 2063 | - |
|
| 2064 | - $flag_env = false; |
|
| 2065 | - if (isset($_contexte['env'])) { |
|
| 2066 | - $flag_env = true; |
|
| 2067 | - unset($_contexte['env']); |
|
| 2068 | - } |
|
| 2069 | - |
|
| 2070 | - // Incoherence dans la syntaxe du contexte. A revoir. |
|
| 2071 | - // Reserver la cle primaire de la boucle courante si elle existe |
|
| 2072 | - if (isset($p->boucles[$p->id_boucle]->primary)) { |
|
| 2073 | - $primary = $p->boucles[$p->id_boucle]->primary; |
|
| 2074 | - if (!strpos($primary, ',')) { |
|
| 2075 | - $id = champ_sql($primary, $p); |
|
| 2076 | - $_contexte[] = "'$primary'=>" . $id; |
|
| 2077 | - $_contexte[] = "'id'=>" . $id; |
|
| 2078 | - } |
|
| 2079 | - } |
|
| 2080 | - $_contexte[] = "'recurs'=>(++\$recurs)"; |
|
| 2081 | - $connect = ''; |
|
| 2082 | - if (isset($p->boucles[$p->id_boucle])) { |
|
| 2083 | - $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2084 | - } |
|
| 2085 | - |
|
| 2086 | - $_options = memoriser_contexte_compil($p); |
|
| 2087 | - $_options = "'compil'=>array($_options), 'trim'=>true"; |
|
| 2088 | - if (isset($_contexte['ajax'])) { |
|
| 2089 | - $_options .= ", " . preg_replace(",=>(.*)$,ims", '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2090 | - unset($_contexte['ajax']); |
|
| 2091 | - } |
|
| 2092 | - |
|
| 2093 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2094 | - if ($flag_env) { |
|
| 2095 | - $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2096 | - } |
|
| 2097 | - |
|
| 2098 | - $page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect)); |
|
| 2099 | - |
|
| 2100 | - $p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n"; |
|
| 2101 | - |
|
| 2102 | - $p->interdire_scripts = false; // securite assuree par le squelette |
|
| 2103 | - } |
|
| 2104 | - |
|
| 2105 | - return $p; |
|
| 2043 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false); |
|
| 2044 | + |
|
| 2045 | + // erreur de syntaxe = fond absent |
|
| 2046 | + // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 2047 | + if (!$_contexte) { |
|
| 2048 | + $_contexte = array(); |
|
| 2049 | + } |
|
| 2050 | + |
|
| 2051 | + if (!isset($_contexte[1])) { |
|
| 2052 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' MODELE')); |
|
| 2053 | + erreur_squelette($msg, $p); |
|
| 2054 | + } else { |
|
| 2055 | + $nom = $_contexte[1]; |
|
| 2056 | + unset($_contexte[1]); |
|
| 2057 | + |
|
| 2058 | + if (preg_match("/^\s*'[^']*'/s", $nom)) { |
|
| 2059 | + $nom = "'modeles/" . substr($nom, 1); |
|
| 2060 | + } else { |
|
| 2061 | + $nom = "'modeles/' . $nom"; |
|
| 2062 | + } |
|
| 2063 | + |
|
| 2064 | + $flag_env = false; |
|
| 2065 | + if (isset($_contexte['env'])) { |
|
| 2066 | + $flag_env = true; |
|
| 2067 | + unset($_contexte['env']); |
|
| 2068 | + } |
|
| 2069 | + |
|
| 2070 | + // Incoherence dans la syntaxe du contexte. A revoir. |
|
| 2071 | + // Reserver la cle primaire de la boucle courante si elle existe |
|
| 2072 | + if (isset($p->boucles[$p->id_boucle]->primary)) { |
|
| 2073 | + $primary = $p->boucles[$p->id_boucle]->primary; |
|
| 2074 | + if (!strpos($primary, ',')) { |
|
| 2075 | + $id = champ_sql($primary, $p); |
|
| 2076 | + $_contexte[] = "'$primary'=>" . $id; |
|
| 2077 | + $_contexte[] = "'id'=>" . $id; |
|
| 2078 | + } |
|
| 2079 | + } |
|
| 2080 | + $_contexte[] = "'recurs'=>(++\$recurs)"; |
|
| 2081 | + $connect = ''; |
|
| 2082 | + if (isset($p->boucles[$p->id_boucle])) { |
|
| 2083 | + $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2084 | + } |
|
| 2085 | + |
|
| 2086 | + $_options = memoriser_contexte_compil($p); |
|
| 2087 | + $_options = "'compil'=>array($_options), 'trim'=>true"; |
|
| 2088 | + if (isset($_contexte['ajax'])) { |
|
| 2089 | + $_options .= ", " . preg_replace(",=>(.*)$,ims", '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2090 | + unset($_contexte['ajax']); |
|
| 2091 | + } |
|
| 2092 | + |
|
| 2093 | + $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2094 | + if ($flag_env) { |
|
| 2095 | + $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2096 | + } |
|
| 2097 | + |
|
| 2098 | + $page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect)); |
|
| 2099 | + |
|
| 2100 | + $p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n"; |
|
| 2101 | + |
|
| 2102 | + $p->interdire_scripts = false; // securite assuree par le squelette |
|
| 2103 | + } |
|
| 2104 | + |
|
| 2105 | + return $p; |
|
| 2106 | 2106 | } |
| 2107 | 2107 | |
| 2108 | 2108 | |
@@ -2126,21 +2126,21 @@ discard block |
||
| 2126 | 2126 | * Pile complétée par le code à générer |
| 2127 | 2127 | **/ |
| 2128 | 2128 | function balise_SET_dist($p) { |
| 2129 | - $_nom = interprete_argument_balise(1, $p); |
|
| 2130 | - $_val = interprete_argument_balise(2, $p); |
|
| 2129 | + $_nom = interprete_argument_balise(1, $p); |
|
| 2130 | + $_val = interprete_argument_balise(2, $p); |
|
| 2131 | 2131 | |
| 2132 | - if (!$_nom or !$_val) { |
|
| 2133 | - $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'SET')); |
|
| 2134 | - erreur_squelette($err_b_s_a, $p); |
|
| 2135 | - } |
|
| 2136 | - // affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4 |
|
| 2137 | - // cf https://bugs.php.net/bug.php?id=65845 |
|
| 2138 | - else { |
|
| 2139 | - $p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)"; |
|
| 2140 | - } |
|
| 2132 | + if (!$_nom or !$_val) { |
|
| 2133 | + $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'SET')); |
|
| 2134 | + erreur_squelette($err_b_s_a, $p); |
|
| 2135 | + } |
|
| 2136 | + // affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4 |
|
| 2137 | + // cf https://bugs.php.net/bug.php?id=65845 |
|
| 2138 | + else { |
|
| 2139 | + $p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)"; |
|
| 2140 | + } |
|
| 2141 | 2141 | |
| 2142 | - $p->interdire_scripts = false; // la balise ne renvoie rien |
|
| 2143 | - return $p; |
|
| 2142 | + $p->interdire_scripts = false; // la balise ne renvoie rien |
|
| 2143 | + return $p; |
|
| 2144 | 2144 | } |
| 2145 | 2145 | |
| 2146 | 2146 | |
@@ -2170,12 +2170,12 @@ discard block |
||
| 2170 | 2170 | * Pile complétée par le code à générer |
| 2171 | 2171 | **/ |
| 2172 | 2172 | function balise_GET_dist($p) { |
| 2173 | - $p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance |
|
| 2174 | - if (function_exists('balise_ENV')) { |
|
| 2175 | - return balise_ENV($p, '$Pile["vars"]'); |
|
| 2176 | - } else { |
|
| 2177 | - return balise_ENV_dist($p, '$Pile["vars"]'); |
|
| 2178 | - } |
|
| 2173 | + $p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance |
|
| 2174 | + if (function_exists('balise_ENV')) { |
|
| 2175 | + return balise_ENV($p, '$Pile["vars"]'); |
|
| 2176 | + } else { |
|
| 2177 | + return balise_ENV_dist($p, '$Pile["vars"]'); |
|
| 2178 | + } |
|
| 2179 | 2179 | } |
| 2180 | 2180 | |
| 2181 | 2181 | |
@@ -2198,22 +2198,22 @@ discard block |
||
| 2198 | 2198 | * Pile complétée par le code à générer |
| 2199 | 2199 | **/ |
| 2200 | 2200 | function balise_DOUBLONS_dist($p) { |
| 2201 | - if ($type = interprete_argument_balise(1, $p)) { |
|
| 2202 | - if ($famille = interprete_argument_balise(2, $p)) { |
|
| 2203 | - $type .= '.' . $famille; |
|
| 2204 | - } |
|
| 2205 | - $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2206 | - if (!$p->etoile) { |
|
| 2207 | - $p->code = 'array_filter(array_map("intval",explode(",",' |
|
| 2208 | - . $p->code . ')))'; |
|
| 2209 | - } |
|
| 2210 | - } else { |
|
| 2211 | - $p->code = '$doublons'; |
|
| 2212 | - } |
|
| 2201 | + if ($type = interprete_argument_balise(1, $p)) { |
|
| 2202 | + if ($famille = interprete_argument_balise(2, $p)) { |
|
| 2203 | + $type .= '.' . $famille; |
|
| 2204 | + } |
|
| 2205 | + $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2206 | + if (!$p->etoile) { |
|
| 2207 | + $p->code = 'array_filter(array_map("intval",explode(",",' |
|
| 2208 | + . $p->code . ')))'; |
|
| 2209 | + } |
|
| 2210 | + } else { |
|
| 2211 | + $p->code = '$doublons'; |
|
| 2212 | + } |
|
| 2213 | 2213 | |
| 2214 | - $p->interdire_scripts = false; |
|
| 2214 | + $p->interdire_scripts = false; |
|
| 2215 | 2215 | |
| 2216 | - return $p; |
|
| 2216 | + return $p; |
|
| 2217 | 2217 | } |
| 2218 | 2218 | |
| 2219 | 2219 | |
@@ -2236,18 +2236,18 @@ discard block |
||
| 2236 | 2236 | * Pile complétée par le code à générer |
| 2237 | 2237 | **/ |
| 2238 | 2238 | function balise_PIPELINE_dist($p) { |
| 2239 | - $_pipe = interprete_argument_balise(1, $p); |
|
| 2240 | - if (!$_pipe) { |
|
| 2241 | - $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'PIPELINE')); |
|
| 2242 | - erreur_squelette($err_b_s_a, $p); |
|
| 2243 | - } else { |
|
| 2244 | - $_flux = interprete_argument_balise(2, $p); |
|
| 2245 | - $_flux = $_flux ? $_flux : "''"; |
|
| 2246 | - $p->code = "pipeline( $_pipe , $_flux )"; |
|
| 2247 | - $p->interdire_scripts = false; |
|
| 2248 | - } |
|
| 2239 | + $_pipe = interprete_argument_balise(1, $p); |
|
| 2240 | + if (!$_pipe) { |
|
| 2241 | + $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'PIPELINE')); |
|
| 2242 | + erreur_squelette($err_b_s_a, $p); |
|
| 2243 | + } else { |
|
| 2244 | + $_flux = interprete_argument_balise(2, $p); |
|
| 2245 | + $_flux = $_flux ? $_flux : "''"; |
|
| 2246 | + $p->code = "pipeline( $_pipe , $_flux )"; |
|
| 2247 | + $p->interdire_scripts = false; |
|
| 2248 | + } |
|
| 2249 | 2249 | |
| 2250 | - return $p; |
|
| 2250 | + return $p; |
|
| 2251 | 2251 | } |
| 2252 | 2252 | |
| 2253 | 2253 | |
@@ -2272,10 +2272,10 @@ discard block |
||
| 2272 | 2272 | * Pile complétée par le code à générer |
| 2273 | 2273 | **/ |
| 2274 | 2274 | function balise_EDIT_dist($p) { |
| 2275 | - $p->code = "''"; |
|
| 2276 | - $p->interdire_scripts = false; |
|
| 2275 | + $p->code = "''"; |
|
| 2276 | + $p->interdire_scripts = false; |
|
| 2277 | 2277 | |
| 2278 | - return $p; |
|
| 2278 | + return $p; |
|
| 2279 | 2279 | } |
| 2280 | 2280 | |
| 2281 | 2281 | |
@@ -2298,11 +2298,11 @@ discard block |
||
| 2298 | 2298 | * Pile complétée par le code à générer |
| 2299 | 2299 | **/ |
| 2300 | 2300 | function balise_TOTAL_UNIQUE_dist($p) { |
| 2301 | - $_famille = interprete_argument_balise(1, $p); |
|
| 2302 | - $_famille = $_famille ? $_famille : "''"; |
|
| 2303 | - $p->code = "unique('', $_famille, true)"; |
|
| 2301 | + $_famille = interprete_argument_balise(1, $p); |
|
| 2302 | + $_famille = $_famille ? $_famille : "''"; |
|
| 2303 | + $p->code = "unique('', $_famille, true)"; |
|
| 2304 | 2304 | |
| 2305 | - return $p; |
|
| 2305 | + return $p; |
|
| 2306 | 2306 | } |
| 2307 | 2307 | |
| 2308 | 2308 | /** |
@@ -2325,19 +2325,19 @@ discard block |
||
| 2325 | 2325 | * Pile complétée par le code à générer |
| 2326 | 2326 | **/ |
| 2327 | 2327 | function balise_ARRAY_dist($p) { |
| 2328 | - $_code = array(); |
|
| 2329 | - $n = 1; |
|
| 2330 | - do { |
|
| 2331 | - $_key = interprete_argument_balise($n++, $p); |
|
| 2332 | - $_val = interprete_argument_balise($n++, $p); |
|
| 2333 | - if ($_key and $_val) { |
|
| 2334 | - $_code[] = "$_key => $_val"; |
|
| 2335 | - } |
|
| 2336 | - } while ($_key && $_val); |
|
| 2337 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2338 | - $p->interdire_scripts = false; |
|
| 2328 | + $_code = array(); |
|
| 2329 | + $n = 1; |
|
| 2330 | + do { |
|
| 2331 | + $_key = interprete_argument_balise($n++, $p); |
|
| 2332 | + $_val = interprete_argument_balise($n++, $p); |
|
| 2333 | + if ($_key and $_val) { |
|
| 2334 | + $_code[] = "$_key => $_val"; |
|
| 2335 | + } |
|
| 2336 | + } while ($_key && $_val); |
|
| 2337 | + $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2338 | + $p->interdire_scripts = false; |
|
| 2339 | 2339 | |
| 2340 | - return $p; |
|
| 2340 | + return $p; |
|
| 2341 | 2341 | } |
| 2342 | 2342 | |
| 2343 | 2343 | /** |
@@ -2356,15 +2356,15 @@ discard block |
||
| 2356 | 2356 | * Pile complétée par le code à générer |
| 2357 | 2357 | */ |
| 2358 | 2358 | function balise_LISTE_dist($p) { |
| 2359 | - $_code = array(); |
|
| 2360 | - $n = 1; |
|
| 2361 | - while ($_val = interprete_argument_balise($n++, $p)) { |
|
| 2362 | - $_code[] = $_val; |
|
| 2363 | - } |
|
| 2364 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2365 | - $p->interdire_scripts = false; |
|
| 2359 | + $_code = array(); |
|
| 2360 | + $n = 1; |
|
| 2361 | + while ($_val = interprete_argument_balise($n++, $p)) { |
|
| 2362 | + $_code[] = $_val; |
|
| 2363 | + } |
|
| 2364 | + $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2365 | + $p->interdire_scripts = false; |
|
| 2366 | 2366 | |
| 2367 | - return $p; |
|
| 2367 | + return $p; |
|
| 2368 | 2368 | } |
| 2369 | 2369 | |
| 2370 | 2370 | |
@@ -2398,19 +2398,19 @@ discard block |
||
| 2398 | 2398 | * Pile complétée par le code à générer |
| 2399 | 2399 | **/ |
| 2400 | 2400 | function balise_AUTORISER_dist($p) { |
| 2401 | - $_code = array(); |
|
| 2402 | - $p->descr['session'] = true; // faire un cache par session |
|
| 2401 | + $_code = array(); |
|
| 2402 | + $p->descr['session'] = true; // faire un cache par session |
|
| 2403 | 2403 | |
| 2404 | - $n = 1; |
|
| 2405 | - while ($_v = interprete_argument_balise($n++, $p)) { |
|
| 2406 | - $_code[] = $_v; |
|
| 2407 | - } |
|
| 2404 | + $n = 1; |
|
| 2405 | + while ($_v = interprete_argument_balise($n++, $p)) { |
|
| 2406 | + $_code[] = $_v; |
|
| 2407 | + } |
|
| 2408 | 2408 | |
| 2409 | - $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join(', ', |
|
| 2410 | - $_code) . ')?" ":"")'; |
|
| 2411 | - $p->interdire_scripts = false; |
|
| 2409 | + $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join(', ', |
|
| 2410 | + $_code) . ')?" ":"")'; |
|
| 2411 | + $p->interdire_scripts = false; |
|
| 2412 | 2412 | |
| 2413 | - return $p; |
|
| 2413 | + return $p; |
|
| 2414 | 2414 | } |
| 2415 | 2415 | |
| 2416 | 2416 | |
@@ -2434,15 +2434,15 @@ discard block |
||
| 2434 | 2434 | * Pile complétée par le code à générer |
| 2435 | 2435 | **/ |
| 2436 | 2436 | function balise_PLUGIN_dist($p) { |
| 2437 | - $plugin = interprete_argument_balise(1, $p); |
|
| 2438 | - $plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""'; |
|
| 2439 | - $type_info = interprete_argument_balise(2, $p); |
|
| 2440 | - $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
|
| 2437 | + $plugin = interprete_argument_balise(1, $p); |
|
| 2438 | + $plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""'; |
|
| 2439 | + $type_info = interprete_argument_balise(2, $p); |
|
| 2440 | + $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
|
| 2441 | 2441 | |
| 2442 | - $f = chercher_filtre('info_plugin'); |
|
| 2443 | - $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2442 | + $f = chercher_filtre('info_plugin'); |
|
| 2443 | + $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2444 | 2444 | |
| 2445 | - return $p; |
|
| 2445 | + return $p; |
|
| 2446 | 2446 | } |
| 2447 | 2447 | |
| 2448 | 2448 | /** |
@@ -2463,11 +2463,11 @@ discard block |
||
| 2463 | 2463 | * Pile complétée par le code à générer |
| 2464 | 2464 | **/ |
| 2465 | 2465 | function balise_AIDER_dist($p) { |
| 2466 | - $_motif = interprete_argument_balise(1, $p); |
|
| 2467 | - $s = "'" . addslashes($p->descr['sourcefile']) . "'"; |
|
| 2468 | - $p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif,$s, \$Pile[0]):'')"; |
|
| 2466 | + $_motif = interprete_argument_balise(1, $p); |
|
| 2467 | + $s = "'" . addslashes($p->descr['sourcefile']) . "'"; |
|
| 2468 | + $p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif,$s, \$Pile[0]):'')"; |
|
| 2469 | 2469 | |
| 2470 | - return $p; |
|
| 2470 | + return $p; |
|
| 2471 | 2471 | } |
| 2472 | 2472 | |
| 2473 | 2473 | /** |
@@ -2493,16 +2493,16 @@ discard block |
||
| 2493 | 2493 | * Pile complétée par le code à générer |
| 2494 | 2494 | **/ |
| 2495 | 2495 | function balise_ACTION_FORMULAIRE($p) { |
| 2496 | - if (!$_url = interprete_argument_balise(1, $p)) { |
|
| 2497 | - $_url = "@\$Pile[0]['action']"; |
|
| 2498 | - } |
|
| 2499 | - if (!$_form = interprete_argument_balise(2, $p)) { |
|
| 2500 | - $_form = "@\$Pile[0]['form']"; |
|
| 2501 | - } |
|
| 2502 | - |
|
| 2503 | - // envoyer le nom du formulaire que l'on traite |
|
| 2504 | - // transmettre les eventuels args de la balise formulaire |
|
| 2505 | - $p->code = " '<div>' . |
|
| 2496 | + if (!$_url = interprete_argument_balise(1, $p)) { |
|
| 2497 | + $_url = "@\$Pile[0]['action']"; |
|
| 2498 | + } |
|
| 2499 | + if (!$_form = interprete_argument_balise(2, $p)) { |
|
| 2500 | + $_form = "@\$Pile[0]['form']"; |
|
| 2501 | + } |
|
| 2502 | + |
|
| 2503 | + // envoyer le nom du formulaire que l'on traite |
|
| 2504 | + // transmettre les eventuels args de la balise formulaire |
|
| 2505 | + $p->code = " '<div>' . |
|
| 2506 | 2506 | form_hidden($_url) . |
| 2507 | 2507 | '<input name=\'formulaire_action\' type=\'hidden\' |
| 2508 | 2508 | value=\'' . $_form . '\' />' . |
@@ -2511,9 +2511,9 @@ discard block |
||
| 2511 | 2511 | (!empty(\$Pile[0]['_hidden']) ? @\$Pile[0]['_hidden'] : '') . |
| 2512 | 2512 | '</div>'"; |
| 2513 | 2513 | |
| 2514 | - $p->interdire_scripts = false; |
|
| 2514 | + $p->interdire_scripts = false; |
|
| 2515 | 2515 | |
| 2516 | - return $p; |
|
| 2516 | + return $p; |
|
| 2517 | 2517 | } |
| 2518 | 2518 | |
| 2519 | 2519 | |
@@ -2543,25 +2543,25 @@ discard block |
||
| 2543 | 2543 | */ |
| 2544 | 2544 | function balise_BOUTON_ACTION_dist($p) { |
| 2545 | 2545 | |
| 2546 | - $args = array(); |
|
| 2547 | - for ($k = 1; $k <= 6; $k++) { |
|
| 2548 | - $_a = interprete_argument_balise($k, $p); |
|
| 2549 | - if (!$_a) { |
|
| 2550 | - $_a = "''"; |
|
| 2551 | - } |
|
| 2552 | - $args[] = $_a; |
|
| 2553 | - } |
|
| 2554 | - // supprimer les args vides |
|
| 2555 | - while (end($args) == "''" and count($args) > 2) { |
|
| 2556 | - array_pop($args); |
|
| 2557 | - } |
|
| 2558 | - $args = implode(",", $args); |
|
| 2546 | + $args = array(); |
|
| 2547 | + for ($k = 1; $k <= 6; $k++) { |
|
| 2548 | + $_a = interprete_argument_balise($k, $p); |
|
| 2549 | + if (!$_a) { |
|
| 2550 | + $_a = "''"; |
|
| 2551 | + } |
|
| 2552 | + $args[] = $_a; |
|
| 2553 | + } |
|
| 2554 | + // supprimer les args vides |
|
| 2555 | + while (end($args) == "''" and count($args) > 2) { |
|
| 2556 | + array_pop($args); |
|
| 2557 | + } |
|
| 2558 | + $args = implode(",", $args); |
|
| 2559 | 2559 | |
| 2560 | - $bouton_action = chercher_filtre("bouton_action"); |
|
| 2561 | - $p->code = "$bouton_action($args)"; |
|
| 2562 | - $p->interdire_scripts = false; |
|
| 2560 | + $bouton_action = chercher_filtre("bouton_action"); |
|
| 2561 | + $p->code = "$bouton_action($args)"; |
|
| 2562 | + $p->interdire_scripts = false; |
|
| 2563 | 2563 | |
| 2564 | - return $p; |
|
| 2564 | + return $p; |
|
| 2565 | 2565 | } |
| 2566 | 2566 | |
| 2567 | 2567 | |
@@ -2580,10 +2580,10 @@ discard block |
||
| 2580 | 2580 | * Pile complétée par le code à générer |
| 2581 | 2581 | */ |
| 2582 | 2582 | function balise_SLOGAN_SITE_SPIP_dist($p) { |
| 2583 | - $p->code = "\$GLOBALS['meta']['slogan_site']"; |
|
| 2583 | + $p->code = "\$GLOBALS['meta']['slogan_site']"; |
|
| 2584 | 2584 | |
| 2585 | - #$p->interdire_scripts = true; |
|
| 2586 | - return $p; |
|
| 2585 | + #$p->interdire_scripts = true; |
|
| 2586 | + return $p; |
|
| 2587 | 2587 | } |
| 2588 | 2588 | |
| 2589 | 2589 | |
@@ -2607,10 +2607,10 @@ discard block |
||
| 2607 | 2607 | * Pile complétée par le code à générer |
| 2608 | 2608 | */ |
| 2609 | 2609 | function balise_HTML5_dist($p) { |
| 2610 | - $p->code = html5_permis() ? "' '" : "''"; |
|
| 2611 | - $p->interdire_scripts = false; |
|
| 2610 | + $p->code = html5_permis() ? "' '" : "''"; |
|
| 2611 | + $p->interdire_scripts = false; |
|
| 2612 | 2612 | |
| 2613 | - return $p; |
|
| 2613 | + return $p; |
|
| 2614 | 2614 | } |
| 2615 | 2615 | |
| 2616 | 2616 | |
@@ -2636,63 +2636,63 @@ discard block |
||
| 2636 | 2636 | * Pile complétée par le code à générer |
| 2637 | 2637 | */ |
| 2638 | 2638 | function balise_TRI_dist($p, $liste = 'true') { |
| 2639 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->descr['id_mere']; |
|
| 2639 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->descr['id_mere']; |
|
| 2640 | 2640 | |
| 2641 | - // s'il n'y a pas de nom de boucle, on ne peut pas trier |
|
| 2642 | - if ($b === '') { |
|
| 2643 | - erreur_squelette( |
|
| 2644 | - _T('zbug_champ_hors_boucle', |
|
| 2645 | - array('champ' => '#TRI') |
|
| 2646 | - ), $p->id_boucle); |
|
| 2647 | - $p->code = "''"; |
|
| 2641 | + // s'il n'y a pas de nom de boucle, on ne peut pas trier |
|
| 2642 | + if ($b === '') { |
|
| 2643 | + erreur_squelette( |
|
| 2644 | + _T('zbug_champ_hors_boucle', |
|
| 2645 | + array('champ' => '#TRI') |
|
| 2646 | + ), $p->id_boucle); |
|
| 2647 | + $p->code = "''"; |
|
| 2648 | 2648 | |
| 2649 | - return $p; |
|
| 2650 | - } |
|
| 2651 | - $boucle = $p->boucles[$b]; |
|
| 2649 | + return $p; |
|
| 2650 | + } |
|
| 2651 | + $boucle = $p->boucles[$b]; |
|
| 2652 | 2652 | |
| 2653 | - // s'il n'y a pas de tri_champ, c'est qu'on se trouve |
|
| 2654 | - // dans un boucle recursive ou qu'on a oublie le critere {tri} |
|
| 2655 | - if (!isset($boucle->modificateur['tri_champ'])) { |
|
| 2656 | - erreur_squelette( |
|
| 2657 | - _T('zbug_tri_sans_critere', |
|
| 2658 | - array('champ' => '#TRI') |
|
| 2659 | - ), $p->id_boucle); |
|
| 2660 | - $p->code = "''"; |
|
| 2653 | + // s'il n'y a pas de tri_champ, c'est qu'on se trouve |
|
| 2654 | + // dans un boucle recursive ou qu'on a oublie le critere {tri} |
|
| 2655 | + if (!isset($boucle->modificateur['tri_champ'])) { |
|
| 2656 | + erreur_squelette( |
|
| 2657 | + _T('zbug_tri_sans_critere', |
|
| 2658 | + array('champ' => '#TRI') |
|
| 2659 | + ), $p->id_boucle); |
|
| 2660 | + $p->code = "''"; |
|
| 2661 | 2661 | |
| 2662 | - return $p; |
|
| 2663 | - } |
|
| 2662 | + return $p; |
|
| 2663 | + } |
|
| 2664 | 2664 | |
| 2665 | - $_champ = interprete_argument_balise(1, $p); |
|
| 2666 | - // si pas de champ, renvoyer le critere de tri utilise |
|
| 2667 | - if (!$_champ) { |
|
| 2668 | - $p->code = $boucle->modificateur['tri_champ']; |
|
| 2665 | + $_champ = interprete_argument_balise(1, $p); |
|
| 2666 | + // si pas de champ, renvoyer le critere de tri utilise |
|
| 2667 | + if (!$_champ) { |
|
| 2668 | + $p->code = $boucle->modificateur['tri_champ']; |
|
| 2669 | 2669 | |
| 2670 | - return $p; |
|
| 2671 | - } |
|
| 2672 | - // forcer la jointure si besoin, et si le champ est statique |
|
| 2673 | - if (preg_match(",^'([\w.]+)'$,i", $_champ, $m)) { |
|
| 2674 | - index_pile($b, $m[1], $p->boucles, '', null, true, false); |
|
| 2675 | - } |
|
| 2670 | + return $p; |
|
| 2671 | + } |
|
| 2672 | + // forcer la jointure si besoin, et si le champ est statique |
|
| 2673 | + if (preg_match(",^'([\w.]+)'$,i", $_champ, $m)) { |
|
| 2674 | + index_pile($b, $m[1], $p->boucles, '', null, true, false); |
|
| 2675 | + } |
|
| 2676 | 2676 | |
| 2677 | - $_libelle = interprete_argument_balise(2, $p); |
|
| 2678 | - $_libelle = $_libelle ? $_libelle : $_champ; |
|
| 2677 | + $_libelle = interprete_argument_balise(2, $p); |
|
| 2678 | + $_libelle = $_libelle ? $_libelle : $_champ; |
|
| 2679 | 2679 | |
| 2680 | - $_class = interprete_argument_balise(3, $p); |
|
| 2681 | - // si champ = ">" c'est un lien vers le tri croissant : de gauche a droite ==> 1 |
|
| 2682 | - // si champ = "<" c'est un lien vers le tri decroissant : (sens inverse) == -1 |
|
| 2683 | - $_issens = "in_array($_champ,array('>','<'))"; |
|
| 2684 | - $_sens = "(strpos('< >',$_champ)-1)"; |
|
| 2680 | + $_class = interprete_argument_balise(3, $p); |
|
| 2681 | + // si champ = ">" c'est un lien vers le tri croissant : de gauche a droite ==> 1 |
|
| 2682 | + // si champ = "<" c'est un lien vers le tri decroissant : (sens inverse) == -1 |
|
| 2683 | + $_issens = "in_array($_champ,array('>','<'))"; |
|
| 2684 | + $_sens = "(strpos('< >',$_champ)-1)"; |
|
| 2685 | 2685 | |
| 2686 | - $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2687 | - $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
|
| 2688 | - $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2689 | - $_on = "\$s?(" . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2686 | + $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2687 | + $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
|
| 2688 | + $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2689 | + $_on = "\$s?(" . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2690 | 2690 | |
| 2691 | - $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : "") . ")"; |
|
| 2692 | - //$p->code = "''"; |
|
| 2693 | - $p->interdire_scripts = false; |
|
| 2691 | + $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : "") . ")"; |
|
| 2692 | + //$p->code = "''"; |
|
| 2693 | + $p->interdire_scripts = false; |
|
| 2694 | 2694 | |
| 2695 | - return $p; |
|
| 2695 | + return $p; |
|
| 2696 | 2696 | } |
| 2697 | 2697 | |
| 2698 | 2698 | |
@@ -2713,22 +2713,22 @@ discard block |
||
| 2713 | 2713 | * Pile complétée par le code à générer |
| 2714 | 2714 | */ |
| 2715 | 2715 | function balise_SAUTER_dist($p) { |
| 2716 | - $id_boucle = $p->id_boucle; |
|
| 2716 | + $id_boucle = $p->id_boucle; |
|
| 2717 | 2717 | |
| 2718 | - if (empty($p->boucles[$id_boucle])) { |
|
| 2719 | - $msg = array('zbug_champ_hors_boucle', array('champ' => '#SAUTER')); |
|
| 2720 | - erreur_squelette($msg, $p); |
|
| 2721 | - } else { |
|
| 2722 | - $boucle = $p->boucles[$id_boucle]; |
|
| 2723 | - $_saut = interprete_argument_balise(1, $p); |
|
| 2724 | - $_compteur = "\$Numrows['$id_boucle']['compteur_boucle']"; |
|
| 2725 | - $_total = "\$Numrows['$id_boucle']['total']"; |
|
| 2718 | + if (empty($p->boucles[$id_boucle])) { |
|
| 2719 | + $msg = array('zbug_champ_hors_boucle', array('champ' => '#SAUTER')); |
|
| 2720 | + erreur_squelette($msg, $p); |
|
| 2721 | + } else { |
|
| 2722 | + $boucle = $p->boucles[$id_boucle]; |
|
| 2723 | + $_saut = interprete_argument_balise(1, $p); |
|
| 2724 | + $_compteur = "\$Numrows['$id_boucle']['compteur_boucle']"; |
|
| 2725 | + $_total = "\$Numrows['$id_boucle']['total']"; |
|
| 2726 | 2726 | |
| 2727 | - $p->code = "vide($_compteur=\$iter->skip($_saut,$_total))"; |
|
| 2728 | - } |
|
| 2729 | - $p->interdire_scripts = false; |
|
| 2727 | + $p->code = "vide($_compteur=\$iter->skip($_saut,$_total))"; |
|
| 2728 | + } |
|
| 2729 | + $p->interdire_scripts = false; |
|
| 2730 | 2730 | |
| 2731 | - return $p; |
|
| 2731 | + return $p; |
|
| 2732 | 2732 | } |
| 2733 | 2733 | |
| 2734 | 2734 | |
@@ -2750,22 +2750,22 @@ discard block |
||
| 2750 | 2750 | * Pile complétée par le code à générer |
| 2751 | 2751 | */ |
| 2752 | 2752 | function balise_PUBLIE_dist($p) { |
| 2753 | - if (!$_type = interprete_argument_balise(1, $p)) { |
|
| 2754 | - $_type = _q($p->type_requete); |
|
| 2755 | - $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p); |
|
| 2756 | - } else { |
|
| 2757 | - $_id = interprete_argument_balise(2, $p); |
|
| 2758 | - } |
|
| 2753 | + if (!$_type = interprete_argument_balise(1, $p)) { |
|
| 2754 | + $_type = _q($p->type_requete); |
|
| 2755 | + $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p); |
|
| 2756 | + } else { |
|
| 2757 | + $_id = interprete_argument_balise(2, $p); |
|
| 2758 | + } |
|
| 2759 | 2759 | |
| 2760 | - $connect = ''; |
|
| 2761 | - if (isset($p->boucles[$p->id_boucle])) { |
|
| 2762 | - $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2763 | - } |
|
| 2760 | + $connect = ''; |
|
| 2761 | + if (isset($p->boucles[$p->id_boucle])) { |
|
| 2762 | + $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2763 | + } |
|
| 2764 | 2764 | |
| 2765 | - $p->code = "(objet_test_si_publie(" . $_type . ",intval(" . $_id . ")," . _q($connect) . ")?' ':'')"; |
|
| 2766 | - $p->interdire_scripts = false; |
|
| 2765 | + $p->code = "(objet_test_si_publie(" . $_type . ",intval(" . $_id . ")," . _q($connect) . ")?' ':'')"; |
|
| 2766 | + $p->interdire_scripts = false; |
|
| 2767 | 2767 | |
| 2768 | - return $p; |
|
| 2768 | + return $p; |
|
| 2769 | 2769 | } |
| 2770 | 2770 | |
| 2771 | 2771 | /** |
@@ -2794,12 +2794,12 @@ discard block |
||
| 2794 | 2794 | * Pile complétée par le code à générer |
| 2795 | 2795 | */ |
| 2796 | 2796 | function balise_PRODUIRE_dist($p) { |
| 2797 | - $balise_inclure = charger_fonction('INCLURE', 'balise'); |
|
| 2798 | - $p = $balise_inclure($p); |
|
| 2797 | + $balise_inclure = charger_fonction('INCLURE', 'balise'); |
|
| 2798 | + $p = $balise_inclure($p); |
|
| 2799 | 2799 | |
| 2800 | - $p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code); |
|
| 2800 | + $p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code); |
|
| 2801 | 2801 | |
| 2802 | - return $p; |
|
| 2802 | + return $p; |
|
| 2803 | 2803 | } |
| 2804 | 2804 | |
| 2805 | 2805 | /** |
@@ -2818,13 +2818,13 @@ discard block |
||
| 2818 | 2818 | * Pile complétée par le code à générer |
| 2819 | 2819 | */ |
| 2820 | 2820 | function balise_LARGEUR_ECRAN_dist($p) { |
| 2821 | - $_class = interprete_argument_balise(1, $p); |
|
| 2822 | - if (!$_class) { |
|
| 2823 | - $_class = 'null'; |
|
| 2824 | - } |
|
| 2825 | - $p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))"; |
|
| 2821 | + $_class = interprete_argument_balise(1, $p); |
|
| 2822 | + if (!$_class) { |
|
| 2823 | + $_class = 'null'; |
|
| 2824 | + } |
|
| 2825 | + $p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))"; |
|
| 2826 | 2826 | |
| 2827 | - return $p; |
|
| 2827 | + return $p; |
|
| 2828 | 2828 | } |
| 2829 | 2829 | |
| 2830 | 2830 | |
@@ -2840,14 +2840,14 @@ discard block |
||
| 2840 | 2840 | * Pile complétée par le code à générer |
| 2841 | 2841 | **/ |
| 2842 | 2842 | function balise_CONST_dist($p) { |
| 2843 | - $_const = interprete_argument_balise(1, $p); |
|
| 2844 | - if (!strlen($_const)) { |
|
| 2845 | - $p->code = "''"; |
|
| 2846 | - } |
|
| 2847 | - else { |
|
| 2848 | - $p->code = "(defined($_const)?constant($_const):'')"; |
|
| 2849 | - } |
|
| 2850 | - $p->interdire_scripts = false; |
|
| 2851 | - |
|
| 2852 | - return $p; |
|
| 2843 | + $_const = interprete_argument_balise(1, $p); |
|
| 2844 | + if (!strlen($_const)) { |
|
| 2845 | + $p->code = "''"; |
|
| 2846 | + } |
|
| 2847 | + else { |
|
| 2848 | + $p->code = "(defined($_const)?constant($_const):'')"; |
|
| 2849 | + } |
|
| 2850 | + $p->interdire_scripts = false; |
|
| 2851 | + |
|
| 2852 | + return $p; |
|
| 2853 | 2853 | } |
@@ -4,419 +4,419 @@ 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 | - 'activer_plugin' => 'Activate plugin', |
|
| 14 | - 'affichage' => 'Display', |
|
| 15 | - 'aide_non_disponible' => 'This part of the online help is not yet available in this language.', |
|
| 16 | - 'annuler_recherche' => 'Cancel the search', |
|
| 17 | - 'auteur' => 'Author:', |
|
| 18 | - 'avis_acces_interdit' => 'Access forbidden.', |
|
| 19 | - 'avis_article_modifie' => 'Warning: @nom_auteur_modif@ modified this article @date_diff@ minutes ago', |
|
| 20 | - 'avis_aucun_resultat' => 'No results found.', |
|
| 21 | - 'avis_base_inaccessible' => 'Impossible to connect to the database @base@.', |
|
| 22 | - 'avis_chemin_invalide_1' => 'The path you selected', |
|
| 23 | - 'avis_chemin_invalide_2' => 'does not seem to be valid. Please go back to previous page and check the information you provided.', |
|
| 24 | - 'avis_connexion_echec_1' => 'Connection to the SQL server failed.', |
|
| 25 | - 'avis_connexion_echec_2' => 'Go back to the previous page, and check the information you provided.', |
|
| 26 | - 'avis_connexion_echec_3' => '<b>N.B.</b> On many servers, you must <b>request</b> activation of your access to the SQL database before you can use it. If you cannot connect to your database, check that activation has been done.', |
|
| 27 | - 'avis_connexion_erreur_creer_base' => 'The database could not be created.', |
|
| 28 | - 'avis_connexion_erreur_nom_base' => 'The database’s name should only contain letters, digits and hyphens.', |
|
| 29 | - 'avis_connexion_ldap_echec_1' => 'Connection to the LDAP server failed.', |
|
| 30 | - 'avis_connexion_ldap_echec_2' => 'Go back to the previous page, and check the information you provided.', |
|
| 31 | - 'avis_connexion_ldap_echec_3' => 'Alternatively, do not use LDAP support to import users.', |
|
| 32 | - 'avis_deplacement_rubrique' => 'Warning! This section contains @contient_breves@ news item@scb@: if you move it, please check this box to confirm.', |
|
| 33 | - 'avis_erreur_connexion_mysql' => 'SQL connection error', |
|
| 34 | - 'avis_espace_interdit' => '<b>Forbidden area</b> <div>SPIP is already installed.</div>', |
|
| 35 | - 'avis_lecture_noms_bases_1' => 'The installer could not read the names of any databases already installed.', |
|
| 36 | - 'avis_lecture_noms_bases_2' => 'Either no database is available, or the option listing databases was disabled for security reasons (which is the case with various hosting services).', |
|
| 37 | - 'avis_lecture_noms_bases_3' => 'In the second case, a database named after your login might already be available:', |
|
| 38 | - 'avis_non_acces_page' => 'You do not have access to this page.', |
|
| 39 | - 'avis_operation_echec' => 'The operation failed.', |
|
| 40 | - 'avis_operation_impossible' => 'Operation impossible', |
|
| 41 | - 'avis_suppression_base' => 'WARNING: data deletion is irreversible', |
|
| 12 | + // A |
|
| 13 | + 'activer_plugin' => 'Activate plugin', |
|
| 14 | + 'affichage' => 'Display', |
|
| 15 | + 'aide_non_disponible' => 'This part of the online help is not yet available in this language.', |
|
| 16 | + 'annuler_recherche' => 'Cancel the search', |
|
| 17 | + 'auteur' => 'Author:', |
|
| 18 | + 'avis_acces_interdit' => 'Access forbidden.', |
|
| 19 | + 'avis_article_modifie' => 'Warning: @nom_auteur_modif@ modified this article @date_diff@ minutes ago', |
|
| 20 | + 'avis_aucun_resultat' => 'No results found.', |
|
| 21 | + 'avis_base_inaccessible' => 'Impossible to connect to the database @base@.', |
|
| 22 | + 'avis_chemin_invalide_1' => 'The path you selected', |
|
| 23 | + 'avis_chemin_invalide_2' => 'does not seem to be valid. Please go back to previous page and check the information you provided.', |
|
| 24 | + 'avis_connexion_echec_1' => 'Connection to the SQL server failed.', |
|
| 25 | + 'avis_connexion_echec_2' => 'Go back to the previous page, and check the information you provided.', |
|
| 26 | + 'avis_connexion_echec_3' => '<b>N.B.</b> On many servers, you must <b>request</b> activation of your access to the SQL database before you can use it. If you cannot connect to your database, check that activation has been done.', |
|
| 27 | + 'avis_connexion_erreur_creer_base' => 'The database could not be created.', |
|
| 28 | + 'avis_connexion_erreur_nom_base' => 'The database’s name should only contain letters, digits and hyphens.', |
|
| 29 | + 'avis_connexion_ldap_echec_1' => 'Connection to the LDAP server failed.', |
|
| 30 | + 'avis_connexion_ldap_echec_2' => 'Go back to the previous page, and check the information you provided.', |
|
| 31 | + 'avis_connexion_ldap_echec_3' => 'Alternatively, do not use LDAP support to import users.', |
|
| 32 | + 'avis_deplacement_rubrique' => 'Warning! This section contains @contient_breves@ news item@scb@: if you move it, please check this box to confirm.', |
|
| 33 | + 'avis_erreur_connexion_mysql' => 'SQL connection error', |
|
| 34 | + 'avis_espace_interdit' => '<b>Forbidden area</b> <div>SPIP is already installed.</div>', |
|
| 35 | + 'avis_lecture_noms_bases_1' => 'The installer could not read the names of any databases already installed.', |
|
| 36 | + 'avis_lecture_noms_bases_2' => 'Either no database is available, or the option listing databases was disabled for security reasons (which is the case with various hosting services).', |
|
| 37 | + 'avis_lecture_noms_bases_3' => 'In the second case, a database named after your login might already be available:', |
|
| 38 | + 'avis_non_acces_page' => 'You do not have access to this page.', |
|
| 39 | + 'avis_operation_echec' => 'The operation failed.', |
|
| 40 | + 'avis_operation_impossible' => 'Operation impossible', |
|
| 41 | + 'avis_suppression_base' => 'WARNING: data deletion is irreversible', |
|
| 42 | 42 | |
| 43 | - // B |
|
| 44 | - 'bouton_acces_ldap' => 'Add LDAP access', |
|
| 45 | - 'bouton_ajouter' => 'Add', |
|
| 46 | - 'bouton_annuler' => 'Cancel', |
|
| 47 | - 'bouton_cache_activer' => 'Re-activate the cache', |
|
| 48 | - 'bouton_cache_desactiver' => 'Disable the cache momentarily', |
|
| 49 | - 'bouton_demande_publication' => 'Request publication of this article', |
|
| 50 | - 'bouton_desactive_tout' => 'Disable all', |
|
| 51 | - 'bouton_desinstaller' => 'Uninstall', |
|
| 52 | - 'bouton_effacer_tout' => 'Delete ALL', |
|
| 53 | - 'bouton_envoyer_message' => 'Message complete: send', |
|
| 54 | - 'bouton_fermer' => 'Close', |
|
| 55 | - 'bouton_mettre_a_jour_base' => 'Update the database', |
|
| 56 | - 'bouton_modifier' => 'Modify', |
|
| 57 | - 'bouton_radio_afficher' => 'Show', |
|
| 58 | - 'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Appear in the list of editors online', |
|
| 59 | - 'bouton_radio_envoi_annonces_adresse' => 'Send announcements to:', |
|
| 60 | - 'bouton_radio_envoi_liste_nouveautes' => 'Send news update list', |
|
| 61 | - 'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Do not appear in the list of editors online', |
|
| 62 | - 'bouton_radio_non_envoi_annonces_editoriales' => 'Do not send any editorial announcements', |
|
| 63 | - 'bouton_redirection' => 'REDIRECT', |
|
| 64 | - 'bouton_reinitialiser_aux_valeurs_par_defaut' => 'Reset to default values', |
|
| 65 | - 'bouton_relancer_installation' => 'Recommence installation', |
|
| 66 | - 'bouton_reset_password' => 'Create a new password and send by e-mail', |
|
| 67 | - 'bouton_suivant' => 'Next', |
|
| 68 | - 'bouton_tenter_recuperation' => 'Attempt to repair', |
|
| 69 | - 'bouton_test_proxy' => 'Test the proxy', |
|
| 70 | - 'bouton_vider_cache' => 'Empty the cache', |
|
| 43 | + // B |
|
| 44 | + 'bouton_acces_ldap' => 'Add LDAP access', |
|
| 45 | + 'bouton_ajouter' => 'Add', |
|
| 46 | + 'bouton_annuler' => 'Cancel', |
|
| 47 | + 'bouton_cache_activer' => 'Re-activate the cache', |
|
| 48 | + 'bouton_cache_desactiver' => 'Disable the cache momentarily', |
|
| 49 | + 'bouton_demande_publication' => 'Request publication of this article', |
|
| 50 | + 'bouton_desactive_tout' => 'Disable all', |
|
| 51 | + 'bouton_desinstaller' => 'Uninstall', |
|
| 52 | + 'bouton_effacer_tout' => 'Delete ALL', |
|
| 53 | + 'bouton_envoyer_message' => 'Message complete: send', |
|
| 54 | + 'bouton_fermer' => 'Close', |
|
| 55 | + 'bouton_mettre_a_jour_base' => 'Update the database', |
|
| 56 | + 'bouton_modifier' => 'Modify', |
|
| 57 | + 'bouton_radio_afficher' => 'Show', |
|
| 58 | + 'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Appear in the list of editors online', |
|
| 59 | + 'bouton_radio_envoi_annonces_adresse' => 'Send announcements to:', |
|
| 60 | + 'bouton_radio_envoi_liste_nouveautes' => 'Send news update list', |
|
| 61 | + 'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Do not appear in the list of editors online', |
|
| 62 | + 'bouton_radio_non_envoi_annonces_editoriales' => 'Do not send any editorial announcements', |
|
| 63 | + 'bouton_redirection' => 'REDIRECT', |
|
| 64 | + 'bouton_reinitialiser_aux_valeurs_par_defaut' => 'Reset to default values', |
|
| 65 | + 'bouton_relancer_installation' => 'Recommence installation', |
|
| 66 | + 'bouton_reset_password' => 'Create a new password and send by e-mail', |
|
| 67 | + 'bouton_suivant' => 'Next', |
|
| 68 | + 'bouton_tenter_recuperation' => 'Attempt to repair', |
|
| 69 | + 'bouton_test_proxy' => 'Test the proxy', |
|
| 70 | + 'bouton_vider_cache' => 'Empty the cache', |
|
| 71 | 71 | |
| 72 | - // C |
|
| 73 | - 'cache_modifiable_webmestre' => 'This parameter can be modified by the webmaster.', |
|
| 74 | - 'calendrier_synchro' => 'If you use a calendar application compatible with <b>iCal</b>, you can synchronise it with information from this site.', |
|
| 75 | - 'config_activer_champs' => 'Activate the following fields', |
|
| 76 | - 'config_choix_base_sup' => 'Choose a database on this server', |
|
| 77 | - 'config_erreur_base_sup' => 'SPIP does not have access to the list of databases available', |
|
| 78 | - 'config_info_base_sup' => 'If you need to query other databases using SPIP, whether on this SQL server or elsewhere, use this form to declare them. If you leave any fields empty, connection details to the main database will be used.', |
|
| 79 | - 'config_info_base_sup_disponibles' => 'Additional databases to which queries may be sent:', |
|
| 80 | - 'config_info_enregistree' => 'The new configuration has been saved', |
|
| 81 | - 'config_info_logos' => 'Each element of the site can have its own logo as well as a "mouseover" logo', |
|
| 82 | - 'config_info_logos_utiliser' => 'Use logos', |
|
| 83 | - 'config_info_logos_utiliser_non' => 'Do not use logos', |
|
| 84 | - 'config_info_logos_utiliser_survol' => 'Use "mouseover" logos', |
|
| 85 | - 'config_info_logos_utiliser_survol_non' => 'Do not use "mouseover" logos', |
|
| 86 | - 'config_info_redirection' => 'By activating this option you can create virtual articles, which are simply links to articles published on other sites, not necessarily using SPIP.', |
|
| 87 | - 'config_redirection' => 'Virtual articles', |
|
| 88 | - 'config_titre_base_sup' => 'Declaration of an additional database', |
|
| 89 | - 'config_titre_base_sup_choix' => 'Choose an additional database', |
|
| 90 | - 'connexion_ldap' => 'Connection:', |
|
| 91 | - 'creer_et_associer_un_auteur' => 'Create and associate an author', |
|
| 72 | + // C |
|
| 73 | + 'cache_modifiable_webmestre' => 'This parameter can be modified by the webmaster.', |
|
| 74 | + 'calendrier_synchro' => 'If you use a calendar application compatible with <b>iCal</b>, you can synchronise it with information from this site.', |
|
| 75 | + 'config_activer_champs' => 'Activate the following fields', |
|
| 76 | + 'config_choix_base_sup' => 'Choose a database on this server', |
|
| 77 | + 'config_erreur_base_sup' => 'SPIP does not have access to the list of databases available', |
|
| 78 | + 'config_info_base_sup' => 'If you need to query other databases using SPIP, whether on this SQL server or elsewhere, use this form to declare them. If you leave any fields empty, connection details to the main database will be used.', |
|
| 79 | + 'config_info_base_sup_disponibles' => 'Additional databases to which queries may be sent:', |
|
| 80 | + 'config_info_enregistree' => 'The new configuration has been saved', |
|
| 81 | + 'config_info_logos' => 'Each element of the site can have its own logo as well as a "mouseover" logo', |
|
| 82 | + 'config_info_logos_utiliser' => 'Use logos', |
|
| 83 | + 'config_info_logos_utiliser_non' => 'Do not use logos', |
|
| 84 | + 'config_info_logos_utiliser_survol' => 'Use "mouseover" logos', |
|
| 85 | + 'config_info_logos_utiliser_survol_non' => 'Do not use "mouseover" logos', |
|
| 86 | + 'config_info_redirection' => 'By activating this option you can create virtual articles, which are simply links to articles published on other sites, not necessarily using SPIP.', |
|
| 87 | + 'config_redirection' => 'Virtual articles', |
|
| 88 | + 'config_titre_base_sup' => 'Declaration of an additional database', |
|
| 89 | + 'config_titre_base_sup_choix' => 'Choose an additional database', |
|
| 90 | + 'connexion_ldap' => 'Connection:', |
|
| 91 | + 'creer_et_associer_un_auteur' => 'Create and associate an author', |
|
| 92 | 92 | |
| 93 | - // D |
|
| 94 | - 'date_mot_heures' => 'H', |
|
| 93 | + // D |
|
| 94 | + 'date_mot_heures' => 'H', |
|
| 95 | 95 | |
| 96 | - // E |
|
| 97 | - 'ecran_securite' => '+ safety screen @version@', |
|
| 98 | - 'email' => 'email', |
|
| 99 | - 'email_2' => 'email:', |
|
| 100 | - 'en_savoir_plus' => 'Learn more', |
|
| 101 | - 'entree_adresse_annuaire' => 'Directory address', |
|
| 102 | - 'entree_adresse_email' => 'Your email address', |
|
| 103 | - 'entree_adresse_email_2' => 'E-mail address', |
|
| 104 | - 'entree_base_donnee_1' => 'Database address', |
|
| 105 | - 'entree_base_donnee_2' => '(This address is often your site’s URL, although sometimes it will be "localhost", and sometimes it should be left blank.)', |
|
| 106 | - 'entree_biographie' => 'Brief biography', |
|
| 107 | - 'entree_chemin_acces' => '<b>Enter</b> the path:', |
|
| 108 | - 'entree_cle_pgp' => 'Your PGP key', |
|
| 109 | - 'entree_cle_pgp_2' => 'PGP key', |
|
| 110 | - 'entree_contenu_rubrique' => '(Brief description of the content of this section.)', |
|
| 111 | - 'entree_identifiants_connexion' => 'Your connection identifiers...', |
|
| 112 | - 'entree_identifiants_connexion_2' => 'Connection identifiers', |
|
| 113 | - 'entree_informations_connexion_ldap' => 'Please fill this form with the LDAP connection information provided by your system or network administrator.', |
|
| 114 | - 'entree_infos_perso' => 'Who are you?', |
|
| 115 | - 'entree_infos_perso_2' => 'Who is the author?', |
|
| 116 | - 'entree_interieur_rubrique' => 'In the section:', |
|
| 117 | - 'entree_liens_sites' => '<b>Hyperlink</b> (reference, site to visit etc.)', |
|
| 118 | - 'entree_login' => 'Your login', |
|
| 119 | - 'entree_login_connexion_1' => 'Connection login', |
|
| 120 | - 'entree_login_connexion_2' => '(Sometimes matches your FTP account login and sometimes left empty)', |
|
| 121 | - 'entree_mot_passe' => 'Your password', |
|
| 122 | - 'entree_mot_passe_1' => 'Password', |
|
| 123 | - 'entree_mot_passe_2' => '(Sometimes matches your FTP access password and sometimes left empty)', |
|
| 124 | - 'entree_nom_fichier' => 'Please enter the filename @texte_compresse@:', |
|
| 125 | - 'entree_nom_pseudo' => 'Your name or alias', |
|
| 126 | - 'entree_nom_pseudo_1' => '(Your name or alias)', |
|
| 127 | - 'entree_nom_pseudo_2' => 'Name or alias', |
|
| 128 | - 'entree_nom_site' => 'Website’s name', |
|
| 129 | - 'entree_nom_site_2' => 'Author’s website’s name', |
|
| 130 | - 'entree_nouveau_passe' => 'New password', |
|
| 131 | - 'entree_passe_ldap' => 'Password', |
|
| 132 | - 'entree_port_annuaire' => 'Port number of the directory', |
|
| 133 | - 'entree_signature' => 'Signature', |
|
| 134 | - 'entree_titre_obligatoire' => '<b>Title</b> [Required]<br />', |
|
| 135 | - 'entree_url' => 'Website’s URL', |
|
| 136 | - 'entree_url_2' => 'Website’s URL', |
|
| 137 | - 'erreur_connect_deja_existant' => 'A server by that name already exists', |
|
| 138 | - 'erreur_contenu_suspect' => 'Text escaped', |
|
| 139 | - 'erreur_email_deja_existant' => 'This email address has already been registered.', |
|
| 140 | - 'erreur_nom_connect_incorrect' => 'Server name not allowed', |
|
| 141 | - 'erreur_plugin_attribut_balise_manquant' => 'Missing attribute @attribut@ in tag @balise@', |
|
| 142 | - 'erreur_plugin_desinstalation_echouee' => 'Uninstallation of the plugin failed. However, you may deactivate it.', |
|
| 143 | - 'erreur_plugin_fichier_absent' => 'File missing', |
|
| 144 | - 'erreur_plugin_fichier_def_absent' => 'Definition file missing', |
|
| 145 | - 'erreur_plugin_nom_fonction_interdit' => 'Prohibited function name', |
|
| 146 | - 'erreur_plugin_nom_manquant' => 'Missing plugin name', |
|
| 147 | - 'erreur_plugin_prefix_manquant' => 'Namespace undefined for this plugin', |
|
| 148 | - 'erreur_plugin_tag_plugin_absent' => '<plugin> missing in the definition file', |
|
| 149 | - 'erreur_plugin_version_manquant' => 'Plugin version missing', |
|
| 96 | + // E |
|
| 97 | + 'ecran_securite' => '+ safety screen @version@', |
|
| 98 | + 'email' => 'email', |
|
| 99 | + 'email_2' => 'email:', |
|
| 100 | + 'en_savoir_plus' => 'Learn more', |
|
| 101 | + 'entree_adresse_annuaire' => 'Directory address', |
|
| 102 | + 'entree_adresse_email' => 'Your email address', |
|
| 103 | + 'entree_adresse_email_2' => 'E-mail address', |
|
| 104 | + 'entree_base_donnee_1' => 'Database address', |
|
| 105 | + 'entree_base_donnee_2' => '(This address is often your site’s URL, although sometimes it will be "localhost", and sometimes it should be left blank.)', |
|
| 106 | + 'entree_biographie' => 'Brief biography', |
|
| 107 | + 'entree_chemin_acces' => '<b>Enter</b> the path:', |
|
| 108 | + 'entree_cle_pgp' => 'Your PGP key', |
|
| 109 | + 'entree_cle_pgp_2' => 'PGP key', |
|
| 110 | + 'entree_contenu_rubrique' => '(Brief description of the content of this section.)', |
|
| 111 | + 'entree_identifiants_connexion' => 'Your connection identifiers...', |
|
| 112 | + 'entree_identifiants_connexion_2' => 'Connection identifiers', |
|
| 113 | + 'entree_informations_connexion_ldap' => 'Please fill this form with the LDAP connection information provided by your system or network administrator.', |
|
| 114 | + 'entree_infos_perso' => 'Who are you?', |
|
| 115 | + 'entree_infos_perso_2' => 'Who is the author?', |
|
| 116 | + 'entree_interieur_rubrique' => 'In the section:', |
|
| 117 | + 'entree_liens_sites' => '<b>Hyperlink</b> (reference, site to visit etc.)', |
|
| 118 | + 'entree_login' => 'Your login', |
|
| 119 | + 'entree_login_connexion_1' => 'Connection login', |
|
| 120 | + 'entree_login_connexion_2' => '(Sometimes matches your FTP account login and sometimes left empty)', |
|
| 121 | + 'entree_mot_passe' => 'Your password', |
|
| 122 | + 'entree_mot_passe_1' => 'Password', |
|
| 123 | + 'entree_mot_passe_2' => '(Sometimes matches your FTP access password and sometimes left empty)', |
|
| 124 | + 'entree_nom_fichier' => 'Please enter the filename @texte_compresse@:', |
|
| 125 | + 'entree_nom_pseudo' => 'Your name or alias', |
|
| 126 | + 'entree_nom_pseudo_1' => '(Your name or alias)', |
|
| 127 | + 'entree_nom_pseudo_2' => 'Name or alias', |
|
| 128 | + 'entree_nom_site' => 'Website’s name', |
|
| 129 | + 'entree_nom_site_2' => 'Author’s website’s name', |
|
| 130 | + 'entree_nouveau_passe' => 'New password', |
|
| 131 | + 'entree_passe_ldap' => 'Password', |
|
| 132 | + 'entree_port_annuaire' => 'Port number of the directory', |
|
| 133 | + 'entree_signature' => 'Signature', |
|
| 134 | + 'entree_titre_obligatoire' => '<b>Title</b> [Required]<br />', |
|
| 135 | + 'entree_url' => 'Website’s URL', |
|
| 136 | + 'entree_url_2' => 'Website’s URL', |
|
| 137 | + 'erreur_connect_deja_existant' => 'A server by that name already exists', |
|
| 138 | + 'erreur_contenu_suspect' => 'Text escaped', |
|
| 139 | + 'erreur_email_deja_existant' => 'This email address has already been registered.', |
|
| 140 | + 'erreur_nom_connect_incorrect' => 'Server name not allowed', |
|
| 141 | + 'erreur_plugin_attribut_balise_manquant' => 'Missing attribute @attribut@ in tag @balise@', |
|
| 142 | + 'erreur_plugin_desinstalation_echouee' => 'Uninstallation of the plugin failed. However, you may deactivate it.', |
|
| 143 | + 'erreur_plugin_fichier_absent' => 'File missing', |
|
| 144 | + 'erreur_plugin_fichier_def_absent' => 'Definition file missing', |
|
| 145 | + 'erreur_plugin_nom_fonction_interdit' => 'Prohibited function name', |
|
| 146 | + 'erreur_plugin_nom_manquant' => 'Missing plugin name', |
|
| 147 | + 'erreur_plugin_prefix_manquant' => 'Namespace undefined for this plugin', |
|
| 148 | + 'erreur_plugin_tag_plugin_absent' => '<plugin> missing in the definition file', |
|
| 149 | + 'erreur_plugin_version_manquant' => 'Plugin version missing', |
|
| 150 | 150 | |
| 151 | - // H |
|
| 152 | - 'htaccess_a_simuler' => 'Warning: your HTTP server configuration ignores @htaccess@ files. To ensure good security, you should change the configuration for this. Alternatively, you should make sure that the constants @constantes@ (definable in the file mes_options.php) have as values directories outside @document_root@.', |
|
| 153 | - 'htaccess_inoperant' => 'inoperative htaccess', |
|
| 151 | + // H |
|
| 152 | + 'htaccess_a_simuler' => 'Warning: your HTTP server configuration ignores @htaccess@ files. To ensure good security, you should change the configuration for this. Alternatively, you should make sure that the constants @constantes@ (definable in the file mes_options.php) have as values directories outside @document_root@.', |
|
| 153 | + 'htaccess_inoperant' => 'inoperative htaccess', |
|
| 154 | 154 | |
| 155 | - // I |
|
| 156 | - 'ical_info1' => 'This page offers several tools to be kept up-to-date with website’s activity.', |
|
| 157 | - 'ical_info2' => 'For more information, do not hesitate to visit <a href="@spipnet@">SPIP’s documentation</a>.', |
|
| 158 | - 'ical_info_calendrier' => 'Two calendars are available. The first is a general, public calendar showing articles as they are published. The second is personal and contains editorial announcements as well as your latest private messages: it is reserved for you via a personal key that you can modify at any time by renewing your password.', |
|
| 159 | - 'ical_methode_http' => 'Downloading', |
|
| 160 | - 'ical_methode_webcal' => 'Synchronisation (webcal://)', |
|
| 161 | - 'ical_texte_js' => 'A line of javascript allows you to easily display the most recent articles published on this site on any other site belonging to you.', |
|
| 162 | - 'ical_texte_prive' => 'This calendar, which is strictly personal, informs you of the private editorial activity of this site (tasks, personal appointments, articles and news items submitted etc.).', |
|
| 163 | - 'ical_texte_public' => 'This calendar allows you to follow the public activity of this site (newly-published articles and news items).', |
|
| 164 | - 'ical_texte_rss' => 'You can syndicate the latest news from this site in any XML/RSS (Rich Site Summary) reader. This is also the format that allows SPIP to read the latest news published by other sites using a compatible exchange format (syndicated sites).', |
|
| 165 | - 'ical_titre_js' => 'Javascript', |
|
| 166 | - 'ical_titre_mailing' => 'Mailing-list', |
|
| 167 | - 'ical_titre_rss' => 'Syndication files', |
|
| 168 | - 'icone_accueil' => 'Home', |
|
| 169 | - 'icone_activer_cookie' => 'Place a cookie', |
|
| 170 | - 'icone_activite' => 'Feedback', |
|
| 171 | - 'icone_admin_plugin' => 'Manage plugins', |
|
| 172 | - 'icone_administration' => 'Maintenance', |
|
| 173 | - 'icone_afficher_auteurs' => 'Show authors', |
|
| 174 | - 'icone_afficher_visiteurs' => 'Show visitors', |
|
| 175 | - 'icone_arret_discussion' => 'Stop participating in this discussion', |
|
| 176 | - 'icone_calendrier' => 'Calendar', |
|
| 177 | - 'icone_configuration' => 'Configuration', |
|
| 178 | - 'icone_creer_auteur' => 'Create a new author and link him/her to this article', |
|
| 179 | - 'icone_creer_mot_cle' => 'Create a new keyword and link it to this article', |
|
| 180 | - 'icone_creer_rubrique_2' => 'Create a new section', |
|
| 181 | - 'icone_developpement' => 'Development', |
|
| 182 | - 'icone_edition' => 'Edit', |
|
| 183 | - 'icone_ma_langue' => 'My language', |
|
| 184 | - 'icone_mes_infos' => 'My details', |
|
| 185 | - 'icone_mes_preferences' => 'Preferences', |
|
| 186 | - 'icone_modifier_article' => 'Edit this article', |
|
| 187 | - 'icone_modifier_rubrique' => 'Edit this section', |
|
| 188 | - 'icone_publication' => 'Publish', |
|
| 189 | - 'icone_relancer_signataire' => 'Contact the signatory again', |
|
| 190 | - 'icone_retour' => 'Back', |
|
| 191 | - 'icone_retour_article' => 'Back to the article', |
|
| 192 | - 'icone_squelette' => 'Templates', |
|
| 193 | - 'icone_suivi_publication' => 'Publication follow up ', |
|
| 194 | - 'icone_supprimer_cookie' => 'Delete cookie', |
|
| 195 | - 'icone_supprimer_rubrique' => 'Delete this section', |
|
| 196 | - 'icone_supprimer_signature' => 'Delete this signature', |
|
| 197 | - 'icone_valider_signature' => 'Validate this signature', |
|
| 198 | - 'image_administrer_rubrique' => 'You can manage this section', |
|
| 199 | - 'info_1_article' => '1 article', |
|
| 200 | - 'info_1_auteur' => '1 author', |
|
| 201 | - 'info_1_message' => '1 message', |
|
| 202 | - 'info_1_mot_cle' => '1 keyword', |
|
| 203 | - 'info_1_rubrique' => '1 section', |
|
| 204 | - 'info_1_visiteur' => '1 visitor', |
|
| 205 | - 'info_activer_cookie' => 'You can activate an <b>administration cookie</b>, which lets you switch easily between the public website and the admin area.', |
|
| 206 | - 'info_activer_menu_developpement' => 'Show the Development menu', |
|
| 207 | - 'info_admin_etre_webmestre' => 'Give me web administrator rights', |
|
| 208 | - 'info_admin_je_suis_webmestre' => 'I am a <b>webmaster</b>', |
|
| 209 | - 'info_admin_statuer_webmestre' => 'Give webmaster rights to this administrator ', |
|
| 210 | - 'info_admin_webmestre' => 'This administrator is <b>webmaster</b>', |
|
| 211 | - 'info_administrateur' => 'Administrator', |
|
| 212 | - 'info_administrateur_1' => 'Administrator', |
|
| 213 | - 'info_administrateur_2' => 'of the site (<i>use with caution</i>)', |
|
| 214 | - 'info_administrateur_site_01' => 'If you are a site administrator, please', |
|
| 215 | - 'info_administrateur_site_02' => 'click on this link', |
|
| 216 | - 'info_administrateurs' => 'Administrators', |
|
| 217 | - 'info_administrer_rubrique' => 'You can manage this section', |
|
| 218 | - 'info_adresse' => 'to this address:', |
|
| 219 | - 'info_adresse_desinscription' => 'Unsubscription address:', |
|
| 220 | - 'info_adresse_url' => 'URL of the public site', |
|
| 221 | - 'info_afficher_par_nb' => 'Show ', |
|
| 222 | - 'info_aide_en_ligne' => 'SPIP Online Help', |
|
| 223 | - 'info_ajout_image' => 'When you add images as attached documents to an article, |
|
| 155 | + // I |
|
| 156 | + 'ical_info1' => 'This page offers several tools to be kept up-to-date with website’s activity.', |
|
| 157 | + 'ical_info2' => 'For more information, do not hesitate to visit <a href="@spipnet@">SPIP’s documentation</a>.', |
|
| 158 | + 'ical_info_calendrier' => 'Two calendars are available. The first is a general, public calendar showing articles as they are published. The second is personal and contains editorial announcements as well as your latest private messages: it is reserved for you via a personal key that you can modify at any time by renewing your password.', |
|
| 159 | + 'ical_methode_http' => 'Downloading', |
|
| 160 | + 'ical_methode_webcal' => 'Synchronisation (webcal://)', |
|
| 161 | + 'ical_texte_js' => 'A line of javascript allows you to easily display the most recent articles published on this site on any other site belonging to you.', |
|
| 162 | + 'ical_texte_prive' => 'This calendar, which is strictly personal, informs you of the private editorial activity of this site (tasks, personal appointments, articles and news items submitted etc.).', |
|
| 163 | + 'ical_texte_public' => 'This calendar allows you to follow the public activity of this site (newly-published articles and news items).', |
|
| 164 | + 'ical_texte_rss' => 'You can syndicate the latest news from this site in any XML/RSS (Rich Site Summary) reader. This is also the format that allows SPIP to read the latest news published by other sites using a compatible exchange format (syndicated sites).', |
|
| 165 | + 'ical_titre_js' => 'Javascript', |
|
| 166 | + 'ical_titre_mailing' => 'Mailing-list', |
|
| 167 | + 'ical_titre_rss' => 'Syndication files', |
|
| 168 | + 'icone_accueil' => 'Home', |
|
| 169 | + 'icone_activer_cookie' => 'Place a cookie', |
|
| 170 | + 'icone_activite' => 'Feedback', |
|
| 171 | + 'icone_admin_plugin' => 'Manage plugins', |
|
| 172 | + 'icone_administration' => 'Maintenance', |
|
| 173 | + 'icone_afficher_auteurs' => 'Show authors', |
|
| 174 | + 'icone_afficher_visiteurs' => 'Show visitors', |
|
| 175 | + 'icone_arret_discussion' => 'Stop participating in this discussion', |
|
| 176 | + 'icone_calendrier' => 'Calendar', |
|
| 177 | + 'icone_configuration' => 'Configuration', |
|
| 178 | + 'icone_creer_auteur' => 'Create a new author and link him/her to this article', |
|
| 179 | + 'icone_creer_mot_cle' => 'Create a new keyword and link it to this article', |
|
| 180 | + 'icone_creer_rubrique_2' => 'Create a new section', |
|
| 181 | + 'icone_developpement' => 'Development', |
|
| 182 | + 'icone_edition' => 'Edit', |
|
| 183 | + 'icone_ma_langue' => 'My language', |
|
| 184 | + 'icone_mes_infos' => 'My details', |
|
| 185 | + 'icone_mes_preferences' => 'Preferences', |
|
| 186 | + 'icone_modifier_article' => 'Edit this article', |
|
| 187 | + 'icone_modifier_rubrique' => 'Edit this section', |
|
| 188 | + 'icone_publication' => 'Publish', |
|
| 189 | + 'icone_relancer_signataire' => 'Contact the signatory again', |
|
| 190 | + 'icone_retour' => 'Back', |
|
| 191 | + 'icone_retour_article' => 'Back to the article', |
|
| 192 | + 'icone_squelette' => 'Templates', |
|
| 193 | + 'icone_suivi_publication' => 'Publication follow up ', |
|
| 194 | + 'icone_supprimer_cookie' => 'Delete cookie', |
|
| 195 | + 'icone_supprimer_rubrique' => 'Delete this section', |
|
| 196 | + 'icone_supprimer_signature' => 'Delete this signature', |
|
| 197 | + 'icone_valider_signature' => 'Validate this signature', |
|
| 198 | + 'image_administrer_rubrique' => 'You can manage this section', |
|
| 199 | + 'info_1_article' => '1 article', |
|
| 200 | + 'info_1_auteur' => '1 author', |
|
| 201 | + 'info_1_message' => '1 message', |
|
| 202 | + 'info_1_mot_cle' => '1 keyword', |
|
| 203 | + 'info_1_rubrique' => '1 section', |
|
| 204 | + 'info_1_visiteur' => '1 visitor', |
|
| 205 | + 'info_activer_cookie' => 'You can activate an <b>administration cookie</b>, which lets you switch easily between the public website and the admin area.', |
|
| 206 | + 'info_activer_menu_developpement' => 'Show the Development menu', |
|
| 207 | + 'info_admin_etre_webmestre' => 'Give me web administrator rights', |
|
| 208 | + 'info_admin_je_suis_webmestre' => 'I am a <b>webmaster</b>', |
|
| 209 | + 'info_admin_statuer_webmestre' => 'Give webmaster rights to this administrator ', |
|
| 210 | + 'info_admin_webmestre' => 'This administrator is <b>webmaster</b>', |
|
| 211 | + 'info_administrateur' => 'Administrator', |
|
| 212 | + 'info_administrateur_1' => 'Administrator', |
|
| 213 | + 'info_administrateur_2' => 'of the site (<i>use with caution</i>)', |
|
| 214 | + 'info_administrateur_site_01' => 'If you are a site administrator, please', |
|
| 215 | + 'info_administrateur_site_02' => 'click on this link', |
|
| 216 | + 'info_administrateurs' => 'Administrators', |
|
| 217 | + 'info_administrer_rubrique' => 'You can manage this section', |
|
| 218 | + 'info_adresse' => 'to this address:', |
|
| 219 | + 'info_adresse_desinscription' => 'Unsubscription address:', |
|
| 220 | + 'info_adresse_url' => 'URL of the public site', |
|
| 221 | + 'info_afficher_par_nb' => 'Show ', |
|
| 222 | + 'info_aide_en_ligne' => 'SPIP Online Help', |
|
| 223 | + 'info_ajout_image' => 'When you add images as attached documents to an article, |
|
| 224 | 224 | SPIP can automatically create thumbnails from |
| 225 | 225 | inserted images. This will allow, for instance, the automated |
| 226 | 226 | creation of a gallery or portfolio.', |
| 227 | - 'info_ajouter_rubrique' => 'Add another section to manage:', |
|
| 228 | - 'info_annonce_nouveautes' => 'Latest news announcements', |
|
| 229 | - 'info_article' => 'article', |
|
| 230 | - 'info_article_2' => 'articles', |
|
| 231 | - 'info_article_a_paraitre' => 'Post-dated articles set for publication', |
|
| 232 | - 'info_articles_02' => 'articles', |
|
| 233 | - 'info_articles_2' => 'Articles', |
|
| 234 | - 'info_articles_auteur' => 'Articles by this author', |
|
| 235 | - 'info_articles_miens' => 'My articles', |
|
| 236 | - 'info_articles_tous' => 'All the articles', |
|
| 237 | - 'info_articles_trouves' => 'Articles found', |
|
| 238 | - 'info_attente_validation' => 'Your articles awaiting validation', |
|
| 239 | - 'info_aucun_article' => 'No articles', |
|
| 240 | - 'info_aucun_auteur' => 'No authors', |
|
| 241 | - 'info_aucun_message' => 'No messages', |
|
| 242 | - 'info_aucun_rubrique' => 'No sections', |
|
| 243 | - 'info_aujourdhui' => 'today:', |
|
| 244 | - 'info_auteur_gere_rubriques' => 'This author manages the following sections:', |
|
| 245 | - 'info_auteur_gere_toutes_rubriques' => 'This author manage <b>all the sections</b>', |
|
| 246 | - 'info_auteur_gere_toutes_rubriques_2' => 'I manage <b>all the sections</b>', |
|
| 247 | - 'info_auteurs' => 'Authors', |
|
| 248 | - 'info_auteurs_par_tri' => 'Authors@partri@', |
|
| 249 | - 'info_auteurs_trouves' => 'Authors found', |
|
| 250 | - 'info_authentification_externe' => 'External authentication', |
|
| 251 | - 'info_avertissement' => 'Warning', |
|
| 252 | - 'info_barre_outils' => 'with its toolbar?', |
|
| 253 | - 'info_base_installee' => 'Your database structure has been installed.', |
|
| 254 | - 'info_bio' => 'Biography', |
|
| 255 | - 'info_cache_desactive' => 'The cache is temporarily disabled', |
|
| 256 | - 'info_chapeau' => 'Introduction', |
|
| 257 | - 'info_chapeau_2' => 'Introduction:', |
|
| 258 | - 'info_chemin_acces_1' => 'Options: <b>Access path in directory</b>', |
|
| 259 | - 'info_chemin_acces_2' => 'You must now configure the access path to the directory information. This information is essential to read the user profiles stored in the directory.', |
|
| 260 | - 'info_chemin_acces_annuaire' => 'Options: <b>Access path in directory</b>', |
|
| 261 | - 'info_choix_base' => 'Third step:', |
|
| 262 | - 'info_classement_1' => ' out of @liste@', |
|
| 263 | - 'info_classement_2' => ' out of @liste@', |
|
| 264 | - 'info_code_acces' => 'Do not forget your own access codes!', |
|
| 265 | - 'info_compatibilite_html' => 'HTML norm to apply', |
|
| 266 | - 'info_config_suivi' => 'If this address corresponds to a mailing list, you can indicate the subscription address for this list. This may be a URL (e.g. a webpage enabling subscription online), or an email address with a specific subject (for instance: <tt>@adresse_suivi@?subject=subscribe</tt>):', |
|
| 267 | - 'info_config_suivi_explication' => 'You can subscribe to the mailing-list for this site. You will then receive email announcements concerning articles and news items submitted for publication.', |
|
| 268 | - 'info_confirmer_passe' => 'Confirm new password:', |
|
| 269 | - 'info_conflit_edition_avis_non_sauvegarde' => 'Caution: the following fields have been modified elsewhere. Your changes to these fields have therefore not been saved.', |
|
| 270 | - 'info_conflit_edition_differences' => 'Differences:', |
|
| 271 | - 'info_conflit_edition_version_enregistree' => 'Saved version:', |
|
| 272 | - 'info_conflit_edition_votre_version' => 'Your version:', |
|
| 273 | - 'info_connexion_base' => 'Trying to connect to database', |
|
| 274 | - 'info_connexion_base_donnee' => 'Connection to your database', |
|
| 275 | - 'info_connexion_ldap_ok' => '<b>LDAP connection succeeded.</b><p> You can go to the next step.</p>', |
|
| 276 | - 'info_connexion_mysql' => 'Your SQL connection', |
|
| 277 | - 'info_connexion_ok' => 'Connection succeeded.', |
|
| 278 | - 'info_contact' => 'Contact', |
|
| 279 | - 'info_contenu_articles' => 'Article content', |
|
| 280 | - 'info_contributions' => 'Contributions', |
|
| 281 | - 'info_creation_paragraphe' => 'To create paragraphs, just leave blank lines.', |
|
| 282 | - 'info_creation_rubrique' => 'Before writing any articles,<br /> you must create at least one section.<br />', |
|
| 283 | - 'info_creation_tables' => 'Creating the database tables', |
|
| 284 | - 'info_creer_base' => '<b>Create</b> a new database:', |
|
| 285 | - 'info_dans_rubrique' => 'In section:', |
|
| 286 | - 'info_date_publication_anterieure' => 'Previously published on:', |
|
| 287 | - 'info_date_referencement' => 'THIS SITE REFERENCED ON:', |
|
| 288 | - 'info_derniere_etape' => 'Done!', |
|
| 289 | - 'info_descriptif' => 'Description:', |
|
| 290 | - 'info_desinstaller_plugin' => ' deactivates the plugin and deletes the data', |
|
| 291 | - 'info_discussion_cours' => 'Current discussions', |
|
| 292 | - 'info_ecrire_article' => 'Before writing any articles, you must create at least one section.', |
|
| 293 | - 'info_email_envoi' => 'Sender’s email address (optional)', |
|
| 294 | - 'info_email_envoi_txt' => 'Enter the sender’s email address used for sending emails (by default, the recipient’s address is used as the sender’s address) :', |
|
| 295 | - 'info_email_webmestre' => 'Webmaster’s email address', |
|
| 296 | - 'info_envoi_email_automatique' => 'Automated mailing', |
|
| 297 | - 'info_envoyer_maintenant' => 'Send now', |
|
| 298 | - 'info_etape_suivante' => 'Go to the next step', |
|
| 299 | - 'info_etape_suivante_1' => 'You can move on to the next step.', |
|
| 300 | - 'info_etape_suivante_2' => 'You can move on to the next step.', |
|
| 301 | - 'info_exceptions_proxy' => 'Exceptions for the proxy', |
|
| 302 | - 'info_exportation_base' => 'export database to @archive@', |
|
| 303 | - 'info_facilite_suivi_activite' => 'To simplify monitoring of the site’s editorial; |
|
| 227 | + 'info_ajouter_rubrique' => 'Add another section to manage:', |
|
| 228 | + 'info_annonce_nouveautes' => 'Latest news announcements', |
|
| 229 | + 'info_article' => 'article', |
|
| 230 | + 'info_article_2' => 'articles', |
|
| 231 | + 'info_article_a_paraitre' => 'Post-dated articles set for publication', |
|
| 232 | + 'info_articles_02' => 'articles', |
|
| 233 | + 'info_articles_2' => 'Articles', |
|
| 234 | + 'info_articles_auteur' => 'Articles by this author', |
|
| 235 | + 'info_articles_miens' => 'My articles', |
|
| 236 | + 'info_articles_tous' => 'All the articles', |
|
| 237 | + 'info_articles_trouves' => 'Articles found', |
|
| 238 | + 'info_attente_validation' => 'Your articles awaiting validation', |
|
| 239 | + 'info_aucun_article' => 'No articles', |
|
| 240 | + 'info_aucun_auteur' => 'No authors', |
|
| 241 | + 'info_aucun_message' => 'No messages', |
|
| 242 | + 'info_aucun_rubrique' => 'No sections', |
|
| 243 | + 'info_aujourdhui' => 'today:', |
|
| 244 | + 'info_auteur_gere_rubriques' => 'This author manages the following sections:', |
|
| 245 | + 'info_auteur_gere_toutes_rubriques' => 'This author manage <b>all the sections</b>', |
|
| 246 | + 'info_auteur_gere_toutes_rubriques_2' => 'I manage <b>all the sections</b>', |
|
| 247 | + 'info_auteurs' => 'Authors', |
|
| 248 | + 'info_auteurs_par_tri' => 'Authors@partri@', |
|
| 249 | + 'info_auteurs_trouves' => 'Authors found', |
|
| 250 | + 'info_authentification_externe' => 'External authentication', |
|
| 251 | + 'info_avertissement' => 'Warning', |
|
| 252 | + 'info_barre_outils' => 'with its toolbar?', |
|
| 253 | + 'info_base_installee' => 'Your database structure has been installed.', |
|
| 254 | + 'info_bio' => 'Biography', |
|
| 255 | + 'info_cache_desactive' => 'The cache is temporarily disabled', |
|
| 256 | + 'info_chapeau' => 'Introduction', |
|
| 257 | + 'info_chapeau_2' => 'Introduction:', |
|
| 258 | + 'info_chemin_acces_1' => 'Options: <b>Access path in directory</b>', |
|
| 259 | + 'info_chemin_acces_2' => 'You must now configure the access path to the directory information. This information is essential to read the user profiles stored in the directory.', |
|
| 260 | + 'info_chemin_acces_annuaire' => 'Options: <b>Access path in directory</b>', |
|
| 261 | + 'info_choix_base' => 'Third step:', |
|
| 262 | + 'info_classement_1' => ' out of @liste@', |
|
| 263 | + 'info_classement_2' => ' out of @liste@', |
|
| 264 | + 'info_code_acces' => 'Do not forget your own access codes!', |
|
| 265 | + 'info_compatibilite_html' => 'HTML norm to apply', |
|
| 266 | + 'info_config_suivi' => 'If this address corresponds to a mailing list, you can indicate the subscription address for this list. This may be a URL (e.g. a webpage enabling subscription online), or an email address with a specific subject (for instance: <tt>@adresse_suivi@?subject=subscribe</tt>):', |
|
| 267 | + 'info_config_suivi_explication' => 'You can subscribe to the mailing-list for this site. You will then receive email announcements concerning articles and news items submitted for publication.', |
|
| 268 | + 'info_confirmer_passe' => 'Confirm new password:', |
|
| 269 | + 'info_conflit_edition_avis_non_sauvegarde' => 'Caution: the following fields have been modified elsewhere. Your changes to these fields have therefore not been saved.', |
|
| 270 | + 'info_conflit_edition_differences' => 'Differences:', |
|
| 271 | + 'info_conflit_edition_version_enregistree' => 'Saved version:', |
|
| 272 | + 'info_conflit_edition_votre_version' => 'Your version:', |
|
| 273 | + 'info_connexion_base' => 'Trying to connect to database', |
|
| 274 | + 'info_connexion_base_donnee' => 'Connection to your database', |
|
| 275 | + 'info_connexion_ldap_ok' => '<b>LDAP connection succeeded.</b><p> You can go to the next step.</p>', |
|
| 276 | + 'info_connexion_mysql' => 'Your SQL connection', |
|
| 277 | + 'info_connexion_ok' => 'Connection succeeded.', |
|
| 278 | + 'info_contact' => 'Contact', |
|
| 279 | + 'info_contenu_articles' => 'Article content', |
|
| 280 | + 'info_contributions' => 'Contributions', |
|
| 281 | + 'info_creation_paragraphe' => 'To create paragraphs, just leave blank lines.', |
|
| 282 | + 'info_creation_rubrique' => 'Before writing any articles,<br /> you must create at least one section.<br />', |
|
| 283 | + 'info_creation_tables' => 'Creating the database tables', |
|
| 284 | + 'info_creer_base' => '<b>Create</b> a new database:', |
|
| 285 | + 'info_dans_rubrique' => 'In section:', |
|
| 286 | + 'info_date_publication_anterieure' => 'Previously published on:', |
|
| 287 | + 'info_date_referencement' => 'THIS SITE REFERENCED ON:', |
|
| 288 | + 'info_derniere_etape' => 'Done!', |
|
| 289 | + 'info_descriptif' => 'Description:', |
|
| 290 | + 'info_desinstaller_plugin' => ' deactivates the plugin and deletes the data', |
|
| 291 | + 'info_discussion_cours' => 'Current discussions', |
|
| 292 | + 'info_ecrire_article' => 'Before writing any articles, you must create at least one section.', |
|
| 293 | + 'info_email_envoi' => 'Sender’s email address (optional)', |
|
| 294 | + 'info_email_envoi_txt' => 'Enter the sender’s email address used for sending emails (by default, the recipient’s address is used as the sender’s address) :', |
|
| 295 | + 'info_email_webmestre' => 'Webmaster’s email address', |
|
| 296 | + 'info_envoi_email_automatique' => 'Automated mailing', |
|
| 297 | + 'info_envoyer_maintenant' => 'Send now', |
|
| 298 | + 'info_etape_suivante' => 'Go to the next step', |
|
| 299 | + 'info_etape_suivante_1' => 'You can move on to the next step.', |
|
| 300 | + 'info_etape_suivante_2' => 'You can move on to the next step.', |
|
| 301 | + 'info_exceptions_proxy' => 'Exceptions for the proxy', |
|
| 302 | + 'info_exportation_base' => 'export database to @archive@', |
|
| 303 | + 'info_facilite_suivi_activite' => 'To simplify monitoring of the site’s editorial; |
|
| 304 | 304 | activities, SPIP can send rmail notifications, e.g. to an editors’ mailing list, |
| 305 | 305 | of publication requests and article validations.', |
| 306 | - 'info_fichiers_authent' => 'Authentication file ".htpasswd"', |
|
| 307 | - 'info_forums_abo_invites' => 'Your site contains forums by subscription; visitors may register for them on the public site.', |
|
| 308 | - 'info_gauche_admin_tech' => '<b>Only webmasters have access to this page.</b><p> It provides access to various |
|
| 306 | + 'info_fichiers_authent' => 'Authentication file ".htpasswd"', |
|
| 307 | + 'info_forums_abo_invites' => 'Your site contains forums by subscription; visitors may register for them on the public site.', |
|
| 308 | + 'info_gauche_admin_tech' => '<b>Only webmasters have access to this page.</b><p> It provides access to various |
|
| 309 | 309 | maintenance tasks. Some of them require a specific authentication process |
| 310 | 310 | via FTP.</p>', |
| 311 | - 'info_gauche_admin_vider' => '<b>Only webmasters have access to this page.</b><p> It provides access to various |
|
| 311 | + 'info_gauche_admin_vider' => '<b>Only webmasters have access to this page.</b><p> It provides access to various |
|
| 312 | 312 | maintenance tasks. Some of them require a specific authentication process |
| 313 | 313 | via FTP.</p>', |
| 314 | - 'info_gauche_auteurs' => 'All the site authors are listed here. |
|
| 314 | + 'info_gauche_auteurs' => 'All the site authors are listed here. |
|
| 315 | 315 | The status of each is indicated by the colour of their icon (administrator = green; editor = yellow).', |
| 316 | - 'info_gauche_auteurs_exterieurs' => 'Visiting authors, without any access to the site, are indicated by a blue icon; deleted authors by a grey icon.', |
|
| 317 | - 'info_gauche_messagerie' => 'Internal messaging lets you exchange messages between editors, keep memos (for personal use) or, display announcements on the admin area’s homepage (if you are an administrator).', |
|
| 318 | - 'info_gauche_statistiques_referers' => 'This page displays the list of <i>referrers</i>, i.e. websites containing links to your own site, for yesterday and today. The list is reset every 24 hours.', |
|
| 319 | - 'info_gauche_visiteurs_enregistres' => 'You will find here the visitors registered |
|
| 316 | + 'info_gauche_auteurs_exterieurs' => 'Visiting authors, without any access to the site, are indicated by a blue icon; deleted authors by a grey icon.', |
|
| 317 | + 'info_gauche_messagerie' => 'Internal messaging lets you exchange messages between editors, keep memos (for personal use) or, display announcements on the admin area’s homepage (if you are an administrator).', |
|
| 318 | + 'info_gauche_statistiques_referers' => 'This page displays the list of <i>referrers</i>, i.e. websites containing links to your own site, for yesterday and today. The list is reset every 24 hours.', |
|
| 319 | + 'info_gauche_visiteurs_enregistres' => 'You will find here the visitors registered |
|
| 320 | 320 | for the public area of the site (subscription-only forums).', |
| 321 | - 'info_generation_miniatures_images' => 'Generation of thumbnail images', |
|
| 322 | - 'info_gerer_trad_objets' => '@objets@: manage translation links', |
|
| 323 | - 'info_hebergeur_desactiver_envoi_email' => 'Some hosts disable automated mail sending |
|
| 321 | + 'info_generation_miniatures_images' => 'Generation of thumbnail images', |
|
| 322 | + 'info_gerer_trad_objets' => '@objets@: manage translation links', |
|
| 323 | + 'info_hebergeur_desactiver_envoi_email' => 'Some hosts disable automated mail sending |
|
| 324 | 324 | on their servers. In this case the following features |
| 325 | 325 | of SPIP cannot be implemented.', |
| 326 | - 'info_hier' => 'yesterday:', |
|
| 327 | - 'info_identification_publique' => 'Your public identity...', |
|
| 328 | - 'info_image_process' => 'Select the best method to create thumbnails by clicking on the corresponding picture.', |
|
| 329 | - 'info_image_process2' => 'If you can’t see any images, then your server is not configured to use such tools. If you want to use these features, contact your provider’s technical support and ask for the «GD» or «Imagick» extensions to be installed.', |
|
| 330 | - 'info_images_auto' => 'Images calculated automatically', |
|
| 331 | - 'info_informations_personnelles' => 'Personal information', |
|
| 332 | - 'info_inscription' => 'Registered on', |
|
| 333 | - 'info_inscription_automatique' => 'Automatic registration for new editors', |
|
| 334 | - 'info_jeu_caractere' => 'Character set for the site', |
|
| 335 | - 'info_jours' => 'days', |
|
| 336 | - 'info_laisser_champs_vides' => 'leave these fields empty)', |
|
| 337 | - 'info_langues' => 'Site languages', |
|
| 338 | - 'info_ldap_ok' => 'LDAP authentication is installed.', |
|
| 339 | - 'info_lien_hypertexte' => 'Hyperlink:', |
|
| 340 | - 'info_liste_nouveautes_envoyee' => 'The news update list has been sent', |
|
| 341 | - 'info_liste_redacteurs_connectes' => 'List of editors online', |
|
| 342 | - 'info_login_existant' => 'This login already exists.', |
|
| 343 | - 'info_login_trop_court' => 'Login too short.', |
|
| 344 | - 'info_login_trop_court_car_pluriel' => 'Your login must contain at least @nb@ characters.', |
|
| 345 | - 'info_logos' => 'Logos', |
|
| 346 | - 'info_maximum' => 'maximum:', |
|
| 347 | - 'info_meme_rubrique' => 'In this section', |
|
| 348 | - 'info_message_en_redaction' => 'Your draft messages', |
|
| 349 | - 'info_message_technique' => 'Technical message:', |
|
| 350 | - 'info_messagerie_interne' => 'Internal messaging', |
|
| 351 | - 'info_mise_a_niveau_base' => 'SQL database upgrade', |
|
| 352 | - 'info_mise_a_niveau_base_2' => '{{Warning!}} You have installed an {older} SPIP version, prior to the one |
|
| 326 | + 'info_hier' => 'yesterday:', |
|
| 327 | + 'info_identification_publique' => 'Your public identity...', |
|
| 328 | + 'info_image_process' => 'Select the best method to create thumbnails by clicking on the corresponding picture.', |
|
| 329 | + 'info_image_process2' => 'If you can’t see any images, then your server is not configured to use such tools. If you want to use these features, contact your provider’s technical support and ask for the «GD» or «Imagick» extensions to be installed.', |
|
| 330 | + 'info_images_auto' => 'Images calculated automatically', |
|
| 331 | + 'info_informations_personnelles' => 'Personal information', |
|
| 332 | + 'info_inscription' => 'Registered on', |
|
| 333 | + 'info_inscription_automatique' => 'Automatic registration for new editors', |
|
| 334 | + 'info_jeu_caractere' => 'Character set for the site', |
|
| 335 | + 'info_jours' => 'days', |
|
| 336 | + 'info_laisser_champs_vides' => 'leave these fields empty)', |
|
| 337 | + 'info_langues' => 'Site languages', |
|
| 338 | + 'info_ldap_ok' => 'LDAP authentication is installed.', |
|
| 339 | + 'info_lien_hypertexte' => 'Hyperlink:', |
|
| 340 | + 'info_liste_nouveautes_envoyee' => 'The news update list has been sent', |
|
| 341 | + 'info_liste_redacteurs_connectes' => 'List of editors online', |
|
| 342 | + 'info_login_existant' => 'This login already exists.', |
|
| 343 | + 'info_login_trop_court' => 'Login too short.', |
|
| 344 | + 'info_login_trop_court_car_pluriel' => 'Your login must contain at least @nb@ characters.', |
|
| 345 | + 'info_logos' => 'Logos', |
|
| 346 | + 'info_maximum' => 'maximum:', |
|
| 347 | + 'info_meme_rubrique' => 'In this section', |
|
| 348 | + 'info_message_en_redaction' => 'Your draft messages', |
|
| 349 | + 'info_message_technique' => 'Technical message:', |
|
| 350 | + 'info_messagerie_interne' => 'Internal messaging', |
|
| 351 | + 'info_mise_a_niveau_base' => 'SQL database upgrade', |
|
| 352 | + 'info_mise_a_niveau_base_2' => '{{Warning!}} You have installed an {older} SPIP version, prior to the one |
|
| 353 | 353 | originally installed on this website: your database is at risk of being corrupted |
| 354 | 354 | and your site might not work properly anymore.<br />{{Please, re-install |
| 355 | 355 | SPIP files.}}', |
| 356 | - 'info_modification_enregistree' => 'Your changes have been saved', |
|
| 357 | - 'info_modifier_auteur' => 'Edit author details:', |
|
| 358 | - 'info_modifier_rubrique' => 'Edit the section:', |
|
| 359 | - 'info_modifier_titre' => 'Edit: @titre@', |
|
| 360 | - 'info_mon_site_spip' => 'My SPIP site', |
|
| 361 | - 'info_moyenne' => 'average:', |
|
| 362 | - 'info_multi_cet_article' => 'Language for this article:', |
|
| 363 | - 'info_multi_langues_choisies' => 'Please select the languages to be made available to the editors of your site. |
|
| 356 | + 'info_modification_enregistree' => 'Your changes have been saved', |
|
| 357 | + 'info_modifier_auteur' => 'Edit author details:', |
|
| 358 | + 'info_modifier_rubrique' => 'Edit the section:', |
|
| 359 | + 'info_modifier_titre' => 'Edit: @titre@', |
|
| 360 | + 'info_mon_site_spip' => 'My SPIP site', |
|
| 361 | + 'info_moyenne' => 'average:', |
|
| 362 | + 'info_multi_cet_article' => 'Language for this article:', |
|
| 363 | + 'info_multi_langues_choisies' => 'Please select the languages to be made available to the editors of your site. |
|
| 364 | 364 | Languages already used on your site (at the top of the list) cannot be disabled.', |
| 365 | - 'info_multi_objets' => '@objets@: activate the language menu', |
|
| 366 | - 'info_multi_secteurs' => '... only for root-level sections?', |
|
| 367 | - 'info_nb_articles' => '@nb@ articles', |
|
| 368 | - 'info_nb_auteurs' => '@nb@ authors', |
|
| 369 | - 'info_nb_messages' => '@nb@ messages', |
|
| 370 | - 'info_nb_mots_cles' => '@nb@ keywords', |
|
| 371 | - 'info_nb_rubriques' => '@nb@ sections', |
|
| 372 | - 'info_nb_visiteurs' => '@nb@ visitors', |
|
| 373 | - 'info_nom' => 'Name', |
|
| 374 | - 'info_nom_destinataire' => 'Name of recipient', |
|
| 375 | - 'info_nom_pas_conforme' => 'html tags are not allowed', |
|
| 376 | - 'info_nom_site' => 'Name of your site', |
|
| 377 | - 'info_nombre_articles' => '@nb_articles@ articles,', |
|
| 378 | - 'info_nombre_rubriques' => '@nb_rubriques@ sections,', |
|
| 379 | - 'info_nombre_sites' => '@nb_sites@ sites,', |
|
| 380 | - 'info_non_deplacer' => 'Do not move...', |
|
| 381 | - 'info_non_envoi_annonce_dernieres_nouveautes' => 'SPIP can send a site newsletter (list of newly-published articles and news items). |
|
| 365 | + 'info_multi_objets' => '@objets@: activate the language menu', |
|
| 366 | + 'info_multi_secteurs' => '... only for root-level sections?', |
|
| 367 | + 'info_nb_articles' => '@nb@ articles', |
|
| 368 | + 'info_nb_auteurs' => '@nb@ authors', |
|
| 369 | + 'info_nb_messages' => '@nb@ messages', |
|
| 370 | + 'info_nb_mots_cles' => '@nb@ keywords', |
|
| 371 | + 'info_nb_rubriques' => '@nb@ sections', |
|
| 372 | + 'info_nb_visiteurs' => '@nb@ visitors', |
|
| 373 | + 'info_nom' => 'Name', |
|
| 374 | + 'info_nom_destinataire' => 'Name of recipient', |
|
| 375 | + 'info_nom_pas_conforme' => 'html tags are not allowed', |
|
| 376 | + 'info_nom_site' => 'Name of your site', |
|
| 377 | + 'info_nombre_articles' => '@nb_articles@ articles,', |
|
| 378 | + 'info_nombre_rubriques' => '@nb_rubriques@ sections,', |
|
| 379 | + 'info_nombre_sites' => '@nb_sites@ sites,', |
|
| 380 | + 'info_non_deplacer' => 'Do not move...', |
|
| 381 | + 'info_non_envoi_annonce_dernieres_nouveautes' => 'SPIP can send a site newsletter (list of newly-published articles and news items). |
|
| 382 | 382 | .', |
| 383 | - 'info_non_envoi_liste_nouveautes' => 'Do not send newsletter', |
|
| 384 | - 'info_non_modifiable' => 'cannot be modified', |
|
| 385 | - 'info_non_suppression_mot_cle' => 'I do not want to delete this keyword.', |
|
| 386 | - 'info_notes' => 'Footnotes', |
|
| 387 | - 'info_nouvel_article' => 'New article', |
|
| 388 | - 'info_nouvelle_traduction' => 'New translation:', |
|
| 389 | - 'info_numero_article' => 'ARTICLE NUMBER:', |
|
| 390 | - 'info_obligatoire_02' => '(Required)', |
|
| 391 | - 'info_option_accepter_visiteurs' => 'Allow visitor registration via the public site', |
|
| 392 | - 'info_option_ne_pas_accepter_visiteurs' => 'Disable visitor registration', |
|
| 393 | - 'info_options_avancees' => 'ADVANCED OPTIONS', |
|
| 394 | - 'info_ou' => 'or...', |
|
| 395 | - 'info_page_interdite' => 'Forbidden page', |
|
| 396 | - 'info_par_nom' => 'by name', |
|
| 397 | - 'info_par_nombre_article' => 'by number of articles', |
|
| 398 | - 'info_par_statut' => 'by status', |
|
| 399 | - 'info_par_tri' => '’(by @tri@)’', |
|
| 400 | - 'info_passe_trop_court' => 'Password too short.', |
|
| 401 | - 'info_passe_trop_court_car_pluriel' => 'Your password must contain at least @nb@ characters.', |
|
| 402 | - 'info_passes_identiques' => 'The two passwords are not identical.', |
|
| 403 | - 'info_plus_cinq_car' => 'more than 5 characters', |
|
| 404 | - 'info_plus_cinq_car_2' => '(More than 5 characters)', |
|
| 405 | - 'info_plus_trois_car' => '(More than 3 characters)', |
|
| 406 | - 'info_popularite' => 'popularity: @popularite@; visits: @visites@', |
|
| 407 | - 'info_post_scriptum' => 'Postscript', |
|
| 408 | - 'info_post_scriptum_2' => 'Postscript:', |
|
| 409 | - 'info_pour' => 'for', |
|
| 410 | - 'info_preview_texte' => 'It is possible to preview the site’s various editorial elements with at least the "submitted" status, as well as the"editing in progress" elements of which you are the author. Should this preview mode be restricted to administrators, open to all authors, or disabled completely?', |
|
| 411 | - 'info_procedez_par_etape' => 'please proceed step by step', |
|
| 412 | - 'info_procedure_maj_version' => 'the upgrade procedure must be run to adapt |
|
| 383 | + 'info_non_envoi_liste_nouveautes' => 'Do not send newsletter', |
|
| 384 | + 'info_non_modifiable' => 'cannot be modified', |
|
| 385 | + 'info_non_suppression_mot_cle' => 'I do not want to delete this keyword.', |
|
| 386 | + 'info_notes' => 'Footnotes', |
|
| 387 | + 'info_nouvel_article' => 'New article', |
|
| 388 | + 'info_nouvelle_traduction' => 'New translation:', |
|
| 389 | + 'info_numero_article' => 'ARTICLE NUMBER:', |
|
| 390 | + 'info_obligatoire_02' => '(Required)', |
|
| 391 | + 'info_option_accepter_visiteurs' => 'Allow visitor registration via the public site', |
|
| 392 | + 'info_option_ne_pas_accepter_visiteurs' => 'Disable visitor registration', |
|
| 393 | + 'info_options_avancees' => 'ADVANCED OPTIONS', |
|
| 394 | + 'info_ou' => 'or...', |
|
| 395 | + 'info_page_interdite' => 'Forbidden page', |
|
| 396 | + 'info_par_nom' => 'by name', |
|
| 397 | + 'info_par_nombre_article' => 'by number of articles', |
|
| 398 | + 'info_par_statut' => 'by status', |
|
| 399 | + 'info_par_tri' => '’(by @tri@)’', |
|
| 400 | + 'info_passe_trop_court' => 'Password too short.', |
|
| 401 | + 'info_passe_trop_court_car_pluriel' => 'Your password must contain at least @nb@ characters.', |
|
| 402 | + 'info_passes_identiques' => 'The two passwords are not identical.', |
|
| 403 | + 'info_plus_cinq_car' => 'more than 5 characters', |
|
| 404 | + 'info_plus_cinq_car_2' => '(More than 5 characters)', |
|
| 405 | + 'info_plus_trois_car' => '(More than 3 characters)', |
|
| 406 | + 'info_popularite' => 'popularity: @popularite@; visits: @visites@', |
|
| 407 | + 'info_post_scriptum' => 'Postscript', |
|
| 408 | + 'info_post_scriptum_2' => 'Postscript:', |
|
| 409 | + 'info_pour' => 'for', |
|
| 410 | + 'info_preview_texte' => 'It is possible to preview the site’s various editorial elements with at least the "submitted" status, as well as the"editing in progress" elements of which you are the author. Should this preview mode be restricted to administrators, open to all authors, or disabled completely?', |
|
| 411 | + 'info_procedez_par_etape' => 'please proceed step by step', |
|
| 412 | + 'info_procedure_maj_version' => 'the upgrade procedure must be run to adapt |
|
| 413 | 413 | the database to this new version of SPIP.', |
| 414 | - 'info_proxy_ok' => 'Proxy test successful.', |
|
| 415 | - 'info_ps' => 'P.S.', |
|
| 416 | - 'info_publier' => 'publish', |
|
| 417 | - 'info_publies' => 'Your articles published online', |
|
| 418 | - 'info_question_accepter_visiteurs' => 'If your website’s templates allows visitors to register with no access to the admin area, please activate the following option:', |
|
| 419 | - 'info_question_inscription_nouveaux_redacteurs' => 'Do you wish to allow new editors to register |
|
| 414 | + 'info_proxy_ok' => 'Proxy test successful.', |
|
| 415 | + 'info_ps' => 'P.S.', |
|
| 416 | + 'info_publier' => 'publish', |
|
| 417 | + 'info_publies' => 'Your articles published online', |
|
| 418 | + 'info_question_accepter_visiteurs' => 'If your website’s templates allows visitors to register with no access to the admin area, please activate the following option:', |
|
| 419 | + 'info_question_inscription_nouveaux_redacteurs' => 'Do you wish to allow new editors to register |
|
| 420 | 420 | from the public website? If you agree with this, visitors will be able to register |
| 421 | 421 | using an automatic form, and then access the admin area to |
| 422 | 422 | write their own articles. <div class="notice">During the registration process, users usually receive an automatic email |
@@ -424,407 +424,407 @@ discard block |
||
| 424 | 424 | service providers disallow sending emails from their |
| 425 | 425 | servers: in that case, automated registration is not |
| 426 | 426 | possible.</div>', |
| 427 | - 'info_qui_edite' => '@nom_auteur_modif@ worked on the contents @date_diff@ minutes ago', |
|
| 428 | - 'info_racine_site' => 'Site root', |
|
| 429 | - 'info_recharger_page' => 'Please wait a few moments, then reload this page.', |
|
| 430 | - 'info_recherche_auteur_zero' => 'No results for "@cherche_auteur@".', |
|
| 431 | - 'info_recommencer' => 'Please try again.', |
|
| 432 | - 'info_redacteur_1' => 'Editor', |
|
| 433 | - 'info_redacteur_2' => 'with access to the admin area (<i>recommended</i>)', |
|
| 434 | - 'info_redacteurs' => 'Editors', |
|
| 435 | - 'info_redaction_en_cours' => 'EDITING IN PROGRESS', |
|
| 436 | - 'info_redirection' => 'Redirection', |
|
| 437 | - 'info_redirection_activee' => 'Redirection is enabled.', |
|
| 438 | - 'info_redirection_boucle' => 'You are trying to redirect the article toward itself. ', |
|
| 439 | - 'info_redirection_desactivee' => 'Redirection is deleted.', |
|
| 440 | - 'info_refuses' => 'Your rejected articles ', |
|
| 441 | - 'info_reglage_ldap' => 'Options: <b>Adjusting LDAP import</b>', |
|
| 442 | - 'info_renvoi_article' => '<b>Redirection.</b> This article redirects to:', |
|
| 443 | - 'info_reserve_admin' => 'Only administrators can modify this address.', |
|
| 444 | - 'info_restreindre_rubrique' => 'Restrict management to section:', |
|
| 445 | - 'info_resultat_recherche' => 'Search results:', |
|
| 446 | - 'info_rubriques' => 'Sections', |
|
| 447 | - 'info_rubriques_02' => 'sections', |
|
| 448 | - 'info_rubriques_trouvees' => 'Sections found', |
|
| 449 | - 'info_sans_titre' => 'Untitled', |
|
| 450 | - 'info_selection_chemin_acces' => '<b>Select</b> the access path in the directory:', |
|
| 451 | - 'info_signatures' => 'signatures', |
|
| 452 | - 'info_site' => 'Site', |
|
| 453 | - 'info_site_2' => 'site:', |
|
| 454 | - 'info_site_min' => 'site', |
|
| 455 | - 'info_site_reference_2' => 'Referenced site', |
|
| 456 | - 'info_site_web' => 'Web site:', |
|
| 457 | - 'info_sites' => 'sites', |
|
| 458 | - 'info_sites_lies_mot' => 'Referenced sites with this keyword', |
|
| 459 | - 'info_sites_proxy' => 'Using a proxy', |
|
| 460 | - 'info_sites_trouves' => 'Sites found', |
|
| 461 | - 'info_sous_titre' => 'Subtitle:', |
|
| 462 | - 'info_statut_administrateur' => 'Administrator', |
|
| 463 | - 'info_statut_auteur' => 'This author’s status:', |
|
| 464 | - 'info_statut_auteur_2' => 'I am', |
|
| 465 | - 'info_statut_auteur_a_confirmer' => 'Registration to be confirmed', |
|
| 466 | - 'info_statut_auteur_autre' => 'Other status:', |
|
| 467 | - 'info_statut_redacteur' => 'Editor', |
|
| 468 | - 'info_statut_utilisateurs_1' => 'Default status for imported users', |
|
| 469 | - 'info_statut_utilisateurs_2' => 'Choose the status to be attributed to persons present in the LDAP directory when they connect for the first time. You can modify this value for each individual author later on.', |
|
| 470 | - 'info_suivi_activite' => 'Follow editorial activity', |
|
| 471 | - 'info_surtitre' => 'Top title:', |
|
| 472 | - 'info_syndication_integrale_1' => 'Your site provides syndication files (see "<a href="@url@">@titre@</a>").', |
|
| 473 | - 'info_syndication_integrale_2' => 'Do you wish to send whole articles or only a summary of a few hundred characters?', |
|
| 474 | - 'info_table_prefix' => 'It is possible to change the prefix of the names of the database tables. (you need to do this if you are installing several sites in the same database). The prefix must be written in unaccented, lower-case letters without any spaces.', |
|
| 475 | - 'info_taille_maximale_images' => 'SPIP will test for the maximum image size (in millions of pixels) which it can process.<br /> Images bigger than this will not be reduced.', |
|
| 476 | - 'info_taille_maximale_vignette' => 'Maximum size for vignettes generated by the system:', |
|
| 477 | - 'info_terminer_installation' => 'You can now finish the standard installation process.', |
|
| 478 | - 'info_texte' => 'Text', |
|
| 479 | - 'info_texte_explicatif' => 'Explanation', |
|
| 480 | - 'info_texte_long' => '(The text is long: it will appear in several parts which will be reassembled after validation.)', |
|
| 481 | - 'info_texte_message' => 'Text of your message:', |
|
| 482 | - 'info_texte_message_02' => 'Message text', |
|
| 483 | - 'info_titre' => 'Title:', |
|
| 484 | - 'info_total' => 'total:', |
|
| 485 | - 'info_tous_articles_en_redaction' => 'All articles in progress', |
|
| 486 | - 'info_tous_articles_presents' => 'All articles published in this section', |
|
| 487 | - 'info_tous_articles_refuses' => 'All refused articles', |
|
| 488 | - 'info_tous_les' => 'every:', |
|
| 489 | - 'info_tout_site' => 'The entire site', |
|
| 490 | - 'info_tout_site2' => 'The article has not been translated into this language.', |
|
| 491 | - 'info_tout_site3' => 'The article has been translated into this language, but changes have since been made to the reference article. The translation needs updating.', |
|
| 492 | - 'info_tout_site4' => 'The article has been translated into this language, and the translation is up-to-date.', |
|
| 493 | - 'info_tout_site5' => 'Original article.', |
|
| 494 | - 'info_tout_site6' => '<b>Warning:</b> only original articles are displayed. |
|
| 427 | + 'info_qui_edite' => '@nom_auteur_modif@ worked on the contents @date_diff@ minutes ago', |
|
| 428 | + 'info_racine_site' => 'Site root', |
|
| 429 | + 'info_recharger_page' => 'Please wait a few moments, then reload this page.', |
|
| 430 | + 'info_recherche_auteur_zero' => 'No results for "@cherche_auteur@".', |
|
| 431 | + 'info_recommencer' => 'Please try again.', |
|
| 432 | + 'info_redacteur_1' => 'Editor', |
|
| 433 | + 'info_redacteur_2' => 'with access to the admin area (<i>recommended</i>)', |
|
| 434 | + 'info_redacteurs' => 'Editors', |
|
| 435 | + 'info_redaction_en_cours' => 'EDITING IN PROGRESS', |
|
| 436 | + 'info_redirection' => 'Redirection', |
|
| 437 | + 'info_redirection_activee' => 'Redirection is enabled.', |
|
| 438 | + 'info_redirection_boucle' => 'You are trying to redirect the article toward itself. ', |
|
| 439 | + 'info_redirection_desactivee' => 'Redirection is deleted.', |
|
| 440 | + 'info_refuses' => 'Your rejected articles ', |
|
| 441 | + 'info_reglage_ldap' => 'Options: <b>Adjusting LDAP import</b>', |
|
| 442 | + 'info_renvoi_article' => '<b>Redirection.</b> This article redirects to:', |
|
| 443 | + 'info_reserve_admin' => 'Only administrators can modify this address.', |
|
| 444 | + 'info_restreindre_rubrique' => 'Restrict management to section:', |
|
| 445 | + 'info_resultat_recherche' => 'Search results:', |
|
| 446 | + 'info_rubriques' => 'Sections', |
|
| 447 | + 'info_rubriques_02' => 'sections', |
|
| 448 | + 'info_rubriques_trouvees' => 'Sections found', |
|
| 449 | + 'info_sans_titre' => 'Untitled', |
|
| 450 | + 'info_selection_chemin_acces' => '<b>Select</b> the access path in the directory:', |
|
| 451 | + 'info_signatures' => 'signatures', |
|
| 452 | + 'info_site' => 'Site', |
|
| 453 | + 'info_site_2' => 'site:', |
|
| 454 | + 'info_site_min' => 'site', |
|
| 455 | + 'info_site_reference_2' => 'Referenced site', |
|
| 456 | + 'info_site_web' => 'Web site:', |
|
| 457 | + 'info_sites' => 'sites', |
|
| 458 | + 'info_sites_lies_mot' => 'Referenced sites with this keyword', |
|
| 459 | + 'info_sites_proxy' => 'Using a proxy', |
|
| 460 | + 'info_sites_trouves' => 'Sites found', |
|
| 461 | + 'info_sous_titre' => 'Subtitle:', |
|
| 462 | + 'info_statut_administrateur' => 'Administrator', |
|
| 463 | + 'info_statut_auteur' => 'This author’s status:', |
|
| 464 | + 'info_statut_auteur_2' => 'I am', |
|
| 465 | + 'info_statut_auteur_a_confirmer' => 'Registration to be confirmed', |
|
| 466 | + 'info_statut_auteur_autre' => 'Other status:', |
|
| 467 | + 'info_statut_redacteur' => 'Editor', |
|
| 468 | + 'info_statut_utilisateurs_1' => 'Default status for imported users', |
|
| 469 | + 'info_statut_utilisateurs_2' => 'Choose the status to be attributed to persons present in the LDAP directory when they connect for the first time. You can modify this value for each individual author later on.', |
|
| 470 | + 'info_suivi_activite' => 'Follow editorial activity', |
|
| 471 | + 'info_surtitre' => 'Top title:', |
|
| 472 | + 'info_syndication_integrale_1' => 'Your site provides syndication files (see "<a href="@url@">@titre@</a>").', |
|
| 473 | + 'info_syndication_integrale_2' => 'Do you wish to send whole articles or only a summary of a few hundred characters?', |
|
| 474 | + 'info_table_prefix' => 'It is possible to change the prefix of the names of the database tables. (you need to do this if you are installing several sites in the same database). The prefix must be written in unaccented, lower-case letters without any spaces.', |
|
| 475 | + 'info_taille_maximale_images' => 'SPIP will test for the maximum image size (in millions of pixels) which it can process.<br /> Images bigger than this will not be reduced.', |
|
| 476 | + 'info_taille_maximale_vignette' => 'Maximum size for vignettes generated by the system:', |
|
| 477 | + 'info_terminer_installation' => 'You can now finish the standard installation process.', |
|
| 478 | + 'info_texte' => 'Text', |
|
| 479 | + 'info_texte_explicatif' => 'Explanation', |
|
| 480 | + 'info_texte_long' => '(The text is long: it will appear in several parts which will be reassembled after validation.)', |
|
| 481 | + 'info_texte_message' => 'Text of your message:', |
|
| 482 | + 'info_texte_message_02' => 'Message text', |
|
| 483 | + 'info_titre' => 'Title:', |
|
| 484 | + 'info_total' => 'total:', |
|
| 485 | + 'info_tous_articles_en_redaction' => 'All articles in progress', |
|
| 486 | + 'info_tous_articles_presents' => 'All articles published in this section', |
|
| 487 | + 'info_tous_articles_refuses' => 'All refused articles', |
|
| 488 | + 'info_tous_les' => 'every:', |
|
| 489 | + 'info_tout_site' => 'The entire site', |
|
| 490 | + 'info_tout_site2' => 'The article has not been translated into this language.', |
|
| 491 | + 'info_tout_site3' => 'The article has been translated into this language, but changes have since been made to the reference article. The translation needs updating.', |
|
| 492 | + 'info_tout_site4' => 'The article has been translated into this language, and the translation is up-to-date.', |
|
| 493 | + 'info_tout_site5' => 'Original article.', |
|
| 494 | + 'info_tout_site6' => '<b>Warning:</b> only original articles are displayed. |
|
| 495 | 495 | Translations are linked to the original, |
| 496 | 496 | and their status is colour-coded:', |
| 497 | - 'info_traductions' => 'Translations', |
|
| 498 | - 'info_travail_colaboratif' => 'Collaborative work on articles', |
|
| 499 | - 'info_un_article' => 'an article,', |
|
| 500 | - 'info_un_site' => 'a site,', |
|
| 501 | - 'info_une_rubrique' => 'a section,', |
|
| 502 | - 'info_une_rubrique_02' => '1 section', |
|
| 503 | - 'info_url' => 'URL:', |
|
| 504 | - 'info_url_proxy' => 'Proxy URL', |
|
| 505 | - 'info_url_proxy_pas_conforme' => 'Proxy’s URL not valid.', |
|
| 506 | - 'info_url_site_pas_conforme' => 'the website URL is invalid.', |
|
| 507 | - 'info_url_test_proxy' => 'Test URL', |
|
| 508 | - 'info_urlref' => 'Hyperlink:', |
|
| 509 | - 'info_utilisation_spip' => 'SPIP is now ready for use', |
|
| 510 | - 'info_visites_par_mois' => 'Monthly display:', |
|
| 511 | - 'info_visiteur_1' => 'Visitor', |
|
| 512 | - 'info_visiteur_2' => 'to the public site', |
|
| 513 | - 'info_visiteurs' => 'Visitors', |
|
| 514 | - 'info_visiteurs_02' => 'Public site visitors', |
|
| 515 | - 'info_webmestre_forces' => 'The web administrators are currently defined in <tt>@file_options@</tt>.', |
|
| 516 | - 'install_adresse_base_hebergeur' => 'Database address attributed by the hosting provider', |
|
| 517 | - 'install_connect_ok' => 'The new database has been declared using the server name @connect@.', |
|
| 518 | - 'install_echec_annonce' => 'This installation will probably fail, or damage your site.', |
|
| 519 | - 'install_extension_mbstring' => 'SPIP does not work with:', |
|
| 520 | - 'install_extension_php_obligatoire' => 'SPIP requires the php extension:', |
|
| 521 | - 'install_login_base_hebergeur' => 'Login attributed by the service provider', |
|
| 522 | - 'install_nom_base_hebergeur' => 'Database name attributed by the service provider:', |
|
| 523 | - 'install_pas_table' => 'The database has no tables', |
|
| 524 | - 'install_pass_base_hebergeur' => 'Password attributed by your hosting service ', |
|
| 525 | - 'install_php_version' => 'This version of PHP @version@ is too old (minimum = @minimum@)', |
|
| 526 | - 'install_select_langue' => 'Select a language, then click on "next" to start installation.', |
|
| 527 | - 'install_select_type_db' => 'Indicate the type of database:', |
|
| 528 | - 'install_select_type_mysql' => 'MySQL', |
|
| 529 | - 'install_select_type_pg' => 'PostgreSQL', |
|
| 530 | - 'install_select_type_sqlite2' => 'SQLite 2', |
|
| 531 | - 'install_select_type_sqlite3' => 'SQLite 3', |
|
| 532 | - 'install_serveur_hebergeur' => 'Database server attributed by the hosting provider', |
|
| 533 | - 'install_table_prefix_hebergeur' => 'Table prefix attributed by your hosting provider:', |
|
| 534 | - 'install_tables_base' => 'Tables in the database', |
|
| 535 | - 'install_types_db_connus' => 'SPIP can use <b>MySQL</b> (the most common) and <b>SQLite</b>.', |
|
| 536 | - 'install_types_db_connus_avertissement' => 'The support of <b>PostgreSQL</b is actually proposed as experimental', |
|
| 537 | - 'instituer_erreur_statut_a_change' => 'The status has already been modified', |
|
| 538 | - 'instituer_erreur_statut_non_autorise' => 'You cannot select this status', |
|
| 539 | - 'intem_redacteur' => 'editor', |
|
| 540 | - 'intitule_licence' => 'Licence', |
|
| 541 | - 'item_accepter_inscriptions' => 'Allow registration', |
|
| 542 | - 'item_activer_messages_avertissement' => 'Activate warning messages', |
|
| 543 | - 'item_administrateur_2' => 'administrator', |
|
| 544 | - 'item_afficher_calendrier' => 'Display in calendar', |
|
| 545 | - 'item_autoriser_syndication_integrale' => 'Include entire articles in syndication feeds', |
|
| 546 | - 'item_choix_administrateurs' => 'administrators', |
|
| 547 | - 'item_choix_generation_miniature' => 'Generate thumbnails automatically.', |
|
| 548 | - 'item_choix_non_generation_miniature' => 'Do not generate thumbnails.', |
|
| 549 | - 'item_choix_redacteurs' => 'editors', |
|
| 550 | - 'item_choix_visiteurs' => 'visitors to the public site', |
|
| 551 | - 'item_creer_fichiers_authent' => 'Create .htpasswd files', |
|
| 552 | - 'item_login' => 'Login', |
|
| 553 | - 'item_messagerie_agenda' => 'Activate messaging system and calendars', |
|
| 554 | - 'item_mots_cles_association_articles' => 'articles', |
|
| 555 | - 'item_mots_cles_association_rubriques' => 'sections', |
|
| 556 | - 'item_mots_cles_association_sites' => 'referenced or syndicated sites.', |
|
| 557 | - 'item_non' => 'No', |
|
| 558 | - 'item_non_accepter_inscriptions' => 'Disable registration', |
|
| 559 | - 'item_non_activer_messages_avertissement' => 'No warning messages', |
|
| 560 | - 'item_non_afficher_calendrier' => 'Do not show in calendar', |
|
| 561 | - 'item_non_autoriser_syndication_integrale' => 'Only send a summary', |
|
| 562 | - 'item_non_creer_fichiers_authent' => 'Do not create these files', |
|
| 563 | - 'item_non_messagerie_agenda' => 'Disable the messaging system and calendars', |
|
| 564 | - 'item_non_publier_articles' => 'Do not publish articles before their specified publication date.', |
|
| 565 | - 'item_nouvel_auteur' => 'New author', |
|
| 566 | - 'item_nouvelle_rubrique' => 'New section', |
|
| 567 | - 'item_oui' => 'Yes', |
|
| 568 | - 'item_publier_articles' => 'Publish articles, irrespective of publication date.', |
|
| 569 | - 'item_reponse_article' => 'Reply to the article', |
|
| 570 | - 'item_version_html_max_html4' => 'Use only HTML4 on the public site', |
|
| 571 | - 'item_version_html_max_html5' => 'Allow HTML5', |
|
| 572 | - 'item_visiteur' => 'visitor', |
|
| 497 | + 'info_traductions' => 'Translations', |
|
| 498 | + 'info_travail_colaboratif' => 'Collaborative work on articles', |
|
| 499 | + 'info_un_article' => 'an article,', |
|
| 500 | + 'info_un_site' => 'a site,', |
|
| 501 | + 'info_une_rubrique' => 'a section,', |
|
| 502 | + 'info_une_rubrique_02' => '1 section', |
|
| 503 | + 'info_url' => 'URL:', |
|
| 504 | + 'info_url_proxy' => 'Proxy URL', |
|
| 505 | + 'info_url_proxy_pas_conforme' => 'Proxy’s URL not valid.', |
|
| 506 | + 'info_url_site_pas_conforme' => 'the website URL is invalid.', |
|
| 507 | + 'info_url_test_proxy' => 'Test URL', |
|
| 508 | + 'info_urlref' => 'Hyperlink:', |
|
| 509 | + 'info_utilisation_spip' => 'SPIP is now ready for use', |
|
| 510 | + 'info_visites_par_mois' => 'Monthly display:', |
|
| 511 | + 'info_visiteur_1' => 'Visitor', |
|
| 512 | + 'info_visiteur_2' => 'to the public site', |
|
| 513 | + 'info_visiteurs' => 'Visitors', |
|
| 514 | + 'info_visiteurs_02' => 'Public site visitors', |
|
| 515 | + 'info_webmestre_forces' => 'The web administrators are currently defined in <tt>@file_options@</tt>.', |
|
| 516 | + 'install_adresse_base_hebergeur' => 'Database address attributed by the hosting provider', |
|
| 517 | + 'install_connect_ok' => 'The new database has been declared using the server name @connect@.', |
|
| 518 | + 'install_echec_annonce' => 'This installation will probably fail, or damage your site.', |
|
| 519 | + 'install_extension_mbstring' => 'SPIP does not work with:', |
|
| 520 | + 'install_extension_php_obligatoire' => 'SPIP requires the php extension:', |
|
| 521 | + 'install_login_base_hebergeur' => 'Login attributed by the service provider', |
|
| 522 | + 'install_nom_base_hebergeur' => 'Database name attributed by the service provider:', |
|
| 523 | + 'install_pas_table' => 'The database has no tables', |
|
| 524 | + 'install_pass_base_hebergeur' => 'Password attributed by your hosting service ', |
|
| 525 | + 'install_php_version' => 'This version of PHP @version@ is too old (minimum = @minimum@)', |
|
| 526 | + 'install_select_langue' => 'Select a language, then click on "next" to start installation.', |
|
| 527 | + 'install_select_type_db' => 'Indicate the type of database:', |
|
| 528 | + 'install_select_type_mysql' => 'MySQL', |
|
| 529 | + 'install_select_type_pg' => 'PostgreSQL', |
|
| 530 | + 'install_select_type_sqlite2' => 'SQLite 2', |
|
| 531 | + 'install_select_type_sqlite3' => 'SQLite 3', |
|
| 532 | + 'install_serveur_hebergeur' => 'Database server attributed by the hosting provider', |
|
| 533 | + 'install_table_prefix_hebergeur' => 'Table prefix attributed by your hosting provider:', |
|
| 534 | + 'install_tables_base' => 'Tables in the database', |
|
| 535 | + 'install_types_db_connus' => 'SPIP can use <b>MySQL</b> (the most common) and <b>SQLite</b>.', |
|
| 536 | + 'install_types_db_connus_avertissement' => 'The support of <b>PostgreSQL</b is actually proposed as experimental', |
|
| 537 | + 'instituer_erreur_statut_a_change' => 'The status has already been modified', |
|
| 538 | + 'instituer_erreur_statut_non_autorise' => 'You cannot select this status', |
|
| 539 | + 'intem_redacteur' => 'editor', |
|
| 540 | + 'intitule_licence' => 'Licence', |
|
| 541 | + 'item_accepter_inscriptions' => 'Allow registration', |
|
| 542 | + 'item_activer_messages_avertissement' => 'Activate warning messages', |
|
| 543 | + 'item_administrateur_2' => 'administrator', |
|
| 544 | + 'item_afficher_calendrier' => 'Display in calendar', |
|
| 545 | + 'item_autoriser_syndication_integrale' => 'Include entire articles in syndication feeds', |
|
| 546 | + 'item_choix_administrateurs' => 'administrators', |
|
| 547 | + 'item_choix_generation_miniature' => 'Generate thumbnails automatically.', |
|
| 548 | + 'item_choix_non_generation_miniature' => 'Do not generate thumbnails.', |
|
| 549 | + 'item_choix_redacteurs' => 'editors', |
|
| 550 | + 'item_choix_visiteurs' => 'visitors to the public site', |
|
| 551 | + 'item_creer_fichiers_authent' => 'Create .htpasswd files', |
|
| 552 | + 'item_login' => 'Login', |
|
| 553 | + 'item_messagerie_agenda' => 'Activate messaging system and calendars', |
|
| 554 | + 'item_mots_cles_association_articles' => 'articles', |
|
| 555 | + 'item_mots_cles_association_rubriques' => 'sections', |
|
| 556 | + 'item_mots_cles_association_sites' => 'referenced or syndicated sites.', |
|
| 557 | + 'item_non' => 'No', |
|
| 558 | + 'item_non_accepter_inscriptions' => 'Disable registration', |
|
| 559 | + 'item_non_activer_messages_avertissement' => 'No warning messages', |
|
| 560 | + 'item_non_afficher_calendrier' => 'Do not show in calendar', |
|
| 561 | + 'item_non_autoriser_syndication_integrale' => 'Only send a summary', |
|
| 562 | + 'item_non_creer_fichiers_authent' => 'Do not create these files', |
|
| 563 | + 'item_non_messagerie_agenda' => 'Disable the messaging system and calendars', |
|
| 564 | + 'item_non_publier_articles' => 'Do not publish articles before their specified publication date.', |
|
| 565 | + 'item_nouvel_auteur' => 'New author', |
|
| 566 | + 'item_nouvelle_rubrique' => 'New section', |
|
| 567 | + 'item_oui' => 'Yes', |
|
| 568 | + 'item_publier_articles' => 'Publish articles, irrespective of publication date.', |
|
| 569 | + 'item_reponse_article' => 'Reply to the article', |
|
| 570 | + 'item_version_html_max_html4' => 'Use only HTML4 on the public site', |
|
| 571 | + 'item_version_html_max_html5' => 'Allow HTML5', |
|
| 572 | + 'item_visiteur' => 'visitor', |
|
| 573 | 573 | |
| 574 | - // J |
|
| 575 | - 'jour_non_connu_nc' => 'unknown', |
|
| 574 | + // J |
|
| 575 | + 'jour_non_connu_nc' => 'unknown', |
|
| 576 | 576 | |
| 577 | - // L |
|
| 578 | - 'label_bando_outils' => 'Toolbar', |
|
| 579 | - 'label_bando_outils_afficher' => 'Show the tools', |
|
| 580 | - 'label_bando_outils_masquer' => 'Hide the tools', |
|
| 581 | - 'label_choix_langue' => 'Choose your language', |
|
| 582 | - 'label_nom_fichier_connect' => 'Indicate the name for this server', |
|
| 583 | - 'label_slogan_site' => 'Website slogan', |
|
| 584 | - 'label_taille_ecran' => 'Screen width', |
|
| 585 | - 'label_texte_et_icones_navigation' => 'Navigation menu', |
|
| 586 | - 'label_texte_et_icones_page' => 'Page display', |
|
| 587 | - 'ldap_correspondance' => 'inherit field @champ@', |
|
| 588 | - 'ldap_correspondance_1' => 'Inherit LDAP fields', |
|
| 589 | - 'ldap_correspondance_2' => 'For each of these SPIP fields, enter the name of the corresponding LDAP field. Leave blank if you don’t want it filled, separate with spaces or commas to try several LDAP fields.', |
|
| 590 | - 'lien_ajouter_auteur' => 'Add this author', |
|
| 591 | - 'lien_ajouter_une_rubrique' => 'Add this section', |
|
| 592 | - 'lien_email' => 'email', |
|
| 593 | - 'lien_nom_site' => 'SITE NAME:', |
|
| 594 | - 'lien_rapide_contenu' => 'Go to the content', |
|
| 595 | - 'lien_rapide_navigation' => 'Go to the navigation', |
|
| 596 | - 'lien_rapide_recherche' => 'Go to the search', |
|
| 597 | - 'lien_retirer_auteur' => 'Remove author', |
|
| 598 | - 'lien_retirer_rubrique' => 'Remove the section', |
|
| 599 | - 'lien_retirer_tous_auteurs' => 'Remove all authors', |
|
| 600 | - 'lien_retirer_toutes_rubriques' => 'Remove all sections', |
|
| 601 | - 'lien_site' => 'site', |
|
| 602 | - 'lien_tout_decocher' => 'Uncheck all', |
|
| 603 | - 'lien_tout_deplier' => 'Expand all', |
|
| 604 | - 'lien_tout_replier' => 'Collapse all', |
|
| 605 | - 'lien_tout_supprimer' => 'Delete all', |
|
| 606 | - 'lien_trier_nom' => 'Sort by name', |
|
| 607 | - 'lien_trier_nombre_articles' => 'Sort by total articles', |
|
| 608 | - 'lien_trier_statut' => 'Sort by status', |
|
| 609 | - 'lien_voir_en_ligne' => 'VIEW ONLINE:', |
|
| 610 | - 'logo_article' => 'Article’s logo', |
|
| 611 | - 'logo_auteur' => 'Author’s logo', |
|
| 612 | - 'logo_rubrique' => 'Section’s logo', |
|
| 613 | - 'logo_site' => 'Website’s logo', |
|
| 614 | - 'logo_standard_rubrique' => 'Default sections’ logo', |
|
| 615 | - 'logo_survol' => 'Mouseover logo', |
|
| 577 | + // L |
|
| 578 | + 'label_bando_outils' => 'Toolbar', |
|
| 579 | + 'label_bando_outils_afficher' => 'Show the tools', |
|
| 580 | + 'label_bando_outils_masquer' => 'Hide the tools', |
|
| 581 | + 'label_choix_langue' => 'Choose your language', |
|
| 582 | + 'label_nom_fichier_connect' => 'Indicate the name for this server', |
|
| 583 | + 'label_slogan_site' => 'Website slogan', |
|
| 584 | + 'label_taille_ecran' => 'Screen width', |
|
| 585 | + 'label_texte_et_icones_navigation' => 'Navigation menu', |
|
| 586 | + 'label_texte_et_icones_page' => 'Page display', |
|
| 587 | + 'ldap_correspondance' => 'inherit field @champ@', |
|
| 588 | + 'ldap_correspondance_1' => 'Inherit LDAP fields', |
|
| 589 | + 'ldap_correspondance_2' => 'For each of these SPIP fields, enter the name of the corresponding LDAP field. Leave blank if you don’t want it filled, separate with spaces or commas to try several LDAP fields.', |
|
| 590 | + 'lien_ajouter_auteur' => 'Add this author', |
|
| 591 | + 'lien_ajouter_une_rubrique' => 'Add this section', |
|
| 592 | + 'lien_email' => 'email', |
|
| 593 | + 'lien_nom_site' => 'SITE NAME:', |
|
| 594 | + 'lien_rapide_contenu' => 'Go to the content', |
|
| 595 | + 'lien_rapide_navigation' => 'Go to the navigation', |
|
| 596 | + 'lien_rapide_recherche' => 'Go to the search', |
|
| 597 | + 'lien_retirer_auteur' => 'Remove author', |
|
| 598 | + 'lien_retirer_rubrique' => 'Remove the section', |
|
| 599 | + 'lien_retirer_tous_auteurs' => 'Remove all authors', |
|
| 600 | + 'lien_retirer_toutes_rubriques' => 'Remove all sections', |
|
| 601 | + 'lien_site' => 'site', |
|
| 602 | + 'lien_tout_decocher' => 'Uncheck all', |
|
| 603 | + 'lien_tout_deplier' => 'Expand all', |
|
| 604 | + 'lien_tout_replier' => 'Collapse all', |
|
| 605 | + 'lien_tout_supprimer' => 'Delete all', |
|
| 606 | + 'lien_trier_nom' => 'Sort by name', |
|
| 607 | + 'lien_trier_nombre_articles' => 'Sort by total articles', |
|
| 608 | + 'lien_trier_statut' => 'Sort by status', |
|
| 609 | + 'lien_voir_en_ligne' => 'VIEW ONLINE:', |
|
| 610 | + 'logo_article' => 'Article’s logo', |
|
| 611 | + 'logo_auteur' => 'Author’s logo', |
|
| 612 | + 'logo_rubrique' => 'Section’s logo', |
|
| 613 | + 'logo_site' => 'Website’s logo', |
|
| 614 | + 'logo_standard_rubrique' => 'Default sections’ logo', |
|
| 615 | + 'logo_survol' => 'Mouseover logo', |
|
| 616 | 616 | |
| 617 | - // M |
|
| 618 | - 'menu_aide_installation_choix_base' => 'Choosing your database', |
|
| 619 | - 'module_fichier_langue' => 'Language file', |
|
| 620 | - 'module_raccourci' => 'Shortcut', |
|
| 621 | - 'module_texte_affiche' => 'Displayed text', |
|
| 622 | - 'module_texte_explicatif' => 'You can insert thse shortcuts in your website templates. They will be automatically translated into any languages for which a language file exists.', |
|
| 623 | - 'module_texte_traduction' => 'The language file « @module@ » is available in:', |
|
| 624 | - 'mois_non_connu' => 'unknown', |
|
| 617 | + // M |
|
| 618 | + 'menu_aide_installation_choix_base' => 'Choosing your database', |
|
| 619 | + 'module_fichier_langue' => 'Language file', |
|
| 620 | + 'module_raccourci' => 'Shortcut', |
|
| 621 | + 'module_texte_affiche' => 'Displayed text', |
|
| 622 | + 'module_texte_explicatif' => 'You can insert thse shortcuts in your website templates. They will be automatically translated into any languages for which a language file exists.', |
|
| 623 | + 'module_texte_traduction' => 'The language file « @module@ » is available in:', |
|
| 624 | + 'mois_non_connu' => 'unknown', |
|
| 625 | 625 | |
| 626 | - // N |
|
| 627 | - 'nouvelle_version_spip' => 'SPIP upgrade @version@ is available', |
|
| 628 | - 'nouvelle_version_spip_majeure' => 'A new SPIP version @version@ is available', |
|
| 626 | + // N |
|
| 627 | + 'nouvelle_version_spip' => 'SPIP upgrade @version@ is available', |
|
| 628 | + 'nouvelle_version_spip_majeure' => 'A new SPIP version @version@ is available', |
|
| 629 | 629 | |
| 630 | - // O |
|
| 631 | - 'onglet_contenu' => 'Contents', |
|
| 632 | - 'onglet_declarer_une_autre_base' => 'Declare another database', |
|
| 633 | - 'onglet_discuter' => 'Discuss', |
|
| 634 | - 'onglet_interactivite' => 'Interactivity', |
|
| 635 | - 'onglet_proprietes' => 'Properties', |
|
| 636 | - 'onglet_repartition_actuelle' => 'now', |
|
| 637 | - 'onglet_sous_rubriques' => 'Subsections', |
|
| 630 | + // O |
|
| 631 | + 'onglet_contenu' => 'Contents', |
|
| 632 | + 'onglet_declarer_une_autre_base' => 'Declare another database', |
|
| 633 | + 'onglet_discuter' => 'Discuss', |
|
| 634 | + 'onglet_interactivite' => 'Interactivity', |
|
| 635 | + 'onglet_proprietes' => 'Properties', |
|
| 636 | + 'onglet_repartition_actuelle' => 'now', |
|
| 637 | + 'onglet_sous_rubriques' => 'Subsections', |
|
| 638 | 638 | |
| 639 | - // P |
|
| 640 | - 'page_pas_proxy' => 'This page must not go through the proxy', |
|
| 641 | - 'pas_de_proxy_pour' => 'If necessary, indicate to which machines or domains this proxy should not apply (for example: @exemple@)', |
|
| 642 | - 'phpinfo' => 'PHP configuration', |
|
| 643 | - 'plugin_charge_paquet' => 'Loading the archive file @name@', |
|
| 644 | - 'plugin_charger' => 'Download', |
|
| 645 | - 'plugin_erreur_charger' => 'error: @zip@ cannot be loaded', |
|
| 646 | - 'plugin_erreur_droit1' => 'Cannot write to directory <code>@dest@</code>.', |
|
| 647 | - 'plugin_erreur_droit2' => 'Please check write permissions for this directory (and create the directory if necessary). Alternatively, install the files by FTP.', |
|
| 648 | - 'plugin_erreur_zip' => 'pclzip failure: error @status@', |
|
| 649 | - 'plugin_etat_developpement' => 'under development', |
|
| 650 | - 'plugin_etat_experimental' => 'experimental', |
|
| 651 | - 'plugin_etat_stable' => 'stable', |
|
| 652 | - 'plugin_etat_test' => 'being tested', |
|
| 653 | - 'plugin_impossible_activer' => 'Impossible to activate the plugin @plugin@', |
|
| 654 | - 'plugin_info_automatique1' => 'If you wish to allow automatic plugin installation, please:', |
|
| 655 | - 'plugin_info_automatique1_lib' => 'If you want to let this library to be installed automatically, please:', |
|
| 656 | - 'plugin_info_automatique2' => 'Create a directory <code>@rep@</code> ;', |
|
| 657 | - 'plugin_info_automatique3' => 'Check that the server has the proper permissions to write to this directory.', |
|
| 658 | - 'plugin_info_automatique_creer' => 'to create at the root of the website.', |
|
| 659 | - 'plugin_info_automatique_exemples' => 'examples:', |
|
| 660 | - 'plugin_info_automatique_ftp' => 'You may install plugins by FTP in the <tt>@rep@</tt> directory', |
|
| 661 | - 'plugin_info_automatique_lib' => 'Some plugins need to be able to load files into the <code>lib/</code> directory. This directory should be created at the website root.', |
|
| 662 | - 'plugin_info_automatique_liste' => 'Your plugin lists:', |
|
| 663 | - 'plugin_info_automatique_liste_officielle' => 'official plugins', |
|
| 664 | - 'plugin_info_automatique_liste_update' => 'Update lists', |
|
| 665 | - 'plugin_info_automatique_ou' => 'or...', |
|
| 666 | - 'plugin_info_automatique_select' => 'Select a plugin below: SPIP will load it and will install it in the <code>@rep@</code> directory. If the plugin already exists, it will be updated.', |
|
| 667 | - 'plugin_info_credit' => 'Credits', |
|
| 668 | - 'plugin_info_erreur_xml' => 'Incorrect declaration of the plugin', |
|
| 669 | - 'plugin_info_install_ok' => 'Installation successful', |
|
| 670 | - 'plugin_info_necessite' => 'Requires:', |
|
| 671 | - 'plugin_info_non_compatible_spip' => 'This plugin is incompatible with this version of SPIP', |
|
| 672 | - 'plugin_info_plugins_dist_1' => 'The following plugins are loaded and activated in the @plugins_dist@ directory.', |
|
| 673 | - 'plugin_info_plugins_dist_2' => 'They cannot be disabled.', |
|
| 674 | - 'plugin_info_telecharger' => 'load from @url@ and install to @rep@', |
|
| 675 | - 'plugin_info_upgrade_ok' => 'Successful update', |
|
| 676 | - 'plugin_librairies_installees' => 'Libraries installed', |
|
| 677 | - 'plugin_necessite_extension_php' => 'Requires the PHP extension @plugin@ version @version@.', |
|
| 678 | - 'plugin_necessite_extension_php_sans_version' => 'Requires the PHP extension @plugin@', |
|
| 679 | - 'plugin_necessite_lib' => 'This plugin requires the library @lib@', |
|
| 680 | - 'plugin_necessite_php' => 'Requires @plugin@ version @version@.', |
|
| 681 | - 'plugin_necessite_plugin' => 'Version @version@ of the plugin @plugin@ is required.', |
|
| 682 | - 'plugin_necessite_plugin_sans_version' => 'Requires the plugin @plugin@', |
|
| 683 | - 'plugin_necessite_spip' => 'SPIP version @version@ or newer is required.', |
|
| 684 | - 'plugin_source' => 'source: ', |
|
| 685 | - 'plugin_titre_automatique' => 'Automatic installation', |
|
| 686 | - 'plugin_titre_automatique_ajouter' => 'Add plugins', |
|
| 687 | - 'plugin_titre_installation' => 'Installation of the @plugin@ plugin', |
|
| 688 | - 'plugin_titre_modifier' => 'My plugins', |
|
| 689 | - 'plugin_utilise_extension_php' => 'Uses the PHP extension @plugin@ version @version@.', |
|
| 690 | - 'plugin_utilise_php' => 'Uses @plugin@ version @version@.', |
|
| 691 | - 'plugin_utilise_plugin' => 'Utilise le plugin @plugin@ en version @version@.', |
|
| 692 | - 'plugin_zip_active' => 'Continue in order to activate', |
|
| 693 | - 'plugin_zip_adresse' => 'To load a zipped plugin file, or a list of plugins, enter the path below.', |
|
| 694 | - 'plugin_zip_adresse_champ' => 'Path of the plugin or list ', |
|
| 695 | - 'plugin_zip_content' => 'It contains the following files(@taille@),<br />ready to be installed in the <code>@rep@</code> directory', |
|
| 696 | - 'plugin_zip_installe_finie' => 'The file @zip@ has been unpacked and installed.', |
|
| 697 | - 'plugin_zip_installe_rep_finie' => 'The file @zip@ has been unpacked and installed in the @rep@ directory', |
|
| 698 | - 'plugin_zip_installer' => 'You may now install it.', |
|
| 699 | - 'plugin_zip_telecharge' => 'The file @zip@ has been loaded', |
|
| 700 | - 'plugins_actif_aucun' => 'No plugins active.', |
|
| 701 | - 'plugins_actif_un' => 'One plugin active', |
|
| 702 | - 'plugins_actifs' => '@count@ active plugins.', |
|
| 703 | - 'plugins_actifs_liste' => 'Enabled', |
|
| 704 | - 'plugins_compte' => '@count@ plugins', |
|
| 705 | - 'plugins_disponible_un' => 'One plugin available', |
|
| 706 | - 'plugins_disponibles' => '@count@ plugins available.', |
|
| 707 | - 'plugins_erreur' => 'Error in the plugins: @plugins@', |
|
| 708 | - 'plugins_liste' => 'List of plugins', |
|
| 709 | - 'plugins_liste_dist' => 'Locked plugins', |
|
| 710 | - 'plugins_recents' => 'Recent plugins', |
|
| 711 | - 'plugins_tous_liste' => 'All', |
|
| 712 | - 'plugins_vue_hierarchie' => 'Hierarchy', |
|
| 713 | - 'plugins_vue_liste' => 'List', |
|
| 714 | - 'protocole_ldap' => 'Protocol version:', |
|
| 639 | + // P |
|
| 640 | + 'page_pas_proxy' => 'This page must not go through the proxy', |
|
| 641 | + 'pas_de_proxy_pour' => 'If necessary, indicate to which machines or domains this proxy should not apply (for example: @exemple@)', |
|
| 642 | + 'phpinfo' => 'PHP configuration', |
|
| 643 | + 'plugin_charge_paquet' => 'Loading the archive file @name@', |
|
| 644 | + 'plugin_charger' => 'Download', |
|
| 645 | + 'plugin_erreur_charger' => 'error: @zip@ cannot be loaded', |
|
| 646 | + 'plugin_erreur_droit1' => 'Cannot write to directory <code>@dest@</code>.', |
|
| 647 | + 'plugin_erreur_droit2' => 'Please check write permissions for this directory (and create the directory if necessary). Alternatively, install the files by FTP.', |
|
| 648 | + 'plugin_erreur_zip' => 'pclzip failure: error @status@', |
|
| 649 | + 'plugin_etat_developpement' => 'under development', |
|
| 650 | + 'plugin_etat_experimental' => 'experimental', |
|
| 651 | + 'plugin_etat_stable' => 'stable', |
|
| 652 | + 'plugin_etat_test' => 'being tested', |
|
| 653 | + 'plugin_impossible_activer' => 'Impossible to activate the plugin @plugin@', |
|
| 654 | + 'plugin_info_automatique1' => 'If you wish to allow automatic plugin installation, please:', |
|
| 655 | + 'plugin_info_automatique1_lib' => 'If you want to let this library to be installed automatically, please:', |
|
| 656 | + 'plugin_info_automatique2' => 'Create a directory <code>@rep@</code> ;', |
|
| 657 | + 'plugin_info_automatique3' => 'Check that the server has the proper permissions to write to this directory.', |
|
| 658 | + 'plugin_info_automatique_creer' => 'to create at the root of the website.', |
|
| 659 | + 'plugin_info_automatique_exemples' => 'examples:', |
|
| 660 | + 'plugin_info_automatique_ftp' => 'You may install plugins by FTP in the <tt>@rep@</tt> directory', |
|
| 661 | + 'plugin_info_automatique_lib' => 'Some plugins need to be able to load files into the <code>lib/</code> directory. This directory should be created at the website root.', |
|
| 662 | + 'plugin_info_automatique_liste' => 'Your plugin lists:', |
|
| 663 | + 'plugin_info_automatique_liste_officielle' => 'official plugins', |
|
| 664 | + 'plugin_info_automatique_liste_update' => 'Update lists', |
|
| 665 | + 'plugin_info_automatique_ou' => 'or...', |
|
| 666 | + 'plugin_info_automatique_select' => 'Select a plugin below: SPIP will load it and will install it in the <code>@rep@</code> directory. If the plugin already exists, it will be updated.', |
|
| 667 | + 'plugin_info_credit' => 'Credits', |
|
| 668 | + 'plugin_info_erreur_xml' => 'Incorrect declaration of the plugin', |
|
| 669 | + 'plugin_info_install_ok' => 'Installation successful', |
|
| 670 | + 'plugin_info_necessite' => 'Requires:', |
|
| 671 | + 'plugin_info_non_compatible_spip' => 'This plugin is incompatible with this version of SPIP', |
|
| 672 | + 'plugin_info_plugins_dist_1' => 'The following plugins are loaded and activated in the @plugins_dist@ directory.', |
|
| 673 | + 'plugin_info_plugins_dist_2' => 'They cannot be disabled.', |
|
| 674 | + 'plugin_info_telecharger' => 'load from @url@ and install to @rep@', |
|
| 675 | + 'plugin_info_upgrade_ok' => 'Successful update', |
|
| 676 | + 'plugin_librairies_installees' => 'Libraries installed', |
|
| 677 | + 'plugin_necessite_extension_php' => 'Requires the PHP extension @plugin@ version @version@.', |
|
| 678 | + 'plugin_necessite_extension_php_sans_version' => 'Requires the PHP extension @plugin@', |
|
| 679 | + 'plugin_necessite_lib' => 'This plugin requires the library @lib@', |
|
| 680 | + 'plugin_necessite_php' => 'Requires @plugin@ version @version@.', |
|
| 681 | + 'plugin_necessite_plugin' => 'Version @version@ of the plugin @plugin@ is required.', |
|
| 682 | + 'plugin_necessite_plugin_sans_version' => 'Requires the plugin @plugin@', |
|
| 683 | + 'plugin_necessite_spip' => 'SPIP version @version@ or newer is required.', |
|
| 684 | + 'plugin_source' => 'source: ', |
|
| 685 | + 'plugin_titre_automatique' => 'Automatic installation', |
|
| 686 | + 'plugin_titre_automatique_ajouter' => 'Add plugins', |
|
| 687 | + 'plugin_titre_installation' => 'Installation of the @plugin@ plugin', |
|
| 688 | + 'plugin_titre_modifier' => 'My plugins', |
|
| 689 | + 'plugin_utilise_extension_php' => 'Uses the PHP extension @plugin@ version @version@.', |
|
| 690 | + 'plugin_utilise_php' => 'Uses @plugin@ version @version@.', |
|
| 691 | + 'plugin_utilise_plugin' => 'Utilise le plugin @plugin@ en version @version@.', |
|
| 692 | + 'plugin_zip_active' => 'Continue in order to activate', |
|
| 693 | + 'plugin_zip_adresse' => 'To load a zipped plugin file, or a list of plugins, enter the path below.', |
|
| 694 | + 'plugin_zip_adresse_champ' => 'Path of the plugin or list ', |
|
| 695 | + 'plugin_zip_content' => 'It contains the following files(@taille@),<br />ready to be installed in the <code>@rep@</code> directory', |
|
| 696 | + 'plugin_zip_installe_finie' => 'The file @zip@ has been unpacked and installed.', |
|
| 697 | + 'plugin_zip_installe_rep_finie' => 'The file @zip@ has been unpacked and installed in the @rep@ directory', |
|
| 698 | + 'plugin_zip_installer' => 'You may now install it.', |
|
| 699 | + 'plugin_zip_telecharge' => 'The file @zip@ has been loaded', |
|
| 700 | + 'plugins_actif_aucun' => 'No plugins active.', |
|
| 701 | + 'plugins_actif_un' => 'One plugin active', |
|
| 702 | + 'plugins_actifs' => '@count@ active plugins.', |
|
| 703 | + 'plugins_actifs_liste' => 'Enabled', |
|
| 704 | + 'plugins_compte' => '@count@ plugins', |
|
| 705 | + 'plugins_disponible_un' => 'One plugin available', |
|
| 706 | + 'plugins_disponibles' => '@count@ plugins available.', |
|
| 707 | + 'plugins_erreur' => 'Error in the plugins: @plugins@', |
|
| 708 | + 'plugins_liste' => 'List of plugins', |
|
| 709 | + 'plugins_liste_dist' => 'Locked plugins', |
|
| 710 | + 'plugins_recents' => 'Recent plugins', |
|
| 711 | + 'plugins_tous_liste' => 'All', |
|
| 712 | + 'plugins_vue_hierarchie' => 'Hierarchy', |
|
| 713 | + 'plugins_vue_liste' => 'List', |
|
| 714 | + 'protocole_ldap' => 'Protocol version:', |
|
| 715 | 715 | |
| 716 | - // Q |
|
| 717 | - 'queue_executer_maintenant' => 'Run now', |
|
| 718 | - 'queue_info_purger' => 'You can delete all pending jobs and reset the list of periodic tasks', |
|
| 719 | - 'queue_nb_jobs_in_queue' => '@nb@ tasks in queue', |
|
| 720 | - 'queue_next_job_in_nb_sec' => 'Next job in @nb@ s', |
|
| 721 | - 'queue_no_job_in_queue' => 'No pending tasks', |
|
| 722 | - 'queue_one_job_in_queue' => '1 job in queue', |
|
| 723 | - 'queue_priorite_tache' => 'priority', |
|
| 724 | - 'queue_purger_queue' => 'Reset the job queue', |
|
| 725 | - 'queue_titre' => 'List of tasks', |
|
| 716 | + // Q |
|
| 717 | + 'queue_executer_maintenant' => 'Run now', |
|
| 718 | + 'queue_info_purger' => 'You can delete all pending jobs and reset the list of periodic tasks', |
|
| 719 | + 'queue_nb_jobs_in_queue' => '@nb@ tasks in queue', |
|
| 720 | + 'queue_next_job_in_nb_sec' => 'Next job in @nb@ s', |
|
| 721 | + 'queue_no_job_in_queue' => 'No pending tasks', |
|
| 722 | + 'queue_one_job_in_queue' => '1 job in queue', |
|
| 723 | + 'queue_priorite_tache' => 'priority', |
|
| 724 | + 'queue_purger_queue' => 'Reset the job queue', |
|
| 725 | + 'queue_titre' => 'List of tasks', |
|
| 726 | 726 | |
| 727 | - // R |
|
| 728 | - 'repertoire_plugins' => 'Directory:', |
|
| 729 | - 'required' => '(Required)', |
|
| 727 | + // R |
|
| 728 | + 'repertoire_plugins' => 'Directory:', |
|
| 729 | + 'required' => '(Required)', |
|
| 730 | 730 | |
| 731 | - // S |
|
| 732 | - 'sans_heure' => 'time not specified', |
|
| 733 | - 'statut_admin_restreint' => 'restricted admin', |
|
| 734 | - 'statut_webmestre' => 'webmaster', |
|
| 731 | + // S |
|
| 732 | + 'sans_heure' => 'time not specified', |
|
| 733 | + 'statut_admin_restreint' => 'restricted admin', |
|
| 734 | + 'statut_webmestre' => 'webmaster', |
|
| 735 | 735 | |
| 736 | - // T |
|
| 737 | - 'tache_cron_asap' => 'CRON task @function@ (ASAP)', |
|
| 738 | - 'tache_cron_secondes' => 'CRON task @function@ (every @nb@ s)', |
|
| 739 | - 'taille_cache_image' => 'The images calculated automatically by SPIP (thumbnails, titles transformed into graphics, mathematical formulae in TeX format, etc.) take up a total of @taille@ in the @dir@ directory.', |
|
| 740 | - 'taille_cache_infinie' => 'This site does not have any fixed limit for the size of the cache.', |
|
| 741 | - 'taille_cache_maxi' => 'SPIP will try to limit the size of the cache directory to approximately <b>@octets@</b>.', |
|
| 742 | - 'taille_cache_moins_de' => 'The cache size is less than @octets@.', |
|
| 743 | - 'taille_cache_octets' => 'The size of the cache is currently around @octets@.', |
|
| 744 | - 'taille_cache_vide' => 'The cache is empty.', |
|
| 745 | - 'taille_repertoire_cache' => 'Current cache size ', |
|
| 746 | - 'text_article_propose_publication' => 'Article submitted for publication.', |
|
| 747 | - 'texte_acces_ldap_anonyme_1' => 'Some LDAP servers do not allow anonymous access. In this case you must indicate an initial access identifier for future directory searches. However, in most cases the following fields can be left empty.', |
|
| 748 | - 'texte_admin_effacer_01' => 'This command deletes <i>all</i> content in the database, |
|
| 736 | + // T |
|
| 737 | + 'tache_cron_asap' => 'CRON task @function@ (ASAP)', |
|
| 738 | + 'tache_cron_secondes' => 'CRON task @function@ (every @nb@ s)', |
|
| 739 | + 'taille_cache_image' => 'The images calculated automatically by SPIP (thumbnails, titles transformed into graphics, mathematical formulae in TeX format, etc.) take up a total of @taille@ in the @dir@ directory.', |
|
| 740 | + 'taille_cache_infinie' => 'This site does not have any fixed limit for the size of the cache.', |
|
| 741 | + 'taille_cache_maxi' => 'SPIP will try to limit the size of the cache directory to approximately <b>@octets@</b>.', |
|
| 742 | + 'taille_cache_moins_de' => 'The cache size is less than @octets@.', |
|
| 743 | + 'taille_cache_octets' => 'The size of the cache is currently around @octets@.', |
|
| 744 | + 'taille_cache_vide' => 'The cache is empty.', |
|
| 745 | + 'taille_repertoire_cache' => 'Current cache size ', |
|
| 746 | + 'text_article_propose_publication' => 'Article submitted for publication.', |
|
| 747 | + 'texte_acces_ldap_anonyme_1' => 'Some LDAP servers do not allow anonymous access. In this case you must indicate an initial access identifier for future directory searches. However, in most cases the following fields can be left empty.', |
|
| 748 | + 'texte_admin_effacer_01' => 'This command deletes <i>all</i> content in the database, |
|
| 749 | 749 | including <i>all</i> the access parameters for editors and administrators. After using it, you must |
| 750 | 750 | reinstall SPIP, create a new database and a new administrator account.', |
| 751 | - 'texte_adresse_annuaire_1' => '(If your directory is installed on the same machine as your website, it is probably «localhost».)', |
|
| 752 | - 'texte_ajout_auteur' => 'The following author was added to the article:', |
|
| 753 | - 'texte_annuaire_ldap_1' => 'If you have access to a LDAP directory server, you can use it to import users automatically into SPIP.', |
|
| 754 | - 'texte_article_statut' => 'Article status:', |
|
| 755 | - 'texte_article_virtuel' => 'Virtual article', |
|
| 756 | - 'texte_article_virtuel_reference' => '<b>Virtual article:</b> an article on your SPIP website which redirects to another URL. To remove redirection, delete the URL.', |
|
| 757 | - 'texte_aucun_resultat_auteur' => 'No results for "@cherche_auteur@".', |
|
| 758 | - 'texte_auteur_messagerie' => 'This site can update the list of editors online in real time, which allows you to be contacted by other users. You can opt not to appear in this list (you are then "invisible" to other users).', |
|
| 759 | - 'texte_auteurs' => 'THE AUTHORS', |
|
| 760 | - 'texte_choix_base_1' => 'Select your database:', |
|
| 761 | - 'texte_choix_base_2' => 'The SQL server contains several databases.', |
|
| 762 | - 'texte_choix_base_3' => '<b>Select</b> below the one attributed by your hosting provider:', |
|
| 763 | - 'texte_choix_table_prefix' => 'Prefix for tables:', |
|
| 764 | - 'texte_compatibilite_html' => 'You can require SPIP to produce code compatible with the <i>HTML4</i> standard, or allow it to use more modern <i>HTML5</i> compatible code.', |
|
| 765 | - 'texte_compatibilite_html_attention' => 'There is no risk involved in activating the <i>HTML5</i> option. But if you do, the pages of your site must begin with the following code in order to be valid: <code><!DOCTYPE html></code>.', |
|
| 766 | - 'texte_compte_element' => '@count@ element', |
|
| 767 | - 'texte_compte_elements' => '@count@ elements', |
|
| 768 | - 'texte_conflit_edition_correction' => 'Please compare differences between the two versions. You can also copy your changes and start over.', |
|
| 769 | - 'texte_connexion_mysql' => 'Consult the information provided by your hosting service. It should contain the connection codes for the SQL server.', |
|
| 770 | - 'texte_contenu_article' => '(Brief description of the article.)', |
|
| 771 | - 'texte_contenu_articles' => 'Depending on the layout chosen for your site, you can decide |
|
| 751 | + 'texte_adresse_annuaire_1' => '(If your directory is installed on the same machine as your website, it is probably «localhost».)', |
|
| 752 | + 'texte_ajout_auteur' => 'The following author was added to the article:', |
|
| 753 | + 'texte_annuaire_ldap_1' => 'If you have access to a LDAP directory server, you can use it to import users automatically into SPIP.', |
|
| 754 | + 'texte_article_statut' => 'Article status:', |
|
| 755 | + 'texte_article_virtuel' => 'Virtual article', |
|
| 756 | + 'texte_article_virtuel_reference' => '<b>Virtual article:</b> an article on your SPIP website which redirects to another URL. To remove redirection, delete the URL.', |
|
| 757 | + 'texte_aucun_resultat_auteur' => 'No results for "@cherche_auteur@".', |
|
| 758 | + 'texte_auteur_messagerie' => 'This site can update the list of editors online in real time, which allows you to be contacted by other users. You can opt not to appear in this list (you are then "invisible" to other users).', |
|
| 759 | + 'texte_auteurs' => 'THE AUTHORS', |
|
| 760 | + 'texte_choix_base_1' => 'Select your database:', |
|
| 761 | + 'texte_choix_base_2' => 'The SQL server contains several databases.', |
|
| 762 | + 'texte_choix_base_3' => '<b>Select</b> below the one attributed by your hosting provider:', |
|
| 763 | + 'texte_choix_table_prefix' => 'Prefix for tables:', |
|
| 764 | + 'texte_compatibilite_html' => 'You can require SPIP to produce code compatible with the <i>HTML4</i> standard, or allow it to use more modern <i>HTML5</i> compatible code.', |
|
| 765 | + 'texte_compatibilite_html_attention' => 'There is no risk involved in activating the <i>HTML5</i> option. But if you do, the pages of your site must begin with the following code in order to be valid: <code><!DOCTYPE html></code>.', |
|
| 766 | + 'texte_compte_element' => '@count@ element', |
|
| 767 | + 'texte_compte_elements' => '@count@ elements', |
|
| 768 | + 'texte_conflit_edition_correction' => 'Please compare differences between the two versions. You can also copy your changes and start over.', |
|
| 769 | + 'texte_connexion_mysql' => 'Consult the information provided by your hosting service. It should contain the connection codes for the SQL server.', |
|
| 770 | + 'texte_contenu_article' => '(Brief description of the article.)', |
|
| 771 | + 'texte_contenu_articles' => 'Depending on the layout chosen for your site, you can decide |
|
| 772 | 772 | that some article options are not to be used. |
| 773 | 773 | Use the following list to choose which options should be available.', |
| 774 | - 'texte_crash_base' => 'If your database |
|
| 774 | + 'texte_crash_base' => 'If your database |
|
| 775 | 775 | crashed, you can try to repair it |
| 776 | 776 | automatically.', |
| 777 | - 'texte_creer_rubrique' => 'Before writing any articles,<br /> you must create a section.', |
|
| 778 | - 'texte_date_creation_article' => 'ARTICLE CREATION DATE:', |
|
| 779 | - 'texte_date_creation_objet' => 'Creation date:', # on ajoute le ":" |
|
| 780 | - 'texte_date_publication_anterieure' => 'Date first published:', |
|
| 781 | - 'texte_date_publication_anterieure_nonaffichee' => 'Hide previous publication date.', |
|
| 782 | - 'texte_date_publication_article' => 'PUBLISHED ON:', |
|
| 783 | - 'texte_date_publication_objet' => 'Published on:', |
|
| 784 | - 'texte_definir_comme_traduction_rubrique' => 'This section is a translation of section number:', |
|
| 785 | - 'texte_descriptif_rapide' => 'Brief description', |
|
| 786 | - 'texte_effacer_base' => 'Delete the SPIP database', |
|
| 787 | - 'texte_effacer_statistiques' => 'Delete the statistics', |
|
| 788 | - 'texte_en_cours_validation' => 'The following articles and news have been submitted for evaluation.', |
|
| 789 | - 'texte_enrichir_mise_a_jour' => 'You can enrich the layout of your text by using "typographical shortcuts".', |
|
| 790 | - 'texte_fichier_authent' => '<b>Should SPIP create the special files <tt>.htpasswd</tt> |
|
| 777 | + 'texte_creer_rubrique' => 'Before writing any articles,<br /> you must create a section.', |
|
| 778 | + 'texte_date_creation_article' => 'ARTICLE CREATION DATE:', |
|
| 779 | + 'texte_date_creation_objet' => 'Creation date:', # on ajoute le ":" |
|
| 780 | + 'texte_date_publication_anterieure' => 'Date first published:', |
|
| 781 | + 'texte_date_publication_anterieure_nonaffichee' => 'Hide previous publication date.', |
|
| 782 | + 'texte_date_publication_article' => 'PUBLISHED ON:', |
|
| 783 | + 'texte_date_publication_objet' => 'Published on:', |
|
| 784 | + 'texte_definir_comme_traduction_rubrique' => 'This section is a translation of section number:', |
|
| 785 | + 'texte_descriptif_rapide' => 'Brief description', |
|
| 786 | + 'texte_effacer_base' => 'Delete the SPIP database', |
|
| 787 | + 'texte_effacer_statistiques' => 'Delete the statistics', |
|
| 788 | + 'texte_en_cours_validation' => 'The following articles and news have been submitted for evaluation.', |
|
| 789 | + 'texte_enrichir_mise_a_jour' => 'You can enrich the layout of your text by using "typographical shortcuts".', |
|
| 790 | + 'texte_fichier_authent' => '<b>Should SPIP create the special files <tt>.htpasswd</tt> |
|
| 791 | 791 | and <tt>.htpasswd-admin</tt> in the directory @dossier@?</b> |
| 792 | 792 | <p>These files can be used to restrict access to authors and administrators to other parts of your site (for instance, external statistical programme).</p><p>If you have no need of such files, you can keep this option with its default value (no file creation).</p>', |
| 793 | - 'texte_informations_personnelles_1' => 'The system will now create your personal account for this site.', |
|
| 794 | - 'texte_informations_personnelles_2' => '(Note: if it is a reinstallation, if your former access is still working, you can', |
|
| 795 | - 'texte_introductif_article' => '(Introductory text for the article.)', |
|
| 796 | - 'texte_jeu_caractere' => 'We advise using the universal alphabet (<tt>utf-8</tt>) on your site. This will make it possible to display text in any language. All modern browsers are fully comptabile with this character set.', |
|
| 797 | - 'texte_jeu_caractere_3' => 'Your site currently uses this character set:', |
|
| 798 | - 'texte_jeu_caractere_4' => 'If that does not correspond to your current data (this may occur after restoring your database from a backup), or if <em>you are setting up this site</em> and wish to use a different character set, please indicate the character set here:', |
|
| 799 | - 'texte_login_ldap_1' => '(Keep empty for anonymous access or enter complete path, for instance «<tt>uid=smith, ou=users, dc=my-domain, dc=com</tt>».)', |
|
| 800 | - 'texte_login_precaution' => 'Warning! This is the login which you are currently using. |
|
| 793 | + 'texte_informations_personnelles_1' => 'The system will now create your personal account for this site.', |
|
| 794 | + 'texte_informations_personnelles_2' => '(Note: if it is a reinstallation, if your former access is still working, you can', |
|
| 795 | + 'texte_introductif_article' => '(Introductory text for the article.)', |
|
| 796 | + 'texte_jeu_caractere' => 'We advise using the universal alphabet (<tt>utf-8</tt>) on your site. This will make it possible to display text in any language. All modern browsers are fully comptabile with this character set.', |
|
| 797 | + 'texte_jeu_caractere_3' => 'Your site currently uses this character set:', |
|
| 798 | + 'texte_jeu_caractere_4' => 'If that does not correspond to your current data (this may occur after restoring your database from a backup), or if <em>you are setting up this site</em> and wish to use a different character set, please indicate the character set here:', |
|
| 799 | + 'texte_login_ldap_1' => '(Keep empty for anonymous access or enter complete path, for instance «<tt>uid=smith, ou=users, dc=my-domain, dc=com</tt>».)', |
|
| 800 | + 'texte_login_precaution' => 'Warning! This is the login which you are currently using. |
|
| 801 | 801 | Use this form with caution...', |
| 802 | - 'texte_messagerie_agenda' => 'A messaging system lets website’s authors communicate directly into the admin area. It is linked to a calendar.', |
|
| 803 | - 'texte_mise_a_niveau_base_1' => 'You have just updated SPIP files. |
|
| 802 | + 'texte_messagerie_agenda' => 'A messaging system lets website’s authors communicate directly into the admin area. It is linked to a calendar.', |
|
| 803 | + 'texte_mise_a_niveau_base_1' => 'You have just updated SPIP files. |
|
| 804 | 804 | Now you must upgrade the site |
| 805 | 805 | database.', |
| 806 | - 'texte_modifier_article' => 'Edit this article:', |
|
| 807 | - 'texte_multilinguisme' => 'If you want to manage objects in several languages, with complex navigation, you can add a language selection menu to these objects, depending on the organization of your site.', |
|
| 808 | - 'texte_multilinguisme_trad' => 'You can also enable a system for managing links between the various translations of certain objects.', |
|
| 809 | - 'texte_non_compresse' => '<i>uncompressed</i> (your server does not support this feature)', |
|
| 810 | - 'texte_nouvelle_version_spip_1' => 'You have just installed a new version of SPIP.', |
|
| 811 | - 'texte_nouvelle_version_spip_2' => 'This new version requires a more thorough update than usual. If you are the webmaster of this site, please delete the file @connect@ and restart installation in order to update your database connection parameters. <p>(PS.: if you have forgotten your connection parameters, take a look at the file @connect@ before deleting it!)</p>', |
|
| 812 | - 'texte_operation_echec' => 'Go back to the previous page, select another database or create a new one. Verify the information provided by your hosting service.', |
|
| 813 | - 'texte_plus_trois_car' => 'more than 3 characters', |
|
| 814 | - 'texte_plusieurs_articles' => 'Several authors were found for "@cherche_auteur@":', |
|
| 815 | - 'texte_port_annuaire' => '(Default value is generally suitable.)', |
|
| 816 | - 'texte_presente_plugin' => 'This page shows the plugins available on this site. Activate the plugins you require by ticking the corresponding box.', |
|
| 817 | - 'texte_proposer_publication' => 'When your article is finished,<br /> you can submit it for publication.', |
|
| 818 | - 'texte_proxy' => 'In some cases (e.g. intranet, protected network), it is necessary to use an <i>HTTP proxy</i> to reach external sites (SPIP documentation, syndicated sites, etc.). If this is the case, enter its address in the form @proxy_en_cours@. In most cases you can leave this box empty.', |
|
| 819 | - 'texte_publication_articles_post_dates' => 'Which behaviour should SPIP adopt for articles whose |
|
| 806 | + 'texte_modifier_article' => 'Edit this article:', |
|
| 807 | + 'texte_multilinguisme' => 'If you want to manage objects in several languages, with complex navigation, you can add a language selection menu to these objects, depending on the organization of your site.', |
|
| 808 | + 'texte_multilinguisme_trad' => 'You can also enable a system for managing links between the various translations of certain objects.', |
|
| 809 | + 'texte_non_compresse' => '<i>uncompressed</i> (your server does not support this feature)', |
|
| 810 | + 'texte_nouvelle_version_spip_1' => 'You have just installed a new version of SPIP.', |
|
| 811 | + 'texte_nouvelle_version_spip_2' => 'This new version requires a more thorough update than usual. If you are the webmaster of this site, please delete the file @connect@ and restart installation in order to update your database connection parameters. <p>(PS.: if you have forgotten your connection parameters, take a look at the file @connect@ before deleting it!)</p>', |
|
| 812 | + 'texte_operation_echec' => 'Go back to the previous page, select another database or create a new one. Verify the information provided by your hosting service.', |
|
| 813 | + 'texte_plus_trois_car' => 'more than 3 characters', |
|
| 814 | + 'texte_plusieurs_articles' => 'Several authors were found for "@cherche_auteur@":', |
|
| 815 | + 'texte_port_annuaire' => '(Default value is generally suitable.)', |
|
| 816 | + 'texte_presente_plugin' => 'This page shows the plugins available on this site. Activate the plugins you require by ticking the corresponding box.', |
|
| 817 | + 'texte_proposer_publication' => 'When your article is finished,<br /> you can submit it for publication.', |
|
| 818 | + 'texte_proxy' => 'In some cases (e.g. intranet, protected network), it is necessary to use an <i>HTTP proxy</i> to reach external sites (SPIP documentation, syndicated sites, etc.). If this is the case, enter its address in the form @proxy_en_cours@. In most cases you can leave this box empty.', |
|
| 819 | + 'texte_publication_articles_post_dates' => 'Which behaviour should SPIP adopt for articles whose |
|
| 820 | 820 | publication date has been set in |
| 821 | 821 | the future?', |
| 822 | - 'texte_rappel_selection_champs' => '[Remember to select this field correctly.]', |
|
| 823 | - 'texte_recalcul_page' => 'If you want |
|
| 822 | + 'texte_rappel_selection_champs' => '[Remember to select this field correctly.]', |
|
| 823 | + 'texte_recalcul_page' => 'If you want |
|
| 824 | 824 | to re-process a single page, it is easier to view that page from the public site and click "Re-process this page".', |
| 825 | - 'texte_recuperer_base' => 'Repair the database', |
|
| 826 | - 'texte_reference_mais_redirige' => 'article referenced in your SPIP site, but redirected to another URL.', |
|
| 827 | - 'texte_requetes_echouent' => '<b>When some SQL queries fail |
|
| 825 | + 'texte_recuperer_base' => 'Repair the database', |
|
| 826 | + 'texte_reference_mais_redirige' => 'article referenced in your SPIP site, but redirected to another URL.', |
|
| 827 | + 'texte_requetes_echouent' => '<b>When some SQL queries fail |
|
| 828 | 828 | systematically, without apparent reason, it is possible |
| 829 | 829 | that the database itself |
| 830 | 830 | is the culprit.</b><p> |
@@ -835,87 +835,87 @@ discard block |
||
| 835 | 835 | clues as to where the problem lies.</p><p> |
| 836 | 836 | If the problem persists, contact your |
| 837 | 837 | service provider.</p>', |
| 838 | - 'texte_selection_langue_principale' => 'You can choose the website’s "primary language". This does not mean that you can only write articles in that language, but it will be used to determine |
|
| 838 | + 'texte_selection_langue_principale' => 'You can choose the website’s "primary language". This does not mean that you can only write articles in that language, but it will be used to determine |
|
| 839 | 839 | |
| 840 | 840 | <ul><li> the default date/time format on the public website,</li> |
| 841 | 841 | <li> the nature of the typographical engine which will be used by SPIP for rendering text,</li> |
| 842 | 842 | <li> the language in use in public website’s forms,</li> |
| 843 | 843 | <li> the default language in use in the admin area.</li></ul>', |
| 844 | - 'texte_sous_titre' => 'Subtitle', |
|
| 845 | - 'texte_statistiques_visites' => '(dark bars = Sunday, dark curve: average visits)', |
|
| 846 | - 'texte_statut_attente_validation' => 'awaiting validation', |
|
| 847 | - 'texte_statut_publies' => 'published online', |
|
| 848 | - 'texte_statut_refuses' => 'rejected', |
|
| 849 | - 'texte_suppression_fichiers' => 'Use this command to purge all the files |
|
| 844 | + 'texte_sous_titre' => 'Subtitle', |
|
| 845 | + 'texte_statistiques_visites' => '(dark bars = Sunday, dark curve: average visits)', |
|
| 846 | + 'texte_statut_attente_validation' => 'awaiting validation', |
|
| 847 | + 'texte_statut_publies' => 'published online', |
|
| 848 | + 'texte_statut_refuses' => 'rejected', |
|
| 849 | + 'texte_suppression_fichiers' => 'Use this command to purge all the files |
|
| 850 | 850 | in the SPIP cache. This will force recalculation of every page on the site, useful after |
| 851 | 851 | significant modifications to the site’s graphics or structure.', |
| 852 | - 'texte_sur_titre' => 'Lead-in title', |
|
| 853 | - 'texte_table_ok' => ': this table is OK.', |
|
| 854 | - 'texte_tentative_recuperation' => 'Attempting to repair', |
|
| 855 | - 'texte_tenter_reparation' => 'Attempt to repair the database', |
|
| 856 | - 'texte_test_proxy' => 'To test this proxy, enter the address of a website |
|
| 852 | + 'texte_sur_titre' => 'Lead-in title', |
|
| 853 | + 'texte_table_ok' => ': this table is OK.', |
|
| 854 | + 'texte_tentative_recuperation' => 'Attempting to repair', |
|
| 855 | + 'texte_tenter_reparation' => 'Attempt to repair the database', |
|
| 856 | + 'texte_test_proxy' => 'To test this proxy, enter the address of a website |
|
| 857 | 857 | for verification.', |
| 858 | - 'texte_titre_02' => 'Subject:', |
|
| 859 | - 'texte_titre_obligatoire' => '<b>Title</b> [Required]', |
|
| 860 | - 'texte_travail_article' => '@nom_auteur_modif@ edited this article @date_diff@ minutes ago', |
|
| 861 | - 'texte_travail_collaboratif' => 'If several editors often work on the same article, the system can mark recently "opened" articles in order to avoid multiple simultaneous editing. |
|
| 858 | + 'texte_titre_02' => 'Subject:', |
|
| 859 | + 'texte_titre_obligatoire' => '<b>Title</b> [Required]', |
|
| 860 | + 'texte_travail_article' => '@nom_auteur_modif@ edited this article @date_diff@ minutes ago', |
|
| 861 | + 'texte_travail_collaboratif' => 'If several editors often work on the same article, the system can mark recently "opened" articles in order to avoid multiple simultaneous editing. |
|
| 862 | 862 | This option is disabled by default to avoid displaying unnecessary warning |
| 863 | 863 | messages.', |
| 864 | - 'texte_vide' => 'empty', |
|
| 865 | - 'texte_vider_cache' => 'Empty the cache', |
|
| 866 | - 'titre_admin_tech' => 'Technical maintenance', |
|
| 867 | - 'titre_admin_vider' => 'Technical maintenance', |
|
| 868 | - 'titre_ajouter_un_auteur' => 'Add an author', |
|
| 869 | - 'titre_ajouter_un_mot' => 'Add a keyword', |
|
| 870 | - 'titre_cadre_afficher_article' => 'Show the articles:', |
|
| 871 | - 'titre_cadre_afficher_traductions' => 'Display the translation status for these languages:', |
|
| 872 | - 'titre_cadre_ajouter_auteur' => 'ADD AN AUTHOR:', |
|
| 873 | - 'titre_cadre_interieur_rubrique' => 'In section', |
|
| 874 | - 'titre_cadre_numero_auteur' => 'AUTHOR NUMBER', |
|
| 875 | - 'titre_cadre_numero_objet' => '@objet@ NUMBER:', |
|
| 876 | - 'titre_cadre_signature_obligatoire' => '<b>Signature</b> [Required]<br />', |
|
| 877 | - 'titre_config_contenu_notifications' => 'Notifications', |
|
| 878 | - 'titre_config_contenu_prive' => 'In the admin area', |
|
| 879 | - 'titre_config_contenu_public' => 'On the public site', |
|
| 880 | - 'titre_config_fonctions' => 'Site configuration', |
|
| 881 | - 'titre_config_langage' => 'Configure the language', |
|
| 882 | - 'titre_configuration' => 'Site configuration', |
|
| 883 | - 'titre_configurer_preferences' => 'Configure your preferences', |
|
| 884 | - 'titre_configurer_preferences_menus' => 'Settings of your menus preferences', |
|
| 885 | - 'titre_conflit_edition' => 'Conflict while editing', |
|
| 886 | - 'titre_connexion_ldap' => 'Options: <b>Your LDAP connection</b>', |
|
| 887 | - 'titre_groupe_mots' => 'KEYWORD GROUP:', |
|
| 888 | - 'titre_identite_site' => 'Site identity', |
|
| 889 | - 'titre_langue_article' => 'Article language', |
|
| 890 | - 'titre_langue_rubrique' => 'Section language', |
|
| 891 | - 'titre_langue_trad_article' => 'ARTICLE LANGUAGE AND TRANSLATIONS', |
|
| 892 | - 'titre_les_articles' => 'ARTICLES', |
|
| 893 | - 'titre_messagerie_agenda' => 'Messaging system and calendar', |
|
| 894 | - 'titre_naviguer_dans_le_site' => 'Browse the site...', |
|
| 895 | - 'titre_nouvelle_rubrique' => 'New section', |
|
| 896 | - 'titre_numero_rubrique' => 'SECTION NUMBER:', |
|
| 897 | - 'titre_page_articles_edit' => 'Modify: @titre@', |
|
| 898 | - 'titre_page_articles_page' => 'Articles', |
|
| 899 | - 'titre_page_articles_tous' => 'The entire site', |
|
| 900 | - 'titre_page_calendrier' => 'Calendar @nom_mois@ @annee@', |
|
| 901 | - 'titre_page_config_contenu' => 'Site configuration', |
|
| 902 | - 'titre_page_delete_all' => 'total and irreversible deletion', |
|
| 903 | - 'titre_page_recherche' => 'Search results @recherche@', |
|
| 904 | - 'titre_page_statistiques_referers' => 'Statistics (incoming links)', |
|
| 905 | - 'titre_page_upgrade' => 'SPIP upgrade', |
|
| 906 | - 'titre_preference_menus_favoris' => 'Favourites menu', |
|
| 907 | - 'titre_publication_articles_post_dates' => 'Publication of post dated articles', |
|
| 908 | - 'titre_reparation' => 'Repair', |
|
| 909 | - 'titre_suivi_petition' => 'Petitions follow-up', |
|
| 910 | - 'tls_ldap' => 'Transport Layer Security :', |
|
| 911 | - 'trad_article_traduction' => 'All the versions of this article:', |
|
| 912 | - 'trad_delier' => 'Stop linking to these translations', |
|
| 913 | - 'trad_lier' => 'This article is a translation of article number:', |
|
| 914 | - 'trad_new' => 'Write a new translation', |
|
| 864 | + 'texte_vide' => 'empty', |
|
| 865 | + 'texte_vider_cache' => 'Empty the cache', |
|
| 866 | + 'titre_admin_tech' => 'Technical maintenance', |
|
| 867 | + 'titre_admin_vider' => 'Technical maintenance', |
|
| 868 | + 'titre_ajouter_un_auteur' => 'Add an author', |
|
| 869 | + 'titre_ajouter_un_mot' => 'Add a keyword', |
|
| 870 | + 'titre_cadre_afficher_article' => 'Show the articles:', |
|
| 871 | + 'titre_cadre_afficher_traductions' => 'Display the translation status for these languages:', |
|
| 872 | + 'titre_cadre_ajouter_auteur' => 'ADD AN AUTHOR:', |
|
| 873 | + 'titre_cadre_interieur_rubrique' => 'In section', |
|
| 874 | + 'titre_cadre_numero_auteur' => 'AUTHOR NUMBER', |
|
| 875 | + 'titre_cadre_numero_objet' => '@objet@ NUMBER:', |
|
| 876 | + 'titre_cadre_signature_obligatoire' => '<b>Signature</b> [Required]<br />', |
|
| 877 | + 'titre_config_contenu_notifications' => 'Notifications', |
|
| 878 | + 'titre_config_contenu_prive' => 'In the admin area', |
|
| 879 | + 'titre_config_contenu_public' => 'On the public site', |
|
| 880 | + 'titre_config_fonctions' => 'Site configuration', |
|
| 881 | + 'titre_config_langage' => 'Configure the language', |
|
| 882 | + 'titre_configuration' => 'Site configuration', |
|
| 883 | + 'titre_configurer_preferences' => 'Configure your preferences', |
|
| 884 | + 'titre_configurer_preferences_menus' => 'Settings of your menus preferences', |
|
| 885 | + 'titre_conflit_edition' => 'Conflict while editing', |
|
| 886 | + 'titre_connexion_ldap' => 'Options: <b>Your LDAP connection</b>', |
|
| 887 | + 'titre_groupe_mots' => 'KEYWORD GROUP:', |
|
| 888 | + 'titre_identite_site' => 'Site identity', |
|
| 889 | + 'titre_langue_article' => 'Article language', |
|
| 890 | + 'titre_langue_rubrique' => 'Section language', |
|
| 891 | + 'titre_langue_trad_article' => 'ARTICLE LANGUAGE AND TRANSLATIONS', |
|
| 892 | + 'titre_les_articles' => 'ARTICLES', |
|
| 893 | + 'titre_messagerie_agenda' => 'Messaging system and calendar', |
|
| 894 | + 'titre_naviguer_dans_le_site' => 'Browse the site...', |
|
| 895 | + 'titre_nouvelle_rubrique' => 'New section', |
|
| 896 | + 'titre_numero_rubrique' => 'SECTION NUMBER:', |
|
| 897 | + 'titre_page_articles_edit' => 'Modify: @titre@', |
|
| 898 | + 'titre_page_articles_page' => 'Articles', |
|
| 899 | + 'titre_page_articles_tous' => 'The entire site', |
|
| 900 | + 'titre_page_calendrier' => 'Calendar @nom_mois@ @annee@', |
|
| 901 | + 'titre_page_config_contenu' => 'Site configuration', |
|
| 902 | + 'titre_page_delete_all' => 'total and irreversible deletion', |
|
| 903 | + 'titre_page_recherche' => 'Search results @recherche@', |
|
| 904 | + 'titre_page_statistiques_referers' => 'Statistics (incoming links)', |
|
| 905 | + 'titre_page_upgrade' => 'SPIP upgrade', |
|
| 906 | + 'titre_preference_menus_favoris' => 'Favourites menu', |
|
| 907 | + 'titre_publication_articles_post_dates' => 'Publication of post dated articles', |
|
| 908 | + 'titre_reparation' => 'Repair', |
|
| 909 | + 'titre_suivi_petition' => 'Petitions follow-up', |
|
| 910 | + 'tls_ldap' => 'Transport Layer Security :', |
|
| 911 | + 'trad_article_traduction' => 'All the versions of this article:', |
|
| 912 | + 'trad_delier' => 'Stop linking to these translations', |
|
| 913 | + 'trad_lier' => 'This article is a translation of article number:', |
|
| 914 | + 'trad_new' => 'Write a new translation', |
|
| 915 | 915 | |
| 916 | - // U |
|
| 917 | - 'utf8_convert_erreur_orig' => 'Error: the character set @charset@ is not supported.', |
|
| 916 | + // U |
|
| 917 | + 'utf8_convert_erreur_orig' => 'Error: the character set @charset@ is not supported.', |
|
| 918 | 918 | |
| 919 | - // V |
|
| 920 | - 'version' => 'Version:' |
|
| 919 | + // V |
|
| 920 | + 'version' => 'Version:' |
|
| 921 | 921 | ); |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (!defined('_TEST_FILE_EXISTS')) { |
| 24 | - /** Permettre d'éviter des tests file_exists sur certains hébergeurs */ |
|
| 25 | - define('_TEST_FILE_EXISTS', preg_match(',(online|free)[.]fr$,', isset($_ENV["HTTP_HOST"]) ? $_ENV["HTTP_HOST"] : "")); |
|
| 24 | + /** Permettre d'éviter des tests file_exists sur certains hébergeurs */ |
|
| 25 | + define('_TEST_FILE_EXISTS', preg_match(',(online|free)[.]fr$,', isset($_ENV["HTTP_HOST"]) ? $_ENV["HTTP_HOST"] : "")); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | #define('_SPIP_LOCK_MODE',0); // ne pas utiliser de lock (deconseille) |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | #define('_SPIP_LOCK_MODE',2); // utiliser le nfslock de spip |
| 31 | 31 | |
| 32 | 32 | if (_SPIP_LOCK_MODE == 2) { |
| 33 | - include_spip('inc/nfslock'); |
|
| 33 | + include_spip('inc/nfslock'); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $GLOBALS['liste_verrous'] = array(); |
@@ -53,24 +53,24 @@ discard block |
||
| 53 | 53 | * Ressource sur le fichier ouvert, sinon false. |
| 54 | 54 | **/ |
| 55 | 55 | function spip_fopen_lock($fichier, $mode, $verrou) { |
| 56 | - if (_SPIP_LOCK_MODE == 1) { |
|
| 57 | - if ($fl = @fopen($fichier, $mode)) { |
|
| 58 | - // verrou |
|
| 59 | - @flock($fl, $verrou); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - return $fl; |
|
| 63 | - } elseif (_SPIP_LOCK_MODE == 2) { |
|
| 64 | - if (($verrou = spip_nfslock($fichier)) && ($fl = @fopen($fichier, $mode))) { |
|
| 65 | - $GLOBALS['liste_verrous'][$fl] = array($fichier, $verrou); |
|
| 66 | - |
|
| 67 | - return $fl; |
|
| 68 | - } else { |
|
| 69 | - return false; |
|
| 70 | - } |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - return @fopen($fichier, $mode); |
|
| 56 | + if (_SPIP_LOCK_MODE == 1) { |
|
| 57 | + if ($fl = @fopen($fichier, $mode)) { |
|
| 58 | + // verrou |
|
| 59 | + @flock($fl, $verrou); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + return $fl; |
|
| 63 | + } elseif (_SPIP_LOCK_MODE == 2) { |
|
| 64 | + if (($verrou = spip_nfslock($fichier)) && ($fl = @fopen($fichier, $mode))) { |
|
| 65 | + $GLOBALS['liste_verrous'][$fl] = array($fichier, $verrou); |
|
| 66 | + |
|
| 67 | + return $fl; |
|
| 68 | + } else { |
|
| 69 | + return false; |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + return @fopen($fichier, $mode); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | * true si succès, false sinon. |
| 86 | 86 | **/ |
| 87 | 87 | function spip_fclose_unlock($handle) { |
| 88 | - if (_SPIP_LOCK_MODE == 1) { |
|
| 89 | - @flock($handle, LOCK_UN); |
|
| 90 | - } elseif (_SPIP_LOCK_MODE == 2) { |
|
| 91 | - spip_nfsunlock(reset($GLOBALS['liste_verrous'][$handle]), end($GLOBALS['liste_verrous'][$handle])); |
|
| 92 | - unset($GLOBALS['liste_verrous'][$handle]); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - return @fclose($handle); |
|
| 88 | + if (_SPIP_LOCK_MODE == 1) { |
|
| 89 | + @flock($handle, LOCK_UN); |
|
| 90 | + } elseif (_SPIP_LOCK_MODE == 2) { |
|
| 91 | + spip_nfsunlock(reset($GLOBALS['liste_verrous'][$handle]), end($GLOBALS['liste_verrous'][$handle])); |
|
| 92 | + unset($GLOBALS['liste_verrous'][$handle]); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + return @fclose($handle); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -106,23 +106,23 @@ discard block |
||
| 106 | 106 | * Contenu du fichier |
| 107 | 107 | **/ |
| 108 | 108 | function spip_file_get_contents($fichier) { |
| 109 | - if (substr($fichier, -3) != '.gz') { |
|
| 110 | - if (function_exists('file_get_contents')) { |
|
| 111 | - // quand on est sous windows on ne sait pas si file_get_contents marche |
|
| 112 | - // on essaye : si ca retourne du contenu alors c'est bon |
|
| 113 | - // sinon on fait un file() pour avoir le coeur net |
|
| 114 | - $contenu = @file_get_contents($fichier); |
|
| 115 | - if (!$contenu and _OS_SERVEUR == 'windows') { |
|
| 116 | - $contenu = @file($fichier); |
|
| 117 | - } |
|
| 118 | - } else { |
|
| 119 | - $contenu = @file($fichier); |
|
| 120 | - } |
|
| 121 | - } else { |
|
| 122 | - $contenu = @gzfile($fichier); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - return is_array($contenu) ? join('', $contenu) : (string)$contenu; |
|
| 109 | + if (substr($fichier, -3) != '.gz') { |
|
| 110 | + if (function_exists('file_get_contents')) { |
|
| 111 | + // quand on est sous windows on ne sait pas si file_get_contents marche |
|
| 112 | + // on essaye : si ca retourne du contenu alors c'est bon |
|
| 113 | + // sinon on fait un file() pour avoir le coeur net |
|
| 114 | + $contenu = @file_get_contents($fichier); |
|
| 115 | + if (!$contenu and _OS_SERVEUR == 'windows') { |
|
| 116 | + $contenu = @file($fichier); |
|
| 117 | + } |
|
| 118 | + } else { |
|
| 119 | + $contenu = @file($fichier); |
|
| 120 | + } |
|
| 121 | + } else { |
|
| 122 | + $contenu = @gzfile($fichier); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + return is_array($contenu) ? join('', $contenu) : (string)$contenu; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -147,48 +147,48 @@ discard block |
||
| 147 | 147 | * true si l'opération a réussie, false sinon. |
| 148 | 148 | **/ |
| 149 | 149 | function lire_fichier($fichier, &$contenu, $options = array()) { |
| 150 | - $contenu = ''; |
|
| 151 | - // inutile car si le fichier n'existe pas, le lock va renvoyer false juste apres |
|
| 152 | - // economisons donc les acces disque, sauf chez free qui rale pour un rien |
|
| 153 | - if (_TEST_FILE_EXISTS and !@file_exists($fichier)) { |
|
| 154 | - return false; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - #spip_timer('lire_fichier'); |
|
| 158 | - |
|
| 159 | - // pas de @ sur spip_fopen_lock qui est silencieux de toute facon |
|
| 160 | - if ($fl = spip_fopen_lock($fichier, 'r', LOCK_SH)) { |
|
| 161 | - // lire le fichier avant tout |
|
| 162 | - $contenu = spip_file_get_contents($fichier); |
|
| 163 | - |
|
| 164 | - // le fichier a-t-il ete supprime par le locker ? |
|
| 165 | - // on ne verifie que si la tentative de lecture a echoue |
|
| 166 | - // pour discriminer un contenu vide d'un fichier absent |
|
| 167 | - // et eviter un acces disque |
|
| 168 | - if (!$contenu and !@file_exists($fichier)) { |
|
| 169 | - spip_fclose_unlock($fl); |
|
| 170 | - |
|
| 171 | - return false; |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - // liberer le verrou |
|
| 175 | - spip_fclose_unlock($fl); |
|
| 176 | - |
|
| 177 | - // Verifications |
|
| 178 | - $ok = true; |
|
| 179 | - if (isset($options['phpcheck']) and $options['phpcheck'] == 'oui') { |
|
| 180 | - $ok &= (preg_match(",[?]>\n?$,", $contenu)); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - #spip_log("$fread $fichier ".spip_timer('lire_fichier')); |
|
| 184 | - if (!$ok) { |
|
| 185 | - spip_log("echec lecture $fichier"); |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - return $ok; |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - return false; |
|
| 150 | + $contenu = ''; |
|
| 151 | + // inutile car si le fichier n'existe pas, le lock va renvoyer false juste apres |
|
| 152 | + // economisons donc les acces disque, sauf chez free qui rale pour un rien |
|
| 153 | + if (_TEST_FILE_EXISTS and !@file_exists($fichier)) { |
|
| 154 | + return false; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + #spip_timer('lire_fichier'); |
|
| 158 | + |
|
| 159 | + // pas de @ sur spip_fopen_lock qui est silencieux de toute facon |
|
| 160 | + if ($fl = spip_fopen_lock($fichier, 'r', LOCK_SH)) { |
|
| 161 | + // lire le fichier avant tout |
|
| 162 | + $contenu = spip_file_get_contents($fichier); |
|
| 163 | + |
|
| 164 | + // le fichier a-t-il ete supprime par le locker ? |
|
| 165 | + // on ne verifie que si la tentative de lecture a echoue |
|
| 166 | + // pour discriminer un contenu vide d'un fichier absent |
|
| 167 | + // et eviter un acces disque |
|
| 168 | + if (!$contenu and !@file_exists($fichier)) { |
|
| 169 | + spip_fclose_unlock($fl); |
|
| 170 | + |
|
| 171 | + return false; |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + // liberer le verrou |
|
| 175 | + spip_fclose_unlock($fl); |
|
| 176 | + |
|
| 177 | + // Verifications |
|
| 178 | + $ok = true; |
|
| 179 | + if (isset($options['phpcheck']) and $options['phpcheck'] == 'oui') { |
|
| 180 | + $ok &= (preg_match(",[?]>\n?$,", $contenu)); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + #spip_log("$fread $fichier ".spip_timer('lire_fichier')); |
|
| 184 | + if (!$ok) { |
|
| 185 | + spip_log("echec lecture $fichier"); |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + return $ok; |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + return false; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -216,85 +216,85 @@ discard block |
||
| 216 | 216 | **/ |
| 217 | 217 | function ecrire_fichier($fichier, $contenu, $ignorer_echec = false, $truncate = true) { |
| 218 | 218 | |
| 219 | - #spip_timer('ecrire_fichier'); |
|
| 220 | - |
|
| 221 | - // verrouiller le fichier destination |
|
| 222 | - if ($fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) { |
|
| 223 | - // ecrire les donnees, compressees le cas echeant |
|
| 224 | - // (on ouvre un nouveau pointeur sur le fichier, ce qui a l'avantage |
|
| 225 | - // de le recreer si le locker qui nous precede l'avait supprime...) |
|
| 226 | - if (substr($fichier, -3) == '.gz') { |
|
| 227 | - $contenu = gzencode($contenu); |
|
| 228 | - } |
|
| 229 | - // si c'est une ecriture avec troncation , on fait plutot une ecriture complete a cote suivie unlink+rename |
|
| 230 | - // pour etre sur d'avoir une operation atomique |
|
| 231 | - // y compris en NFS : http://www.ietf.org/rfc/rfc1094.txt |
|
| 232 | - // sauf sous wintruc ou ca ne marche pas |
|
| 233 | - $ok = false; |
|
| 234 | - if ($truncate and _OS_SERVEUR != 'windows') { |
|
| 235 | - if (!function_exists('creer_uniqid')) { |
|
| 236 | - include_spip('inc/acces'); |
|
| 237 | - } |
|
| 238 | - $id = creer_uniqid(); |
|
| 239 | - // on ouvre un pointeur sur un fichier temporaire en ecriture +raz |
|
| 240 | - if ($fp2 = spip_fopen_lock("$fichier.$id", 'w', LOCK_EX)) { |
|
| 241 | - $s = @fputs($fp2, $contenu, $a = strlen($contenu)); |
|
| 242 | - $ok = ($s == $a); |
|
| 243 | - spip_fclose_unlock($fp2); |
|
| 244 | - spip_fclose_unlock($fp); |
|
| 245 | - // unlink direct et pas spip_unlink car on avait deja le verrou |
|
| 246 | - // a priori pas besoin car rename ecrase la cible |
|
| 247 | - // @unlink($fichier); |
|
| 248 | - // le rename aussitot, atomique quand on est pas sous windows |
|
| 249 | - // au pire on arrive en second en cas de concourance, et le rename echoue |
|
| 250 | - // --> on a la version de l'autre process qui doit etre identique |
|
| 251 | - @rename("$fichier.$id", $fichier); |
|
| 252 | - // precaution en cas d'echec du rename |
|
| 253 | - if (!_TEST_FILE_EXISTS or @file_exists("$fichier.$id")) { |
|
| 254 | - @unlink("$fichier.$id"); |
|
| 255 | - } |
|
| 256 | - if ($ok) { |
|
| 257 | - $ok = file_exists($fichier); |
|
| 258 | - } |
|
| 259 | - } else // echec mais penser a fermer .. |
|
| 260 | - { |
|
| 261 | - spip_fclose_unlock($fp); |
|
| 262 | - } |
|
| 263 | - } |
|
| 264 | - // sinon ou si methode precedente a echoueee |
|
| 265 | - // on se rabat sur la methode ancienne |
|
| 266 | - if (!$ok) { |
|
| 267 | - // ici on est en ajout ou sous windows, cas desespere |
|
| 268 | - if ($truncate) { |
|
| 269 | - @ftruncate($fp, 0); |
|
| 270 | - } |
|
| 271 | - $s = @fputs($fp, $contenu, $a = strlen($contenu)); |
|
| 272 | - |
|
| 273 | - $ok = ($s == $a); |
|
| 274 | - spip_fclose_unlock($fp); |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - // liberer le verrou et fermer le fichier |
|
| 278 | - @chmod($fichier, _SPIP_CHMOD & 0666); |
|
| 279 | - if ($ok) { |
|
| 280 | - if (strpos($fichier, ".php") !== false) { |
|
| 281 | - spip_clear_opcode_cache(realpath($fichier)); |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - return $ok; |
|
| 285 | - } |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - if (!$ignorer_echec) { |
|
| 289 | - include_spip('inc/autoriser'); |
|
| 290 | - if (autoriser('chargerftp')) { |
|
| 291 | - raler_fichier($fichier); |
|
| 292 | - } |
|
| 293 | - spip_unlink($fichier); |
|
| 294 | - } |
|
| 295 | - spip_log("Ecriture fichier $fichier impossible", _LOG_INFO_IMPORTANTE); |
|
| 296 | - |
|
| 297 | - return false; |
|
| 219 | + #spip_timer('ecrire_fichier'); |
|
| 220 | + |
|
| 221 | + // verrouiller le fichier destination |
|
| 222 | + if ($fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) { |
|
| 223 | + // ecrire les donnees, compressees le cas echeant |
|
| 224 | + // (on ouvre un nouveau pointeur sur le fichier, ce qui a l'avantage |
|
| 225 | + // de le recreer si le locker qui nous precede l'avait supprime...) |
|
| 226 | + if (substr($fichier, -3) == '.gz') { |
|
| 227 | + $contenu = gzencode($contenu); |
|
| 228 | + } |
|
| 229 | + // si c'est une ecriture avec troncation , on fait plutot une ecriture complete a cote suivie unlink+rename |
|
| 230 | + // pour etre sur d'avoir une operation atomique |
|
| 231 | + // y compris en NFS : http://www.ietf.org/rfc/rfc1094.txt |
|
| 232 | + // sauf sous wintruc ou ca ne marche pas |
|
| 233 | + $ok = false; |
|
| 234 | + if ($truncate and _OS_SERVEUR != 'windows') { |
|
| 235 | + if (!function_exists('creer_uniqid')) { |
|
| 236 | + include_spip('inc/acces'); |
|
| 237 | + } |
|
| 238 | + $id = creer_uniqid(); |
|
| 239 | + // on ouvre un pointeur sur un fichier temporaire en ecriture +raz |
|
| 240 | + if ($fp2 = spip_fopen_lock("$fichier.$id", 'w', LOCK_EX)) { |
|
| 241 | + $s = @fputs($fp2, $contenu, $a = strlen($contenu)); |
|
| 242 | + $ok = ($s == $a); |
|
| 243 | + spip_fclose_unlock($fp2); |
|
| 244 | + spip_fclose_unlock($fp); |
|
| 245 | + // unlink direct et pas spip_unlink car on avait deja le verrou |
|
| 246 | + // a priori pas besoin car rename ecrase la cible |
|
| 247 | + // @unlink($fichier); |
|
| 248 | + // le rename aussitot, atomique quand on est pas sous windows |
|
| 249 | + // au pire on arrive en second en cas de concourance, et le rename echoue |
|
| 250 | + // --> on a la version de l'autre process qui doit etre identique |
|
| 251 | + @rename("$fichier.$id", $fichier); |
|
| 252 | + // precaution en cas d'echec du rename |
|
| 253 | + if (!_TEST_FILE_EXISTS or @file_exists("$fichier.$id")) { |
|
| 254 | + @unlink("$fichier.$id"); |
|
| 255 | + } |
|
| 256 | + if ($ok) { |
|
| 257 | + $ok = file_exists($fichier); |
|
| 258 | + } |
|
| 259 | + } else // echec mais penser a fermer .. |
|
| 260 | + { |
|
| 261 | + spip_fclose_unlock($fp); |
|
| 262 | + } |
|
| 263 | + } |
|
| 264 | + // sinon ou si methode precedente a echoueee |
|
| 265 | + // on se rabat sur la methode ancienne |
|
| 266 | + if (!$ok) { |
|
| 267 | + // ici on est en ajout ou sous windows, cas desespere |
|
| 268 | + if ($truncate) { |
|
| 269 | + @ftruncate($fp, 0); |
|
| 270 | + } |
|
| 271 | + $s = @fputs($fp, $contenu, $a = strlen($contenu)); |
|
| 272 | + |
|
| 273 | + $ok = ($s == $a); |
|
| 274 | + spip_fclose_unlock($fp); |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + // liberer le verrou et fermer le fichier |
|
| 278 | + @chmod($fichier, _SPIP_CHMOD & 0666); |
|
| 279 | + if ($ok) { |
|
| 280 | + if (strpos($fichier, ".php") !== false) { |
|
| 281 | + spip_clear_opcode_cache(realpath($fichier)); |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + return $ok; |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + if (!$ignorer_echec) { |
|
| 289 | + include_spip('inc/autoriser'); |
|
| 290 | + if (autoriser('chargerftp')) { |
|
| 291 | + raler_fichier($fichier); |
|
| 292 | + } |
|
| 293 | + spip_unlink($fichier); |
|
| 294 | + } |
|
| 295 | + spip_log("Ecriture fichier $fichier impossible", _LOG_INFO_IMPORTANTE); |
|
| 296 | + |
|
| 297 | + return false; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /** |
@@ -314,12 +314,12 @@ discard block |
||
| 314 | 314 | * Écriture avec troncation ? |
| 315 | 315 | */ |
| 316 | 316 | function ecrire_fichier_securise($fichier, $contenu, $ecrire_quand_meme = false, $truncate = true) { |
| 317 | - if (substr($fichier, -4) !== '.php') { |
|
| 318 | - spip_log('Erreur de programmation: ' . $fichier . ' doit finir par .php'); |
|
| 319 | - } |
|
| 320 | - $contenu = "<" . "?php die ('Acces interdit'); ?" . ">\n" . $contenu; |
|
| 317 | + if (substr($fichier, -4) !== '.php') { |
|
| 318 | + spip_log('Erreur de programmation: ' . $fichier . ' doit finir par .php'); |
|
| 319 | + } |
|
| 320 | + $contenu = "<" . "?php die ('Acces interdit'); ?" . ">\n" . $contenu; |
|
| 321 | 321 | |
| 322 | - return ecrire_fichier($fichier, $contenu, $ecrire_quand_meme, $truncate); |
|
| 322 | + return ecrire_fichier($fichier, $contenu, $ecrire_quand_meme, $truncate); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | * true si l'opération a réussie, false sinon. |
| 340 | 340 | */ |
| 341 | 341 | function lire_fichier_securise($fichier, &$contenu, $options = array()) { |
| 342 | - if ($res = lire_fichier($fichier, $contenu, $options)) { |
|
| 343 | - $contenu = substr($contenu, strlen("<" . "?php die ('Acces interdit'); ?" . ">\n")); |
|
| 344 | - } |
|
| 342 | + if ($res = lire_fichier($fichier, $contenu, $options)) { |
|
| 343 | + $contenu = substr($contenu, strlen("<" . "?php die ('Acces interdit'); ?" . ">\n")); |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | - return $res; |
|
| 346 | + return $res; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
@@ -358,20 +358,20 @@ discard block |
||
| 358 | 358 | * Chemin du fichier |
| 359 | 359 | **/ |
| 360 | 360 | function raler_fichier($fichier) { |
| 361 | - include_spip('inc/minipres'); |
|
| 362 | - $dir = dirname($fichier); |
|
| 363 | - http_status(401); |
|
| 364 | - echo minipres(_T('texte_inc_meta_2'), "<h4 style='color: red'>" |
|
| 365 | - . _T('texte_inc_meta_1', array('fichier' => $fichier)) |
|
| 366 | - . " <a href='" |
|
| 367 | - . generer_url_ecrire('install', "etape=chmod&test_dir=$dir") |
|
| 368 | - . "'>" |
|
| 369 | - . _T('texte_inc_meta_2') |
|
| 370 | - . "</a> " |
|
| 371 | - . _T('texte_inc_meta_3', |
|
| 372 | - array('repertoire' => joli_repertoire($dir))) |
|
| 373 | - . "</h4>\n"); |
|
| 374 | - exit; |
|
| 361 | + include_spip('inc/minipres'); |
|
| 362 | + $dir = dirname($fichier); |
|
| 363 | + http_status(401); |
|
| 364 | + echo minipres(_T('texte_inc_meta_2'), "<h4 style='color: red'>" |
|
| 365 | + . _T('texte_inc_meta_1', array('fichier' => $fichier)) |
|
| 366 | + . " <a href='" |
|
| 367 | + . generer_url_ecrire('install', "etape=chmod&test_dir=$dir") |
|
| 368 | + . "'>" |
|
| 369 | + . _T('texte_inc_meta_2') |
|
| 370 | + . "</a> " |
|
| 371 | + . _T('texte_inc_meta_3', |
|
| 372 | + array('repertoire' => joli_repertoire($dir))) |
|
| 373 | + . "</h4>\n"); |
|
| 374 | + exit; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | |
@@ -386,14 +386,14 @@ discard block |
||
| 386 | 386 | * - true si récent, false sinon |
| 387 | 387 | */ |
| 388 | 388 | function jeune_fichier($fichier, $n) { |
| 389 | - if (!file_exists($fichier)) { |
|
| 390 | - return false; |
|
| 391 | - } |
|
| 392 | - if (!$c = @filemtime($fichier)) { |
|
| 393 | - return false; |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - return (time() - $n <= $c); |
|
| 389 | + if (!file_exists($fichier)) { |
|
| 390 | + return false; |
|
| 391 | + } |
|
| 392 | + if (!$c = @filemtime($fichier)) { |
|
| 393 | + return false; |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + return (time() - $n <= $c); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -409,22 +409,22 @@ discard block |
||
| 409 | 409 | * - void sinon |
| 410 | 410 | */ |
| 411 | 411 | function supprimer_fichier($fichier, $lock = true) { |
| 412 | - if (!@file_exists($fichier)) { |
|
| 413 | - return true; |
|
| 414 | - } |
|
| 415 | - |
|
| 416 | - if ($lock) { |
|
| 417 | - // verrouiller le fichier destination |
|
| 418 | - if (!$fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) { |
|
| 419 | - return false; |
|
| 420 | - } |
|
| 421 | - |
|
| 422 | - // liberer le verrou |
|
| 423 | - spip_fclose_unlock($fp); |
|
| 424 | - } |
|
| 425 | - |
|
| 426 | - // supprimer |
|
| 427 | - return @unlink($fichier); |
|
| 412 | + if (!@file_exists($fichier)) { |
|
| 413 | + return true; |
|
| 414 | + } |
|
| 415 | + |
|
| 416 | + if ($lock) { |
|
| 417 | + // verrouiller le fichier destination |
|
| 418 | + if (!$fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) { |
|
| 419 | + return false; |
|
| 420 | + } |
|
| 421 | + |
|
| 422 | + // liberer le verrou |
|
| 423 | + spip_fclose_unlock($fp); |
|
| 424 | + } |
|
| 425 | + |
|
| 426 | + // supprimer |
|
| 427 | + return @unlink($fichier); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /** |
@@ -434,12 +434,12 @@ discard block |
||
| 434 | 434 | * Chemin du fichier |
| 435 | 435 | */ |
| 436 | 436 | function spip_unlink($f) { |
| 437 | - if (!is_dir($f)) { |
|
| 438 | - supprimer_fichier($f, false); |
|
| 439 | - } else { |
|
| 440 | - @unlink("$f/.ok"); |
|
| 441 | - @rmdir($f); |
|
| 442 | - } |
|
| 437 | + if (!is_dir($f)) { |
|
| 438 | + supprimer_fichier($f, false); |
|
| 439 | + } else { |
|
| 440 | + @unlink("$f/.ok"); |
|
| 441 | + @rmdir($f); |
|
| 442 | + } |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | /** |
@@ -453,23 +453,23 @@ discard block |
||
| 453 | 453 | * The absolute path of the PHP file to invalidate. |
| 454 | 454 | */ |
| 455 | 455 | function spip_clear_opcode_cache($filepath) { |
| 456 | - clearstatcache(true, $filepath); |
|
| 457 | - |
|
| 458 | - // Zend OPcache |
|
| 459 | - if (function_exists('opcache_invalidate')) { |
|
| 460 | - $invalidate = @opcache_invalidate($filepath, true); |
|
| 461 | - // si l'invalidation a echoue lever un flag |
|
| 462 | - if (!$invalidate and !defined('_spip_attend_invalidation_opcode_cache')) { |
|
| 463 | - define('_spip_attend_invalidation_opcode_cache',true); |
|
| 464 | - } |
|
| 465 | - } |
|
| 466 | - // APC. |
|
| 467 | - if (function_exists('apc_delete_file')) { |
|
| 468 | - // apc_delete_file() throws a PHP warning in case the specified file was |
|
| 469 | - // not compiled yet. |
|
| 470 | - // @see http://php.net/apc-delete-file |
|
| 471 | - @apc_delete_file($filepath); |
|
| 472 | - } |
|
| 456 | + clearstatcache(true, $filepath); |
|
| 457 | + |
|
| 458 | + // Zend OPcache |
|
| 459 | + if (function_exists('opcache_invalidate')) { |
|
| 460 | + $invalidate = @opcache_invalidate($filepath, true); |
|
| 461 | + // si l'invalidation a echoue lever un flag |
|
| 462 | + if (!$invalidate and !defined('_spip_attend_invalidation_opcode_cache')) { |
|
| 463 | + define('_spip_attend_invalidation_opcode_cache',true); |
|
| 464 | + } |
|
| 465 | + } |
|
| 466 | + // APC. |
|
| 467 | + if (function_exists('apc_delete_file')) { |
|
| 468 | + // apc_delete_file() throws a PHP warning in case the specified file was |
|
| 469 | + // not compiled yet. |
|
| 470 | + // @see http://php.net/apc-delete-file |
|
| 471 | + @apc_delete_file($filepath); |
|
| 472 | + } |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | /** |
@@ -492,24 +492,24 @@ discard block |
||
| 492 | 492 | * |
| 493 | 493 | */ |
| 494 | 494 | function spip_attend_invalidation_opcode_cache($timestamp = null) { |
| 495 | - if (function_exists('opcache_get_configuration') |
|
| 496 | - and @ini_get('opcache.enable') |
|
| 497 | - and @ini_get('opcache.validate_timestamps') |
|
| 498 | - and $duree = @ini_get('opcache.revalidate_freq') |
|
| 499 | - and defined('_spip_attend_invalidation_opcode_cache') // des invalidations ont echouees |
|
| 500 | - ) { |
|
| 501 | - $wait = $duree + 1; |
|
| 502 | - if ($timestamp) { |
|
| 503 | - $wait -= (time() - $timestamp); |
|
| 504 | - if ($wait<0) { |
|
| 505 | - $wait = 0; |
|
| 506 | - } |
|
| 507 | - } |
|
| 508 | - spip_log('Probleme de configuration opcache.revalidate_freq '. $duree .'s : on attend '.$wait.'s', _LOG_INFO_IMPORTANTE); |
|
| 509 | - if ($wait) { |
|
| 510 | - sleep($duree + 1); |
|
| 511 | - } |
|
| 512 | - } |
|
| 495 | + if (function_exists('opcache_get_configuration') |
|
| 496 | + and @ini_get('opcache.enable') |
|
| 497 | + and @ini_get('opcache.validate_timestamps') |
|
| 498 | + and $duree = @ini_get('opcache.revalidate_freq') |
|
| 499 | + and defined('_spip_attend_invalidation_opcode_cache') // des invalidations ont echouees |
|
| 500 | + ) { |
|
| 501 | + $wait = $duree + 1; |
|
| 502 | + if ($timestamp) { |
|
| 503 | + $wait -= (time() - $timestamp); |
|
| 504 | + if ($wait<0) { |
|
| 505 | + $wait = 0; |
|
| 506 | + } |
|
| 507 | + } |
|
| 508 | + spip_log('Probleme de configuration opcache.revalidate_freq '. $duree .'s : on attend '.$wait.'s', _LOG_INFO_IMPORTANTE); |
|
| 509 | + if ($wait) { |
|
| 510 | + sleep($duree + 1); |
|
| 511 | + } |
|
| 512 | + } |
|
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | |
@@ -522,26 +522,26 @@ discard block |
||
| 522 | 522 | * @return bool Suppression reussie. |
| 523 | 523 | */ |
| 524 | 524 | function supprimer_repertoire($dir) { |
| 525 | - if (!file_exists($dir)) { |
|
| 526 | - return true; |
|
| 527 | - } |
|
| 528 | - if (!is_dir($dir) || is_link($dir)) { |
|
| 529 | - return @unlink($dir); |
|
| 530 | - } |
|
| 531 | - |
|
| 532 | - foreach (scandir($dir) as $item) { |
|
| 533 | - if ($item == '.' || $item == '..') { |
|
| 534 | - continue; |
|
| 535 | - } |
|
| 536 | - if (!supprimer_repertoire($dir . "/" . $item)) { |
|
| 537 | - @chmod($dir . "/" . $item, 0777); |
|
| 538 | - if (!supprimer_repertoire($dir . "/" . $item)) { |
|
| 539 | - return false; |
|
| 540 | - } |
|
| 541 | - }; |
|
| 542 | - } |
|
| 543 | - |
|
| 544 | - return @rmdir($dir); |
|
| 525 | + if (!file_exists($dir)) { |
|
| 526 | + return true; |
|
| 527 | + } |
|
| 528 | + if (!is_dir($dir) || is_link($dir)) { |
|
| 529 | + return @unlink($dir); |
|
| 530 | + } |
|
| 531 | + |
|
| 532 | + foreach (scandir($dir) as $item) { |
|
| 533 | + if ($item == '.' || $item == '..') { |
|
| 534 | + continue; |
|
| 535 | + } |
|
| 536 | + if (!supprimer_repertoire($dir . "/" . $item)) { |
|
| 537 | + @chmod($dir . "/" . $item, 0777); |
|
| 538 | + if (!supprimer_repertoire($dir . "/" . $item)) { |
|
| 539 | + return false; |
|
| 540 | + } |
|
| 541 | + }; |
|
| 542 | + } |
|
| 543 | + |
|
| 544 | + return @rmdir($dir); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | |
@@ -570,57 +570,57 @@ discard block |
||
| 570 | 570 | * Chemin du répertoire créé. |
| 571 | 571 | **/ |
| 572 | 572 | function sous_repertoire($base, $subdir = '', $nobase = false, $tantpis = false) { |
| 573 | - static $dirs = array(); |
|
| 574 | - |
|
| 575 | - $base = str_replace("//", "/", $base); |
|
| 576 | - |
|
| 577 | - # suppr le dernier caractere si c'est un / |
|
| 578 | - $base = rtrim($base, '/'); |
|
| 579 | - |
|
| 580 | - if (!strlen($subdir)) { |
|
| 581 | - $n = strrpos($base, "/"); |
|
| 582 | - if ($n === false) { |
|
| 583 | - return $nobase ? '' : ($base . '/'); |
|
| 584 | - } |
|
| 585 | - $subdir = substr($base, $n + 1); |
|
| 586 | - $base = substr($base, 0, $n + 1); |
|
| 587 | - } else { |
|
| 588 | - $base .= '/'; |
|
| 589 | - $subdir = str_replace("/", "", $subdir); |
|
| 590 | - } |
|
| 591 | - |
|
| 592 | - $baseaff = $nobase ? '' : $base; |
|
| 593 | - if (isset($dirs[$base . $subdir])) { |
|
| 594 | - return $baseaff . $dirs[$base . $subdir]; |
|
| 595 | - } |
|
| 596 | - |
|
| 597 | - $path = $base . $subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf' |
|
| 598 | - |
|
| 599 | - if (file_exists("$path/.ok")) { |
|
| 600 | - return $baseaff . ($dirs[$base . $subdir] = "$subdir/"); |
|
| 601 | - } |
|
| 602 | - |
|
| 603 | - @mkdir($path, _SPIP_CHMOD); |
|
| 604 | - @chmod($path, _SPIP_CHMOD); |
|
| 605 | - |
|
| 606 | - if (is_dir($path) && is_writable($path)) { |
|
| 607 | - @touch("$path/.ok"); |
|
| 608 | - spip_log("creation $base$subdir/"); |
|
| 609 | - |
|
| 610 | - return $baseaff . ($dirs[$base . $subdir] = "$subdir/"); |
|
| 611 | - } |
|
| 612 | - |
|
| 613 | - // en cas d'echec c'est peut etre tout simplement que le disque est plein : |
|
| 614 | - // l'inode du fichier dir_test existe, mais impossible d'y mettre du contenu |
|
| 615 | - spip_log("echec creation $base${subdir}"); |
|
| 616 | - if ($tantpis) { |
|
| 617 | - return ''; |
|
| 618 | - } |
|
| 619 | - if (!_DIR_RESTREINT) { |
|
| 620 | - $base = preg_replace(',^' . _DIR_RACINE . ',', '', $base); |
|
| 621 | - } |
|
| 622 | - $base .= $subdir; |
|
| 623 | - raler_fichier($base . '/.ok'); |
|
| 573 | + static $dirs = array(); |
|
| 574 | + |
|
| 575 | + $base = str_replace("//", "/", $base); |
|
| 576 | + |
|
| 577 | + # suppr le dernier caractere si c'est un / |
|
| 578 | + $base = rtrim($base, '/'); |
|
| 579 | + |
|
| 580 | + if (!strlen($subdir)) { |
|
| 581 | + $n = strrpos($base, "/"); |
|
| 582 | + if ($n === false) { |
|
| 583 | + return $nobase ? '' : ($base . '/'); |
|
| 584 | + } |
|
| 585 | + $subdir = substr($base, $n + 1); |
|
| 586 | + $base = substr($base, 0, $n + 1); |
|
| 587 | + } else { |
|
| 588 | + $base .= '/'; |
|
| 589 | + $subdir = str_replace("/", "", $subdir); |
|
| 590 | + } |
|
| 591 | + |
|
| 592 | + $baseaff = $nobase ? '' : $base; |
|
| 593 | + if (isset($dirs[$base . $subdir])) { |
|
| 594 | + return $baseaff . $dirs[$base . $subdir]; |
|
| 595 | + } |
|
| 596 | + |
|
| 597 | + $path = $base . $subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf' |
|
| 598 | + |
|
| 599 | + if (file_exists("$path/.ok")) { |
|
| 600 | + return $baseaff . ($dirs[$base . $subdir] = "$subdir/"); |
|
| 601 | + } |
|
| 602 | + |
|
| 603 | + @mkdir($path, _SPIP_CHMOD); |
|
| 604 | + @chmod($path, _SPIP_CHMOD); |
|
| 605 | + |
|
| 606 | + if (is_dir($path) && is_writable($path)) { |
|
| 607 | + @touch("$path/.ok"); |
|
| 608 | + spip_log("creation $base$subdir/"); |
|
| 609 | + |
|
| 610 | + return $baseaff . ($dirs[$base . $subdir] = "$subdir/"); |
|
| 611 | + } |
|
| 612 | + |
|
| 613 | + // en cas d'echec c'est peut etre tout simplement que le disque est plein : |
|
| 614 | + // l'inode du fichier dir_test existe, mais impossible d'y mettre du contenu |
|
| 615 | + spip_log("echec creation $base${subdir}"); |
|
| 616 | + if ($tantpis) { |
|
| 617 | + return ''; |
|
| 618 | + } |
|
| 619 | + if (!_DIR_RESTREINT) { |
|
| 620 | + $base = preg_replace(',^' . _DIR_RACINE . ',', '', $base); |
|
| 621 | + } |
|
| 622 | + $base .= $subdir; |
|
| 623 | + raler_fichier($base . '/.ok'); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | |
@@ -653,51 +653,51 @@ discard block |
||
| 653 | 653 | * Chemins des fichiers trouvés. |
| 654 | 654 | **/ |
| 655 | 655 | function preg_files($dir, $pattern = -1 /* AUTO */, $maxfiles = 10000, $recurs = array()) { |
| 656 | - $nbfiles = 0; |
|
| 657 | - if ($pattern == -1) { |
|
| 658 | - $pattern = "^$dir"; |
|
| 659 | - } |
|
| 660 | - $fichiers = array(); |
|
| 661 | - // revenir au repertoire racine si on a recu dossier/truc |
|
| 662 | - // pour regarder dossier/truc/ ne pas oublier le / final |
|
| 663 | - $dir = preg_replace(',/[^/]*$,', '', $dir); |
|
| 664 | - if ($dir == '') { |
|
| 665 | - $dir = '.'; |
|
| 666 | - } |
|
| 667 | - |
|
| 668 | - if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) { |
|
| 669 | - while (($f = readdir($d)) !== false && ($nbfiles < $maxfiles)) { |
|
| 670 | - if ($f[0] != '.' # ignorer . .. .svn etc |
|
| 671 | - and $f != 'CVS' |
|
| 672 | - and $f != 'remove.txt' |
|
| 673 | - and is_readable($f = "$dir/$f") |
|
| 674 | - ) { |
|
| 675 | - if (is_file($f)) { |
|
| 676 | - if (preg_match(";$pattern;iS", $f)) { |
|
| 677 | - $fichiers[] = $f; |
|
| 678 | - $nbfiles++; |
|
| 679 | - } |
|
| 680 | - } else { |
|
| 681 | - if (is_dir($f) and is_array($recurs)) { |
|
| 682 | - $rp = @realpath($f); |
|
| 683 | - if (!is_string($rp) or !strlen($rp)) { |
|
| 684 | - $rp = $f; |
|
| 685 | - } # realpath n'est peut etre pas autorise |
|
| 686 | - if (!isset($recurs[$rp])) { |
|
| 687 | - $recurs[$rp] = true; |
|
| 688 | - $beginning = $fichiers; |
|
| 689 | - $end = preg_files("$f/", $pattern, |
|
| 690 | - $maxfiles - $nbfiles, $recurs); |
|
| 691 | - $fichiers = array_merge((array)$beginning, (array)$end); |
|
| 692 | - $nbfiles = count($fichiers); |
|
| 693 | - } |
|
| 694 | - } |
|
| 695 | - } |
|
| 696 | - } |
|
| 697 | - } |
|
| 698 | - closedir($d); |
|
| 699 | - } |
|
| 700 | - sort($fichiers); |
|
| 701 | - |
|
| 702 | - return $fichiers; |
|
| 656 | + $nbfiles = 0; |
|
| 657 | + if ($pattern == -1) { |
|
| 658 | + $pattern = "^$dir"; |
|
| 659 | + } |
|
| 660 | + $fichiers = array(); |
|
| 661 | + // revenir au repertoire racine si on a recu dossier/truc |
|
| 662 | + // pour regarder dossier/truc/ ne pas oublier le / final |
|
| 663 | + $dir = preg_replace(',/[^/]*$,', '', $dir); |
|
| 664 | + if ($dir == '') { |
|
| 665 | + $dir = '.'; |
|
| 666 | + } |
|
| 667 | + |
|
| 668 | + if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) { |
|
| 669 | + while (($f = readdir($d)) !== false && ($nbfiles < $maxfiles)) { |
|
| 670 | + if ($f[0] != '.' # ignorer . .. .svn etc |
|
| 671 | + and $f != 'CVS' |
|
| 672 | + and $f != 'remove.txt' |
|
| 673 | + and is_readable($f = "$dir/$f") |
|
| 674 | + ) { |
|
| 675 | + if (is_file($f)) { |
|
| 676 | + if (preg_match(";$pattern;iS", $f)) { |
|
| 677 | + $fichiers[] = $f; |
|
| 678 | + $nbfiles++; |
|
| 679 | + } |
|
| 680 | + } else { |
|
| 681 | + if (is_dir($f) and is_array($recurs)) { |
|
| 682 | + $rp = @realpath($f); |
|
| 683 | + if (!is_string($rp) or !strlen($rp)) { |
|
| 684 | + $rp = $f; |
|
| 685 | + } # realpath n'est peut etre pas autorise |
|
| 686 | + if (!isset($recurs[$rp])) { |
|
| 687 | + $recurs[$rp] = true; |
|
| 688 | + $beginning = $fichiers; |
|
| 689 | + $end = preg_files("$f/", $pattern, |
|
| 690 | + $maxfiles - $nbfiles, $recurs); |
|
| 691 | + $fichiers = array_merge((array)$beginning, (array)$end); |
|
| 692 | + $nbfiles = count($fichiers); |
|
| 693 | + } |
|
| 694 | + } |
|
| 695 | + } |
|
| 696 | + } |
|
| 697 | + } |
|
| 698 | + closedir($d); |
|
| 699 | + } |
|
| 700 | + sort($fichiers); |
|
| 701 | + |
|
| 702 | + return $fichiers; |
|
| 703 | 703 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $contenu = @gzfile($fichier); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - return is_array($contenu) ? join('', $contenu) : (string)$contenu; |
|
| 125 | + return is_array($contenu) ? join('', $contenu) : (string) $contenu; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | function ecrire_fichier_securise($fichier, $contenu, $ecrire_quand_meme = false, $truncate = true) { |
| 317 | 317 | if (substr($fichier, -4) !== '.php') { |
| 318 | - spip_log('Erreur de programmation: ' . $fichier . ' doit finir par .php'); |
|
| 318 | + spip_log('Erreur de programmation: '.$fichier.' doit finir par .php'); |
|
| 319 | 319 | } |
| 320 | - $contenu = "<" . "?php die ('Acces interdit'); ?" . ">\n" . $contenu; |
|
| 320 | + $contenu = "<"."?php die ('Acces interdit'); ?".">\n".$contenu; |
|
| 321 | 321 | |
| 322 | 322 | return ecrire_fichier($fichier, $contenu, $ecrire_quand_meme, $truncate); |
| 323 | 323 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | */ |
| 341 | 341 | function lire_fichier_securise($fichier, &$contenu, $options = array()) { |
| 342 | 342 | if ($res = lire_fichier($fichier, $contenu, $options)) { |
| 343 | - $contenu = substr($contenu, strlen("<" . "?php die ('Acces interdit'); ?" . ">\n")); |
|
| 343 | + $contenu = substr($contenu, strlen("<"."?php die ('Acces interdit'); ?".">\n")); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | return $res; |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | $invalidate = @opcache_invalidate($filepath, true); |
| 461 | 461 | // si l'invalidation a echoue lever un flag |
| 462 | 462 | if (!$invalidate and !defined('_spip_attend_invalidation_opcode_cache')) { |
| 463 | - define('_spip_attend_invalidation_opcode_cache',true); |
|
| 463 | + define('_spip_attend_invalidation_opcode_cache', true); |
|
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | 466 | // APC. |
@@ -501,11 +501,11 @@ discard block |
||
| 501 | 501 | $wait = $duree + 1; |
| 502 | 502 | if ($timestamp) { |
| 503 | 503 | $wait -= (time() - $timestamp); |
| 504 | - if ($wait<0) { |
|
| 504 | + if ($wait < 0) { |
|
| 505 | 505 | $wait = 0; |
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | - spip_log('Probleme de configuration opcache.revalidate_freq '. $duree .'s : on attend '.$wait.'s', _LOG_INFO_IMPORTANTE); |
|
| 508 | + spip_log('Probleme de configuration opcache.revalidate_freq '.$duree.'s : on attend '.$wait.'s', _LOG_INFO_IMPORTANTE); |
|
| 509 | 509 | if ($wait) { |
| 510 | 510 | sleep($duree + 1); |
| 511 | 511 | } |
@@ -533,9 +533,9 @@ discard block |
||
| 533 | 533 | if ($item == '.' || $item == '..') { |
| 534 | 534 | continue; |
| 535 | 535 | } |
| 536 | - if (!supprimer_repertoire($dir . "/" . $item)) { |
|
| 537 | - @chmod($dir . "/" . $item, 0777); |
|
| 538 | - if (!supprimer_repertoire($dir . "/" . $item)) { |
|
| 536 | + if (!supprimer_repertoire($dir."/".$item)) { |
|
| 537 | + @chmod($dir."/".$item, 0777); |
|
| 538 | + if (!supprimer_repertoire($dir."/".$item)) { |
|
| 539 | 539 | return false; |
| 540 | 540 | } |
| 541 | 541 | }; |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | if (!strlen($subdir)) { |
| 581 | 581 | $n = strrpos($base, "/"); |
| 582 | 582 | if ($n === false) { |
| 583 | - return $nobase ? '' : ($base . '/'); |
|
| 583 | + return $nobase ? '' : ($base.'/'); |
|
| 584 | 584 | } |
| 585 | 585 | $subdir = substr($base, $n + 1); |
| 586 | 586 | $base = substr($base, 0, $n + 1); |
@@ -590,14 +590,14 @@ discard block |
||
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | $baseaff = $nobase ? '' : $base; |
| 593 | - if (isset($dirs[$base . $subdir])) { |
|
| 594 | - return $baseaff . $dirs[$base . $subdir]; |
|
| 593 | + if (isset($dirs[$base.$subdir])) { |
|
| 594 | + return $baseaff.$dirs[$base.$subdir]; |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | - $path = $base . $subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf' |
|
| 597 | + $path = $base.$subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf' |
|
| 598 | 598 | |
| 599 | 599 | if (file_exists("$path/.ok")) { |
| 600 | - return $baseaff . ($dirs[$base . $subdir] = "$subdir/"); |
|
| 600 | + return $baseaff.($dirs[$base.$subdir] = "$subdir/"); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | @mkdir($path, _SPIP_CHMOD); |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | @touch("$path/.ok"); |
| 608 | 608 | spip_log("creation $base$subdir/"); |
| 609 | 609 | |
| 610 | - return $baseaff . ($dirs[$base . $subdir] = "$subdir/"); |
|
| 610 | + return $baseaff.($dirs[$base.$subdir] = "$subdir/"); |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | // en cas d'echec c'est peut etre tout simplement que le disque est plein : |
@@ -617,10 +617,10 @@ discard block |
||
| 617 | 617 | return ''; |
| 618 | 618 | } |
| 619 | 619 | if (!_DIR_RESTREINT) { |
| 620 | - $base = preg_replace(',^' . _DIR_RACINE . ',', '', $base); |
|
| 620 | + $base = preg_replace(',^'._DIR_RACINE.',', '', $base); |
|
| 621 | 621 | } |
| 622 | 622 | $base .= $subdir; |
| 623 | - raler_fichier($base . '/.ok'); |
|
| 623 | + raler_fichier($base.'/.ok'); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | $beginning = $fichiers; |
| 689 | 689 | $end = preg_files("$f/", $pattern, |
| 690 | 690 | $maxfiles - $nbfiles, $recurs); |
| 691 | - $fichiers = array_merge((array)$beginning, (array)$end); |
|
| 691 | + $fichiers = array_merge((array) $beginning, (array) $end); |
|
| 692 | 692 | $nbfiles = count($fichiers); |
| 693 | 693 | } |
| 694 | 694 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Autorisations |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('base/abstract_sql'); |
@@ -38,83 +38,83 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | if (!function_exists('autoriser')) { |
| 41 | - /** |
|
| 42 | - * Autoriser une action |
|
| 43 | - * |
|
| 44 | - * Teste si une personne (par défaut le visiteur en cours) peut effectuer |
|
| 45 | - * une certaine action. Cette fonction est le point d'entrée de toutes |
|
| 46 | - * les autorisations. |
|
| 47 | - * |
|
| 48 | - * La fonction se charge d'appeler des fonctions d'autorisations spécifiques |
|
| 49 | - * aux actions demandées si elles existent. Elle cherche donc les fonctions |
|
| 50 | - * dans cet ordre : |
|
| 51 | - * |
|
| 52 | - * - autoriser_{type}_{faire}, sinon avec _dist |
|
| 53 | - * - autoriser_{type}, sinon avec _dist |
|
| 54 | - * - autoriser_{faire}, sinon avec _dist |
|
| 55 | - * - autoriser_{defaut}, sinon avec _dist |
|
| 56 | - * |
|
| 57 | - * Seul le premier argument est obligatoire. |
|
| 58 | - * |
|
| 59 | - * @note |
|
| 60 | - * Le paramètre `$type` attend par défaut un type d'objet éditorial, et à ce titre, |
|
| 61 | - * la valeur transmise se verra appliquer la fonction 'objet_type' pour uniformiser |
|
| 62 | - * cette valeur. |
|
| 63 | - * |
|
| 64 | - * Si ce paramètre n'a rien n'a voir avec un objet éditorial, par exemple |
|
| 65 | - * 'statistiques', un souligné avant le terme est ajouté afin d'indiquer |
|
| 66 | - * explicitement à la fonction autoriser de ne pas transformer la chaîne en type |
|
| 67 | - * d'objet. Cela donne pour cet exemple : `autoriser('detruire', '_statistiques')` |
|
| 68 | - * |
|
| 69 | - * @note |
|
| 70 | - * Le paramètre `$type`, en plus de l'uniformisation en type d'objet, se voit retirer |
|
| 71 | - * tous les soulignés du terme. Ainsi le type d'objet `livre_art` deviendra `livreart` |
|
| 72 | - * et SPIP cherchera une fonction `autoriser_livreart_{faire}`. Ceci permet |
|
| 73 | - * d'éviter une possible confusion si une fonction `autoriser_livre_art` existait : |
|
| 74 | - * quel serait le type, quel serait l'action ? |
|
| 75 | - * |
|
| 76 | - * Pour résumer, si le type d'objet éditorial a un souligné, tel que 'livre_art', |
|
| 77 | - * la fonction d'autorisation correspondante ne l'aura pas. |
|
| 78 | - * Exemple : `function autoriser_livreart_modifier_dist(...){...}` |
|
| 79 | - * |
|
| 80 | - * @api |
|
| 81 | - * @see autoriser_dist() |
|
| 82 | - * |
|
| 83 | - * @param string $faire |
|
| 84 | - * une action ('modifier', 'publier'...) |
|
| 85 | - * @param string $type |
|
| 86 | - * type d'objet ou nom de table ('article') |
|
| 87 | - * @param int $id |
|
| 88 | - * id de l'objet sur lequel on veut agir |
|
| 89 | - * @param null|int|array $qui |
|
| 90 | - * - si null on prend alors visiteur_session |
|
| 91 | - * - un id_auteur (on regarde dans la base) |
|
| 92 | - * - un tableau auteur complet, y compris [restreint] |
|
| 93 | - * @param null|array $opt |
|
| 94 | - * options sous forme de tableau associatif |
|
| 95 | - * @return bool |
|
| 96 | - * true si la personne peut effectuer l'action |
|
| 97 | - */ |
|
| 98 | - function autoriser($faire, $type = '', $id = 0, $qui = null, $opt = null) { |
|
| 99 | - // Charger les fonctions d'autorisation supplementaires |
|
| 100 | - static $pipe; |
|
| 101 | - if (!isset($pipe)) { |
|
| 102 | - $pipe = 1; |
|
| 103 | - pipeline('autoriser'); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $args = func_get_args(); |
|
| 107 | - |
|
| 108 | - return call_user_func_array('autoriser_dist', $args); |
|
| 109 | - } |
|
| 41 | + /** |
|
| 42 | + * Autoriser une action |
|
| 43 | + * |
|
| 44 | + * Teste si une personne (par défaut le visiteur en cours) peut effectuer |
|
| 45 | + * une certaine action. Cette fonction est le point d'entrée de toutes |
|
| 46 | + * les autorisations. |
|
| 47 | + * |
|
| 48 | + * La fonction se charge d'appeler des fonctions d'autorisations spécifiques |
|
| 49 | + * aux actions demandées si elles existent. Elle cherche donc les fonctions |
|
| 50 | + * dans cet ordre : |
|
| 51 | + * |
|
| 52 | + * - autoriser_{type}_{faire}, sinon avec _dist |
|
| 53 | + * - autoriser_{type}, sinon avec _dist |
|
| 54 | + * - autoriser_{faire}, sinon avec _dist |
|
| 55 | + * - autoriser_{defaut}, sinon avec _dist |
|
| 56 | + * |
|
| 57 | + * Seul le premier argument est obligatoire. |
|
| 58 | + * |
|
| 59 | + * @note |
|
| 60 | + * Le paramètre `$type` attend par défaut un type d'objet éditorial, et à ce titre, |
|
| 61 | + * la valeur transmise se verra appliquer la fonction 'objet_type' pour uniformiser |
|
| 62 | + * cette valeur. |
|
| 63 | + * |
|
| 64 | + * Si ce paramètre n'a rien n'a voir avec un objet éditorial, par exemple |
|
| 65 | + * 'statistiques', un souligné avant le terme est ajouté afin d'indiquer |
|
| 66 | + * explicitement à la fonction autoriser de ne pas transformer la chaîne en type |
|
| 67 | + * d'objet. Cela donne pour cet exemple : `autoriser('detruire', '_statistiques')` |
|
| 68 | + * |
|
| 69 | + * @note |
|
| 70 | + * Le paramètre `$type`, en plus de l'uniformisation en type d'objet, se voit retirer |
|
| 71 | + * tous les soulignés du terme. Ainsi le type d'objet `livre_art` deviendra `livreart` |
|
| 72 | + * et SPIP cherchera une fonction `autoriser_livreart_{faire}`. Ceci permet |
|
| 73 | + * d'éviter une possible confusion si une fonction `autoriser_livre_art` existait : |
|
| 74 | + * quel serait le type, quel serait l'action ? |
|
| 75 | + * |
|
| 76 | + * Pour résumer, si le type d'objet éditorial a un souligné, tel que 'livre_art', |
|
| 77 | + * la fonction d'autorisation correspondante ne l'aura pas. |
|
| 78 | + * Exemple : `function autoriser_livreart_modifier_dist(...){...}` |
|
| 79 | + * |
|
| 80 | + * @api |
|
| 81 | + * @see autoriser_dist() |
|
| 82 | + * |
|
| 83 | + * @param string $faire |
|
| 84 | + * une action ('modifier', 'publier'...) |
|
| 85 | + * @param string $type |
|
| 86 | + * type d'objet ou nom de table ('article') |
|
| 87 | + * @param int $id |
|
| 88 | + * id de l'objet sur lequel on veut agir |
|
| 89 | + * @param null|int|array $qui |
|
| 90 | + * - si null on prend alors visiteur_session |
|
| 91 | + * - un id_auteur (on regarde dans la base) |
|
| 92 | + * - un tableau auteur complet, y compris [restreint] |
|
| 93 | + * @param null|array $opt |
|
| 94 | + * options sous forme de tableau associatif |
|
| 95 | + * @return bool |
|
| 96 | + * true si la personne peut effectuer l'action |
|
| 97 | + */ |
|
| 98 | + function autoriser($faire, $type = '', $id = 0, $qui = null, $opt = null) { |
|
| 99 | + // Charger les fonctions d'autorisation supplementaires |
|
| 100 | + static $pipe; |
|
| 101 | + if (!isset($pipe)) { |
|
| 102 | + $pipe = 1; |
|
| 103 | + pipeline('autoriser'); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $args = func_get_args(); |
|
| 107 | + |
|
| 108 | + return call_user_func_array('autoriser_dist', $args); |
|
| 109 | + } |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | // mes_fonctions peut aussi declarer des autorisations, il faut donc le charger |
| 114 | 114 | // mais apres la fonction autoriser() |
| 115 | 115 | if ($f = find_in_path('mes_fonctions.php')) { |
| 116 | - global $dossier_squelettes; |
|
| 117 | - include_once(_ROOT_CWD . $f); |
|
| 116 | + global $dossier_squelettes; |
|
| 117 | + include_once(_ROOT_CWD . $f); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
@@ -142,72 +142,72 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | function autoriser_dist($faire, $type = '', $id = 0, $qui = null, $opt = null) { |
| 144 | 144 | |
| 145 | - // Qui ? visiteur_session ? |
|
| 146 | - // si null ou '' (appel depuis #AUTORISER) on prend l'auteur loge |
|
| 147 | - if ($qui === null or $qui === '') { |
|
| 148 | - $qui = $GLOBALS['visiteur_session'] ? $GLOBALS['visiteur_session'] : array(); |
|
| 149 | - $qui = array_merge(array('statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'), $qui); |
|
| 150 | - } elseif (is_numeric($qui)) { |
|
| 151 | - $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui); |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - // Admins restreints, on construit ici (pas generique mais...) |
|
| 155 | - // le tableau de toutes leurs rubriques (y compris les sous-rubriques) |
|
| 156 | - if (_ADMINS_RESTREINTS and is_array($qui)) { |
|
| 157 | - $qui['restreint'] = isset($qui['id_auteur']) ? liste_rubriques_auteur($qui['id_auteur']) : array(); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - spip_log( |
|
| 161 | - "autoriser $faire $type $id (" . (isset($qui['nom']) ? $qui['nom'] : '') . ') ?', |
|
| 162 | - 'autoriser' . _LOG_DEBUG |
|
| 163 | - ); |
|
| 164 | - |
|
| 165 | - // passer par objet_type pour avoir les alias |
|
| 166 | - // et supprimer les _ |
|
| 167 | - $type = str_replace('_', '', strncmp($type, '_', 1) == 0 ? $type : objet_type($type, false)); |
|
| 168 | - |
|
| 169 | - // Si une exception a ete decretee plus haut dans le code, l'appliquer |
|
| 170 | - if (isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) |
|
| 171 | - and autoriser_exception($faire, $type, $id, 'verifier') |
|
| 172 | - ) { |
|
| 173 | - spip_log("autoriser ($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG); |
|
| 174 | - return true; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - // Chercher une fonction d'autorisation |
|
| 178 | - // Dans l'ordre on va chercher autoriser_type_faire[_dist], autoriser_type[_dist], |
|
| 179 | - // autoriser_faire[_dist], autoriser_defaut[_dist] |
|
| 180 | - $fonctions = $type |
|
| 181 | - ? array( |
|
| 182 | - 'autoriser_' . $type . '_' . $faire, |
|
| 183 | - 'autoriser_' . $type . '_' . $faire . '_dist', |
|
| 184 | - 'autoriser_' . $type, |
|
| 185 | - 'autoriser_' . $type . '_dist', |
|
| 186 | - 'autoriser_' . $faire, |
|
| 187 | - 'autoriser_' . $faire . '_dist', |
|
| 188 | - 'autoriser_defaut', |
|
| 189 | - 'autoriser_defaut_dist' |
|
| 190 | - ) |
|
| 191 | - : array( |
|
| 192 | - 'autoriser_' . $faire, |
|
| 193 | - 'autoriser_' . $faire . '_dist', |
|
| 194 | - 'autoriser_defaut', |
|
| 195 | - 'autoriser_defaut_dist' |
|
| 196 | - ); |
|
| 197 | - |
|
| 198 | - foreach ($fonctions as $f) { |
|
| 199 | - if (function_exists($f)) { |
|
| 200 | - $a = $f($faire, $type, $id, $qui, $opt); |
|
| 201 | - break; |
|
| 202 | - } |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - spip_log( |
|
| 206 | - "$f($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : ' . ($a ? 'OK' : 'niet'), |
|
| 207 | - 'autoriser' . _LOG_DEBUG |
|
| 208 | - ); |
|
| 209 | - |
|
| 210 | - return $a; |
|
| 145 | + // Qui ? visiteur_session ? |
|
| 146 | + // si null ou '' (appel depuis #AUTORISER) on prend l'auteur loge |
|
| 147 | + if ($qui === null or $qui === '') { |
|
| 148 | + $qui = $GLOBALS['visiteur_session'] ? $GLOBALS['visiteur_session'] : array(); |
|
| 149 | + $qui = array_merge(array('statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'), $qui); |
|
| 150 | + } elseif (is_numeric($qui)) { |
|
| 151 | + $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui); |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + // Admins restreints, on construit ici (pas generique mais...) |
|
| 155 | + // le tableau de toutes leurs rubriques (y compris les sous-rubriques) |
|
| 156 | + if (_ADMINS_RESTREINTS and is_array($qui)) { |
|
| 157 | + $qui['restreint'] = isset($qui['id_auteur']) ? liste_rubriques_auteur($qui['id_auteur']) : array(); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + spip_log( |
|
| 161 | + "autoriser $faire $type $id (" . (isset($qui['nom']) ? $qui['nom'] : '') . ') ?', |
|
| 162 | + 'autoriser' . _LOG_DEBUG |
|
| 163 | + ); |
|
| 164 | + |
|
| 165 | + // passer par objet_type pour avoir les alias |
|
| 166 | + // et supprimer les _ |
|
| 167 | + $type = str_replace('_', '', strncmp($type, '_', 1) == 0 ? $type : objet_type($type, false)); |
|
| 168 | + |
|
| 169 | + // Si une exception a ete decretee plus haut dans le code, l'appliquer |
|
| 170 | + if (isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) |
|
| 171 | + and autoriser_exception($faire, $type, $id, 'verifier') |
|
| 172 | + ) { |
|
| 173 | + spip_log("autoriser ($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG); |
|
| 174 | + return true; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + // Chercher une fonction d'autorisation |
|
| 178 | + // Dans l'ordre on va chercher autoriser_type_faire[_dist], autoriser_type[_dist], |
|
| 179 | + // autoriser_faire[_dist], autoriser_defaut[_dist] |
|
| 180 | + $fonctions = $type |
|
| 181 | + ? array( |
|
| 182 | + 'autoriser_' . $type . '_' . $faire, |
|
| 183 | + 'autoriser_' . $type . '_' . $faire . '_dist', |
|
| 184 | + 'autoriser_' . $type, |
|
| 185 | + 'autoriser_' . $type . '_dist', |
|
| 186 | + 'autoriser_' . $faire, |
|
| 187 | + 'autoriser_' . $faire . '_dist', |
|
| 188 | + 'autoriser_defaut', |
|
| 189 | + 'autoriser_defaut_dist' |
|
| 190 | + ) |
|
| 191 | + : array( |
|
| 192 | + 'autoriser_' . $faire, |
|
| 193 | + 'autoriser_' . $faire . '_dist', |
|
| 194 | + 'autoriser_defaut', |
|
| 195 | + 'autoriser_defaut_dist' |
|
| 196 | + ); |
|
| 197 | + |
|
| 198 | + foreach ($fonctions as $f) { |
|
| 199 | + if (function_exists($f)) { |
|
| 200 | + $a = $f($faire, $type, $id, $qui, $opt); |
|
| 201 | + break; |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + spip_log( |
|
| 206 | + "$f($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : ' . ($a ? 'OK' : 'niet'), |
|
| 207 | + 'autoriser' . _LOG_DEBUG |
|
| 208 | + ); |
|
| 209 | + |
|
| 210 | + return $a; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | // une globale pour aller au plus vite dans la fonction generique ci dessus |
@@ -225,20 +225,20 @@ discard block |
||
| 225 | 225 | * @return bool |
| 226 | 226 | */ |
| 227 | 227 | function autoriser_exception($faire, $type, $id, $autoriser = true) { |
| 228 | - // une static innaccessible par url pour verifier que la globale est positionnee a bon escient |
|
| 229 | - static $autorisation; |
|
| 230 | - if ($autoriser === 'verifier') { |
|
| 231 | - return isset($autorisation[$faire][$type][$id]); |
|
| 232 | - } |
|
| 233 | - if ($autoriser === true) { |
|
| 234 | - $GLOBALS['autoriser_exception'][$faire][$type][$id] = $autorisation[$faire][$type][$id] = true; |
|
| 235 | - } |
|
| 236 | - if ($autoriser === false) { |
|
| 237 | - unset($GLOBALS['autoriser_exception'][$faire][$type][$id]); |
|
| 238 | - unset($autorisation[$faire][$type][$id]); |
|
| 239 | - } |
|
| 228 | + // une static innaccessible par url pour verifier que la globale est positionnee a bon escient |
|
| 229 | + static $autorisation; |
|
| 230 | + if ($autoriser === 'verifier') { |
|
| 231 | + return isset($autorisation[$faire][$type][$id]); |
|
| 232 | + } |
|
| 233 | + if ($autoriser === true) { |
|
| 234 | + $GLOBALS['autoriser_exception'][$faire][$type][$id] = $autorisation[$faire][$type][$id] = true; |
|
| 235 | + } |
|
| 236 | + if ($autoriser === false) { |
|
| 237 | + unset($GLOBALS['autoriser_exception'][$faire][$type][$id]); |
|
| 238 | + unset($autorisation[$faire][$type][$id]); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - return false; |
|
| 241 | + return false; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | * @return bool true s'il a le droit, false sinon |
| 256 | 256 | **/ |
| 257 | 257 | function autoriser_defaut_dist($faire, $type, $id, $qui, $opt) { |
| 258 | - return |
|
| 259 | - $qui['statut'] == '0minirezo' |
|
| 260 | - and !$qui['restreint']; |
|
| 258 | + return |
|
| 259 | + $qui['statut'] == '0minirezo' |
|
| 260 | + and !$qui['restreint']; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -273,10 +273,10 @@ discard block |
||
| 273 | 273 | * @return bool |
| 274 | 274 | */ |
| 275 | 275 | function autoriser_loger_dist($faire, $type, $id, $qui, $opt) { |
| 276 | - if ($qui['statut'] == '5poubelle') { |
|
| 277 | - return false; |
|
| 278 | - } |
|
| 279 | - return true; |
|
| 276 | + if ($qui['statut'] == '5poubelle') { |
|
| 277 | + return false; |
|
| 278 | + } |
|
| 279 | + return true; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @return bool true s'il a le droit, false sinon |
| 291 | 291 | **/ |
| 292 | 292 | function autoriser_ecrire_dist($faire, $type, $id, $qui, $opt) { |
| 293 | - return isset($qui['statut']) and in_array($qui['statut'], array('0minirezo', '1comite')); |
|
| 293 | + return isset($qui['statut']) and in_array($qui['statut'], array('0minirezo', '1comite')); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * @return bool true s'il a le droit, false sinon |
| 308 | 308 | **/ |
| 309 | 309 | function autoriser_creer_dist($faire, $type, $id, $qui, $opt) { |
| 310 | - return in_array($qui['statut'], array('0minirezo', '1comite')); |
|
| 310 | + return in_array($qui['statut'], array('0minirezo', '1comite')); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | /** |
@@ -325,18 +325,18 @@ discard block |
||
| 325 | 325 | **/ |
| 326 | 326 | function autoriser_previsualiser_dist($faire, $type, $id, $qui, $opt) { |
| 327 | 327 | |
| 328 | - // Le visiteur a-t-il un statut prevu par la config ? |
|
| 329 | - if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) { |
|
| 330 | - return test_previsualiser_objet_champ($type, $id, $qui, $opt); |
|
| 331 | - } |
|
| 328 | + // Le visiteur a-t-il un statut prevu par la config ? |
|
| 329 | + if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) { |
|
| 330 | + return test_previsualiser_objet_champ($type, $id, $qui, $opt); |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - // A-t-on un token de prévisualisation valable ? |
|
| 334 | - include_spip('inc/securiser_action'); |
|
| 335 | - if (decrire_token_previsu()) { |
|
| 336 | - return true; |
|
| 337 | - } |
|
| 333 | + // A-t-on un token de prévisualisation valable ? |
|
| 334 | + include_spip('inc/securiser_action'); |
|
| 335 | + if (decrire_token_previsu()) { |
|
| 336 | + return true; |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | - return false; |
|
| 339 | + return false; |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /** |
@@ -364,57 +364,57 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | function test_previsualiser_objet_champ($type = null, $id = 0, $qui = array(), $opt = array()) { |
| 366 | 366 | |
| 367 | - // si pas de type et statut fourni, c'est une autorisation generale => OK |
|
| 368 | - if (!$type) { |
|
| 369 | - return true; |
|
| 370 | - } |
|
| 371 | - |
|
| 372 | - include_spip('base/objets'); |
|
| 373 | - $infos = lister_tables_objets_sql(table_objet_sql($type)); |
|
| 374 | - if (isset($infos['statut'])) { |
|
| 375 | - foreach ($infos['statut'] as $c) { |
|
| 376 | - if (isset($c['publie'])) { |
|
| 377 | - if (!isset($c['previsu'])) { |
|
| 378 | - return false; |
|
| 379 | - } // pas de previsu definie => NIET |
|
| 380 | - $champ = $c['champ']; |
|
| 381 | - if (!isset($opt[$champ])) { |
|
| 382 | - return false; |
|
| 383 | - } // pas de champ passe a la demande => NIET |
|
| 384 | - $previsu = explode(',', $c['previsu']); |
|
| 385 | - // regarder si ce statut est autorise pour l'auteur |
|
| 386 | - if (in_array($opt[$champ] . '/auteur', $previsu)) { |
|
| 387 | - |
|
| 388 | - // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement, |
|
| 389 | - // sinon l’auteur en session |
|
| 390 | - include_spip('inc/securiser_action'); |
|
| 391 | - if ($desc = decrire_token_previsu()) { |
|
| 392 | - $id_auteur = $desc['id_auteur']; |
|
| 393 | - } elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 394 | - $id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']); |
|
| 395 | - } else { |
|
| 396 | - $id_auteur = null; |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - if (!$id_auteur) { |
|
| 400 | - return false; |
|
| 401 | - } elseif(autoriser('previsualiser' . $opt[$champ], $type, '', $id_auteur)) { |
|
| 402 | - // dans ce cas (admin en general), pas de filtrage sur ce statut |
|
| 403 | - } elseif (!sql_countsel( |
|
| 404 | - 'spip_auteurs_liens', |
|
| 405 | - 'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id) |
|
| 406 | - )) { |
|
| 407 | - return false; |
|
| 408 | - } // pas auteur de cet objet => NIET |
|
| 409 | - } elseif (!in_array($opt[$champ], $previsu)) { |
|
| 410 | - // le statut n'est pas dans ceux definis par la previsu => NIET |
|
| 411 | - return false; |
|
| 412 | - } |
|
| 413 | - } |
|
| 414 | - } |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - return true; |
|
| 367 | + // si pas de type et statut fourni, c'est une autorisation generale => OK |
|
| 368 | + if (!$type) { |
|
| 369 | + return true; |
|
| 370 | + } |
|
| 371 | + |
|
| 372 | + include_spip('base/objets'); |
|
| 373 | + $infos = lister_tables_objets_sql(table_objet_sql($type)); |
|
| 374 | + if (isset($infos['statut'])) { |
|
| 375 | + foreach ($infos['statut'] as $c) { |
|
| 376 | + if (isset($c['publie'])) { |
|
| 377 | + if (!isset($c['previsu'])) { |
|
| 378 | + return false; |
|
| 379 | + } // pas de previsu definie => NIET |
|
| 380 | + $champ = $c['champ']; |
|
| 381 | + if (!isset($opt[$champ])) { |
|
| 382 | + return false; |
|
| 383 | + } // pas de champ passe a la demande => NIET |
|
| 384 | + $previsu = explode(',', $c['previsu']); |
|
| 385 | + // regarder si ce statut est autorise pour l'auteur |
|
| 386 | + if (in_array($opt[$champ] . '/auteur', $previsu)) { |
|
| 387 | + |
|
| 388 | + // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement, |
|
| 389 | + // sinon l’auteur en session |
|
| 390 | + include_spip('inc/securiser_action'); |
|
| 391 | + if ($desc = decrire_token_previsu()) { |
|
| 392 | + $id_auteur = $desc['id_auteur']; |
|
| 393 | + } elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 394 | + $id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']); |
|
| 395 | + } else { |
|
| 396 | + $id_auteur = null; |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + if (!$id_auteur) { |
|
| 400 | + return false; |
|
| 401 | + } elseif(autoriser('previsualiser' . $opt[$champ], $type, '', $id_auteur)) { |
|
| 402 | + // dans ce cas (admin en general), pas de filtrage sur ce statut |
|
| 403 | + } elseif (!sql_countsel( |
|
| 404 | + 'spip_auteurs_liens', |
|
| 405 | + 'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id) |
|
| 406 | + )) { |
|
| 407 | + return false; |
|
| 408 | + } // pas auteur de cet objet => NIET |
|
| 409 | + } elseif (!in_array($opt[$champ], $previsu)) { |
|
| 410 | + // le statut n'est pas dans ceux definis par la previsu => NIET |
|
| 411 | + return false; |
|
| 412 | + } |
|
| 413 | + } |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + return true; |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /** |
@@ -428,47 +428,47 @@ discard block |
||
| 428 | 428 | * @return bool true s'il a le droit, false sinon |
| 429 | 429 | **/ |
| 430 | 430 | function autoriser_changerlangue_dist($faire, $type, $id, $qui, $opt) { |
| 431 | - $multi_objets = explode(',', lire_config('multi_objets')); |
|
| 432 | - $gerer_trad_objets = explode(',', lire_config('gerer_trad_objets')); |
|
| 433 | - $table = table_objet_sql($type); |
|
| 434 | - if (in_array($table, $multi_objets) |
|
| 435 | - or in_array($table, $gerer_trad_objets)) { // affichage du formulaire si la configuration l'accepte |
|
| 436 | - $multi_secteurs = lire_config('multi_secteurs'); |
|
| 437 | - $champs = objet_info($type, 'field'); |
|
| 438 | - if ($multi_secteurs == 'oui' |
|
| 439 | - and array_key_exists('id_rubrique', $champs)) { |
|
| 440 | - // multilinguisme par secteur et objet rattaché à une rubrique |
|
| 441 | - $primary = id_table_objet($type); |
|
| 442 | - if ($table != 'spip_rubriques') { |
|
| 443 | - $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id)); |
|
| 444 | - } else { |
|
| 445 | - $id_rubrique = $id; |
|
| 446 | - } |
|
| 447 | - $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 448 | - if (!$id_secteur > 0) { |
|
| 449 | - $id_secteur = $id_rubrique; |
|
| 450 | - } |
|
| 451 | - $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur)); |
|
| 452 | - $langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id)); |
|
| 453 | - if ($langue_secteur != $langue_objet) { |
|
| 454 | - // configuration incohérente, on laisse l'utilisateur corriger la situation |
|
| 455 | - return true; |
|
| 456 | - } |
|
| 457 | - if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques |
|
| 458 | - return false; |
|
| 459 | - } else { |
|
| 460 | - $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id)); |
|
| 461 | - if ($id_parent != 0) { |
|
| 462 | - // sous-rubriques : pas de choix de langue |
|
| 463 | - return false; |
|
| 464 | - } |
|
| 465 | - } |
|
| 466 | - } |
|
| 467 | - } else { |
|
| 468 | - return false; |
|
| 469 | - } |
|
| 470 | - |
|
| 471 | - return autoriser('modifier', $type, $id, $qui, $opt); |
|
| 431 | + $multi_objets = explode(',', lire_config('multi_objets')); |
|
| 432 | + $gerer_trad_objets = explode(',', lire_config('gerer_trad_objets')); |
|
| 433 | + $table = table_objet_sql($type); |
|
| 434 | + if (in_array($table, $multi_objets) |
|
| 435 | + or in_array($table, $gerer_trad_objets)) { // affichage du formulaire si la configuration l'accepte |
|
| 436 | + $multi_secteurs = lire_config('multi_secteurs'); |
|
| 437 | + $champs = objet_info($type, 'field'); |
|
| 438 | + if ($multi_secteurs == 'oui' |
|
| 439 | + and array_key_exists('id_rubrique', $champs)) { |
|
| 440 | + // multilinguisme par secteur et objet rattaché à une rubrique |
|
| 441 | + $primary = id_table_objet($type); |
|
| 442 | + if ($table != 'spip_rubriques') { |
|
| 443 | + $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id)); |
|
| 444 | + } else { |
|
| 445 | + $id_rubrique = $id; |
|
| 446 | + } |
|
| 447 | + $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 448 | + if (!$id_secteur > 0) { |
|
| 449 | + $id_secteur = $id_rubrique; |
|
| 450 | + } |
|
| 451 | + $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur)); |
|
| 452 | + $langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id)); |
|
| 453 | + if ($langue_secteur != $langue_objet) { |
|
| 454 | + // configuration incohérente, on laisse l'utilisateur corriger la situation |
|
| 455 | + return true; |
|
| 456 | + } |
|
| 457 | + if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques |
|
| 458 | + return false; |
|
| 459 | + } else { |
|
| 460 | + $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id)); |
|
| 461 | + if ($id_parent != 0) { |
|
| 462 | + // sous-rubriques : pas de choix de langue |
|
| 463 | + return false; |
|
| 464 | + } |
|
| 465 | + } |
|
| 466 | + } |
|
| 467 | + } else { |
|
| 468 | + return false; |
|
| 469 | + } |
|
| 470 | + |
|
| 471 | + return autoriser('modifier', $type, $id, $qui, $opt); |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | /** |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | * @return bool true s'il a le droit, false sinon |
| 483 | 483 | **/ |
| 484 | 484 | function autoriser_changertraduction_dist($faire, $type, $id, $qui, $opt) { |
| 485 | - return autoriser('modifier', $type, $id, $qui, $opt); |
|
| 485 | + return autoriser('modifier', $type, $id, $qui, $opt); |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | /** |
@@ -496,41 +496,41 @@ discard block |
||
| 496 | 496 | * @return bool true s'il a le droit, false sinon |
| 497 | 497 | **/ |
| 498 | 498 | function autoriser_dater_dist($faire, $type, $id, $qui, $opt) { |
| 499 | - $table = table_objet($type); |
|
| 500 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 501 | - $desc = $trouver_table($table); |
|
| 502 | - if (!$desc) { |
|
| 503 | - return false; |
|
| 504 | - } |
|
| 499 | + $table = table_objet($type); |
|
| 500 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 501 | + $desc = $trouver_table($table); |
|
| 502 | + if (!$desc) { |
|
| 503 | + return false; |
|
| 504 | + } |
|
| 505 | 505 | |
| 506 | - if (!isset($opt['statut'])) { |
|
| 507 | - if (isset($desc['field']['statut'])) { |
|
| 508 | - $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id)); |
|
| 509 | - } else { |
|
| 510 | - $statut = 'publie'; |
|
| 511 | - } // pas de statut => publie |
|
| 512 | - } else { |
|
| 513 | - $statut = $opt['statut']; |
|
| 514 | - } |
|
| 506 | + if (!isset($opt['statut'])) { |
|
| 507 | + if (isset($desc['field']['statut'])) { |
|
| 508 | + $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id)); |
|
| 509 | + } else { |
|
| 510 | + $statut = 'publie'; |
|
| 511 | + } // pas de statut => publie |
|
| 512 | + } else { |
|
| 513 | + $statut = $opt['statut']; |
|
| 514 | + } |
|
| 515 | 515 | |
| 516 | - // Liste des statuts publiés pour cet objet |
|
| 517 | - if (isset($desc['statut'][0]['publie'])) { |
|
| 518 | - $statuts_publies = explode(',', $desc['statut'][0]['publie']); |
|
| 519 | - } |
|
| 520 | - // Sinon en dur le statut "publie" |
|
| 521 | - else { |
|
| 522 | - $statuts_publies = array('publie'); |
|
| 523 | - } |
|
| 516 | + // Liste des statuts publiés pour cet objet |
|
| 517 | + if (isset($desc['statut'][0]['publie'])) { |
|
| 518 | + $statuts_publies = explode(',', $desc['statut'][0]['publie']); |
|
| 519 | + } |
|
| 520 | + // Sinon en dur le statut "publie" |
|
| 521 | + else { |
|
| 522 | + $statuts_publies = array('publie'); |
|
| 523 | + } |
|
| 524 | 524 | |
| 525 | - if ( |
|
| 526 | - in_array($statut, $statuts_publies) |
|
| 527 | - // Ou cas particulier géré en dur ici pour les articles |
|
| 528 | - or ($statut == 'prop' and $type == 'article' and $GLOBALS['meta']['post_dates'] == 'non') |
|
| 529 | - ) { |
|
| 530 | - return autoriser('modifier', $type, $id); |
|
| 531 | - } |
|
| 525 | + if ( |
|
| 526 | + in_array($statut, $statuts_publies) |
|
| 527 | + // Ou cas particulier géré en dur ici pour les articles |
|
| 528 | + or ($statut == 'prop' and $type == 'article' and $GLOBALS['meta']['post_dates'] == 'non') |
|
| 529 | + ) { |
|
| 530 | + return autoriser('modifier', $type, $id); |
|
| 531 | + } |
|
| 532 | 532 | |
| 533 | - return false; |
|
| 533 | + return false; |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | /** |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | * @return bool true s'il a le droit, false sinon |
| 548 | 548 | **/ |
| 549 | 549 | function autoriser_instituer_dist($faire, $type, $id, $qui, $opt) { |
| 550 | - return autoriser('modifier', $type, $id, $qui, $opt); |
|
| 550 | + return autoriser('modifier', $type, $id, $qui, $opt); |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | /** |
@@ -563,12 +563,12 @@ discard block |
||
| 563 | 563 | * @return bool true s'il a le droit, false sinon |
| 564 | 564 | **/ |
| 565 | 565 | function autoriser_rubrique_publierdans_dist($faire, $type, $id, $qui, $opt) { |
| 566 | - return |
|
| 567 | - ($qui['statut'] == '0minirezo') |
|
| 568 | - and ( |
|
| 569 | - !$qui['restreint'] or !$id |
|
| 570 | - or in_array($id, $qui['restreint']) |
|
| 571 | - ); |
|
| 566 | + return |
|
| 567 | + ($qui['statut'] == '0minirezo') |
|
| 568 | + and ( |
|
| 569 | + !$qui['restreint'] or !$id |
|
| 570 | + or in_array($id, $qui['restreint']) |
|
| 571 | + ); |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /** |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | * @return bool true s'il a le droit, false sinon |
| 585 | 585 | **/ |
| 586 | 586 | function autoriser_rubrique_creer_dist($faire, $type, $id, $qui, $opt) { |
| 587 | - return |
|
| 588 | - ((!$id and autoriser('defaut', null, null, $qui, $opt)) |
|
| 589 | - or $id and autoriser('creerrubriquedans', 'rubrique', $id, $qui, $opt) |
|
| 590 | - ); |
|
| 587 | + return |
|
| 588 | + ((!$id and autoriser('defaut', null, null, $qui, $opt)) |
|
| 589 | + or $id and autoriser('creerrubriquedans', 'rubrique', $id, $qui, $opt) |
|
| 590 | + ); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | /** |
@@ -603,10 +603,10 @@ discard block |
||
| 603 | 603 | * @return bool true s'il a le droit, false sinon |
| 604 | 604 | **/ |
| 605 | 605 | function autoriser_rubrique_creerrubriquedans_dist($faire, $type, $id, $qui, $opt) { |
| 606 | - return |
|
| 607 | - ($id or ($qui['statut'] == '0minirezo' and !$qui['restreint'])) |
|
| 608 | - and autoriser('voir', 'rubrique', $id) |
|
| 609 | - and autoriser('publierdans', 'rubrique', $id); |
|
| 606 | + return |
|
| 607 | + ($id or ($qui['statut'] == '0minirezo' and !$qui['restreint'])) |
|
| 608 | + and autoriser('voir', 'rubrique', $id) |
|
| 609 | + and autoriser('publierdans', 'rubrique', $id); |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | /** |
@@ -622,10 +622,10 @@ discard block |
||
| 622 | 622 | * @return bool true s'il a le droit, false sinon |
| 623 | 623 | **/ |
| 624 | 624 | function autoriser_rubrique_creerarticledans_dist($faire, $type, $id, $qui, $opt) { |
| 625 | - return |
|
| 626 | - $id |
|
| 627 | - and autoriser('voir', 'rubrique', $id) |
|
| 628 | - and autoriser('creer', 'article'); |
|
| 625 | + return |
|
| 626 | + $id |
|
| 627 | + and autoriser('voir', 'rubrique', $id) |
|
| 628 | + and autoriser('creer', 'article'); |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | |
@@ -642,8 +642,8 @@ discard block |
||
| 642 | 642 | * @return bool true s'il a le droit, false sinon |
| 643 | 643 | **/ |
| 644 | 644 | function autoriser_rubrique_modifier_dist($faire, $type, $id, $qui, $opt) { |
| 645 | - return |
|
| 646 | - autoriser('publierdans', 'rubrique', $id, $qui, $opt); |
|
| 645 | + return |
|
| 646 | + autoriser('publierdans', 'rubrique', $id, $qui, $opt); |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | /** |
@@ -659,29 +659,29 @@ discard block |
||
| 659 | 659 | * @return bool true s'il a le droit, false sinon |
| 660 | 660 | **/ |
| 661 | 661 | function autoriser_rubrique_supprimer_dist($faire, $type, $id, $qui, $opt) { |
| 662 | - if (!$id = intval($id)) { |
|
| 663 | - return false; |
|
| 664 | - } |
|
| 662 | + if (!$id = intval($id)) { |
|
| 663 | + return false; |
|
| 664 | + } |
|
| 665 | 665 | |
| 666 | - if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) { |
|
| 667 | - return false; |
|
| 668 | - } |
|
| 666 | + if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) { |
|
| 667 | + return false; |
|
| 668 | + } |
|
| 669 | 669 | |
| 670 | - if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) { |
|
| 671 | - return false; |
|
| 672 | - } |
|
| 670 | + if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) { |
|
| 671 | + return false; |
|
| 672 | + } |
|
| 673 | 673 | |
| 674 | - $compte = pipeline( |
|
| 675 | - 'objet_compte_enfants', |
|
| 676 | - array('args' => array('objet' => 'rubrique', 'id_objet' => $id), 'data' => array()) |
|
| 677 | - ); |
|
| 678 | - foreach ($compte as $objet => $n) { |
|
| 679 | - if ($n) { |
|
| 680 | - return false; |
|
| 681 | - } |
|
| 682 | - } |
|
| 674 | + $compte = pipeline( |
|
| 675 | + 'objet_compte_enfants', |
|
| 676 | + array('args' => array('objet' => 'rubrique', 'id_objet' => $id), 'data' => array()) |
|
| 677 | + ); |
|
| 678 | + foreach ($compte as $objet => $n) { |
|
| 679 | + if ($n) { |
|
| 680 | + return false; |
|
| 681 | + } |
|
| 682 | + } |
|
| 683 | 683 | |
| 684 | - return autoriser('modifier', 'rubrique', $id); |
|
| 684 | + return autoriser('modifier', 'rubrique', $id); |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | |
@@ -699,20 +699,20 @@ discard block |
||
| 699 | 699 | * @return bool true s'il a le droit, false sinon |
| 700 | 700 | **/ |
| 701 | 701 | function autoriser_article_modifier_dist($faire, $type, $id, $qui, $opt) { |
| 702 | - $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id)); |
|
| 702 | + $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id)); |
|
| 703 | 703 | |
| 704 | - return |
|
| 705 | - $r |
|
| 706 | - and |
|
| 707 | - ( |
|
| 708 | - autoriser('publierdans', 'rubrique', $r['id_rubrique'], $qui, $opt) |
|
| 709 | - or ( |
|
| 710 | - (!isset($opt['statut']) or $opt['statut'] !== 'publie') |
|
| 711 | - and in_array($qui['statut'], array('0minirezo', '1comite')) |
|
| 712 | - and in_array($r['statut'], array('prop', 'prepa', 'poubelle')) |
|
| 713 | - and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']) |
|
| 714 | - ) |
|
| 715 | - ); |
|
| 704 | + return |
|
| 705 | + $r |
|
| 706 | + and |
|
| 707 | + ( |
|
| 708 | + autoriser('publierdans', 'rubrique', $r['id_rubrique'], $qui, $opt) |
|
| 709 | + or ( |
|
| 710 | + (!isset($opt['statut']) or $opt['statut'] !== 'publie') |
|
| 711 | + and in_array($qui['statut'], array('0minirezo', '1comite')) |
|
| 712 | + and in_array($r['statut'], array('prop', 'prepa', 'poubelle')) |
|
| 713 | + and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']) |
|
| 714 | + ) |
|
| 715 | + ); |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | /** |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | * @return bool true s'il a le droit, false sinon |
| 729 | 729 | **/ |
| 730 | 730 | function autoriser_article_creer_dist($faire, $type, $id, $qui, $opt) { |
| 731 | - return (sql_countsel('spip_rubriques') > 0 and in_array($qui['statut'], array('0minirezo', '1comite'))); |
|
| 731 | + return (sql_countsel('spip_rubriques') > 0 and in_array($qui['statut'], array('0minirezo', '1comite'))); |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | /** |
@@ -748,28 +748,28 @@ discard block |
||
| 748 | 748 | * @return bool true s'il a le droit, false sinon |
| 749 | 749 | */ |
| 750 | 750 | function autoriser_article_voir_dist($faire, $type, $id, $qui, $opt) { |
| 751 | - if ($qui['statut'] == '0minirezo') { |
|
| 752 | - return true; |
|
| 753 | - } |
|
| 754 | - // cas des articles : depend du statut de l'article et de l'auteur |
|
| 755 | - if (isset($opt['statut'])) { |
|
| 756 | - $statut = $opt['statut']; |
|
| 757 | - } else { |
|
| 758 | - if (!$id) { |
|
| 759 | - return false; |
|
| 760 | - } |
|
| 761 | - $statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id)); |
|
| 762 | - } |
|
| 763 | - |
|
| 764 | - return |
|
| 765 | - // si on est pas auteur de l'article, |
|
| 766 | - // seuls les propose et publies sont visibles |
|
| 767 | - in_array($statut, array('prop', 'publie')) |
|
| 768 | - // sinon si on est auteur, on a le droit de le voir, evidemment ! |
|
| 769 | - or |
|
| 770 | - ($id |
|
| 771 | - and $qui['id_auteur'] |
|
| 772 | - and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])); |
|
| 751 | + if ($qui['statut'] == '0minirezo') { |
|
| 752 | + return true; |
|
| 753 | + } |
|
| 754 | + // cas des articles : depend du statut de l'article et de l'auteur |
|
| 755 | + if (isset($opt['statut'])) { |
|
| 756 | + $statut = $opt['statut']; |
|
| 757 | + } else { |
|
| 758 | + if (!$id) { |
|
| 759 | + return false; |
|
| 760 | + } |
|
| 761 | + $statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id)); |
|
| 762 | + } |
|
| 763 | + |
|
| 764 | + return |
|
| 765 | + // si on est pas auteur de l'article, |
|
| 766 | + // seuls les propose et publies sont visibles |
|
| 767 | + in_array($statut, array('prop', 'publie')) |
|
| 768 | + // sinon si on est auteur, on a le droit de le voir, evidemment ! |
|
| 769 | + or |
|
| 770 | + ($id |
|
| 771 | + and $qui['id_auteur'] |
|
| 772 | + and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])); |
|
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | |
@@ -786,22 +786,22 @@ discard block |
||
| 786 | 786 | * @return bool true s'il a le droit, false sinon |
| 787 | 787 | **/ |
| 788 | 788 | function autoriser_voir_dist($faire, $type, $id, $qui, $opt) { |
| 789 | - # securite, mais on aurait pas du arriver ici ! |
|
| 790 | - if (function_exists($f = 'autoriser_' . $type . '_voir') |
|
| 791 | - or function_exists($f = 'autoriser_' . $type . '_voir_dist')) { |
|
| 792 | - return $f($faire, $type, $id, $qui, $opt); |
|
| 793 | - } |
|
| 789 | + # securite, mais on aurait pas du arriver ici ! |
|
| 790 | + if (function_exists($f = 'autoriser_' . $type . '_voir') |
|
| 791 | + or function_exists($f = 'autoriser_' . $type . '_voir_dist')) { |
|
| 792 | + return $f($faire, $type, $id, $qui, $opt); |
|
| 793 | + } |
|
| 794 | 794 | |
| 795 | - if ($qui['statut'] == '0minirezo') { |
|
| 796 | - return true; |
|
| 797 | - } |
|
| 798 | - // admins et redacteurs peuvent voir un auteur |
|
| 799 | - if ($type == 'auteur') { |
|
| 800 | - return in_array($qui['statut'], array('0minirezo', '1comite')); |
|
| 801 | - } |
|
| 802 | - // sinon par defaut tout est visible |
|
| 803 | - // sauf cas particuliers traites separemment (ie article) |
|
| 804 | - return true; |
|
| 795 | + if ($qui['statut'] == '0minirezo') { |
|
| 796 | + return true; |
|
| 797 | + } |
|
| 798 | + // admins et redacteurs peuvent voir un auteur |
|
| 799 | + if ($type == 'auteur') { |
|
| 800 | + return in_array($qui['statut'], array('0minirezo', '1comite')); |
|
| 801 | + } |
|
| 802 | + // sinon par defaut tout est visible |
|
| 803 | + // sauf cas particuliers traites separemment (ie article) |
|
| 804 | + return true; |
|
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | |
@@ -822,12 +822,12 @@ discard block |
||
| 822 | 822 | * @return bool true s'il a le droit, false sinon |
| 823 | 823 | **/ |
| 824 | 824 | function autoriser_webmestre_dist($faire, $type, $id, $qui, $opt) { |
| 825 | - return |
|
| 826 | - (defined('_ID_WEBMESTRES') ? |
|
| 827 | - in_array($qui['id_auteur'], explode(':', _ID_WEBMESTRES)) |
|
| 828 | - : $qui['webmestre'] == 'oui') |
|
| 829 | - and $qui['statut'] == '0minirezo' |
|
| 830 | - and !$qui['restreint']; |
|
| 825 | + return |
|
| 826 | + (defined('_ID_WEBMESTRES') ? |
|
| 827 | + in_array($qui['id_auteur'], explode(':', _ID_WEBMESTRES)) |
|
| 828 | + : $qui['webmestre'] == 'oui') |
|
| 829 | + and $qui['statut'] == '0minirezo' |
|
| 830 | + and !$qui['restreint']; |
|
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | /** |
@@ -843,9 +843,9 @@ discard block |
||
| 843 | 843 | * @return bool true s'il a le droit, false sinon |
| 844 | 844 | **/ |
| 845 | 845 | function autoriser_configurer_dist($faire, $type, $id, $qui, $opt) { |
| 846 | - return |
|
| 847 | - $qui['statut'] == '0minirezo' |
|
| 848 | - and !$qui['restreint']; |
|
| 846 | + return |
|
| 847 | + $qui['statut'] == '0minirezo' |
|
| 848 | + and !$qui['restreint']; |
|
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | /** |
@@ -861,8 +861,8 @@ discard block |
||
| 861 | 861 | * @return bool true s'il a le droit, false sinon |
| 862 | 862 | **/ |
| 863 | 863 | function autoriser_sauvegarder_dist($faire, $type, $id, $qui, $opt) { |
| 864 | - return |
|
| 865 | - $qui['statut'] == '0minirezo'; |
|
| 864 | + return |
|
| 865 | + $qui['statut'] == '0minirezo'; |
|
| 866 | 866 | } |
| 867 | 867 | |
| 868 | 868 | /** |
@@ -878,8 +878,8 @@ discard block |
||
| 878 | 878 | * @return bool true s'il a le droit, false sinon |
| 879 | 879 | **/ |
| 880 | 880 | function autoriser_detruire_dist($faire, $type, $id, $qui, $opt) { |
| 881 | - return |
|
| 882 | - autoriser('webmestre', null, null, $qui, $opt); |
|
| 881 | + return |
|
| 882 | + autoriser('webmestre', null, null, $qui, $opt); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | /** |
@@ -896,20 +896,20 @@ discard block |
||
| 896 | 896 | * @return bool true s'il a le droit, false sinon |
| 897 | 897 | **/ |
| 898 | 898 | function autoriser_auteur_previsualiser_dist($faire, $type, $id, $qui, $opt) { |
| 899 | - // les admins peuvent "previsualiser" une page auteur |
|
| 900 | - if ($qui['statut'] == '0minirezo' |
|
| 901 | - and !$qui['restreint'] |
|
| 902 | - ) { |
|
| 903 | - return true; |
|
| 904 | - } |
|
| 905 | - // "Voir en ligne" si l'auteur a un article publie |
|
| 906 | - $n = sql_fetsel( |
|
| 907 | - 'A.id_article', |
|
| 908 | - 'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)', |
|
| 909 | - "A.statut='publie' AND L.id_auteur=" . sql_quote($id) |
|
| 910 | - ); |
|
| 899 | + // les admins peuvent "previsualiser" une page auteur |
|
| 900 | + if ($qui['statut'] == '0minirezo' |
|
| 901 | + and !$qui['restreint'] |
|
| 902 | + ) { |
|
| 903 | + return true; |
|
| 904 | + } |
|
| 905 | + // "Voir en ligne" si l'auteur a un article publie |
|
| 906 | + $n = sql_fetsel( |
|
| 907 | + 'A.id_article', |
|
| 908 | + 'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)', |
|
| 909 | + "A.statut='publie' AND L.id_auteur=" . sql_quote($id) |
|
| 910 | + ); |
|
| 911 | 911 | |
| 912 | - return $n ? true : false; |
|
| 912 | + return $n ? true : false; |
|
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | |
@@ -937,7 +937,7 @@ discard block |
||
| 937 | 937 | * @return bool true s'il a le droit, false sinon |
| 938 | 938 | **/ |
| 939 | 939 | function autoriser_auteur_creer_dist($faire, $type, $id, $qui, $opt) { |
| 940 | - return ($qui['statut'] == '0minirezo'); |
|
| 940 | + return ($qui['statut'] == '0minirezo'); |
|
| 941 | 941 | } |
| 942 | 942 | |
| 943 | 943 | |
@@ -957,78 +957,78 @@ discard block |
||
| 957 | 957 | **/ |
| 958 | 958 | function autoriser_auteur_modifier_dist($faire, $type, $id, $qui, $opt) { |
| 959 | 959 | |
| 960 | - // Ni admin ni redacteur => non |
|
| 961 | - if (!in_array($qui['statut'], array('0minirezo', '1comite'))) { |
|
| 962 | - return false; |
|
| 963 | - } |
|
| 964 | - |
|
| 965 | - // Un redacteur peut modifier ses propres donnees mais ni son login/email |
|
| 966 | - // ni son statut (qui sont le cas echeant passes comme option) |
|
| 967 | - if ($qui['statut'] == '1comite') { |
|
| 968 | - if (!empty($opt['webmestre'])) { |
|
| 969 | - return false; |
|
| 970 | - } elseif ( |
|
| 971 | - !empty($opt['statut']) |
|
| 972 | - or !empty($opt['restreintes']) |
|
| 973 | - or !empty($opt['email']) |
|
| 974 | - ) { |
|
| 975 | - return false; |
|
| 976 | - } elseif ($id == $qui['id_auteur']) { |
|
| 977 | - return true; |
|
| 978 | - } else { |
|
| 979 | - return false; |
|
| 980 | - } |
|
| 981 | - } |
|
| 982 | - |
|
| 983 | - // Un admin restreint peut modifier/creer un auteur non-admin mais il |
|
| 984 | - // n'a le droit ni de le promouvoir admin, ni de changer les rubriques |
|
| 985 | - if ($qui['restreint']) { |
|
| 986 | - if (isset($opt['webmestre']) and $opt['webmestre']) { |
|
| 987 | - return false; |
|
| 988 | - } elseif ((isset($opt['statut']) and ($opt['statut'] == '0minirezo')) |
|
| 989 | - or (isset($opt['restreintes']) and $opt['restreintes']) |
|
| 990 | - ) { |
|
| 991 | - return false; |
|
| 992 | - } else { |
|
| 993 | - if ($id == $qui['id_auteur']) { |
|
| 994 | - if (isset($opt['statut']) and $opt['statut']) { |
|
| 995 | - return false; |
|
| 996 | - } else { |
|
| 997 | - return true; |
|
| 998 | - } |
|
| 999 | - } else { |
|
| 1000 | - if ($id_auteur = intval($id)) { |
|
| 1001 | - $t = sql_fetsel('statut', 'spip_auteurs', "id_auteur=$id_auteur"); |
|
| 1002 | - if ($t and $t['statut'] != '0minirezo') { |
|
| 1003 | - return true; |
|
| 1004 | - } else { |
|
| 1005 | - return false; |
|
| 1006 | - } |
|
| 1007 | - } // id = 0 => creation |
|
| 1008 | - else { |
|
| 1009 | - return true; |
|
| 1010 | - } |
|
| 1011 | - } |
|
| 1012 | - } |
|
| 1013 | - } |
|
| 1014 | - |
|
| 1015 | - // Un admin complet fait ce qu'il veut |
|
| 1016 | - // sauf se degrader |
|
| 1017 | - if ($id == $qui['id_auteur'] && (isset($opt['statut']) and $opt['statut'])) { |
|
| 1018 | - return false; |
|
| 1019 | - } elseif (isset($opt['webmestre']) |
|
| 1020 | - and $opt['webmestre'] |
|
| 1021 | - and (defined('_ID_WEBMESTRES') |
|
| 1022 | - or !autoriser('webmestre'))) { |
|
| 1023 | - // et toucher au statut webmestre si il ne l'est pas lui meme |
|
| 1024 | - // ou si les webmestres sont fixes par constante (securite) |
|
| 1025 | - return false; |
|
| 1026 | - } // et modifier un webmestre si il ne l'est pas lui meme |
|
| 1027 | - elseif (intval($id) and autoriser('webmestre', '', 0, $id) and !autoriser('webmestre')) { |
|
| 1028 | - return false; |
|
| 1029 | - } else { |
|
| 1030 | - return true; |
|
| 1031 | - } |
|
| 960 | + // Ni admin ni redacteur => non |
|
| 961 | + if (!in_array($qui['statut'], array('0minirezo', '1comite'))) { |
|
| 962 | + return false; |
|
| 963 | + } |
|
| 964 | + |
|
| 965 | + // Un redacteur peut modifier ses propres donnees mais ni son login/email |
|
| 966 | + // ni son statut (qui sont le cas echeant passes comme option) |
|
| 967 | + if ($qui['statut'] == '1comite') { |
|
| 968 | + if (!empty($opt['webmestre'])) { |
|
| 969 | + return false; |
|
| 970 | + } elseif ( |
|
| 971 | + !empty($opt['statut']) |
|
| 972 | + or !empty($opt['restreintes']) |
|
| 973 | + or !empty($opt['email']) |
|
| 974 | + ) { |
|
| 975 | + return false; |
|
| 976 | + } elseif ($id == $qui['id_auteur']) { |
|
| 977 | + return true; |
|
| 978 | + } else { |
|
| 979 | + return false; |
|
| 980 | + } |
|
| 981 | + } |
|
| 982 | + |
|
| 983 | + // Un admin restreint peut modifier/creer un auteur non-admin mais il |
|
| 984 | + // n'a le droit ni de le promouvoir admin, ni de changer les rubriques |
|
| 985 | + if ($qui['restreint']) { |
|
| 986 | + if (isset($opt['webmestre']) and $opt['webmestre']) { |
|
| 987 | + return false; |
|
| 988 | + } elseif ((isset($opt['statut']) and ($opt['statut'] == '0minirezo')) |
|
| 989 | + or (isset($opt['restreintes']) and $opt['restreintes']) |
|
| 990 | + ) { |
|
| 991 | + return false; |
|
| 992 | + } else { |
|
| 993 | + if ($id == $qui['id_auteur']) { |
|
| 994 | + if (isset($opt['statut']) and $opt['statut']) { |
|
| 995 | + return false; |
|
| 996 | + } else { |
|
| 997 | + return true; |
|
| 998 | + } |
|
| 999 | + } else { |
|
| 1000 | + if ($id_auteur = intval($id)) { |
|
| 1001 | + $t = sql_fetsel('statut', 'spip_auteurs', "id_auteur=$id_auteur"); |
|
| 1002 | + if ($t and $t['statut'] != '0minirezo') { |
|
| 1003 | + return true; |
|
| 1004 | + } else { |
|
| 1005 | + return false; |
|
| 1006 | + } |
|
| 1007 | + } // id = 0 => creation |
|
| 1008 | + else { |
|
| 1009 | + return true; |
|
| 1010 | + } |
|
| 1011 | + } |
|
| 1012 | + } |
|
| 1013 | + } |
|
| 1014 | + |
|
| 1015 | + // Un admin complet fait ce qu'il veut |
|
| 1016 | + // sauf se degrader |
|
| 1017 | + if ($id == $qui['id_auteur'] && (isset($opt['statut']) and $opt['statut'])) { |
|
| 1018 | + return false; |
|
| 1019 | + } elseif (isset($opt['webmestre']) |
|
| 1020 | + and $opt['webmestre'] |
|
| 1021 | + and (defined('_ID_WEBMESTRES') |
|
| 1022 | + or !autoriser('webmestre'))) { |
|
| 1023 | + // et toucher au statut webmestre si il ne l'est pas lui meme |
|
| 1024 | + // ou si les webmestres sont fixes par constante (securite) |
|
| 1025 | + return false; |
|
| 1026 | + } // et modifier un webmestre si il ne l'est pas lui meme |
|
| 1027 | + elseif (intval($id) and autoriser('webmestre', '', 0, $id) and !autoriser('webmestre')) { |
|
| 1028 | + return false; |
|
| 1029 | + } else { |
|
| 1030 | + return true; |
|
| 1031 | + } |
|
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | * @return bool true s'il a le droit, false sinon |
| 1046 | 1046 | **/ |
| 1047 | 1047 | function autoriser_associerauteurs_dist($faire, $type, $id, $qui, $opt) { |
| 1048 | - return autoriser('modifier', $type, $id, $qui, $opt); |
|
| 1048 | + return autoriser('modifier', $type, $id, $qui, $opt); |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | |
@@ -1062,7 +1062,7 @@ discard block |
||
| 1062 | 1062 | * @return bool true s'il a le droit, false sinon |
| 1063 | 1063 | **/ |
| 1064 | 1064 | function autoriser_chargerftp_dist($faire, $type, $id, $qui, $opt) { |
| 1065 | - return $qui['statut'] == '0minirezo'; |
|
| 1065 | + return $qui['statut'] == '0minirezo'; |
|
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | /** |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | * @return bool true s'il a le droit, false sinon |
| 1079 | 1079 | **/ |
| 1080 | 1080 | function autoriser_debug_dist($faire, $type, $id, $qui, $opt) { |
| 1081 | - return $qui['statut'] == '0minirezo'; |
|
| 1081 | + return $qui['statut'] == '0minirezo'; |
|
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | 1084 | /** |
@@ -1095,52 +1095,52 @@ discard block |
||
| 1095 | 1095 | * @return array Liste des rubriques |
| 1096 | 1096 | **/ |
| 1097 | 1097 | function liste_rubriques_auteur($id_auteur, $raz = false) { |
| 1098 | - static $restreint = array(); |
|
| 1099 | - |
|
| 1100 | - if (!$id_auteur = intval($id_auteur)) { |
|
| 1101 | - return array(); |
|
| 1102 | - } |
|
| 1103 | - if ($raz) { |
|
| 1104 | - unset($restreint[$id_auteur]); |
|
| 1105 | - } elseif (isset($restreint[$id_auteur])) { |
|
| 1106 | - return $restreint[$id_auteur]; |
|
| 1107 | - } |
|
| 1108 | - |
|
| 1109 | - $rubriques = array(); |
|
| 1110 | - if ((!isset($GLOBALS['meta']['version_installee']) |
|
| 1111 | - or $GLOBALS['meta']['version_installee'] > 16428) |
|
| 1112 | - and $r = sql_allfetsel( |
|
| 1113 | - 'id_objet', |
|
| 1114 | - 'spip_auteurs_liens', |
|
| 1115 | - 'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0" |
|
| 1116 | - ) |
|
| 1117 | - and count($r) |
|
| 1118 | - ) { |
|
| 1119 | - $r = array_column($r, 'id_objet'); |
|
| 1120 | - |
|
| 1121 | - // recuperer toute la branche, au format chaine enumeration |
|
| 1122 | - include_spip('inc/rubriques'); |
|
| 1123 | - $r = calcul_branche_in($r); |
|
| 1124 | - $r = explode(',', $r); |
|
| 1125 | - |
|
| 1126 | - // passer les rubriques en index, elimine les doublons |
|
| 1127 | - $r = array_flip($r); |
|
| 1128 | - // recuperer les index seuls |
|
| 1129 | - $r = array_keys($r); |
|
| 1130 | - // combiner pour avoir un tableau id_rubrique=>id_rubrique |
|
| 1131 | - // est-ce vraiment utile ? (on preserve la forme donnee par le code precedent) |
|
| 1132 | - $rubriques = array_combine($r, $r); |
|
| 1133 | - } |
|
| 1134 | - |
|
| 1135 | - // Affecter l'auteur session le cas echeant |
|
| 1136 | - if (isset($GLOBALS['visiteur_session']['id_auteur']) |
|
| 1137 | - and $GLOBALS['visiteur_session']['id_auteur'] == $id_auteur |
|
| 1138 | - ) { |
|
| 1139 | - $GLOBALS['visiteur_session']['restreint'] = $rubriques; |
|
| 1140 | - } |
|
| 1141 | - |
|
| 1142 | - |
|
| 1143 | - return $restreint[$id_auteur] = $rubriques; |
|
| 1098 | + static $restreint = array(); |
|
| 1099 | + |
|
| 1100 | + if (!$id_auteur = intval($id_auteur)) { |
|
| 1101 | + return array(); |
|
| 1102 | + } |
|
| 1103 | + if ($raz) { |
|
| 1104 | + unset($restreint[$id_auteur]); |
|
| 1105 | + } elseif (isset($restreint[$id_auteur])) { |
|
| 1106 | + return $restreint[$id_auteur]; |
|
| 1107 | + } |
|
| 1108 | + |
|
| 1109 | + $rubriques = array(); |
|
| 1110 | + if ((!isset($GLOBALS['meta']['version_installee']) |
|
| 1111 | + or $GLOBALS['meta']['version_installee'] > 16428) |
|
| 1112 | + and $r = sql_allfetsel( |
|
| 1113 | + 'id_objet', |
|
| 1114 | + 'spip_auteurs_liens', |
|
| 1115 | + 'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0" |
|
| 1116 | + ) |
|
| 1117 | + and count($r) |
|
| 1118 | + ) { |
|
| 1119 | + $r = array_column($r, 'id_objet'); |
|
| 1120 | + |
|
| 1121 | + // recuperer toute la branche, au format chaine enumeration |
|
| 1122 | + include_spip('inc/rubriques'); |
|
| 1123 | + $r = calcul_branche_in($r); |
|
| 1124 | + $r = explode(',', $r); |
|
| 1125 | + |
|
| 1126 | + // passer les rubriques en index, elimine les doublons |
|
| 1127 | + $r = array_flip($r); |
|
| 1128 | + // recuperer les index seuls |
|
| 1129 | + $r = array_keys($r); |
|
| 1130 | + // combiner pour avoir un tableau id_rubrique=>id_rubrique |
|
| 1131 | + // est-ce vraiment utile ? (on preserve la forme donnee par le code precedent) |
|
| 1132 | + $rubriques = array_combine($r, $r); |
|
| 1133 | + } |
|
| 1134 | + |
|
| 1135 | + // Affecter l'auteur session le cas echeant |
|
| 1136 | + if (isset($GLOBALS['visiteur_session']['id_auteur']) |
|
| 1137 | + and $GLOBALS['visiteur_session']['id_auteur'] == $id_auteur |
|
| 1138 | + ) { |
|
| 1139 | + $GLOBALS['visiteur_session']['restreint'] = $rubriques; |
|
| 1140 | + } |
|
| 1141 | + |
|
| 1142 | + |
|
| 1143 | + return $restreint[$id_auteur] = $rubriques; |
|
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | /** |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | * @return bool true s'il a le droit, false sinon |
| 1157 | 1157 | **/ |
| 1158 | 1158 | function autoriser_rubrique_previsualiser_dist($faire, $type, $id, $qui, $opt) { |
| 1159 | - return autoriser('previsualiser'); |
|
| 1159 | + return autoriser('previsualiser'); |
|
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | 1162 | /** |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | * @return bool true s'il a le droit, false sinon |
| 1173 | 1173 | **/ |
| 1174 | 1174 | function autoriser_rubrique_iconifier_dist($faire, $type, $id, $qui, $opt) { |
| 1175 | - return autoriser('publierdans', 'rubrique', $id, $qui, $opt); |
|
| 1175 | + return autoriser('publierdans', 'rubrique', $id, $qui, $opt); |
|
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | 1178 | /** |
@@ -1188,8 +1188,8 @@ discard block |
||
| 1188 | 1188 | * @return bool true s'il a le droit, false sinon |
| 1189 | 1189 | **/ |
| 1190 | 1190 | function autoriser_auteur_iconifier_dist($faire, $type, $id, $qui, $opt) { |
| 1191 | - return (($id == $qui['id_auteur']) or |
|
| 1192 | - (($qui['statut'] == '0minirezo') and !$qui['restreint'])); |
|
| 1191 | + return (($id == $qui['id_auteur']) or |
|
| 1192 | + (($qui['statut'] == '0minirezo') and !$qui['restreint'])); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | /** |
@@ -1205,8 +1205,8 @@ discard block |
||
| 1205 | 1205 | * @return bool true s'il a le droit, false sinon |
| 1206 | 1206 | **/ |
| 1207 | 1207 | function autoriser_iconifier_dist($faire, $type, $id, $qui, $opt) { |
| 1208 | - // par defaut, on a le droit d'iconifier si on a le droit de modifier |
|
| 1209 | - return autoriser('modifier', $type, $id, $qui, $opt); |
|
| 1208 | + // par defaut, on a le droit d'iconifier si on a le droit de modifier |
|
| 1209 | + return autoriser('modifier', $type, $id, $qui, $opt); |
|
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | |
@@ -1224,7 +1224,7 @@ discard block |
||
| 1224 | 1224 | * @return bool true |
| 1225 | 1225 | **/ |
| 1226 | 1226 | function autoriser_ok_dist($faire, $type, $id, $qui, $opt) { |
| 1227 | - return true; |
|
| 1227 | + return true; |
|
| 1228 | 1228 | } |
| 1229 | 1229 | |
| 1230 | 1230 | /** |
@@ -1241,7 +1241,7 @@ discard block |
||
| 1241 | 1241 | * @return bool false |
| 1242 | 1242 | **/ |
| 1243 | 1243 | function autoriser_niet_dist($faire, $type, $id, $qui, $opt) { |
| 1244 | - return false; |
|
| 1244 | + return false; |
|
| 1245 | 1245 | } |
| 1246 | 1246 | |
| 1247 | 1247 | /** |
@@ -1257,11 +1257,11 @@ discard block |
||
| 1257 | 1257 | * @return bool false |
| 1258 | 1258 | **/ |
| 1259 | 1259 | function autoriser_base_reparer_dist($faire, $type, $id, $qui, $opt) { |
| 1260 | - if (!autoriser('detruire') or _request('reinstall')) { |
|
| 1261 | - return false; |
|
| 1262 | - } |
|
| 1260 | + if (!autoriser('detruire') or _request('reinstall')) { |
|
| 1261 | + return false; |
|
| 1262 | + } |
|
| 1263 | 1263 | |
| 1264 | - return true; |
|
| 1264 | + return true; |
|
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | 1267 | /** |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | * @return bool true s'il a le droit, false sinon |
| 1278 | 1278 | **/ |
| 1279 | 1279 | function autoriser_infosperso_dist($faire, $type, $id, $qui, $opt) { |
| 1280 | - return true; |
|
| 1280 | + return true; |
|
| 1281 | 1281 | } |
| 1282 | 1282 | |
| 1283 | 1283 | /** |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | * @return bool true s'il a le droit, false sinon |
| 1294 | 1294 | **/ |
| 1295 | 1295 | function autoriser_langage_configurer_dist($faire, $type, $id, $qui, $opt) { |
| 1296 | - return true; |
|
| 1296 | + return true; |
|
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | /** |
@@ -1309,7 +1309,7 @@ discard block |
||
| 1309 | 1309 | * @return bool true s'il a le droit, false sinon |
| 1310 | 1310 | **/ |
| 1311 | 1311 | function autoriser_configurerlangage_dist($faire, $type, $id, $qui, $opt) { |
| 1312 | - return autoriser('configurer', '_langage', $id, $qui, $opt); |
|
| 1312 | + return autoriser('configurer', '_langage', $id, $qui, $opt); |
|
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | 1315 | /** |
@@ -1325,7 +1325,7 @@ discard block |
||
| 1325 | 1325 | * @return bool true s'il a le droit, false sinon |
| 1326 | 1326 | **/ |
| 1327 | 1327 | function autoriser_preferences_configurer_dist($faire, $type, $id, $qui, $opt) { |
| 1328 | - return true; |
|
| 1328 | + return true; |
|
| 1329 | 1329 | } |
| 1330 | 1330 | |
| 1331 | 1331 | /** |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | * @return bool true s'il a le droit, false sinon |
| 1342 | 1342 | **/ |
| 1343 | 1343 | function autoriser_configurerpreferences_dist($faire, $type, $id, $qui, $opt) { |
| 1344 | - return autoriser('configurer', '_preferences', $id, $qui, $opt); |
|
| 1344 | + return autoriser('configurer', '_preferences', $id, $qui, $opt); |
|
| 1345 | 1345 | } |
| 1346 | 1346 | |
| 1347 | 1347 | /** |
@@ -1357,8 +1357,8 @@ discard block |
||
| 1357 | 1357 | * @return bool true s'il a le droit, false sinon |
| 1358 | 1358 | **/ |
| 1359 | 1359 | function autoriser_menudeveloppement_menugrandeentree_dist($faire, $type, $id, $qui, $opt) { |
| 1360 | - return (isset($GLOBALS['visiteur_session']['prefs']['activer_menudev']) |
|
| 1361 | - and $GLOBALS['visiteur_session']['prefs']['activer_menudev'] == 'oui'); |
|
| 1360 | + return (isset($GLOBALS['visiteur_session']['prefs']['activer_menudev']) |
|
| 1361 | + and $GLOBALS['visiteur_session']['prefs']['activer_menudev'] == 'oui'); |
|
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | 1364 | /** |
@@ -1375,7 +1375,7 @@ discard block |
||
| 1375 | 1375 | * @return bool true s'il a le droit, false sinon |
| 1376 | 1376 | **/ |
| 1377 | 1377 | function autoriser_menugrandeentree_dist($faire, $type, $id, $qui, $opt) { |
| 1378 | - return true; |
|
| 1378 | + return true; |
|
| 1379 | 1379 | } |
| 1380 | 1380 | |
| 1381 | 1381 | /** |
@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | * @return bool true s'il a le droit, false sinon |
| 1392 | 1392 | **/ |
| 1393 | 1393 | function autoriser_auteurs_voir_dist($faire, $type, $id, $qui, $opt) { |
| 1394 | - return true; |
|
| 1394 | + return true; |
|
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 1397 | /** |
@@ -1407,7 +1407,7 @@ discard block |
||
| 1407 | 1407 | * @return bool true s'il a le droit, false sinon |
| 1408 | 1408 | **/ |
| 1409 | 1409 | function autoriser_auteurs_menu_dist($faire, $type, $id, $qui, $opt) { |
| 1410 | - return autoriser('voir', '_auteurs', $id, $qui, $opt); |
|
| 1410 | + return autoriser('voir', '_auteurs', $id, $qui, $opt); |
|
| 1411 | 1411 | } |
| 1412 | 1412 | |
| 1413 | 1413 | /** |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | * @return bool true s'il a le droit, false sinon |
| 1424 | 1424 | **/ |
| 1425 | 1425 | function autoriser_articles_voir_dist($faire, $type, $id, $qui, $opt) { |
| 1426 | - return true; |
|
| 1426 | + return true; |
|
| 1427 | 1427 | } |
| 1428 | 1428 | |
| 1429 | 1429 | /** |
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | * @return bool true s'il a le droit, false sinon |
| 1440 | 1440 | **/ |
| 1441 | 1441 | function autoriser_articles_menu_dist($faire, $type, $id, $qui, $opt) { |
| 1442 | - return autoriser('voir', '_articles', $id, $qui, $opt); |
|
| 1442 | + return autoriser('voir', '_articles', $id, $qui, $opt); |
|
| 1443 | 1443 | } |
| 1444 | 1444 | |
| 1445 | 1445 | /** |
@@ -1455,7 +1455,7 @@ discard block |
||
| 1455 | 1455 | * @return bool true s'il a le droit, false sinon |
| 1456 | 1456 | **/ |
| 1457 | 1457 | function autoriser_rubriques_voir_dist($faire, $type, $id, $qui, $opt) { |
| 1458 | - return true; |
|
| 1458 | + return true; |
|
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | 1461 | /** |
@@ -1471,7 +1471,7 @@ discard block |
||
| 1471 | 1471 | * @return bool true s'il a le droit, false sinon |
| 1472 | 1472 | **/ |
| 1473 | 1473 | function autoriser_rubriques_menu_dist($faire, $type, $id, $qui, $opt) { |
| 1474 | - return autoriser('voir', '_rubriques', $id, $qui, $opt); |
|
| 1474 | + return autoriser('voir', '_rubriques', $id, $qui, $opt); |
|
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | 1477 | /** |
@@ -1487,7 +1487,7 @@ discard block |
||
| 1487 | 1487 | * @return bool true s'il a le droit, false sinon |
| 1488 | 1488 | **/ |
| 1489 | 1489 | function autoriser_articlecreer_menu_dist($faire, $type, $id, $qui, $opt) { |
| 1490 | - return verifier_table_non_vide(); |
|
| 1490 | + return verifier_table_non_vide(); |
|
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | 1493 | |
@@ -1506,7 +1506,7 @@ discard block |
||
| 1506 | 1506 | * @return bool true s'il a le droit, false sinon |
| 1507 | 1507 | **/ |
| 1508 | 1508 | function autoriser_auteurcreer_menu_dist($faire, $type, $id, $qui, $opt) { |
| 1509 | - return autoriser('creer', 'auteur', $id, $qui, $opt); |
|
| 1509 | + return autoriser('creer', 'auteur', $id, $qui, $opt); |
|
| 1510 | 1510 | } |
| 1511 | 1511 | |
| 1512 | 1512 | /** |
@@ -1522,13 +1522,13 @@ discard block |
||
| 1522 | 1522 | * @return bool true s'il a le droit, false sinon |
| 1523 | 1523 | **/ |
| 1524 | 1524 | function autoriser_visiteurs_menu_dist($faire, $type, $id, $qui, $opt) { |
| 1525 | - include_spip('base/abstract_sql'); |
|
| 1526 | - return |
|
| 1527 | - $qui['statut'] == '0minirezo' and !$qui['restreint'] |
|
| 1528 | - and ( |
|
| 1529 | - $GLOBALS['meta']["accepter_visiteurs"] != 'non' |
|
| 1530 | - or sql_countsel('spip_auteurs', 'statut in ("6forum", "nouveau")') > 0 |
|
| 1531 | - ); |
|
| 1525 | + include_spip('base/abstract_sql'); |
|
| 1526 | + return |
|
| 1527 | + $qui['statut'] == '0minirezo' and !$qui['restreint'] |
|
| 1528 | + and ( |
|
| 1529 | + $GLOBALS['meta']["accepter_visiteurs"] != 'non' |
|
| 1530 | + or sql_countsel('spip_auteurs', 'statut in ("6forum", "nouveau")') > 0 |
|
| 1531 | + ); |
|
| 1532 | 1532 | } |
| 1533 | 1533 | |
| 1534 | 1534 | /** |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | * @return bool true s'il a le droit, false sinon |
| 1545 | 1545 | **/ |
| 1546 | 1546 | function autoriser_suiviedito_menu_dist($faire, $type, $id, $qui, $opt) { |
| 1547 | - return $qui['statut'] == '0minirezo'; |
|
| 1547 | + return $qui['statut'] == '0minirezo'; |
|
| 1548 | 1548 | } |
| 1549 | 1549 | |
| 1550 | 1550 | /** |
@@ -1560,7 +1560,7 @@ discard block |
||
| 1560 | 1560 | * @return bool true s'il a le droit, false sinon |
| 1561 | 1561 | **/ |
| 1562 | 1562 | function autoriser_synchro_menu_dist($faire, $type, $id, $qui, $opt) { |
| 1563 | - return $qui['statut'] == '0minirezo'; |
|
| 1563 | + return $qui['statut'] == '0minirezo'; |
|
| 1564 | 1564 | } |
| 1565 | 1565 | |
| 1566 | 1566 | /** |
@@ -1688,7 +1688,7 @@ discard block |
||
| 1688 | 1688 | * @return bool true s'il a le droit, false sinon |
| 1689 | 1689 | **/ |
| 1690 | 1690 | function autoriser_queue_purger_dist($faire, $type, $id, $qui, $opt) { |
| 1691 | - return autoriser('webmestre'); |
|
| 1691 | + return autoriser('webmestre'); |
|
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | 1694 | |
@@ -1706,11 +1706,11 @@ discard block |
||
| 1706 | 1706 | * @return bool true s'il a le droit, false sinon |
| 1707 | 1707 | **/ |
| 1708 | 1708 | function autoriser_echafauder_dist($faire, $type, $id, $qui, $opt) { |
| 1709 | - if (test_espace_prive()) { |
|
| 1710 | - return intval($qui['id_auteur']) ? true : false; |
|
| 1711 | - } else { |
|
| 1712 | - return autoriser('webmestre', '', $id, $qui, $opt); |
|
| 1713 | - } |
|
| 1709 | + if (test_espace_prive()) { |
|
| 1710 | + return intval($qui['id_auteur']) ? true : false; |
|
| 1711 | + } else { |
|
| 1712 | + return autoriser('webmestre', '', $id, $qui, $opt); |
|
| 1713 | + } |
|
| 1714 | 1714 | } |
| 1715 | 1715 | |
| 1716 | 1716 | |
@@ -1725,27 +1725,27 @@ discard block |
||
| 1725 | 1725 | * Identifiants d'auteurs |
| 1726 | 1726 | */ |
| 1727 | 1727 | function auteurs_objet($objet, $id_objet, $cond = '') { |
| 1728 | - $objet = objet_type($objet); |
|
| 1729 | - $where = array( |
|
| 1730 | - 'objet=' . sql_quote($objet), |
|
| 1731 | - 'id_objet=' . intval($id_objet) |
|
| 1732 | - ); |
|
| 1733 | - if (!empty($cond)) { |
|
| 1734 | - if (is_array($cond)) { |
|
| 1735 | - $where = array_merge($where, $cond); |
|
| 1736 | - } else { |
|
| 1737 | - $where[] = $cond; |
|
| 1738 | - } |
|
| 1739 | - } |
|
| 1740 | - $auteurs = sql_allfetsel( |
|
| 1741 | - 'id_auteur', |
|
| 1742 | - 'spip_auteurs_liens', |
|
| 1743 | - $where |
|
| 1744 | - ); |
|
| 1745 | - if (is_array($auteurs)) { |
|
| 1746 | - return array_column($auteurs, 'id_auteur'); |
|
| 1747 | - } |
|
| 1748 | - return array(); |
|
| 1728 | + $objet = objet_type($objet); |
|
| 1729 | + $where = array( |
|
| 1730 | + 'objet=' . sql_quote($objet), |
|
| 1731 | + 'id_objet=' . intval($id_objet) |
|
| 1732 | + ); |
|
| 1733 | + if (!empty($cond)) { |
|
| 1734 | + if (is_array($cond)) { |
|
| 1735 | + $where = array_merge($where, $cond); |
|
| 1736 | + } else { |
|
| 1737 | + $where[] = $cond; |
|
| 1738 | + } |
|
| 1739 | + } |
|
| 1740 | + $auteurs = sql_allfetsel( |
|
| 1741 | + 'id_auteur', |
|
| 1742 | + 'spip_auteurs_liens', |
|
| 1743 | + $where |
|
| 1744 | + ); |
|
| 1745 | + if (is_array($auteurs)) { |
|
| 1746 | + return array_column($auteurs, 'id_auteur'); |
|
| 1747 | + } |
|
| 1748 | + return array(); |
|
| 1749 | 1749 | } |
| 1750 | 1750 | |
| 1751 | 1751 | /** |
@@ -1759,11 +1759,11 @@ discard block |
||
| 1759 | 1759 | * - false : serveur SQL indisponible |
| 1760 | 1760 | */ |
| 1761 | 1761 | function auteurs_article($id_article, $cond = '') { |
| 1762 | - return sql_allfetsel( |
|
| 1763 | - 'id_auteur', |
|
| 1764 | - 'spip_auteurs_liens', |
|
| 1765 | - "objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '') |
|
| 1766 | - ); |
|
| 1762 | + return sql_allfetsel( |
|
| 1763 | + 'id_auteur', |
|
| 1764 | + 'spip_auteurs_liens', |
|
| 1765 | + "objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '') |
|
| 1766 | + ); |
|
| 1767 | 1767 | } |
| 1768 | 1768 | |
| 1769 | 1769 | |
@@ -1777,7 +1777,7 @@ discard block |
||
| 1777 | 1777 | */ |
| 1778 | 1778 | function acces_restreint_rubrique($id_rubrique) { |
| 1779 | 1779 | |
| 1780 | - return (isset($GLOBALS['connect_id_rubrique'][$id_rubrique])); |
|
| 1780 | + return (isset($GLOBALS['connect_id_rubrique'][$id_rubrique])); |
|
| 1781 | 1781 | } |
| 1782 | 1782 | |
| 1783 | 1783 | |
@@ -1790,12 +1790,12 @@ discard block |
||
| 1790 | 1790 | * @return bool true si un parent existe |
| 1791 | 1791 | */ |
| 1792 | 1792 | function verifier_table_non_vide($table = 'spip_rubriques') { |
| 1793 | - static $done = array(); |
|
| 1794 | - if (!isset($done[$table])) { |
|
| 1795 | - $done[$table] = sql_countsel($table) > 0; |
|
| 1796 | - } |
|
| 1793 | + static $done = array(); |
|
| 1794 | + if (!isset($done[$table])) { |
|
| 1795 | + $done[$table] = sql_countsel($table) > 0; |
|
| 1796 | + } |
|
| 1797 | 1797 | |
| 1798 | - return $done[$table]; |
|
| 1798 | + return $done[$table]; |
|
| 1799 | 1799 | } |
| 1800 | 1800 | |
| 1801 | 1801 | /** |
@@ -1820,15 +1820,15 @@ discard block |
||
| 1820 | 1820 | */ |
| 1821 | 1821 | function autoriser_inscrireauteur_dist($faire, $quoi, $id, $qui, $opt) { |
| 1822 | 1822 | |
| 1823 | - $s = array_search($quoi, $GLOBALS['liste_des_statuts']); |
|
| 1824 | - switch ($s) { |
|
| 1825 | - case 'info_redacteurs': |
|
| 1826 | - return ($GLOBALS['meta']['accepter_inscriptions'] == 'oui'); |
|
| 1827 | - case 'info_visiteurs': |
|
| 1828 | - return ($GLOBALS['meta']['accepter_visiteurs'] == 'oui' or $GLOBALS['meta']['forums_publics'] == 'abo'); |
|
| 1829 | - } |
|
| 1823 | + $s = array_search($quoi, $GLOBALS['liste_des_statuts']); |
|
| 1824 | + switch ($s) { |
|
| 1825 | + case 'info_redacteurs': |
|
| 1826 | + return ($GLOBALS['meta']['accepter_inscriptions'] == 'oui'); |
|
| 1827 | + case 'info_visiteurs': |
|
| 1828 | + return ($GLOBALS['meta']['accepter_visiteurs'] == 'oui' or $GLOBALS['meta']['forums_publics'] == 'abo'); |
|
| 1829 | + } |
|
| 1830 | 1830 | |
| 1831 | - return false; |
|
| 1831 | + return false; |
|
| 1832 | 1832 | } |
| 1833 | 1833 | |
| 1834 | 1834 | |
@@ -1845,5 +1845,5 @@ discard block |
||
| 1845 | 1845 | * @return bool true s'il a le droit, false sinon |
| 1846 | 1846 | **/ |
| 1847 | 1847 | function autoriser_phpinfos($faire, $type, $id, $qui, $opt) { |
| 1848 | - return autoriser('webmestre'); |
|
| 1848 | + return autoriser('webmestre'); |
|
| 1849 | 1849 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | // mais apres la fonction autoriser() |
| 115 | 115 | if ($f = find_in_path('mes_fonctions.php')) { |
| 116 | 116 | global $dossier_squelettes; |
| 117 | - include_once(_ROOT_CWD . $f); |
|
| 117 | + include_once(_ROOT_CWD.$f); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $qui = $GLOBALS['visiteur_session'] ? $GLOBALS['visiteur_session'] : array(); |
| 149 | 149 | $qui = array_merge(array('statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'), $qui); |
| 150 | 150 | } elseif (is_numeric($qui)) { |
| 151 | - $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui); |
|
| 151 | + $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur='.$qui); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Admins restreints, on construit ici (pas generique mais...) |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | spip_log( |
| 161 | - "autoriser $faire $type $id (" . (isset($qui['nom']) ? $qui['nom'] : '') . ') ?', |
|
| 162 | - 'autoriser' . _LOG_DEBUG |
|
| 161 | + "autoriser $faire $type $id (".(isset($qui['nom']) ? $qui['nom'] : '').') ?', |
|
| 162 | + 'autoriser'._LOG_DEBUG |
|
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | 165 | // passer par objet_type pour avoir les alias |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | if (isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) |
| 171 | 171 | and autoriser_exception($faire, $type, $id, 'verifier') |
| 172 | 172 | ) { |
| 173 | - spip_log("autoriser ($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG); |
|
| 173 | + spip_log("autoriser ($faire, $type, $id, ".(isset($qui['nom']) ? $qui['nom'] : '').') : OK Exception', 'autoriser'._LOG_DEBUG); |
|
| 174 | 174 | return true; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -179,18 +179,18 @@ discard block |
||
| 179 | 179 | // autoriser_faire[_dist], autoriser_defaut[_dist] |
| 180 | 180 | $fonctions = $type |
| 181 | 181 | ? array( |
| 182 | - 'autoriser_' . $type . '_' . $faire, |
|
| 183 | - 'autoriser_' . $type . '_' . $faire . '_dist', |
|
| 184 | - 'autoriser_' . $type, |
|
| 185 | - 'autoriser_' . $type . '_dist', |
|
| 186 | - 'autoriser_' . $faire, |
|
| 187 | - 'autoriser_' . $faire . '_dist', |
|
| 182 | + 'autoriser_'.$type.'_'.$faire, |
|
| 183 | + 'autoriser_'.$type.'_'.$faire.'_dist', |
|
| 184 | + 'autoriser_'.$type, |
|
| 185 | + 'autoriser_'.$type.'_dist', |
|
| 186 | + 'autoriser_'.$faire, |
|
| 187 | + 'autoriser_'.$faire.'_dist', |
|
| 188 | 188 | 'autoriser_defaut', |
| 189 | 189 | 'autoriser_defaut_dist' |
| 190 | 190 | ) |
| 191 | 191 | : array( |
| 192 | - 'autoriser_' . $faire, |
|
| 193 | - 'autoriser_' . $faire . '_dist', |
|
| 192 | + 'autoriser_'.$faire, |
|
| 193 | + 'autoriser_'.$faire.'_dist', |
|
| 194 | 194 | 'autoriser_defaut', |
| 195 | 195 | 'autoriser_defaut_dist' |
| 196 | 196 | ); |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | spip_log( |
| 206 | - "$f($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : ' . ($a ? 'OK' : 'niet'), |
|
| 207 | - 'autoriser' . _LOG_DEBUG |
|
| 206 | + "$f($faire, $type, $id, ".(isset($qui['nom']) ? $qui['nom'] : '').') : '.($a ? 'OK' : 'niet'), |
|
| 207 | + 'autoriser'._LOG_DEBUG |
|
| 208 | 208 | ); |
| 209 | 209 | |
| 210 | 210 | return $a; |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | function autoriser_previsualiser_dist($faire, $type, $id, $qui, $opt) { |
| 327 | 327 | |
| 328 | 328 | // Le visiteur a-t-il un statut prevu par la config ? |
| 329 | - if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) { |
|
| 329 | + if (strpos($GLOBALS['meta']['preview'], ','.$qui['statut'].',') !== false) { |
|
| 330 | 330 | return test_previsualiser_objet_champ($type, $id, $qui, $opt); |
| 331 | 331 | } |
| 332 | 332 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } // pas de champ passe a la demande => NIET |
| 384 | 384 | $previsu = explode(',', $c['previsu']); |
| 385 | 385 | // regarder si ce statut est autorise pour l'auteur |
| 386 | - if (in_array($opt[$champ] . '/auteur', $previsu)) { |
|
| 386 | + if (in_array($opt[$champ].'/auteur', $previsu)) { |
|
| 387 | 387 | |
| 388 | 388 | // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement, |
| 389 | 389 | // sinon l’auteur en session |
@@ -398,11 +398,11 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | if (!$id_auteur) { |
| 400 | 400 | return false; |
| 401 | - } elseif(autoriser('previsualiser' . $opt[$champ], $type, '', $id_auteur)) { |
|
| 401 | + } elseif (autoriser('previsualiser'.$opt[$champ], $type, '', $id_auteur)) { |
|
| 402 | 402 | // dans ce cas (admin en general), pas de filtrage sur ce statut |
| 403 | 403 | } elseif (!sql_countsel( |
| 404 | 404 | 'spip_auteurs_liens', |
| 405 | - 'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id) |
|
| 405 | + 'id_auteur='.intval($id_auteur).' AND objet='.sql_quote($type).' AND id_objet='.intval($id) |
|
| 406 | 406 | )) { |
| 407 | 407 | return false; |
| 408 | 408 | } // pas auteur de cet objet => NIET |
@@ -440,16 +440,16 @@ discard block |
||
| 440 | 440 | // multilinguisme par secteur et objet rattaché à une rubrique |
| 441 | 441 | $primary = id_table_objet($type); |
| 442 | 442 | if ($table != 'spip_rubriques') { |
| 443 | - $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id)); |
|
| 443 | + $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=".intval($id)); |
|
| 444 | 444 | } else { |
| 445 | 445 | $id_rubrique = $id; |
| 446 | 446 | } |
| 447 | - $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 447 | + $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique)); |
|
| 448 | 448 | if (!$id_secteur > 0) { |
| 449 | 449 | $id_secteur = $id_rubrique; |
| 450 | 450 | } |
| 451 | - $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur)); |
|
| 452 | - $langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id)); |
|
| 451 | + $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique='.intval($id_secteur)); |
|
| 452 | + $langue_objet = sql_getfetsel('lang', "$table", "$primary=".intval($id)); |
|
| 453 | 453 | if ($langue_secteur != $langue_objet) { |
| 454 | 454 | // configuration incohérente, on laisse l'utilisateur corriger la situation |
| 455 | 455 | return true; |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques |
| 458 | 458 | return false; |
| 459 | 459 | } else { |
| 460 | - $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id)); |
|
| 460 | + $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id)); |
|
| 461 | 461 | if ($id_parent != 0) { |
| 462 | 462 | // sous-rubriques : pas de choix de langue |
| 463 | 463 | return false; |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | |
| 506 | 506 | if (!isset($opt['statut'])) { |
| 507 | 507 | if (isset($desc['field']['statut'])) { |
| 508 | - $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id)); |
|
| 508 | + $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type).'='.intval($id)); |
|
| 509 | 509 | } else { |
| 510 | 510 | $statut = 'publie'; |
| 511 | 511 | } // pas de statut => publie |
@@ -663,11 +663,11 @@ discard block |
||
| 663 | 663 | return false; |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | - if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) { |
|
| 666 | + if (sql_countsel('spip_rubriques', 'id_parent='.intval($id))) { |
|
| 667 | 667 | return false; |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | - if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) { |
|
| 670 | + if (sql_countsel('spip_articles', 'id_rubrique='.intval($id)." AND (statut<>'poubelle')")) { |
|
| 671 | 671 | return false; |
| 672 | 672 | } |
| 673 | 673 | |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | * @return bool true s'il a le droit, false sinon |
| 700 | 700 | **/ |
| 701 | 701 | function autoriser_article_modifier_dist($faire, $type, $id, $qui, $opt) { |
| 702 | - $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id)); |
|
| 702 | + $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article='.sql_quote($id)); |
|
| 703 | 703 | |
| 704 | 704 | return |
| 705 | 705 | $r |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | (!isset($opt['statut']) or $opt['statut'] !== 'publie') |
| 711 | 711 | and in_array($qui['statut'], array('0minirezo', '1comite')) |
| 712 | 712 | and in_array($r['statut'], array('prop', 'prepa', 'poubelle')) |
| 713 | - and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']) |
|
| 713 | + and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur']) |
|
| 714 | 714 | ) |
| 715 | 715 | ); |
| 716 | 716 | } |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | if (!$id) { |
| 759 | 759 | return false; |
| 760 | 760 | } |
| 761 | - $statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id)); |
|
| 761 | + $statut = sql_getfetsel('statut', 'spip_articles', 'id_article='.intval($id)); |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | return |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | or |
| 770 | 770 | ($id |
| 771 | 771 | and $qui['id_auteur'] |
| 772 | - and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])); |
|
| 772 | + and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur'])); |
|
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | |
@@ -787,8 +787,8 @@ discard block |
||
| 787 | 787 | **/ |
| 788 | 788 | function autoriser_voir_dist($faire, $type, $id, $qui, $opt) { |
| 789 | 789 | # securite, mais on aurait pas du arriver ici ! |
| 790 | - if (function_exists($f = 'autoriser_' . $type . '_voir') |
|
| 791 | - or function_exists($f = 'autoriser_' . $type . '_voir_dist')) { |
|
| 790 | + if (function_exists($f = 'autoriser_'.$type.'_voir') |
|
| 791 | + or function_exists($f = 'autoriser_'.$type.'_voir_dist')) { |
|
| 792 | 792 | return $f($faire, $type, $id, $qui, $opt); |
| 793 | 793 | } |
| 794 | 794 | |
@@ -906,7 +906,7 @@ discard block |
||
| 906 | 906 | $n = sql_fetsel( |
| 907 | 907 | 'A.id_article', |
| 908 | 908 | 'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)', |
| 909 | - "A.statut='publie' AND L.id_auteur=" . sql_quote($id) |
|
| 909 | + "A.statut='publie' AND L.id_auteur=".sql_quote($id) |
|
| 910 | 910 | ); |
| 911 | 911 | |
| 912 | 912 | return $n ? true : false; |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | and $r = sql_allfetsel( |
| 1113 | 1113 | 'id_objet', |
| 1114 | 1114 | 'spip_auteurs_liens', |
| 1115 | - 'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0" |
|
| 1115 | + 'id_auteur='.intval($id_auteur)." AND objet='rubrique' AND id_objet!=0" |
|
| 1116 | 1116 | ) |
| 1117 | 1117 | and count($r) |
| 1118 | 1118 | ) { |
@@ -1727,8 +1727,8 @@ discard block |
||
| 1727 | 1727 | function auteurs_objet($objet, $id_objet, $cond = '') { |
| 1728 | 1728 | $objet = objet_type($objet); |
| 1729 | 1729 | $where = array( |
| 1730 | - 'objet=' . sql_quote($objet), |
|
| 1731 | - 'id_objet=' . intval($id_objet) |
|
| 1730 | + 'objet='.sql_quote($objet), |
|
| 1731 | + 'id_objet='.intval($id_objet) |
|
| 1732 | 1732 | ); |
| 1733 | 1733 | if (!empty($cond)) { |
| 1734 | 1734 | if (is_array($cond)) { |
@@ -1762,7 +1762,7 @@ discard block |
||
| 1762 | 1762 | return sql_allfetsel( |
| 1763 | 1763 | 'id_auteur', |
| 1764 | 1764 | 'spip_auteurs_liens', |
| 1765 | - "objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '') |
|
| 1765 | + "objet='article' AND id_objet=".intval($id_article).($cond ? " AND $cond" : '') |
|
| 1766 | 1766 | ); |
| 1767 | 1767 | } |
| 1768 | 1768 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Filtres |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/charsets'); |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @return string Fonction PHP correspondante du filtre |
| 43 | 43 | */ |
| 44 | 44 | function charger_filtre($fonc, $default = 'filtre_identite_dist') { |
| 45 | - include_spip('public/parametrer'); // inclure les fichiers fonctions |
|
| 46 | - return chercher_filtre($fonc, $default); |
|
| 45 | + include_spip('public/parametrer'); // inclure les fichiers fonctions |
|
| 46 | + return chercher_filtre($fonc, $default); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -75,36 +75,36 @@ discard block |
||
| 75 | 75 | * Fonction PHP correspondante du filtre demandé |
| 76 | 76 | */ |
| 77 | 77 | function chercher_filtre($fonc, $default = null) { |
| 78 | - if (!$fonc) { |
|
| 79 | - return $default; |
|
| 80 | - } |
|
| 81 | - // Cas des types mime, sans confondre avec les appels de fonction de classe |
|
| 82 | - // Foo::Bar |
|
| 83 | - // qui peuvent etre avec un namespace : space\Foo::Bar |
|
| 84 | - if (preg_match(',^[\w]+/,', $fonc)) { |
|
| 85 | - $nom = preg_replace(',\W,', '_', $fonc); |
|
| 86 | - $f = chercher_filtre($nom); |
|
| 87 | - // cas du sous-type MIME sans filtre associe, passer au type: |
|
| 88 | - // si filtre_text_plain pas defini, passe a filtre_text |
|
| 89 | - if (!$f and $nom !== $fonc) { |
|
| 90 | - $f = chercher_filtre(preg_replace(',\W.*$,', '', $fonc)); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - return $f; |
|
| 94 | - } |
|
| 95 | - foreach (array('filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc) as $f) { |
|
| 96 | - trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels |
|
| 97 | - // fonction ou name\space\fonction |
|
| 98 | - if (is_callable($f)) { |
|
| 99 | - return $f; |
|
| 100 | - } |
|
| 101 | - // méthode statique d'une classe Classe::methode ou name\space\Classe::methode |
|
| 102 | - elseif (false === strpos($f, '::') and is_callable(array($f))) { |
|
| 103 | - return $f; |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - return $default; |
|
| 78 | + if (!$fonc) { |
|
| 79 | + return $default; |
|
| 80 | + } |
|
| 81 | + // Cas des types mime, sans confondre avec les appels de fonction de classe |
|
| 82 | + // Foo::Bar |
|
| 83 | + // qui peuvent etre avec un namespace : space\Foo::Bar |
|
| 84 | + if (preg_match(',^[\w]+/,', $fonc)) { |
|
| 85 | + $nom = preg_replace(',\W,', '_', $fonc); |
|
| 86 | + $f = chercher_filtre($nom); |
|
| 87 | + // cas du sous-type MIME sans filtre associe, passer au type: |
|
| 88 | + // si filtre_text_plain pas defini, passe a filtre_text |
|
| 89 | + if (!$f and $nom !== $fonc) { |
|
| 90 | + $f = chercher_filtre(preg_replace(',\W.*$,', '', $fonc)); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + return $f; |
|
| 94 | + } |
|
| 95 | + foreach (array('filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc) as $f) { |
|
| 96 | + trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels |
|
| 97 | + // fonction ou name\space\fonction |
|
| 98 | + if (is_callable($f)) { |
|
| 99 | + return $f; |
|
| 100 | + } |
|
| 101 | + // méthode statique d'une classe Classe::methode ou name\space\Classe::methode |
|
| 102 | + elseif (false === strpos($f, '::') and is_callable(array($f))) { |
|
| 103 | + return $f; |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + return $default; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -128,20 +128,20 @@ discard block |
||
| 128 | 128 | * Chaîne vide sinon (filtre introuvable). |
| 129 | 129 | **/ |
| 130 | 130 | function appliquer_filtre($arg, $filtre, $force = null) { |
| 131 | - $f = chercher_filtre($filtre); |
|
| 132 | - if (!$f) { |
|
| 133 | - if (!$force) { |
|
| 134 | - return ''; |
|
| 135 | - } else { |
|
| 136 | - return $arg; |
|
| 137 | - } |
|
| 138 | - } |
|
| 131 | + $f = chercher_filtre($filtre); |
|
| 132 | + if (!$f) { |
|
| 133 | + if (!$force) { |
|
| 134 | + return ''; |
|
| 135 | + } else { |
|
| 136 | + return $arg; |
|
| 137 | + } |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - $args = func_get_args(); |
|
| 141 | - array_shift($args); // enlever $arg |
|
| 142 | - array_shift($args); // enlever $filtre |
|
| 143 | - array_unshift($args, $arg); // remettre $arg |
|
| 144 | - return call_user_func_array($f, $args); |
|
| 140 | + $args = func_get_args(); |
|
| 141 | + array_shift($args); // enlever $arg |
|
| 142 | + array_shift($args); // enlever $filtre |
|
| 143 | + array_unshift($args, $arg); // remettre $arg |
|
| 144 | + return call_user_func_array($f, $args); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | * Version de SPIP |
| 158 | 158 | **/ |
| 159 | 159 | function spip_version() { |
| 160 | - $version = $GLOBALS['spip_version_affichee']; |
|
| 161 | - if ($svn_revision = version_svn_courante(_DIR_RACINE)) { |
|
| 162 | - $version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']'; |
|
| 163 | - } |
|
| 160 | + $version = $GLOBALS['spip_version_affichee']; |
|
| 161 | + if ($svn_revision = version_svn_courante(_DIR_RACINE)) { |
|
| 162 | + $version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']'; |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - return $version; |
|
| 165 | + return $version; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -181,43 +181,43 @@ discard block |
||
| 181 | 181 | * |
| 182 | 182 | **/ |
| 183 | 183 | function version_svn_courante($dir) { |
| 184 | - if (!$dir) { |
|
| 185 | - $dir = '.'; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - // version installee par paquet ZIP |
|
| 189 | - if (lire_fichier($dir . '/svn.revision', $c) |
|
| 190 | - and preg_match(',Revision: (\d+),', $c, $d) |
|
| 191 | - ) { |
|
| 192 | - return intval($d[1]); |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - // version installee par SVN |
|
| 196 | - if (file_exists($dir . '/.svn/wc.db') && class_exists('SQLite3')) { |
|
| 197 | - $db = new SQLite3($dir . '/.svn/wc.db'); |
|
| 198 | - $result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1'); |
|
| 199 | - if ($result) { |
|
| 200 | - $row = $result->fetchArray(); |
|
| 201 | - if ($row['changed_revision'] != "") { |
|
| 202 | - return -$row['changed_revision']; |
|
| 203 | - } |
|
| 204 | - } |
|
| 205 | - } else if (lire_fichier($dir . '/.svn/entries', $c) |
|
| 206 | - and ( |
|
| 207 | - (preg_match_all( |
|
| 208 | - ',committed-rev="([0-9]+)",', $c, $r1, PREG_PATTERN_ORDER) |
|
| 209 | - and $v = max($r1[1]) |
|
| 210 | - ) |
|
| 211 | - or |
|
| 212 | - (preg_match(',^\d.*dir[\r\n]+(\d+),ms', $c, $r1) # svn >= 1.4 |
|
| 213 | - and $v = $r1[1] |
|
| 214 | - )) |
|
| 215 | - ) { |
|
| 216 | - return -$v; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - // Bug ou paquet fait main |
|
| 220 | - return 0; |
|
| 184 | + if (!$dir) { |
|
| 185 | + $dir = '.'; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + // version installee par paquet ZIP |
|
| 189 | + if (lire_fichier($dir . '/svn.revision', $c) |
|
| 190 | + and preg_match(',Revision: (\d+),', $c, $d) |
|
| 191 | + ) { |
|
| 192 | + return intval($d[1]); |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + // version installee par SVN |
|
| 196 | + if (file_exists($dir . '/.svn/wc.db') && class_exists('SQLite3')) { |
|
| 197 | + $db = new SQLite3($dir . '/.svn/wc.db'); |
|
| 198 | + $result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1'); |
|
| 199 | + if ($result) { |
|
| 200 | + $row = $result->fetchArray(); |
|
| 201 | + if ($row['changed_revision'] != "") { |
|
| 202 | + return -$row['changed_revision']; |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | + } else if (lire_fichier($dir . '/.svn/entries', $c) |
|
| 206 | + and ( |
|
| 207 | + (preg_match_all( |
|
| 208 | + ',committed-rev="([0-9]+)",', $c, $r1, PREG_PATTERN_ORDER) |
|
| 209 | + and $v = max($r1[1]) |
|
| 210 | + ) |
|
| 211 | + or |
|
| 212 | + (preg_match(',^\d.*dir[\r\n]+(\d+),ms', $c, $r1) # svn >= 1.4 |
|
| 213 | + and $v = $r1[1] |
|
| 214 | + )) |
|
| 215 | + ) { |
|
| 216 | + return -$v; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + // Bug ou paquet fait main |
|
| 220 | + return 0; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images |
@@ -261,18 +261,18 @@ discard block |
||
| 261 | 261 | * Code HTML retourné par le filtre |
| 262 | 262 | **/ |
| 263 | 263 | function filtrer($filtre) { |
| 264 | - $tous = func_get_args(); |
|
| 265 | - if (trouver_filtre_matrice($filtre) and substr($filtre, 0, 6) == 'image_') { |
|
| 266 | - return image_filtrer($tous); |
|
| 267 | - } elseif ($f = chercher_filtre($filtre)) { |
|
| 268 | - array_shift($tous); |
|
| 269 | - return call_user_func_array($f, $tous); |
|
| 270 | - } else { |
|
| 271 | - // le filtre n'existe pas, on provoque une erreur |
|
| 272 | - $msg = array('zbug_erreur_filtre', array('filtre' => texte_script($filtre))); |
|
| 273 | - erreur_squelette($msg); |
|
| 274 | - return ''; |
|
| 275 | - } |
|
| 264 | + $tous = func_get_args(); |
|
| 265 | + if (trouver_filtre_matrice($filtre) and substr($filtre, 0, 6) == 'image_') { |
|
| 266 | + return image_filtrer($tous); |
|
| 267 | + } elseif ($f = chercher_filtre($filtre)) { |
|
| 268 | + array_shift($tous); |
|
| 269 | + return call_user_func_array($f, $tous); |
|
| 270 | + } else { |
|
| 271 | + // le filtre n'existe pas, on provoque une erreur |
|
| 272 | + $msg = array('zbug_erreur_filtre', array('filtre' => texte_script($filtre))); |
|
| 273 | + erreur_squelette($msg); |
|
| 274 | + return ''; |
|
| 275 | + } |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /** |
@@ -289,11 +289,11 @@ discard block |
||
| 289 | 289 | * @return bool true si on trouve le filtre dans la matrice, false sinon. |
| 290 | 290 | */ |
| 291 | 291 | function trouver_filtre_matrice($filtre) { |
| 292 | - if (isset($GLOBALS['spip_matrice'][$filtre]) and is_string($f = $GLOBALS['spip_matrice'][$filtre])) { |
|
| 293 | - find_in_path($f, '', true); |
|
| 294 | - $GLOBALS['spip_matrice'][$filtre] = true; |
|
| 295 | - } |
|
| 296 | - return !empty($GLOBALS['spip_matrice'][$filtre]); |
|
| 292 | + if (isset($GLOBALS['spip_matrice'][$filtre]) and is_string($f = $GLOBALS['spip_matrice'][$filtre])) { |
|
| 293 | + find_in_path($f, '', true); |
|
| 294 | + $GLOBALS['spip_matrice'][$filtre] = true; |
|
| 295 | + } |
|
| 296 | + return !empty($GLOBALS['spip_matrice'][$filtre]); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
@@ -321,8 +321,8 @@ discard block |
||
| 321 | 321 | * @return mixed |
| 322 | 322 | */ |
| 323 | 323 | function filtre_set(&$Pile, $val, $key, $continue = null) { |
| 324 | - $Pile['vars'][$key] = $val; |
|
| 325 | - return $continue ? $val : ''; |
|
| 324 | + $Pile['vars'][$key] = $val; |
|
| 325 | + return $continue ? $val : ''; |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /** |
@@ -348,8 +348,8 @@ discard block |
||
| 348 | 348 | * @return string|mixed Retourne `$val` si `$continue` présent, sinon ''. |
| 349 | 349 | */ |
| 350 | 350 | function filtre_setenv(&$Pile, $val, $key, $continue = null) { |
| 351 | - $Pile[0][$key] = $val; |
|
| 352 | - return $continue ? $val : ''; |
|
| 351 | + $Pile[0][$key] = $val; |
|
| 352 | + return $continue ? $val : ''; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
@@ -371,18 +371,18 @@ discard block |
||
| 371 | 371 | * @return mixed Retourne la valeur (sans la modifier). |
| 372 | 372 | */ |
| 373 | 373 | function filtre_debug($val, $key = null) { |
| 374 | - $debug = ( |
|
| 375 | - is_null($key) ? '' : (var_export($key, true) . " = ") |
|
| 376 | - ) . var_export($val, true); |
|
| 374 | + $debug = ( |
|
| 375 | + is_null($key) ? '' : (var_export($key, true) . " = ") |
|
| 376 | + ) . var_export($val, true); |
|
| 377 | 377 | |
| 378 | - include_spip('inc/autoriser'); |
|
| 379 | - if (autoriser('webmestre')) { |
|
| 380 | - echo "<div class='spip_debug'>\n", $debug, "</div>\n"; |
|
| 381 | - } |
|
| 378 | + include_spip('inc/autoriser'); |
|
| 379 | + if (autoriser('webmestre')) { |
|
| 380 | + echo "<div class='spip_debug'>\n", $debug, "</div>\n"; |
|
| 381 | + } |
|
| 382 | 382 | |
| 383 | - spip_log($debug, 'debug'); |
|
| 383 | + spip_log($debug, 'debug'); |
|
| 384 | 384 | |
| 385 | - return $val; |
|
| 385 | + return $val; |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | |
@@ -410,71 +410,71 @@ discard block |
||
| 410 | 410 | * Texte qui a reçu les filtres |
| 411 | 411 | **/ |
| 412 | 412 | function image_filtrer($args) { |
| 413 | - $filtre = array_shift($args); # enlever $filtre |
|
| 414 | - $texte = array_shift($args); |
|
| 415 | - if (!strlen($texte)) { |
|
| 416 | - return; |
|
| 417 | - } |
|
| 418 | - find_in_path('filtres_images_mini.php', 'inc/', true); |
|
| 419 | - statut_effacer_images_temporaires(true); // activer la suppression des images temporaires car le compilo finit la chaine par un image_graver |
|
| 420 | - // Cas du nom de fichier local |
|
| 421 | - if (strpos(substr($texte, strlen(_DIR_RACINE)), '..') === false |
|
| 422 | - and !preg_match(',^/|[<>]|\s,S', $texte) |
|
| 423 | - and ( |
|
| 424 | - file_exists(preg_replace(',[?].*$,', '', $texte)) |
|
| 425 | - or tester_url_absolue($texte) |
|
| 426 | - ) |
|
| 427 | - ) { |
|
| 428 | - array_unshift($args, "<img src='$texte' />"); |
|
| 429 | - $res = call_user_func_array($filtre, $args); |
|
| 430 | - statut_effacer_images_temporaires(false); // desactiver pour les appels hors compilo |
|
| 431 | - return $res; |
|
| 432 | - } |
|
| 433 | - |
|
| 434 | - // Cas general : trier toutes les images, avec eventuellement leur <span> |
|
| 435 | - if (preg_match_all( |
|
| 436 | - ',(<([a-z]+) [^<>]*spip_documents[^<>]*>)?\s*(<img\s.*>),UimsS', |
|
| 437 | - $texte, $tags, PREG_SET_ORDER)) { |
|
| 438 | - foreach ($tags as $tag) { |
|
| 439 | - $class = extraire_attribut($tag[3], 'class'); |
|
| 440 | - if (!$class or |
|
| 441 | - (strpos($class, 'filtre_inactif') == false |
|
| 442 | - // compat historique a virer en 3.2 |
|
| 443 | - and strpos($class, 'no_image_filtrer') === false) |
|
| 444 | - ) { |
|
| 445 | - array_unshift($args, $tag[3]); |
|
| 446 | - if ($reduit = call_user_func_array($filtre, $args)) { |
|
| 447 | - // En cas de span spip_documents, modifier le style=...width: |
|
| 448 | - if ($tag[1]) { |
|
| 449 | - $w = extraire_attribut($reduit, 'width'); |
|
| 450 | - if (!$w and preg_match(",width:\s*(\d+)px,S", extraire_attribut($reduit, 'style'), $regs)) { |
|
| 451 | - $w = $regs[1]; |
|
| 452 | - } |
|
| 453 | - if ($w and ($style = extraire_attribut($tag[1], 'style'))) { |
|
| 454 | - $style = preg_replace(",width:\s*\d+px,S", "width:${w}px", $style); |
|
| 455 | - $replace = inserer_attribut($tag[1], 'style', $style); |
|
| 456 | - $texte = str_replace($tag[1], $replace, $texte); |
|
| 457 | - } |
|
| 458 | - } |
|
| 459 | - // traiter aussi un eventuel mouseover |
|
| 460 | - if ($mouseover = extraire_attribut($reduit, 'onmouseover')) { |
|
| 461 | - if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) { |
|
| 462 | - $srcover = $match[1]; |
|
| 463 | - array_shift($args); |
|
| 464 | - array_unshift($args, "<img src='" . $match[1] . "' />"); |
|
| 465 | - $srcover_filter = call_user_func_array($filtre, $args); |
|
| 466 | - $srcover_filter = extraire_attribut($srcover_filter, 'src'); |
|
| 467 | - $reduit = str_replace($srcover, $srcover_filter, $reduit); |
|
| 468 | - } |
|
| 469 | - } |
|
| 470 | - $texte = str_replace($tag[3], $reduit, $texte); |
|
| 471 | - } |
|
| 472 | - array_shift($args); |
|
| 473 | - } |
|
| 474 | - } |
|
| 475 | - } |
|
| 476 | - statut_effacer_images_temporaires(false); // desactiver pour les appels hors compilo |
|
| 477 | - return $texte; |
|
| 413 | + $filtre = array_shift($args); # enlever $filtre |
|
| 414 | + $texte = array_shift($args); |
|
| 415 | + if (!strlen($texte)) { |
|
| 416 | + return; |
|
| 417 | + } |
|
| 418 | + find_in_path('filtres_images_mini.php', 'inc/', true); |
|
| 419 | + statut_effacer_images_temporaires(true); // activer la suppression des images temporaires car le compilo finit la chaine par un image_graver |
|
| 420 | + // Cas du nom de fichier local |
|
| 421 | + if (strpos(substr($texte, strlen(_DIR_RACINE)), '..') === false |
|
| 422 | + and !preg_match(',^/|[<>]|\s,S', $texte) |
|
| 423 | + and ( |
|
| 424 | + file_exists(preg_replace(',[?].*$,', '', $texte)) |
|
| 425 | + or tester_url_absolue($texte) |
|
| 426 | + ) |
|
| 427 | + ) { |
|
| 428 | + array_unshift($args, "<img src='$texte' />"); |
|
| 429 | + $res = call_user_func_array($filtre, $args); |
|
| 430 | + statut_effacer_images_temporaires(false); // desactiver pour les appels hors compilo |
|
| 431 | + return $res; |
|
| 432 | + } |
|
| 433 | + |
|
| 434 | + // Cas general : trier toutes les images, avec eventuellement leur <span> |
|
| 435 | + if (preg_match_all( |
|
| 436 | + ',(<([a-z]+) [^<>]*spip_documents[^<>]*>)?\s*(<img\s.*>),UimsS', |
|
| 437 | + $texte, $tags, PREG_SET_ORDER)) { |
|
| 438 | + foreach ($tags as $tag) { |
|
| 439 | + $class = extraire_attribut($tag[3], 'class'); |
|
| 440 | + if (!$class or |
|
| 441 | + (strpos($class, 'filtre_inactif') == false |
|
| 442 | + // compat historique a virer en 3.2 |
|
| 443 | + and strpos($class, 'no_image_filtrer') === false) |
|
| 444 | + ) { |
|
| 445 | + array_unshift($args, $tag[3]); |
|
| 446 | + if ($reduit = call_user_func_array($filtre, $args)) { |
|
| 447 | + // En cas de span spip_documents, modifier le style=...width: |
|
| 448 | + if ($tag[1]) { |
|
| 449 | + $w = extraire_attribut($reduit, 'width'); |
|
| 450 | + if (!$w and preg_match(",width:\s*(\d+)px,S", extraire_attribut($reduit, 'style'), $regs)) { |
|
| 451 | + $w = $regs[1]; |
|
| 452 | + } |
|
| 453 | + if ($w and ($style = extraire_attribut($tag[1], 'style'))) { |
|
| 454 | + $style = preg_replace(",width:\s*\d+px,S", "width:${w}px", $style); |
|
| 455 | + $replace = inserer_attribut($tag[1], 'style', $style); |
|
| 456 | + $texte = str_replace($tag[1], $replace, $texte); |
|
| 457 | + } |
|
| 458 | + } |
|
| 459 | + // traiter aussi un eventuel mouseover |
|
| 460 | + if ($mouseover = extraire_attribut($reduit, 'onmouseover')) { |
|
| 461 | + if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) { |
|
| 462 | + $srcover = $match[1]; |
|
| 463 | + array_shift($args); |
|
| 464 | + array_unshift($args, "<img src='" . $match[1] . "' />"); |
|
| 465 | + $srcover_filter = call_user_func_array($filtre, $args); |
|
| 466 | + $srcover_filter = extraire_attribut($srcover_filter, 'src'); |
|
| 467 | + $reduit = str_replace($srcover, $srcover_filter, $reduit); |
|
| 468 | + } |
|
| 469 | + } |
|
| 470 | + $texte = str_replace($tag[3], $reduit, $texte); |
|
| 471 | + } |
|
| 472 | + array_shift($args); |
|
| 473 | + } |
|
| 474 | + } |
|
| 475 | + } |
|
| 476 | + statut_effacer_images_temporaires(false); // desactiver pour les appels hors compilo |
|
| 477 | + return $texte; |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | |
@@ -490,64 +490,64 @@ discard block |
||
| 490 | 490 | **/ |
| 491 | 491 | function taille_image($img) { |
| 492 | 492 | |
| 493 | - static $largeur_img = array(), $hauteur_img = array(); |
|
| 494 | - $srcWidth = 0; |
|
| 495 | - $srcHeight = 0; |
|
| 496 | - |
|
| 497 | - $logo = extraire_attribut($img, 'src'); |
|
| 498 | - |
|
| 499 | - if (!$logo) { |
|
| 500 | - $logo = $img; |
|
| 501 | - } else { |
|
| 502 | - $srcWidth = extraire_attribut($img, 'width'); |
|
| 503 | - $srcHeight = extraire_attribut($img, 'height'); |
|
| 504 | - } |
|
| 505 | - |
|
| 506 | - // ne jamais operer directement sur une image distante pour des raisons de perfo |
|
| 507 | - // la copie locale a toutes les chances d'etre la ou de resservir |
|
| 508 | - if (tester_url_absolue($logo)) { |
|
| 509 | - include_spip('inc/distant'); |
|
| 510 | - $fichier = copie_locale($logo); |
|
| 511 | - $logo = $fichier ? _DIR_RACINE . $fichier : $logo; |
|
| 512 | - } |
|
| 513 | - if (($p = strpos($logo, '?')) !== false) { |
|
| 514 | - $logo = substr($logo, 0, $p); |
|
| 515 | - } |
|
| 516 | - |
|
| 517 | - $srcsize = false; |
|
| 518 | - if (isset($largeur_img[$logo])) { |
|
| 519 | - $srcWidth = $largeur_img[$logo]; |
|
| 520 | - } |
|
| 521 | - if (isset($hauteur_img[$logo])) { |
|
| 522 | - $srcHeight = $hauteur_img[$logo]; |
|
| 523 | - } |
|
| 524 | - if (!$srcWidth or !$srcHeight) { |
|
| 525 | - if (file_exists($logo) |
|
| 526 | - and $srcsize = @getimagesize($logo) |
|
| 527 | - ) { |
|
| 528 | - if (!$srcWidth) { |
|
| 529 | - $largeur_img[$logo] = $srcWidth = $srcsize[0]; |
|
| 530 | - } |
|
| 531 | - if (!$srcHeight) { |
|
| 532 | - $hauteur_img[$logo] = $srcHeight = $srcsize[1]; |
|
| 533 | - } |
|
| 534 | - } |
|
| 535 | - // $logo peut etre une reference a une image temporaire dont a n'a que le log .src |
|
| 536 | - // on s'y refere, l'image sera reconstruite en temps utile si necessaire |
|
| 537 | - elseif (@file_exists($f = "$logo.src") |
|
| 538 | - and lire_fichier($f, $valeurs) |
|
| 539 | - and $valeurs = unserialize($valeurs) |
|
| 540 | - ) { |
|
| 541 | - if (!$srcWidth) { |
|
| 542 | - $largeur_img[$logo] = $srcWidth = $valeurs["largeur_dest"]; |
|
| 543 | - } |
|
| 544 | - if (!$srcHeight) { |
|
| 545 | - $hauteur_img[$logo] = $srcHeight = $valeurs["hauteur_dest"]; |
|
| 546 | - } |
|
| 547 | - } |
|
| 548 | - } |
|
| 549 | - |
|
| 550 | - return array($srcHeight, $srcWidth); |
|
| 493 | + static $largeur_img = array(), $hauteur_img = array(); |
|
| 494 | + $srcWidth = 0; |
|
| 495 | + $srcHeight = 0; |
|
| 496 | + |
|
| 497 | + $logo = extraire_attribut($img, 'src'); |
|
| 498 | + |
|
| 499 | + if (!$logo) { |
|
| 500 | + $logo = $img; |
|
| 501 | + } else { |
|
| 502 | + $srcWidth = extraire_attribut($img, 'width'); |
|
| 503 | + $srcHeight = extraire_attribut($img, 'height'); |
|
| 504 | + } |
|
| 505 | + |
|
| 506 | + // ne jamais operer directement sur une image distante pour des raisons de perfo |
|
| 507 | + // la copie locale a toutes les chances d'etre la ou de resservir |
|
| 508 | + if (tester_url_absolue($logo)) { |
|
| 509 | + include_spip('inc/distant'); |
|
| 510 | + $fichier = copie_locale($logo); |
|
| 511 | + $logo = $fichier ? _DIR_RACINE . $fichier : $logo; |
|
| 512 | + } |
|
| 513 | + if (($p = strpos($logo, '?')) !== false) { |
|
| 514 | + $logo = substr($logo, 0, $p); |
|
| 515 | + } |
|
| 516 | + |
|
| 517 | + $srcsize = false; |
|
| 518 | + if (isset($largeur_img[$logo])) { |
|
| 519 | + $srcWidth = $largeur_img[$logo]; |
|
| 520 | + } |
|
| 521 | + if (isset($hauteur_img[$logo])) { |
|
| 522 | + $srcHeight = $hauteur_img[$logo]; |
|
| 523 | + } |
|
| 524 | + if (!$srcWidth or !$srcHeight) { |
|
| 525 | + if (file_exists($logo) |
|
| 526 | + and $srcsize = @getimagesize($logo) |
|
| 527 | + ) { |
|
| 528 | + if (!$srcWidth) { |
|
| 529 | + $largeur_img[$logo] = $srcWidth = $srcsize[0]; |
|
| 530 | + } |
|
| 531 | + if (!$srcHeight) { |
|
| 532 | + $hauteur_img[$logo] = $srcHeight = $srcsize[1]; |
|
| 533 | + } |
|
| 534 | + } |
|
| 535 | + // $logo peut etre une reference a une image temporaire dont a n'a que le log .src |
|
| 536 | + // on s'y refere, l'image sera reconstruite en temps utile si necessaire |
|
| 537 | + elseif (@file_exists($f = "$logo.src") |
|
| 538 | + and lire_fichier($f, $valeurs) |
|
| 539 | + and $valeurs = unserialize($valeurs) |
|
| 540 | + ) { |
|
| 541 | + if (!$srcWidth) { |
|
| 542 | + $largeur_img[$logo] = $srcWidth = $valeurs["largeur_dest"]; |
|
| 543 | + } |
|
| 544 | + if (!$srcHeight) { |
|
| 545 | + $hauteur_img[$logo] = $srcHeight = $valeurs["hauteur_dest"]; |
|
| 546 | + } |
|
| 547 | + } |
|
| 548 | + } |
|
| 549 | + |
|
| 550 | + return array($srcHeight, $srcWidth); |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | |
@@ -565,12 +565,12 @@ discard block |
||
| 565 | 565 | * Largeur en pixels, NULL ou 0 si aucune image. |
| 566 | 566 | **/ |
| 567 | 567 | function largeur($img) { |
| 568 | - if (!$img) { |
|
| 569 | - return; |
|
| 570 | - } |
|
| 571 | - list($h, $l) = taille_image($img); |
|
| 568 | + if (!$img) { |
|
| 569 | + return; |
|
| 570 | + } |
|
| 571 | + list($h, $l) = taille_image($img); |
|
| 572 | 572 | |
| 573 | - return $l; |
|
| 573 | + return $l; |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | /** |
@@ -587,12 +587,12 @@ discard block |
||
| 587 | 587 | * Hauteur en pixels, NULL ou 0 si aucune image. |
| 588 | 588 | **/ |
| 589 | 589 | function hauteur($img) { |
| 590 | - if (!$img) { |
|
| 591 | - return; |
|
| 592 | - } |
|
| 593 | - list($h, $l) = taille_image($img); |
|
| 590 | + if (!$img) { |
|
| 591 | + return; |
|
| 592 | + } |
|
| 593 | + list($h, $l) = taille_image($img); |
|
| 594 | 594 | |
| 595 | - return $h; |
|
| 595 | + return $h; |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | |
@@ -612,11 +612,11 @@ discard block |
||
| 612 | 612 | * @return string |
| 613 | 613 | **/ |
| 614 | 614 | function corriger_entites_html($texte) { |
| 615 | - if (strpos($texte, '&') === false) { |
|
| 616 | - return $texte; |
|
| 617 | - } |
|
| 615 | + if (strpos($texte, '&') === false) { |
|
| 616 | + return $texte; |
|
| 617 | + } |
|
| 618 | 618 | |
| 619 | - return preg_replace(',&(#[0-9][0-9][0-9]+;|amp;),iS', '&\1', $texte); |
|
| 619 | + return preg_replace(',&(#[0-9][0-9][0-9]+;|amp;),iS', '&\1', $texte); |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | /** |
@@ -631,11 +631,11 @@ discard block |
||
| 631 | 631 | * @return string |
| 632 | 632 | **/ |
| 633 | 633 | function corriger_toutes_entites_html($texte) { |
| 634 | - if (strpos($texte, '&') === false) { |
|
| 635 | - return $texte; |
|
| 636 | - } |
|
| 634 | + if (strpos($texte, '&') === false) { |
|
| 635 | + return $texte; |
|
| 636 | + } |
|
| 637 | 637 | |
| 638 | - return preg_replace(',&(#?[a-z0-9]+;),iS', '&\1', $texte); |
|
| 638 | + return preg_replace(',&(#?[a-z0-9]+;),iS', '&\1', $texte); |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /** |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | * @return string |
| 646 | 646 | **/ |
| 647 | 647 | function proteger_amp($texte) { |
| 648 | - return str_replace('&', '&', $texte); |
|
| 648 | + return str_replace('&', '&', $texte); |
|
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | |
@@ -676,20 +676,20 @@ discard block |
||
| 676 | 676 | * @return mixed|string |
| 677 | 677 | */ |
| 678 | 678 | function entites_html($texte, $tout = false, $quote = true) { |
| 679 | - if (!is_string($texte) or !$texte |
|
| 680 | - or strpbrk($texte, "&\"'<>") == false |
|
| 681 | - ) { |
|
| 682 | - return $texte; |
|
| 683 | - } |
|
| 684 | - include_spip('inc/texte'); |
|
| 685 | - $flags = ($quote ? ENT_QUOTES : ENT_NOQUOTES); |
|
| 686 | - $flags |= ENT_HTML401; |
|
| 687 | - $texte = spip_htmlspecialchars(echappe_retour(echappe_html($texte, '', true), '', 'proteger_amp'), $flags); |
|
| 688 | - if ($tout) { |
|
| 689 | - return corriger_toutes_entites_html($texte); |
|
| 690 | - } else { |
|
| 691 | - return corriger_entites_html($texte); |
|
| 692 | - } |
|
| 679 | + if (!is_string($texte) or !$texte |
|
| 680 | + or strpbrk($texte, "&\"'<>") == false |
|
| 681 | + ) { |
|
| 682 | + return $texte; |
|
| 683 | + } |
|
| 684 | + include_spip('inc/texte'); |
|
| 685 | + $flags = ($quote ? ENT_QUOTES : ENT_NOQUOTES); |
|
| 686 | + $flags |= ENT_HTML401; |
|
| 687 | + $texte = spip_htmlspecialchars(echappe_retour(echappe_html($texte, '', true), '', 'proteger_amp'), $flags); |
|
| 688 | + if ($tout) { |
|
| 689 | + return corriger_toutes_entites_html($texte); |
|
| 690 | + } else { |
|
| 691 | + return corriger_entites_html($texte); |
|
| 692 | + } |
|
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | /** |
@@ -708,37 +708,37 @@ discard block |
||
| 708 | 708 | * Texte converti |
| 709 | 709 | **/ |
| 710 | 710 | function filtrer_entites($texte) { |
| 711 | - if (strpos($texte, '&') === false) { |
|
| 712 | - return $texte; |
|
| 713 | - } |
|
| 714 | - // filtrer |
|
| 715 | - $texte = html2unicode($texte); |
|
| 716 | - // remettre le tout dans le charset cible |
|
| 717 | - $texte = unicode2charset($texte); |
|
| 718 | - // cas particulier des " et ' qu'il faut filtrer aussi |
|
| 719 | - // (on le faisait deja avec un ") |
|
| 720 | - if (strpos($texte, "&#") !== false) { |
|
| 721 | - $texte = str_replace(array("'", "'", """, """), array("'", "'", '"', '"'), $texte); |
|
| 722 | - } |
|
| 711 | + if (strpos($texte, '&') === false) { |
|
| 712 | + return $texte; |
|
| 713 | + } |
|
| 714 | + // filtrer |
|
| 715 | + $texte = html2unicode($texte); |
|
| 716 | + // remettre le tout dans le charset cible |
|
| 717 | + $texte = unicode2charset($texte); |
|
| 718 | + // cas particulier des " et ' qu'il faut filtrer aussi |
|
| 719 | + // (on le faisait deja avec un ") |
|
| 720 | + if (strpos($texte, "&#") !== false) { |
|
| 721 | + $texte = str_replace(array("'", "'", """, """), array("'", "'", '"', '"'), $texte); |
|
| 722 | + } |
|
| 723 | 723 | |
| 724 | - return $texte; |
|
| 724 | + return $texte; |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | |
| 728 | 728 | if (!function_exists('filtre_filtrer_entites_dist')) { |
| 729 | - /** |
|
| 730 | - * Version sécurisée de filtrer_entites |
|
| 731 | - * |
|
| 732 | - * @uses interdire_scripts() |
|
| 733 | - * @uses filtrer_entites() |
|
| 734 | - * |
|
| 735 | - * @param string $t |
|
| 736 | - * @return string |
|
| 737 | - */ |
|
| 738 | - function filtre_filtrer_entites_dist($t) { |
|
| 739 | - include_spip('inc/texte'); |
|
| 740 | - return interdire_scripts(filtrer_entites($t)); |
|
| 741 | - } |
|
| 729 | + /** |
|
| 730 | + * Version sécurisée de filtrer_entites |
|
| 731 | + * |
|
| 732 | + * @uses interdire_scripts() |
|
| 733 | + * @uses filtrer_entites() |
|
| 734 | + * |
|
| 735 | + * @param string $t |
|
| 736 | + * @return string |
|
| 737 | + */ |
|
| 738 | + function filtre_filtrer_entites_dist($t) { |
|
| 739 | + include_spip('inc/texte'); |
|
| 740 | + return interdire_scripts(filtrer_entites($t)); |
|
| 741 | + } |
|
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | |
@@ -753,18 +753,18 @@ discard block |
||
| 753 | 753 | * @return string|array |
| 754 | 754 | **/ |
| 755 | 755 | function supprimer_caracteres_illegaux($texte) { |
| 756 | - static $from = "\x0\x1\x2\x3\x4\x5\x6\x7\x8\xB\xC\xE\xF\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; |
|
| 757 | - static $to = null; |
|
| 756 | + static $from = "\x0\x1\x2\x3\x4\x5\x6\x7\x8\xB\xC\xE\xF\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; |
|
| 757 | + static $to = null; |
|
| 758 | 758 | |
| 759 | - if (is_array($texte)) { |
|
| 760 | - return array_map('supprimer_caracteres_illegaux', $texte); |
|
| 761 | - } |
|
| 759 | + if (is_array($texte)) { |
|
| 760 | + return array_map('supprimer_caracteres_illegaux', $texte); |
|
| 761 | + } |
|
| 762 | 762 | |
| 763 | - if (!$to) { |
|
| 764 | - $to = str_repeat('-', strlen($from)); |
|
| 765 | - } |
|
| 763 | + if (!$to) { |
|
| 764 | + $to = str_repeat('-', strlen($from)); |
|
| 765 | + } |
|
| 766 | 766 | |
| 767 | - return strtr($texte, $from, $to); |
|
| 767 | + return strtr($texte, $from, $to); |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | /** |
@@ -776,10 +776,10 @@ discard block |
||
| 776 | 776 | * @return string|array |
| 777 | 777 | **/ |
| 778 | 778 | function corriger_caracteres($texte) { |
| 779 | - $texte = corriger_caracteres_windows($texte); |
|
| 780 | - $texte = supprimer_caracteres_illegaux($texte); |
|
| 779 | + $texte = corriger_caracteres_windows($texte); |
|
| 780 | + $texte = supprimer_caracteres_illegaux($texte); |
|
| 781 | 781 | |
| 782 | - return $texte; |
|
| 782 | + return $texte; |
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | /** |
@@ -797,40 +797,40 @@ discard block |
||
| 797 | 797 | */ |
| 798 | 798 | function texte_backend($texte) { |
| 799 | 799 | |
| 800 | - static $apostrophe = array("’", "'"); # n'allouer qu'une fois |
|
| 800 | + static $apostrophe = array("’", "'"); # n'allouer qu'une fois |
|
| 801 | 801 | |
| 802 | - // si on a des liens ou des images, les passer en absolu |
|
| 803 | - $texte = liens_absolus($texte); |
|
| 802 | + // si on a des liens ou des images, les passer en absolu |
|
| 803 | + $texte = liens_absolus($texte); |
|
| 804 | 804 | |
| 805 | - // echapper les tags > < |
|
| 806 | - $texte = preg_replace(',&(gt|lt);,S', '&\1;', $texte); |
|
| 805 | + // echapper les tags > < |
|
| 806 | + $texte = preg_replace(',&(gt|lt);,S', '&\1;', $texte); |
|
| 807 | 807 | |
| 808 | - // importer les é |
|
| 809 | - $texte = filtrer_entites($texte); |
|
| 808 | + // importer les é |
|
| 809 | + $texte = filtrer_entites($texte); |
|
| 810 | 810 | |
| 811 | - // " -> " et tout ce genre de choses |
|
| 812 | - $u = $GLOBALS['meta']['pcre_u']; |
|
| 813 | - $texte = str_replace(" ", " ", $texte); |
|
| 814 | - $texte = preg_replace('/\s{2,}/S' . $u, " ", $texte); |
|
| 815 | - // ne pas echapper les sinqle quotes car certains outils de syndication gerent mal |
|
| 816 | - $texte = entites_html($texte, false, false); |
|
| 817 | - // mais bien echapper les double quotes ! |
|
| 818 | - $texte = str_replace('"', '"', $texte); |
|
| 811 | + // " -> " et tout ce genre de choses |
|
| 812 | + $u = $GLOBALS['meta']['pcre_u']; |
|
| 813 | + $texte = str_replace(" ", " ", $texte); |
|
| 814 | + $texte = preg_replace('/\s{2,}/S' . $u, " ", $texte); |
|
| 815 | + // ne pas echapper les sinqle quotes car certains outils de syndication gerent mal |
|
| 816 | + $texte = entites_html($texte, false, false); |
|
| 817 | + // mais bien echapper les double quotes ! |
|
| 818 | + $texte = str_replace('"', '"', $texte); |
|
| 819 | 819 | |
| 820 | - // verifier le charset |
|
| 821 | - $texte = charset2unicode($texte); |
|
| 820 | + // verifier le charset |
|
| 821 | + $texte = charset2unicode($texte); |
|
| 822 | 822 | |
| 823 | - // Caracteres problematiques en iso-latin 1 |
|
| 824 | - if (isset($GLOBALS['meta']['charset']) and $GLOBALS['meta']['charset'] == 'iso-8859-1') { |
|
| 825 | - $texte = str_replace(chr(156), 'œ', $texte); |
|
| 826 | - $texte = str_replace(chr(140), 'Œ', $texte); |
|
| 827 | - $texte = str_replace(chr(159), 'Ÿ', $texte); |
|
| 828 | - } |
|
| 823 | + // Caracteres problematiques en iso-latin 1 |
|
| 824 | + if (isset($GLOBALS['meta']['charset']) and $GLOBALS['meta']['charset'] == 'iso-8859-1') { |
|
| 825 | + $texte = str_replace(chr(156), 'œ', $texte); |
|
| 826 | + $texte = str_replace(chr(140), 'Œ', $texte); |
|
| 827 | + $texte = str_replace(chr(159), 'Ÿ', $texte); |
|
| 828 | + } |
|
| 829 | 829 | |
| 830 | - // l'apostrophe curly pose probleme a certains lecteure de RSS |
|
| 831 | - // et le caractere apostrophe alourdit les squelettes avec PHP |
|
| 832 | - // ==> on les remplace par l'entite HTML |
|
| 833 | - return str_replace($apostrophe, "'", $texte); |
|
| 830 | + // l'apostrophe curly pose probleme a certains lecteure de RSS |
|
| 831 | + // et le caractere apostrophe alourdit les squelettes avec PHP |
|
| 832 | + // ==> on les remplace par l'entite HTML |
|
| 833 | + return str_replace($apostrophe, "'", $texte); |
|
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | /** |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | * Texte encodé et quote pour XML |
| 848 | 848 | */ |
| 849 | 849 | function texte_backendq($texte) { |
| 850 | - return addslashes(texte_backend($texte)); |
|
| 850 | + return addslashes(texte_backend($texte)); |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | |
@@ -870,9 +870,9 @@ discard block |
||
| 870 | 870 | * Numéro de titre, sinon chaîne vide |
| 871 | 871 | **/ |
| 872 | 872 | function supprimer_numero($texte) { |
| 873 | - return preg_replace( |
|
| 874 | - ",^[[:space:]]*([0-9]+)([.)]|" . chr(194) . '?' . chr(176) . ")[[:space:]]+,S", |
|
| 875 | - "", $texte); |
|
| 873 | + return preg_replace( |
|
| 874 | + ",^[[:space:]]*([0-9]+)([.)]|" . chr(194) . '?' . chr(176) . ")[[:space:]]+,S", |
|
| 875 | + "", $texte); |
|
| 876 | 876 | } |
| 877 | 877 | |
| 878 | 878 | /** |
@@ -895,13 +895,13 @@ discard block |
||
| 895 | 895 | * Numéro de titre, sinon chaîne vide |
| 896 | 896 | **/ |
| 897 | 897 | function recuperer_numero($texte) { |
| 898 | - if (preg_match( |
|
| 899 | - ",^[[:space:]]*([0-9]+)([.)]|" . chr(194) . '?' . chr(176) . ")[[:space:]]+,S", |
|
| 900 | - $texte, $regs)) { |
|
| 901 | - return strval($regs[1]); |
|
| 902 | - } else { |
|
| 903 | - return ''; |
|
| 904 | - } |
|
| 898 | + if (preg_match( |
|
| 899 | + ",^[[:space:]]*([0-9]+)([.)]|" . chr(194) . '?' . chr(176) . ")[[:space:]]+,S", |
|
| 900 | + $texte, $regs)) { |
|
| 901 | + return strval($regs[1]); |
|
| 902 | + } else { |
|
| 903 | + return ''; |
|
| 904 | + } |
|
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | /** |
@@ -928,13 +928,13 @@ discard block |
||
| 928 | 928 | * Texte converti |
| 929 | 929 | **/ |
| 930 | 930 | function supprimer_tags($texte, $rempl = "") { |
| 931 | - $texte = preg_replace(",<(!--|\w|/|!\[endif|!\[if)[^>]*>,US", $rempl, $texte); |
|
| 932 | - // ne pas oublier un < final non ferme car coupe |
|
| 933 | - $texte = preg_replace(",<(!--|\w|/).*$,US", $rempl, $texte); |
|
| 934 | - // mais qui peut aussi etre un simple signe plus petit que |
|
| 935 | - $texte = str_replace('<', '<', $texte); |
|
| 931 | + $texte = preg_replace(",<(!--|\w|/|!\[endif|!\[if)[^>]*>,US", $rempl, $texte); |
|
| 932 | + // ne pas oublier un < final non ferme car coupe |
|
| 933 | + $texte = preg_replace(",<(!--|\w|/).*$,US", $rempl, $texte); |
|
| 934 | + // mais qui peut aussi etre un simple signe plus petit que |
|
| 935 | + $texte = str_replace('<', '<', $texte); |
|
| 936 | 936 | |
| 937 | - return $texte; |
|
| 937 | + return $texte; |
|
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | /** |
@@ -957,9 +957,9 @@ discard block |
||
| 957 | 957 | * Texte converti |
| 958 | 958 | **/ |
| 959 | 959 | function echapper_tags($texte, $rempl = "") { |
| 960 | - $texte = preg_replace("/<([^>]*)>/", "<\\1>", $texte); |
|
| 960 | + $texte = preg_replace("/<([^>]*)>/", "<\\1>", $texte); |
|
| 961 | 961 | |
| 962 | - return $texte; |
|
| 962 | + return $texte; |
|
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | /** |
@@ -980,18 +980,18 @@ discard block |
||
| 980 | 980 | * Texte converti |
| 981 | 981 | **/ |
| 982 | 982 | function textebrut($texte) { |
| 983 | - $u = $GLOBALS['meta']['pcre_u']; |
|
| 984 | - $texte = preg_replace('/\s+/S' . $u, " ", $texte); |
|
| 985 | - $texte = preg_replace("/<(p|br)( [^>]*)?" . ">/iS", "\n\n", $texte); |
|
| 986 | - $texte = preg_replace("/^\n+/", "", $texte); |
|
| 987 | - $texte = preg_replace("/\n+$/", "", $texte); |
|
| 988 | - $texte = preg_replace("/\n +/", "\n", $texte); |
|
| 989 | - $texte = supprimer_tags($texte); |
|
| 990 | - $texte = preg_replace("/( | )+/S", " ", $texte); |
|
| 991 | - // nettoyer l'apostrophe curly qui pose probleme a certains rss-readers, lecteurs de mail... |
|
| 992 | - $texte = str_replace("’", "'", $texte); |
|
| 983 | + $u = $GLOBALS['meta']['pcre_u']; |
|
| 984 | + $texte = preg_replace('/\s+/S' . $u, " ", $texte); |
|
| 985 | + $texte = preg_replace("/<(p|br)( [^>]*)?" . ">/iS", "\n\n", $texte); |
|
| 986 | + $texte = preg_replace("/^\n+/", "", $texte); |
|
| 987 | + $texte = preg_replace("/\n+$/", "", $texte); |
|
| 988 | + $texte = preg_replace("/\n +/", "\n", $texte); |
|
| 989 | + $texte = supprimer_tags($texte); |
|
| 990 | + $texte = preg_replace("/( | )+/S", " ", $texte); |
|
| 991 | + // nettoyer l'apostrophe curly qui pose probleme a certains rss-readers, lecteurs de mail... |
|
| 992 | + $texte = str_replace("’", "'", $texte); |
|
| 993 | 993 | |
| 994 | - return $texte; |
|
| 994 | + return $texte; |
|
| 995 | 995 | } |
| 996 | 996 | |
| 997 | 997 | |
@@ -1007,17 +1007,17 @@ discard block |
||
| 1007 | 1007 | * Texte avec liens ouvrants |
| 1008 | 1008 | **/ |
| 1009 | 1009 | function liens_ouvrants($texte) { |
| 1010 | - if (preg_match_all(",(<a\s+[^>]*https?://[^>]*class=[\"']spip_(out|url)\b[^>]+>),imsS", |
|
| 1011 | - $texte, $liens, PREG_PATTERN_ORDER)) { |
|
| 1012 | - foreach ($liens[0] as $a) { |
|
| 1013 | - $rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel'); |
|
| 1014 | - $ablank = inserer_attribut($a, 'rel', $rel); |
|
| 1015 | - $ablank = inserer_attribut($ablank, 'target', '_blank'); |
|
| 1016 | - $texte = str_replace($a, $ablank, $texte); |
|
| 1017 | - } |
|
| 1018 | - } |
|
| 1010 | + if (preg_match_all(",(<a\s+[^>]*https?://[^>]*class=[\"']spip_(out|url)\b[^>]+>),imsS", |
|
| 1011 | + $texte, $liens, PREG_PATTERN_ORDER)) { |
|
| 1012 | + foreach ($liens[0] as $a) { |
|
| 1013 | + $rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel'); |
|
| 1014 | + $ablank = inserer_attribut($a, 'rel', $rel); |
|
| 1015 | + $ablank = inserer_attribut($ablank, 'target', '_blank'); |
|
| 1016 | + $texte = str_replace($a, $ablank, $texte); |
|
| 1017 | + } |
|
| 1018 | + } |
|
| 1019 | 1019 | |
| 1020 | - return $texte; |
|
| 1020 | + return $texte; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | 1023 | /** |
@@ -1027,22 +1027,22 @@ discard block |
||
| 1027 | 1027 | * @return string |
| 1028 | 1028 | */ |
| 1029 | 1029 | function liens_nofollow($texte) { |
| 1030 | - if (stripos($texte, "<a") === false) { |
|
| 1031 | - return $texte; |
|
| 1032 | - } |
|
| 1030 | + if (stripos($texte, "<a") === false) { |
|
| 1031 | + return $texte; |
|
| 1032 | + } |
|
| 1033 | 1033 | |
| 1034 | - if (preg_match_all(",<a\b[^>]*>,UimsS", $texte, $regs, PREG_PATTERN_ORDER)) { |
|
| 1035 | - foreach ($regs[0] as $a) { |
|
| 1036 | - $rel = extraire_attribut($a, "rel"); |
|
| 1037 | - if (strpos($rel, "nofollow") === false) { |
|
| 1038 | - $rel = "nofollow" . ($rel ? " $rel" : ""); |
|
| 1039 | - $anofollow = inserer_attribut($a, "rel", $rel); |
|
| 1040 | - $texte = str_replace($a, $anofollow, $texte); |
|
| 1041 | - } |
|
| 1042 | - } |
|
| 1043 | - } |
|
| 1034 | + if (preg_match_all(",<a\b[^>]*>,UimsS", $texte, $regs, PREG_PATTERN_ORDER)) { |
|
| 1035 | + foreach ($regs[0] as $a) { |
|
| 1036 | + $rel = extraire_attribut($a, "rel"); |
|
| 1037 | + if (strpos($rel, "nofollow") === false) { |
|
| 1038 | + $rel = "nofollow" . ($rel ? " $rel" : ""); |
|
| 1039 | + $anofollow = inserer_attribut($a, "rel", $rel); |
|
| 1040 | + $texte = str_replace($a, $anofollow, $texte); |
|
| 1041 | + } |
|
| 1042 | + } |
|
| 1043 | + } |
|
| 1044 | 1044 | |
| 1045 | - return $texte; |
|
| 1045 | + return $texte; |
|
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | /** |
@@ -1061,12 +1061,12 @@ discard block |
||
| 1061 | 1061 | * Texte sans paraghaphes |
| 1062 | 1062 | **/ |
| 1063 | 1063 | function PtoBR($texte) { |
| 1064 | - $u = $GLOBALS['meta']['pcre_u']; |
|
| 1065 | - $texte = preg_replace("@</p>@iS", "\n", $texte); |
|
| 1066 | - $texte = preg_replace("@<p\b.*>@UiS", "<br />", $texte); |
|
| 1067 | - $texte = preg_replace("@^\s*<br />@S" . $u, "", $texte); |
|
| 1064 | + $u = $GLOBALS['meta']['pcre_u']; |
|
| 1065 | + $texte = preg_replace("@</p>@iS", "\n", $texte); |
|
| 1066 | + $texte = preg_replace("@<p\b.*>@UiS", "<br />", $texte); |
|
| 1067 | + $texte = preg_replace("@^\s*<br />@S" . $u, "", $texte); |
|
| 1068 | 1068 | |
| 1069 | - return $texte; |
|
| 1069 | + return $texte; |
|
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | 1072 | |
@@ -1090,14 +1090,14 @@ discard block |
||
| 1090 | 1090 | * @return string Texte encadré du style CSS |
| 1091 | 1091 | */ |
| 1092 | 1092 | function lignes_longues($texte) { |
| 1093 | - if (!strlen(trim($texte))) { |
|
| 1094 | - return $texte; |
|
| 1095 | - } |
|
| 1096 | - include_spip('inc/texte'); |
|
| 1097 | - $tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ? |
|
| 1098 | - 'div' : 'span'; |
|
| 1093 | + if (!strlen(trim($texte))) { |
|
| 1094 | + return $texte; |
|
| 1095 | + } |
|
| 1096 | + include_spip('inc/texte'); |
|
| 1097 | + $tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ? |
|
| 1098 | + 'div' : 'span'; |
|
| 1099 | 1099 | |
| 1100 | - return "<$tag style='word-wrap:break-word;'>$texte</$tag>"; |
|
| 1100 | + return "<$tag style='word-wrap:break-word;'>$texte</$tag>"; |
|
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | 1103 | /** |
@@ -1116,30 +1116,30 @@ discard block |
||
| 1116 | 1116 | * @return string Texte en majuscule |
| 1117 | 1117 | */ |
| 1118 | 1118 | function majuscules($texte) { |
| 1119 | - if (!strlen($texte)) { |
|
| 1120 | - return ''; |
|
| 1121 | - } |
|
| 1119 | + if (!strlen($texte)) { |
|
| 1120 | + return ''; |
|
| 1121 | + } |
|
| 1122 | 1122 | |
| 1123 | - // Cas du turc |
|
| 1124 | - if ($GLOBALS['spip_lang'] == 'tr') { |
|
| 1125 | - # remplacer hors des tags et des entites |
|
| 1126 | - if (preg_match_all(',<[^<>]+>|&[^;]+;,S', $texte, $regs, PREG_SET_ORDER)) { |
|
| 1127 | - foreach ($regs as $n => $match) { |
|
| 1128 | - $texte = str_replace($match[0], "@@SPIP_TURC$n@@", $texte); |
|
| 1129 | - } |
|
| 1130 | - } |
|
| 1123 | + // Cas du turc |
|
| 1124 | + if ($GLOBALS['spip_lang'] == 'tr') { |
|
| 1125 | + # remplacer hors des tags et des entites |
|
| 1126 | + if (preg_match_all(',<[^<>]+>|&[^;]+;,S', $texte, $regs, PREG_SET_ORDER)) { |
|
| 1127 | + foreach ($regs as $n => $match) { |
|
| 1128 | + $texte = str_replace($match[0], "@@SPIP_TURC$n@@", $texte); |
|
| 1129 | + } |
|
| 1130 | + } |
|
| 1131 | 1131 | |
| 1132 | - $texte = str_replace('i', 'İ', $texte); |
|
| 1132 | + $texte = str_replace('i', 'İ', $texte); |
|
| 1133 | 1133 | |
| 1134 | - if ($regs) { |
|
| 1135 | - foreach ($regs as $n => $match) { |
|
| 1136 | - $texte = str_replace("@@SPIP_TURC$n@@", $match[0], $texte); |
|
| 1137 | - } |
|
| 1138 | - } |
|
| 1139 | - } |
|
| 1134 | + if ($regs) { |
|
| 1135 | + foreach ($regs as $n => $match) { |
|
| 1136 | + $texte = str_replace("@@SPIP_TURC$n@@", $match[0], $texte); |
|
| 1137 | + } |
|
| 1138 | + } |
|
| 1139 | + } |
|
| 1140 | 1140 | |
| 1141 | - // Cas general |
|
| 1142 | - return "<span style='text-transform: uppercase;'>$texte</span>"; |
|
| 1141 | + // Cas general |
|
| 1142 | + return "<span style='text-transform: uppercase;'>$texte</span>"; |
|
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | /** |
@@ -1157,29 +1157,29 @@ discard block |
||
| 1157 | 1157 | * @return string |
| 1158 | 1158 | **/ |
| 1159 | 1159 | function taille_en_octets($taille) { |
| 1160 | - if (!defined('_KILOBYTE')) { |
|
| 1161 | - /** |
|
| 1162 | - * Définit le nombre d'octets dans un Kilobyte |
|
| 1163 | - * |
|
| 1164 | - * @var int |
|
| 1165 | - **/ |
|
| 1166 | - define('_KILOBYTE', 1024); |
|
| 1167 | - } |
|
| 1160 | + if (!defined('_KILOBYTE')) { |
|
| 1161 | + /** |
|
| 1162 | + * Définit le nombre d'octets dans un Kilobyte |
|
| 1163 | + * |
|
| 1164 | + * @var int |
|
| 1165 | + **/ |
|
| 1166 | + define('_KILOBYTE', 1024); |
|
| 1167 | + } |
|
| 1168 | 1168 | |
| 1169 | - if ($taille < 1) { |
|
| 1170 | - return ''; |
|
| 1171 | - } |
|
| 1172 | - if ($taille < _KILOBYTE) { |
|
| 1173 | - $taille = _T('taille_octets', array('taille' => $taille)); |
|
| 1174 | - } elseif ($taille < _KILOBYTE * _KILOBYTE) { |
|
| 1175 | - $taille = _T('taille_ko', array('taille' => round($taille / _KILOBYTE, 1))); |
|
| 1176 | - } elseif ($taille < _KILOBYTE * _KILOBYTE * _KILOBYTE) { |
|
| 1177 | - $taille = _T('taille_mo', array('taille' => round($taille / _KILOBYTE / _KILOBYTE, 1))); |
|
| 1178 | - } else { |
|
| 1179 | - $taille = _T('taille_go', array('taille' => round($taille / _KILOBYTE / _KILOBYTE / _KILOBYTE, 2))); |
|
| 1180 | - } |
|
| 1169 | + if ($taille < 1) { |
|
| 1170 | + return ''; |
|
| 1171 | + } |
|
| 1172 | + if ($taille < _KILOBYTE) { |
|
| 1173 | + $taille = _T('taille_octets', array('taille' => $taille)); |
|
| 1174 | + } elseif ($taille < _KILOBYTE * _KILOBYTE) { |
|
| 1175 | + $taille = _T('taille_ko', array('taille' => round($taille / _KILOBYTE, 1))); |
|
| 1176 | + } elseif ($taille < _KILOBYTE * _KILOBYTE * _KILOBYTE) { |
|
| 1177 | + $taille = _T('taille_mo', array('taille' => round($taille / _KILOBYTE / _KILOBYTE, 1))); |
|
| 1178 | + } else { |
|
| 1179 | + $taille = _T('taille_go', array('taille' => round($taille / _KILOBYTE / _KILOBYTE / _KILOBYTE, 2))); |
|
| 1180 | + } |
|
| 1181 | 1181 | |
| 1182 | - return $taille; |
|
| 1182 | + return $taille; |
|
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | 1185 | |
@@ -1201,15 +1201,15 @@ discard block |
||
| 1201 | 1201 | * Texte prêt pour être utilisé en attribut HTML |
| 1202 | 1202 | **/ |
| 1203 | 1203 | function attribut_html($texte, $textebrut = true) { |
| 1204 | - $u = $GLOBALS['meta']['pcre_u']; |
|
| 1205 | - if ($textebrut) { |
|
| 1206 | - $texte = preg_replace(array(",\n,", ",\s(?=\s),msS" . $u), array(" ", ""), textebrut($texte)); |
|
| 1207 | - } |
|
| 1208 | - $texte = texte_backend($texte); |
|
| 1209 | - $texte = str_replace(array("'", '"'), array(''', '"'), $texte); |
|
| 1204 | + $u = $GLOBALS['meta']['pcre_u']; |
|
| 1205 | + if ($textebrut) { |
|
| 1206 | + $texte = preg_replace(array(",\n,", ",\s(?=\s),msS" . $u), array(" ", ""), textebrut($texte)); |
|
| 1207 | + } |
|
| 1208 | + $texte = texte_backend($texte); |
|
| 1209 | + $texte = str_replace(array("'", '"'), array(''', '"'), $texte); |
|
| 1210 | 1210 | |
| 1211 | - return preg_replace(array("/&(amp;|#38;)/", "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/"), array("&", "&"), |
|
| 1212 | - $texte); |
|
| 1211 | + return preg_replace(array("/&(amp;|#38;)/", "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/"), array("&", "&"), |
|
| 1212 | + $texte); |
|
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | |
@@ -1229,12 +1229,12 @@ discard block |
||
| 1229 | 1229 | * URL ou chaîne vide |
| 1230 | 1230 | **/ |
| 1231 | 1231 | function vider_url($url, $entites = true) { |
| 1232 | - # un message pour abs_url |
|
| 1233 | - $GLOBALS['mode_abs_url'] = 'url'; |
|
| 1234 | - $url = trim($url); |
|
| 1235 | - $r = ",^(?:" . _PROTOCOLES_STD . '):?/?/?$,iS'; |
|
| 1232 | + # un message pour abs_url |
|
| 1233 | + $GLOBALS['mode_abs_url'] = 'url'; |
|
| 1234 | + $url = trim($url); |
|
| 1235 | + $r = ",^(?:" . _PROTOCOLES_STD . '):?/?/?$,iS'; |
|
| 1236 | 1236 | |
| 1237 | - return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url); |
|
| 1237 | + return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url); |
|
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | 1240 | |
@@ -1249,10 +1249,10 @@ discard block |
||
| 1249 | 1249 | * @return string Adresse email maquillée |
| 1250 | 1250 | **/ |
| 1251 | 1251 | function antispam($texte) { |
| 1252 | - include_spip('inc/acces'); |
|
| 1253 | - $masque = creer_pass_aleatoire(3); |
|
| 1252 | + include_spip('inc/acces'); |
|
| 1253 | + $masque = creer_pass_aleatoire(3); |
|
| 1254 | 1254 | |
| 1255 | - return preg_replace("/@/", " $masque ", $texte); |
|
| 1255 | + return preg_replace("/@/", " $masque ", $texte); |
|
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | /** |
@@ -1284,12 +1284,12 @@ discard block |
||
| 1284 | 1284 | * True si on a le droit d'accès, false sinon. |
| 1285 | 1285 | **/ |
| 1286 | 1286 | function securiser_acces($id_auteur, $cle, $dir, $op = '', $args = '') { |
| 1287 | - include_spip('inc/acces'); |
|
| 1288 | - if ($op) { |
|
| 1289 | - $dir .= " $op $args"; |
|
| 1290 | - } |
|
| 1287 | + include_spip('inc/acces'); |
|
| 1288 | + if ($op) { |
|
| 1289 | + $dir .= " $op $args"; |
|
| 1290 | + } |
|
| 1291 | 1291 | |
| 1292 | - return verifier_low_sec($id_auteur, $cle, $dir); |
|
| 1292 | + return verifier_low_sec($id_auteur, $cle, $dir); |
|
| 1293 | 1293 | } |
| 1294 | 1294 | |
| 1295 | 1295 | /** |
@@ -1314,11 +1314,11 @@ discard block |
||
| 1314 | 1314 | * Retourne $texte, sinon $sinon. |
| 1315 | 1315 | **/ |
| 1316 | 1316 | function sinon($texte, $sinon = '') { |
| 1317 | - if ($texte or (!is_array($texte) and strlen($texte))) { |
|
| 1318 | - return $texte; |
|
| 1319 | - } else { |
|
| 1320 | - return $sinon; |
|
| 1321 | - } |
|
| 1317 | + if ($texte or (!is_array($texte) and strlen($texte))) { |
|
| 1318 | + return $texte; |
|
| 1319 | + } else { |
|
| 1320 | + return $sinon; |
|
| 1321 | + } |
|
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | /** |
@@ -1342,7 +1342,7 @@ discard block |
||
| 1342 | 1342 | * @return mixed |
| 1343 | 1343 | **/ |
| 1344 | 1344 | function choixsivide($a, $vide, $pasvide) { |
| 1345 | - return $a ? $pasvide : $vide; |
|
| 1345 | + return $a ? $pasvide : $vide; |
|
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | /** |
@@ -1366,7 +1366,7 @@ discard block |
||
| 1366 | 1366 | * @return mixed |
| 1367 | 1367 | **/ |
| 1368 | 1368 | function choixsiegal($a1, $a2, $v, $f) { |
| 1369 | - return ($a1 == $a2) ? $v : $f; |
|
| 1369 | + return ($a1 == $a2) ? $v : $f; |
|
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | 1372 | // |
@@ -1385,13 +1385,13 @@ discard block |
||
| 1385 | 1385 | * @return string |
| 1386 | 1386 | **/ |
| 1387 | 1387 | function filtrer_ical($texte) { |
| 1388 | - #include_spip('inc/charsets'); |
|
| 1389 | - $texte = html2unicode($texte); |
|
| 1390 | - $texte = unicode2charset(charset2unicode($texte, $GLOBALS['meta']['charset'], 1), 'utf-8'); |
|
| 1391 | - $texte = preg_replace("/\n/", " ", $texte); |
|
| 1392 | - $texte = preg_replace("/,/", "\,", $texte); |
|
| 1388 | + #include_spip('inc/charsets'); |
|
| 1389 | + $texte = html2unicode($texte); |
|
| 1390 | + $texte = unicode2charset(charset2unicode($texte, $GLOBALS['meta']['charset'], 1), 'utf-8'); |
|
| 1391 | + $texte = preg_replace("/\n/", " ", $texte); |
|
| 1392 | + $texte = preg_replace("/,/", "\,", $texte); |
|
| 1393 | 1393 | |
| 1394 | - return $texte; |
|
| 1394 | + return $texte; |
|
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 1397 | |
@@ -1416,53 +1416,53 @@ discard block |
||
| 1416 | 1416 | * @return string |
| 1417 | 1417 | **/ |
| 1418 | 1418 | function post_autobr($texte, $delim = "\n_ ") { |
| 1419 | - if (!function_exists('echappe_html')) { |
|
| 1420 | - include_spip('inc/texte_mini'); |
|
| 1421 | - } |
|
| 1422 | - $texte = str_replace("\r\n", "\r", $texte); |
|
| 1423 | - $texte = str_replace("\r", "\n", $texte); |
|
| 1424 | - |
|
| 1425 | - if (preg_match(",\n+$,", $texte, $fin)) { |
|
| 1426 | - $texte = substr($texte, 0, -strlen($fin = $fin[0])); |
|
| 1427 | - } else { |
|
| 1428 | - $fin = ''; |
|
| 1429 | - } |
|
| 1430 | - |
|
| 1431 | - $texte = echappe_html($texte, '', true); |
|
| 1432 | - |
|
| 1433 | - // echapper les modeles |
|
| 1434 | - if (strpos($texte, "<") !== false) { |
|
| 1435 | - include_spip('inc/lien'); |
|
| 1436 | - if (defined('_PREG_MODELE')) { |
|
| 1437 | - $preg_modeles = "@" . _PREG_MODELE . "@imsS"; |
|
| 1438 | - $texte = echappe_html($texte, '', true, $preg_modeles); |
|
| 1439 | - } |
|
| 1440 | - } |
|
| 1441 | - |
|
| 1442 | - $debut = ''; |
|
| 1443 | - $suite = $texte; |
|
| 1444 | - while ($t = strpos('-' . $suite, "\n", 1)) { |
|
| 1445 | - $debut .= substr($suite, 0, $t - 1); |
|
| 1446 | - $suite = substr($suite, $t); |
|
| 1447 | - $car = substr($suite, 0, 1); |
|
| 1448 | - if (($car <> '-') and ($car <> '_') and ($car <> "\n") and ($car <> "|") and ($car <> "}") |
|
| 1449 | - and !preg_match(',^\s*(\n|</?(quote|div|dl|dt|dd)|$),S', ($suite)) |
|
| 1450 | - and !preg_match(',</?(quote|div|dl|dt|dd)> *$,iS', $debut) |
|
| 1451 | - ) { |
|
| 1452 | - $debut .= $delim; |
|
| 1453 | - } else { |
|
| 1454 | - $debut .= "\n"; |
|
| 1455 | - } |
|
| 1456 | - if (preg_match(",^\n+,", $suite, $regs)) { |
|
| 1457 | - $debut .= $regs[0]; |
|
| 1458 | - $suite = substr($suite, strlen($regs[0])); |
|
| 1459 | - } |
|
| 1460 | - } |
|
| 1461 | - $texte = $debut . $suite; |
|
| 1462 | - |
|
| 1463 | - $texte = echappe_retour($texte); |
|
| 1464 | - |
|
| 1465 | - return $texte . $fin; |
|
| 1419 | + if (!function_exists('echappe_html')) { |
|
| 1420 | + include_spip('inc/texte_mini'); |
|
| 1421 | + } |
|
| 1422 | + $texte = str_replace("\r\n", "\r", $texte); |
|
| 1423 | + $texte = str_replace("\r", "\n", $texte); |
|
| 1424 | + |
|
| 1425 | + if (preg_match(",\n+$,", $texte, $fin)) { |
|
| 1426 | + $texte = substr($texte, 0, -strlen($fin = $fin[0])); |
|
| 1427 | + } else { |
|
| 1428 | + $fin = ''; |
|
| 1429 | + } |
|
| 1430 | + |
|
| 1431 | + $texte = echappe_html($texte, '', true); |
|
| 1432 | + |
|
| 1433 | + // echapper les modeles |
|
| 1434 | + if (strpos($texte, "<") !== false) { |
|
| 1435 | + include_spip('inc/lien'); |
|
| 1436 | + if (defined('_PREG_MODELE')) { |
|
| 1437 | + $preg_modeles = "@" . _PREG_MODELE . "@imsS"; |
|
| 1438 | + $texte = echappe_html($texte, '', true, $preg_modeles); |
|
| 1439 | + } |
|
| 1440 | + } |
|
| 1441 | + |
|
| 1442 | + $debut = ''; |
|
| 1443 | + $suite = $texte; |
|
| 1444 | + while ($t = strpos('-' . $suite, "\n", 1)) { |
|
| 1445 | + $debut .= substr($suite, 0, $t - 1); |
|
| 1446 | + $suite = substr($suite, $t); |
|
| 1447 | + $car = substr($suite, 0, 1); |
|
| 1448 | + if (($car <> '-') and ($car <> '_') and ($car <> "\n") and ($car <> "|") and ($car <> "}") |
|
| 1449 | + and !preg_match(',^\s*(\n|</?(quote|div|dl|dt|dd)|$),S', ($suite)) |
|
| 1450 | + and !preg_match(',</?(quote|div|dl|dt|dd)> *$,iS', $debut) |
|
| 1451 | + ) { |
|
| 1452 | + $debut .= $delim; |
|
| 1453 | + } else { |
|
| 1454 | + $debut .= "\n"; |
|
| 1455 | + } |
|
| 1456 | + if (preg_match(",^\n+,", $suite, $regs)) { |
|
| 1457 | + $debut .= $regs[0]; |
|
| 1458 | + $suite = substr($suite, strlen($regs[0])); |
|
| 1459 | + } |
|
| 1460 | + } |
|
| 1461 | + $texte = $debut . $suite; |
|
| 1462 | + |
|
| 1463 | + $texte = echappe_retour($texte); |
|
| 1464 | + |
|
| 1465 | + return $texte . $fin; |
|
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | 1468 | |
@@ -1503,46 +1503,46 @@ discard block |
||
| 1503 | 1503 | * @return string |
| 1504 | 1504 | **/ |
| 1505 | 1505 | function extraire_idiome($letexte, $lang = null, $options = array()) { |
| 1506 | - static $traduire = false; |
|
| 1507 | - if ($letexte |
|
| 1508 | - and preg_match_all(_EXTRAIRE_IDIOME, $letexte, $regs, PREG_SET_ORDER) |
|
| 1509 | - ) { |
|
| 1510 | - if (!$traduire) { |
|
| 1511 | - $traduire = charger_fonction('traduire', 'inc'); |
|
| 1512 | - include_spip('inc/lang'); |
|
| 1513 | - } |
|
| 1514 | - if (!$lang) { |
|
| 1515 | - $lang = $GLOBALS['spip_lang']; |
|
| 1516 | - } |
|
| 1517 | - // Compatibilité avec le prototype de fonction précédente qui utilisait un boolean |
|
| 1518 | - if (is_bool($options)) { |
|
| 1519 | - $options = array('echappe_span' => $options); |
|
| 1520 | - } |
|
| 1521 | - if (!isset($options['echappe_span'])) { |
|
| 1522 | - $options = array_merge($options, array('echappe_span' => false)); |
|
| 1523 | - } |
|
| 1524 | - |
|
| 1525 | - foreach ($regs as $reg) { |
|
| 1526 | - $cle = ($reg[1] ? $reg[1] . ':' : '') . $reg[2]; |
|
| 1527 | - $desc = $traduire($cle, $lang, true); |
|
| 1528 | - $l = $desc->langue; |
|
| 1529 | - // si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte. |
|
| 1530 | - if (strlen($desc->texte)) { |
|
| 1531 | - $trad = code_echappement($desc->texte, 'idiome', false); |
|
| 1532 | - if ($l !== $lang) { |
|
| 1533 | - $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l)); |
|
| 1534 | - } |
|
| 1535 | - if (lang_dir($l) !== lang_dir($lang)) { |
|
| 1536 | - $trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l))); |
|
| 1537 | - } |
|
| 1538 | - if (!$options['echappe_span']) { |
|
| 1539 | - $trad = echappe_retour($trad, 'idiome'); |
|
| 1540 | - } |
|
| 1541 | - $letexte = str_replace($reg[0], $trad, $letexte); |
|
| 1542 | - } |
|
| 1543 | - } |
|
| 1544 | - } |
|
| 1545 | - return $letexte; |
|
| 1506 | + static $traduire = false; |
|
| 1507 | + if ($letexte |
|
| 1508 | + and preg_match_all(_EXTRAIRE_IDIOME, $letexte, $regs, PREG_SET_ORDER) |
|
| 1509 | + ) { |
|
| 1510 | + if (!$traduire) { |
|
| 1511 | + $traduire = charger_fonction('traduire', 'inc'); |
|
| 1512 | + include_spip('inc/lang'); |
|
| 1513 | + } |
|
| 1514 | + if (!$lang) { |
|
| 1515 | + $lang = $GLOBALS['spip_lang']; |
|
| 1516 | + } |
|
| 1517 | + // Compatibilité avec le prototype de fonction précédente qui utilisait un boolean |
|
| 1518 | + if (is_bool($options)) { |
|
| 1519 | + $options = array('echappe_span' => $options); |
|
| 1520 | + } |
|
| 1521 | + if (!isset($options['echappe_span'])) { |
|
| 1522 | + $options = array_merge($options, array('echappe_span' => false)); |
|
| 1523 | + } |
|
| 1524 | + |
|
| 1525 | + foreach ($regs as $reg) { |
|
| 1526 | + $cle = ($reg[1] ? $reg[1] . ':' : '') . $reg[2]; |
|
| 1527 | + $desc = $traduire($cle, $lang, true); |
|
| 1528 | + $l = $desc->langue; |
|
| 1529 | + // si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte. |
|
| 1530 | + if (strlen($desc->texte)) { |
|
| 1531 | + $trad = code_echappement($desc->texte, 'idiome', false); |
|
| 1532 | + if ($l !== $lang) { |
|
| 1533 | + $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l)); |
|
| 1534 | + } |
|
| 1535 | + if (lang_dir($l) !== lang_dir($lang)) { |
|
| 1536 | + $trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l))); |
|
| 1537 | + } |
|
| 1538 | + if (!$options['echappe_span']) { |
|
| 1539 | + $trad = echappe_retour($trad, 'idiome'); |
|
| 1540 | + } |
|
| 1541 | + $letexte = str_replace($reg[0], $trad, $letexte); |
|
| 1542 | + } |
|
| 1543 | + } |
|
| 1544 | + } |
|
| 1545 | + return $letexte; |
|
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | 1548 | /** |
@@ -1594,64 +1594,64 @@ discard block |
||
| 1594 | 1594 | **/ |
| 1595 | 1595 | function extraire_multi($letexte, $lang = null, $options = array()) { |
| 1596 | 1596 | |
| 1597 | - if ($letexte |
|
| 1598 | - and preg_match_all(_EXTRAIRE_MULTI, $letexte, $regs, PREG_SET_ORDER) |
|
| 1599 | - ) { |
|
| 1600 | - if (!$lang) { |
|
| 1601 | - $lang = $GLOBALS['spip_lang']; |
|
| 1602 | - } |
|
| 1603 | - |
|
| 1604 | - // Compatibilité avec le prototype de fonction précédente qui utilisait un boolean |
|
| 1605 | - if (is_bool($options)) { |
|
| 1606 | - $options = array('echappe_span' => $options, 'lang_defaut' => _LANGUE_PAR_DEFAUT); |
|
| 1607 | - } |
|
| 1608 | - if (!isset($options['echappe_span'])) { |
|
| 1609 | - $options = array_merge($options, array('echappe_span' => false)); |
|
| 1610 | - } |
|
| 1611 | - if (!isset($options['lang_defaut'])) { |
|
| 1612 | - $options = array_merge($options, array('lang_defaut' => _LANGUE_PAR_DEFAUT)); |
|
| 1613 | - } |
|
| 1614 | - |
|
| 1615 | - include_spip('inc/lang'); |
|
| 1616 | - foreach ($regs as $reg) { |
|
| 1617 | - // chercher la version de la langue courante |
|
| 1618 | - $trads = extraire_trads($reg[1]); |
|
| 1619 | - if ($l = approcher_langue($trads, $lang)) { |
|
| 1620 | - $trad = $trads[$l]; |
|
| 1621 | - } else { |
|
| 1622 | - if ($options['lang_defaut'] == 'aucune') { |
|
| 1623 | - $trad = ''; |
|
| 1624 | - } else { |
|
| 1625 | - // langue absente, prendre le fr ou une langue précisée (meme comportement que inc/traduire.php) |
|
| 1626 | - // ou la premiere dispo |
|
| 1627 | - // mais typographier le texte selon les regles de celle-ci |
|
| 1628 | - // Attention aux blocs multi sur plusieurs lignes |
|
| 1629 | - if (!$l = approcher_langue($trads, $options['lang_defaut'])) { |
|
| 1630 | - $l = key($trads); |
|
| 1631 | - } |
|
| 1632 | - $trad = $trads[$l]; |
|
| 1633 | - $typographie = charger_fonction(lang_typo($l), 'typographie'); |
|
| 1634 | - $trad = $typographie($trad); |
|
| 1635 | - // Tester si on echappe en span ou en div |
|
| 1636 | - // il ne faut pas echapper en div si propre produit un seul paragraphe |
|
| 1637 | - include_spip('inc/texte'); |
|
| 1638 | - $trad_propre = preg_replace(",(^<p[^>]*>|</p>$),Uims", "", propre($trad)); |
|
| 1639 | - $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span'; |
|
| 1640 | - $trad = code_echappement($trad, 'multi', false, $mode); |
|
| 1641 | - $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l)); |
|
| 1642 | - if (lang_dir($l) !== lang_dir($lang)) { |
|
| 1643 | - $trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l))); |
|
| 1644 | - } |
|
| 1645 | - if (!$options['echappe_span']) { |
|
| 1646 | - $trad = echappe_retour($trad, 'multi'); |
|
| 1647 | - } |
|
| 1648 | - } |
|
| 1649 | - } |
|
| 1650 | - $letexte = str_replace($reg[0], $trad, $letexte); |
|
| 1651 | - } |
|
| 1652 | - } |
|
| 1653 | - |
|
| 1654 | - return $letexte; |
|
| 1597 | + if ($letexte |
|
| 1598 | + and preg_match_all(_EXTRAIRE_MULTI, $letexte, $regs, PREG_SET_ORDER) |
|
| 1599 | + ) { |
|
| 1600 | + if (!$lang) { |
|
| 1601 | + $lang = $GLOBALS['spip_lang']; |
|
| 1602 | + } |
|
| 1603 | + |
|
| 1604 | + // Compatibilité avec le prototype de fonction précédente qui utilisait un boolean |
|
| 1605 | + if (is_bool($options)) { |
|
| 1606 | + $options = array('echappe_span' => $options, 'lang_defaut' => _LANGUE_PAR_DEFAUT); |
|
| 1607 | + } |
|
| 1608 | + if (!isset($options['echappe_span'])) { |
|
| 1609 | + $options = array_merge($options, array('echappe_span' => false)); |
|
| 1610 | + } |
|
| 1611 | + if (!isset($options['lang_defaut'])) { |
|
| 1612 | + $options = array_merge($options, array('lang_defaut' => _LANGUE_PAR_DEFAUT)); |
|
| 1613 | + } |
|
| 1614 | + |
|
| 1615 | + include_spip('inc/lang'); |
|
| 1616 | + foreach ($regs as $reg) { |
|
| 1617 | + // chercher la version de la langue courante |
|
| 1618 | + $trads = extraire_trads($reg[1]); |
|
| 1619 | + if ($l = approcher_langue($trads, $lang)) { |
|
| 1620 | + $trad = $trads[$l]; |
|
| 1621 | + } else { |
|
| 1622 | + if ($options['lang_defaut'] == 'aucune') { |
|
| 1623 | + $trad = ''; |
|
| 1624 | + } else { |
|
| 1625 | + // langue absente, prendre le fr ou une langue précisée (meme comportement que inc/traduire.php) |
|
| 1626 | + // ou la premiere dispo |
|
| 1627 | + // mais typographier le texte selon les regles de celle-ci |
|
| 1628 | + // Attention aux blocs multi sur plusieurs lignes |
|
| 1629 | + if (!$l = approcher_langue($trads, $options['lang_defaut'])) { |
|
| 1630 | + $l = key($trads); |
|
| 1631 | + } |
|
| 1632 | + $trad = $trads[$l]; |
|
| 1633 | + $typographie = charger_fonction(lang_typo($l), 'typographie'); |
|
| 1634 | + $trad = $typographie($trad); |
|
| 1635 | + // Tester si on echappe en span ou en div |
|
| 1636 | + // il ne faut pas echapper en div si propre produit un seul paragraphe |
|
| 1637 | + include_spip('inc/texte'); |
|
| 1638 | + $trad_propre = preg_replace(",(^<p[^>]*>|</p>$),Uims", "", propre($trad)); |
|
| 1639 | + $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span'; |
|
| 1640 | + $trad = code_echappement($trad, 'multi', false, $mode); |
|
| 1641 | + $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l)); |
|
| 1642 | + if (lang_dir($l) !== lang_dir($lang)) { |
|
| 1643 | + $trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l))); |
|
| 1644 | + } |
|
| 1645 | + if (!$options['echappe_span']) { |
|
| 1646 | + $trad = echappe_retour($trad, 'multi'); |
|
| 1647 | + } |
|
| 1648 | + } |
|
| 1649 | + } |
|
| 1650 | + $letexte = str_replace($reg[0], $trad, $letexte); |
|
| 1651 | + } |
|
| 1652 | + } |
|
| 1653 | + |
|
| 1654 | + return $letexte; |
|
| 1655 | 1655 | } |
| 1656 | 1656 | |
| 1657 | 1657 | /** |
@@ -1667,20 +1667,20 @@ discard block |
||
| 1667 | 1667 | * Peut retourner un code de langue vide, lorsqu'un texte par défaut est indiqué. |
| 1668 | 1668 | **/ |
| 1669 | 1669 | function extraire_trads($bloc) { |
| 1670 | - $lang = ''; |
|
| 1670 | + $lang = ''; |
|
| 1671 | 1671 | // ce reg fait planter l'analyse multi s'il y a de l'{italique} dans le champ |
| 1672 | 1672 | // while (preg_match("/^(.*?)[{\[]([a-z_]+)[}\]]/siS", $bloc, $regs)) { |
| 1673 | - while (preg_match("/^(.*?)[\[]([a-z_]+)[\]]/siS", $bloc, $regs)) { |
|
| 1674 | - $texte = trim($regs[1]); |
|
| 1675 | - if ($texte or $lang) { |
|
| 1676 | - $trads[$lang] = $texte; |
|
| 1677 | - } |
|
| 1678 | - $bloc = substr($bloc, strlen($regs[0])); |
|
| 1679 | - $lang = $regs[2]; |
|
| 1680 | - } |
|
| 1681 | - $trads[$lang] = $bloc; |
|
| 1673 | + while (preg_match("/^(.*?)[\[]([a-z_]+)[\]]/siS", $bloc, $regs)) { |
|
| 1674 | + $texte = trim($regs[1]); |
|
| 1675 | + if ($texte or $lang) { |
|
| 1676 | + $trads[$lang] = $texte; |
|
| 1677 | + } |
|
| 1678 | + $bloc = substr($bloc, strlen($regs[0])); |
|
| 1679 | + $lang = $regs[2]; |
|
| 1680 | + } |
|
| 1681 | + $trads[$lang] = $bloc; |
|
| 1682 | 1682 | |
| 1683 | - return $trads; |
|
| 1683 | + return $trads; |
|
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | 1686 | |
@@ -1691,7 +1691,7 @@ discard block |
||
| 1691 | 1691 | * @return string L'initiale en majuscule |
| 1692 | 1692 | */ |
| 1693 | 1693 | function filtre_initiale($nom) { |
| 1694 | - return spip_substr(trim(strtoupper(extraire_multi($nom))), 0, 1); |
|
| 1694 | + return spip_substr(trim(strtoupper(extraire_multi($nom))), 0, 1); |
|
| 1695 | 1695 | } |
| 1696 | 1696 | |
| 1697 | 1697 | |
@@ -1736,33 +1736,33 @@ discard block |
||
| 1736 | 1736 | * - null (interne) : si on empile |
| 1737 | 1737 | **/ |
| 1738 | 1738 | function unique($donnee, $famille = '', $cpt = false) { |
| 1739 | - static $mem = array(); |
|
| 1740 | - // permettre de vider la pile et de la restaurer |
|
| 1741 | - // pour le calcul de introduction... |
|
| 1742 | - if ($famille == '_spip_raz_') { |
|
| 1743 | - $tmp = $mem; |
|
| 1744 | - $mem = array(); |
|
| 1745 | - |
|
| 1746 | - return $tmp; |
|
| 1747 | - } elseif ($famille == '_spip_set_') { |
|
| 1748 | - $mem = $donnee; |
|
| 1749 | - |
|
| 1750 | - return; |
|
| 1751 | - } |
|
| 1752 | - // eviter une notice |
|
| 1753 | - if (!isset($mem[$famille])) { |
|
| 1754 | - $mem[$famille] = array(); |
|
| 1755 | - } |
|
| 1756 | - if ($cpt) { |
|
| 1757 | - return count($mem[$famille]); |
|
| 1758 | - } |
|
| 1759 | - // eviter une notice |
|
| 1760 | - if (!isset($mem[$famille][$donnee])) { |
|
| 1761 | - $mem[$famille][$donnee] = 0; |
|
| 1762 | - } |
|
| 1763 | - if (!($mem[$famille][$donnee]++)) { |
|
| 1764 | - return $donnee; |
|
| 1765 | - } |
|
| 1739 | + static $mem = array(); |
|
| 1740 | + // permettre de vider la pile et de la restaurer |
|
| 1741 | + // pour le calcul de introduction... |
|
| 1742 | + if ($famille == '_spip_raz_') { |
|
| 1743 | + $tmp = $mem; |
|
| 1744 | + $mem = array(); |
|
| 1745 | + |
|
| 1746 | + return $tmp; |
|
| 1747 | + } elseif ($famille == '_spip_set_') { |
|
| 1748 | + $mem = $donnee; |
|
| 1749 | + |
|
| 1750 | + return; |
|
| 1751 | + } |
|
| 1752 | + // eviter une notice |
|
| 1753 | + if (!isset($mem[$famille])) { |
|
| 1754 | + $mem[$famille] = array(); |
|
| 1755 | + } |
|
| 1756 | + if ($cpt) { |
|
| 1757 | + return count($mem[$famille]); |
|
| 1758 | + } |
|
| 1759 | + // eviter une notice |
|
| 1760 | + if (!isset($mem[$famille][$donnee])) { |
|
| 1761 | + $mem[$famille][$donnee] = 0; |
|
| 1762 | + } |
|
| 1763 | + if (!($mem[$famille][$donnee]++)) { |
|
| 1764 | + return $donnee; |
|
| 1765 | + } |
|
| 1766 | 1766 | } |
| 1767 | 1767 | |
| 1768 | 1768 | |
@@ -1790,18 +1790,18 @@ discard block |
||
| 1790 | 1790 | * Une des valeurs en fonction du compteur. |
| 1791 | 1791 | **/ |
| 1792 | 1792 | function alterner($i) { |
| 1793 | - // recuperer les arguments (attention fonctions un peu space) |
|
| 1794 | - $num = func_num_args(); |
|
| 1795 | - $args = func_get_args(); |
|
| 1793 | + // recuperer les arguments (attention fonctions un peu space) |
|
| 1794 | + $num = func_num_args(); |
|
| 1795 | + $args = func_get_args(); |
|
| 1796 | 1796 | |
| 1797 | - if ($num == 2 && is_array($args[1])) { |
|
| 1798 | - $args = $args[1]; |
|
| 1799 | - array_unshift($args, ''); |
|
| 1800 | - $num = count($args); |
|
| 1801 | - } |
|
| 1797 | + if ($num == 2 && is_array($args[1])) { |
|
| 1798 | + $args = $args[1]; |
|
| 1799 | + array_unshift($args, ''); |
|
| 1800 | + $num = count($args); |
|
| 1801 | + } |
|
| 1802 | 1802 | |
| 1803 | - // renvoyer le i-ieme argument, modulo le nombre d'arguments |
|
| 1804 | - return $args[(intval($i) - 1) % ($num - 1) + 1]; |
|
| 1803 | + // renvoyer le i-ieme argument, modulo le nombre d'arguments |
|
| 1804 | + return $args[(intval($i) - 1) % ($num - 1) + 1]; |
|
| 1805 | 1805 | } |
| 1806 | 1806 | |
| 1807 | 1807 | |
@@ -1826,46 +1826,46 @@ discard block |
||
| 1826 | 1826 | * - Tableau complet (si 2e argument) |
| 1827 | 1827 | **/ |
| 1828 | 1828 | function extraire_attribut($balise, $attribut, $complet = false) { |
| 1829 | - if (is_array($balise)) { |
|
| 1830 | - array_walk( |
|
| 1831 | - $balise, |
|
| 1832 | - function(&$a, $key, $t){ |
|
| 1833 | - $a = extraire_attribut($a, $t); |
|
| 1834 | - }, |
|
| 1835 | - $attribut |
|
| 1836 | - ); |
|
| 1837 | - |
|
| 1838 | - return $balise; |
|
| 1839 | - } |
|
| 1840 | - if (preg_match( |
|
| 1841 | - ',(^.*?<(?:(?>\s*)(?>[\w:.-]+)(?>(?:=(?:"[^"]*"|\'[^\']*\'|[^\'"]\S*))?))*?)(\s+' |
|
| 1842 | - . $attribut |
|
| 1843 | - . '(?:=\s*("[^"]*"|\'[^\']*\'|[^\'"]\S*))?)()((?:[\s/][^>]*)?>.*),isS', |
|
| 1844 | - |
|
| 1845 | - $balise, $r)) { |
|
| 1846 | - if (isset($r[3][0]) and ($r[3][0] == '"' || $r[3][0] == "'")) { |
|
| 1847 | - $r[4] = substr($r[3], 1, -1); |
|
| 1848 | - $r[3] = $r[3][0]; |
|
| 1849 | - } elseif ($r[3] !== '') { |
|
| 1850 | - $r[4] = $r[3]; |
|
| 1851 | - $r[3] = ''; |
|
| 1852 | - } else { |
|
| 1853 | - $r[4] = trim($r[2]); |
|
| 1854 | - } |
|
| 1855 | - $att = $r[4]; |
|
| 1856 | - if (strpos($att, "&#") !== false) { |
|
| 1857 | - $att = str_replace(array("'", "'", """, """), array("'", "'", '"', '"'), $att); |
|
| 1858 | - } |
|
| 1859 | - $att = filtrer_entites($att); |
|
| 1860 | - } else { |
|
| 1861 | - $att = null; |
|
| 1862 | - } |
|
| 1863 | - |
|
| 1864 | - if ($complet) { |
|
| 1865 | - return array($att, $r); |
|
| 1866 | - } else { |
|
| 1867 | - return $att; |
|
| 1868 | - } |
|
| 1829 | + if (is_array($balise)) { |
|
| 1830 | + array_walk( |
|
| 1831 | + $balise, |
|
| 1832 | + function(&$a, $key, $t){ |
|
| 1833 | + $a = extraire_attribut($a, $t); |
|
| 1834 | + }, |
|
| 1835 | + $attribut |
|
| 1836 | + ); |
|
| 1837 | + |
|
| 1838 | + return $balise; |
|
| 1839 | + } |
|
| 1840 | + if (preg_match( |
|
| 1841 | + ',(^.*?<(?:(?>\s*)(?>[\w:.-]+)(?>(?:=(?:"[^"]*"|\'[^\']*\'|[^\'"]\S*))?))*?)(\s+' |
|
| 1842 | + . $attribut |
|
| 1843 | + . '(?:=\s*("[^"]*"|\'[^\']*\'|[^\'"]\S*))?)()((?:[\s/][^>]*)?>.*),isS', |
|
| 1844 | + |
|
| 1845 | + $balise, $r)) { |
|
| 1846 | + if (isset($r[3][0]) and ($r[3][0] == '"' || $r[3][0] == "'")) { |
|
| 1847 | + $r[4] = substr($r[3], 1, -1); |
|
| 1848 | + $r[3] = $r[3][0]; |
|
| 1849 | + } elseif ($r[3] !== '') { |
|
| 1850 | + $r[4] = $r[3]; |
|
| 1851 | + $r[3] = ''; |
|
| 1852 | + } else { |
|
| 1853 | + $r[4] = trim($r[2]); |
|
| 1854 | + } |
|
| 1855 | + $att = $r[4]; |
|
| 1856 | + if (strpos($att, "&#") !== false) { |
|
| 1857 | + $att = str_replace(array("'", "'", """, """), array("'", "'", '"', '"'), $att); |
|
| 1858 | + } |
|
| 1859 | + $att = filtrer_entites($att); |
|
| 1860 | + } else { |
|
| 1861 | + $att = null; |
|
| 1862 | + } |
|
| 1863 | + |
|
| 1864 | + if ($complet) { |
|
| 1865 | + return array($att, $r); |
|
| 1866 | + } else { |
|
| 1867 | + return $att; |
|
| 1868 | + } |
|
| 1869 | 1869 | } |
| 1870 | 1870 | |
| 1871 | 1871 | /** |
@@ -1897,37 +1897,37 @@ discard block |
||
| 1897 | 1897 | * Code html modifié |
| 1898 | 1898 | **/ |
| 1899 | 1899 | function inserer_attribut($balise, $attribut, $val, $proteger = true, $vider = false) { |
| 1900 | - // preparer l'attribut |
|
| 1901 | - // supprimer les etc mais pas les balises html |
|
| 1902 | - // qui ont un sens dans un attribut value d'un input |
|
| 1903 | - if ($proteger) { |
|
| 1904 | - $val = attribut_html($val, false); |
|
| 1905 | - } |
|
| 1906 | - |
|
| 1907 | - // echapper les ' pour eviter tout bug |
|
| 1908 | - $val = str_replace("'", "'", $val); |
|
| 1909 | - if ($vider and strlen($val) == 0) { |
|
| 1910 | - $insert = ''; |
|
| 1911 | - } else { |
|
| 1912 | - $insert = " $attribut='$val'"; |
|
| 1913 | - } |
|
| 1914 | - |
|
| 1915 | - list($old, $r) = extraire_attribut($balise, $attribut, true); |
|
| 1916 | - |
|
| 1917 | - if ($old !== null) { |
|
| 1918 | - // Remplacer l'ancien attribut du meme nom |
|
| 1919 | - $balise = $r[1] . $insert . $r[5]; |
|
| 1920 | - } else { |
|
| 1921 | - // preferer une balise " />" (comme <img />) |
|
| 1922 | - if (preg_match(',/>,', $balise)) { |
|
| 1923 | - $balise = preg_replace(",\s?/>,S", $insert . " />", $balise, 1); |
|
| 1924 | - } // sinon une balise <a ...> ... </a> |
|
| 1925 | - else { |
|
| 1926 | - $balise = preg_replace(",\s?>,S", $insert . ">", $balise, 1); |
|
| 1927 | - } |
|
| 1928 | - } |
|
| 1929 | - |
|
| 1930 | - return $balise; |
|
| 1900 | + // preparer l'attribut |
|
| 1901 | + // supprimer les etc mais pas les balises html |
|
| 1902 | + // qui ont un sens dans un attribut value d'un input |
|
| 1903 | + if ($proteger) { |
|
| 1904 | + $val = attribut_html($val, false); |
|
| 1905 | + } |
|
| 1906 | + |
|
| 1907 | + // echapper les ' pour eviter tout bug |
|
| 1908 | + $val = str_replace("'", "'", $val); |
|
| 1909 | + if ($vider and strlen($val) == 0) { |
|
| 1910 | + $insert = ''; |
|
| 1911 | + } else { |
|
| 1912 | + $insert = " $attribut='$val'"; |
|
| 1913 | + } |
|
| 1914 | + |
|
| 1915 | + list($old, $r) = extraire_attribut($balise, $attribut, true); |
|
| 1916 | + |
|
| 1917 | + if ($old !== null) { |
|
| 1918 | + // Remplacer l'ancien attribut du meme nom |
|
| 1919 | + $balise = $r[1] . $insert . $r[5]; |
|
| 1920 | + } else { |
|
| 1921 | + // preferer une balise " />" (comme <img />) |
|
| 1922 | + if (preg_match(',/>,', $balise)) { |
|
| 1923 | + $balise = preg_replace(",\s?/>,S", $insert . " />", $balise, 1); |
|
| 1924 | + } // sinon une balise <a ...> ... </a> |
|
| 1925 | + else { |
|
| 1926 | + $balise = preg_replace(",\s?>,S", $insert . ">", $balise, 1); |
|
| 1927 | + } |
|
| 1928 | + } |
|
| 1929 | + |
|
| 1930 | + return $balise; |
|
| 1931 | 1931 | } |
| 1932 | 1932 | |
| 1933 | 1933 | /** |
@@ -1945,7 +1945,7 @@ discard block |
||
| 1945 | 1945 | * @return string Code HTML sans l'attribut |
| 1946 | 1946 | **/ |
| 1947 | 1947 | function vider_attribut($balise, $attribut) { |
| 1948 | - return inserer_attribut($balise, $attribut, '', false, true); |
|
| 1948 | + return inserer_attribut($balise, $attribut, '', false, true); |
|
| 1949 | 1949 | } |
| 1950 | 1950 | |
| 1951 | 1951 | |
@@ -1957,9 +1957,9 @@ discard block |
||
| 1957 | 1957 | * @return string |
| 1958 | 1958 | */ |
| 1959 | 1959 | function tester_config($id, $mode = '') { |
| 1960 | - include_spip('action/inscrire_auteur'); |
|
| 1960 | + include_spip('action/inscrire_auteur'); |
|
| 1961 | 1961 | |
| 1962 | - return tester_statut_inscription($mode, $id); |
|
| 1962 | + return tester_statut_inscription($mode, $id); |
|
| 1963 | 1963 | } |
| 1964 | 1964 | |
| 1965 | 1965 | // |
@@ -1984,7 +1984,7 @@ discard block |
||
| 1984 | 1984 | * @return int $a+$b |
| 1985 | 1985 | **/ |
| 1986 | 1986 | function plus($a, $b) { |
| 1987 | - return $a + $b; |
|
| 1987 | + return $a + $b; |
|
| 1988 | 1988 | } |
| 1989 | 1989 | function strplus($a, $b) {return strize('plus', $a, $b);} |
| 1990 | 1990 | /** |
@@ -2003,7 +2003,7 @@ discard block |
||
| 2003 | 2003 | * @return int $a-$b |
| 2004 | 2004 | **/ |
| 2005 | 2005 | function moins($a, $b) { |
| 2006 | - return $a - $b; |
|
| 2006 | + return $a - $b; |
|
| 2007 | 2007 | } |
| 2008 | 2008 | function strmoins($a, $b) {return strize('moins', $a, $b);} |
| 2009 | 2009 | |
@@ -2024,7 +2024,7 @@ discard block |
||
| 2024 | 2024 | * @return int $a*$b |
| 2025 | 2025 | **/ |
| 2026 | 2026 | function mult($a, $b) { |
| 2027 | - return $a * $b; |
|
| 2027 | + return $a * $b; |
|
| 2028 | 2028 | } |
| 2029 | 2029 | function strmult($a, $b) {return strize('mult', $a, $b);} |
| 2030 | 2030 | |
@@ -2045,7 +2045,7 @@ discard block |
||
| 2045 | 2045 | * @return int $a/$b (ou 0 si $b est nul) |
| 2046 | 2046 | **/ |
| 2047 | 2047 | function div($a, $b) { |
| 2048 | - return $b ? $a / $b : 0; |
|
| 2048 | + return $b ? $a / $b : 0; |
|
| 2049 | 2049 | } |
| 2050 | 2050 | function strdiv($a, $b) {return strize('div', $a, $b);} |
| 2051 | 2051 | |
@@ -2067,7 +2067,7 @@ discard block |
||
| 2067 | 2067 | * @return int ($nb % $mod) + $add |
| 2068 | 2068 | **/ |
| 2069 | 2069 | function modulo($nb, $mod, $add = 0) { |
| 2070 | - return ($mod ? $nb % $mod : 0) + $add; |
|
| 2070 | + return ($mod ? $nb % $mod : 0) + $add; |
|
| 2071 | 2071 | } |
| 2072 | 2072 | |
| 2073 | 2073 | |
@@ -2082,24 +2082,24 @@ discard block |
||
| 2082 | 2082 | * - true sinon |
| 2083 | 2083 | **/ |
| 2084 | 2084 | function nom_acceptable($nom) { |
| 2085 | - if (!is_string($nom)) { |
|
| 2086 | - return false; |
|
| 2087 | - } |
|
| 2088 | - if (!defined('_TAGS_NOM_AUTEUR')) { |
|
| 2089 | - define('_TAGS_NOM_AUTEUR', ''); |
|
| 2090 | - } |
|
| 2091 | - $tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR)); |
|
| 2092 | - foreach ($tags_acceptes as $tag) { |
|
| 2093 | - if (strlen($tag)) { |
|
| 2094 | - $remp1[] = '<' . trim($tag) . '>'; |
|
| 2095 | - $remp1[] = '</' . trim($tag) . '>'; |
|
| 2096 | - $remp2[] = '\x60' . trim($tag) . '\x61'; |
|
| 2097 | - $remp2[] = '\x60/' . trim($tag) . '\x61'; |
|
| 2098 | - } |
|
| 2099 | - } |
|
| 2100 | - $v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom))); |
|
| 2085 | + if (!is_string($nom)) { |
|
| 2086 | + return false; |
|
| 2087 | + } |
|
| 2088 | + if (!defined('_TAGS_NOM_AUTEUR')) { |
|
| 2089 | + define('_TAGS_NOM_AUTEUR', ''); |
|
| 2090 | + } |
|
| 2091 | + $tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR)); |
|
| 2092 | + foreach ($tags_acceptes as $tag) { |
|
| 2093 | + if (strlen($tag)) { |
|
| 2094 | + $remp1[] = '<' . trim($tag) . '>'; |
|
| 2095 | + $remp1[] = '</' . trim($tag) . '>'; |
|
| 2096 | + $remp2[] = '\x60' . trim($tag) . '\x61'; |
|
| 2097 | + $remp2[] = '\x60/' . trim($tag) . '\x61'; |
|
| 2098 | + } |
|
| 2099 | + } |
|
| 2100 | + $v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom))); |
|
| 2101 | 2101 | |
| 2102 | - return str_replace('<', '<', $v_nom) == $nom; |
|
| 2102 | + return str_replace('<', '<', $v_nom) == $nom; |
|
| 2103 | 2103 | } |
| 2104 | 2104 | |
| 2105 | 2105 | |
@@ -2113,29 +2113,29 @@ discard block |
||
| 2113 | 2113 | * - la normalisation de la dernière adresse donnée sinon |
| 2114 | 2114 | **/ |
| 2115 | 2115 | function email_valide($adresses) { |
| 2116 | - // eviter d'injecter n'importe quoi dans preg_match |
|
| 2117 | - if (!is_string($adresses)) { |
|
| 2118 | - return false; |
|
| 2119 | - } |
|
| 2116 | + // eviter d'injecter n'importe quoi dans preg_match |
|
| 2117 | + if (!is_string($adresses)) { |
|
| 2118 | + return false; |
|
| 2119 | + } |
|
| 2120 | 2120 | |
| 2121 | - // Si c'est un spammeur autant arreter tout de suite |
|
| 2122 | - if (preg_match(",[\n\r].*(MIME|multipart|Content-),i", $adresses)) { |
|
| 2123 | - spip_log("Tentative d'injection de mail : $adresses"); |
|
| 2121 | + // Si c'est un spammeur autant arreter tout de suite |
|
| 2122 | + if (preg_match(",[\n\r].*(MIME|multipart|Content-),i", $adresses)) { |
|
| 2123 | + spip_log("Tentative d'injection de mail : $adresses"); |
|
| 2124 | 2124 | |
| 2125 | - return false; |
|
| 2126 | - } |
|
| 2125 | + return false; |
|
| 2126 | + } |
|
| 2127 | 2127 | |
| 2128 | - foreach (explode(',', $adresses) as $v) { |
|
| 2129 | - // nettoyer certains formats |
|
| 2130 | - // "Marie Toto <[email protected]>" |
|
| 2131 | - $adresse = trim(preg_replace(",^[^<>\"]*<([^<>\"]+)>$,i", "\\1", $v)); |
|
| 2132 | - // RFC 822 |
|
| 2133 | - if (!preg_match('#^[^()<>@,;:\\"/[:space:]]+(@([-_0-9a-z]+\.)*[-_0-9a-z]+)$#i', $adresse)) { |
|
| 2134 | - return false; |
|
| 2135 | - } |
|
| 2136 | - } |
|
| 2128 | + foreach (explode(',', $adresses) as $v) { |
|
| 2129 | + // nettoyer certains formats |
|
| 2130 | + // "Marie Toto <[email protected]>" |
|
| 2131 | + $adresse = trim(preg_replace(",^[^<>\"]*<([^<>\"]+)>$,i", "\\1", $v)); |
|
| 2132 | + // RFC 822 |
|
| 2133 | + if (!preg_match('#^[^()<>@,;:\\"/[:space:]]+(@([-_0-9a-z]+\.)*[-_0-9a-z]+)$#i', $adresse)) { |
|
| 2134 | + return false; |
|
| 2135 | + } |
|
| 2136 | + } |
|
| 2137 | 2137 | |
| 2138 | - return $adresse; |
|
| 2138 | + return $adresse; |
|
| 2139 | 2139 | } |
| 2140 | 2140 | |
| 2141 | 2141 | /** |
@@ -2149,20 +2149,20 @@ discard block |
||
| 2149 | 2149 | * @return string Texte |
| 2150 | 2150 | **/ |
| 2151 | 2151 | function afficher_enclosures($tags) { |
| 2152 | - $s = array(); |
|
| 2153 | - foreach (extraire_balises($tags, 'a') as $tag) { |
|
| 2154 | - if (extraire_attribut($tag, 'rel') == 'enclosure' |
|
| 2155 | - and $t = extraire_attribut($tag, 'href') |
|
| 2156 | - ) { |
|
| 2157 | - $s[] = preg_replace(',>[^<]+</a>,S', |
|
| 2158 | - '>' |
|
| 2159 | - . http_img_pack('attachment-16.png', $t, |
|
| 2160 | - 'title="' . attribut_html($t) . '"') |
|
| 2161 | - . '</a>', $tag); |
|
| 2162 | - } |
|
| 2163 | - } |
|
| 2152 | + $s = array(); |
|
| 2153 | + foreach (extraire_balises($tags, 'a') as $tag) { |
|
| 2154 | + if (extraire_attribut($tag, 'rel') == 'enclosure' |
|
| 2155 | + and $t = extraire_attribut($tag, 'href') |
|
| 2156 | + ) { |
|
| 2157 | + $s[] = preg_replace(',>[^<]+</a>,S', |
|
| 2158 | + '>' |
|
| 2159 | + . http_img_pack('attachment-16.png', $t, |
|
| 2160 | + 'title="' . attribut_html($t) . '"') |
|
| 2161 | + . '</a>', $tag); |
|
| 2162 | + } |
|
| 2163 | + } |
|
| 2164 | 2164 | |
| 2165 | - return join(' ', $s); |
|
| 2165 | + return join(' ', $s); |
|
| 2166 | 2166 | } |
| 2167 | 2167 | |
| 2168 | 2168 | /** |
@@ -2177,15 +2177,15 @@ discard block |
||
| 2177 | 2177 | * @return string Liens trouvés |
| 2178 | 2178 | **/ |
| 2179 | 2179 | function afficher_tags($tags, $rels = 'tag,directory') { |
| 2180 | - $s = array(); |
|
| 2181 | - foreach (extraire_balises($tags, 'a') as $tag) { |
|
| 2182 | - $rel = extraire_attribut($tag, 'rel'); |
|
| 2183 | - if (strstr(",$rels,", ",$rel,")) { |
|
| 2184 | - $s[] = $tag; |
|
| 2185 | - } |
|
| 2186 | - } |
|
| 2180 | + $s = array(); |
|
| 2181 | + foreach (extraire_balises($tags, 'a') as $tag) { |
|
| 2182 | + $rel = extraire_attribut($tag, 'rel'); |
|
| 2183 | + if (strstr(",$rels,", ",$rel,")) { |
|
| 2184 | + $s[] = $tag; |
|
| 2185 | + } |
|
| 2186 | + } |
|
| 2187 | 2187 | |
| 2188 | - return join(', ', $s); |
|
| 2188 | + return join(', ', $s); |
|
| 2189 | 2189 | } |
| 2190 | 2190 | |
| 2191 | 2191 | |
@@ -2207,21 +2207,21 @@ discard block |
||
| 2207 | 2207 | * @return string Tag HTML `<a>` avec microformat. |
| 2208 | 2208 | **/ |
| 2209 | 2209 | function enclosure2microformat($e) { |
| 2210 | - if (!$url = filtrer_entites(extraire_attribut($e, 'url'))) { |
|
| 2211 | - $url = filtrer_entites(extraire_attribut($e, 'href')); |
|
| 2212 | - } |
|
| 2213 | - $type = extraire_attribut($e, 'type'); |
|
| 2214 | - if (!$length = extraire_attribut($e, 'length')) { |
|
| 2215 | - # <media:content : longeur dans fileSize. On tente. |
|
| 2216 | - $length = extraire_attribut($e, 'fileSize'); |
|
| 2217 | - } |
|
| 2218 | - $fichier = basename($url); |
|
| 2210 | + if (!$url = filtrer_entites(extraire_attribut($e, 'url'))) { |
|
| 2211 | + $url = filtrer_entites(extraire_attribut($e, 'href')); |
|
| 2212 | + } |
|
| 2213 | + $type = extraire_attribut($e, 'type'); |
|
| 2214 | + if (!$length = extraire_attribut($e, 'length')) { |
|
| 2215 | + # <media:content : longeur dans fileSize. On tente. |
|
| 2216 | + $length = extraire_attribut($e, 'fileSize'); |
|
| 2217 | + } |
|
| 2218 | + $fichier = basename($url); |
|
| 2219 | 2219 | |
| 2220 | - return '<a rel="enclosure"' |
|
| 2221 | - . ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2222 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2223 | - . ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '') |
|
| 2224 | - . '>' . $fichier . '</a>'; |
|
| 2220 | + return '<a rel="enclosure"' |
|
| 2221 | + . ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2222 | + . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2223 | + . ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '') |
|
| 2224 | + . '>' . $fichier . '</a>'; |
|
| 2225 | 2225 | } |
| 2226 | 2226 | |
| 2227 | 2227 | /** |
@@ -2239,24 +2239,24 @@ discard block |
||
| 2239 | 2239 | * @return string Tags RSS `<enclosure>`. |
| 2240 | 2240 | **/ |
| 2241 | 2241 | function microformat2enclosure($tags) { |
| 2242 | - $enclosures = array(); |
|
| 2243 | - foreach (extraire_balises($tags, 'a') as $e) { |
|
| 2244 | - if (extraire_attribut($e, 'rel') == 'enclosure') { |
|
| 2245 | - $url = filtrer_entites(extraire_attribut($e, 'href')); |
|
| 2246 | - $type = extraire_attribut($e, 'type'); |
|
| 2247 | - if (!$length = intval(extraire_attribut($e, 'title'))) { |
|
| 2248 | - $length = intval(extraire_attribut($e, 'length')); |
|
| 2249 | - } # vieux data |
|
| 2250 | - $fichier = basename($url); |
|
| 2251 | - $enclosures[] = '<enclosure' |
|
| 2252 | - . ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2253 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2254 | - . ($length ? ' length="' . $length . '"' : '') |
|
| 2255 | - . ' />'; |
|
| 2256 | - } |
|
| 2257 | - } |
|
| 2242 | + $enclosures = array(); |
|
| 2243 | + foreach (extraire_balises($tags, 'a') as $e) { |
|
| 2244 | + if (extraire_attribut($e, 'rel') == 'enclosure') { |
|
| 2245 | + $url = filtrer_entites(extraire_attribut($e, 'href')); |
|
| 2246 | + $type = extraire_attribut($e, 'type'); |
|
| 2247 | + if (!$length = intval(extraire_attribut($e, 'title'))) { |
|
| 2248 | + $length = intval(extraire_attribut($e, 'length')); |
|
| 2249 | + } # vieux data |
|
| 2250 | + $fichier = basename($url); |
|
| 2251 | + $enclosures[] = '<enclosure' |
|
| 2252 | + . ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2253 | + . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2254 | + . ($length ? ' length="' . $length . '"' : '') |
|
| 2255 | + . ' />'; |
|
| 2256 | + } |
|
| 2257 | + } |
|
| 2258 | 2258 | |
| 2259 | - return join("\n", $enclosures); |
|
| 2259 | + return join("\n", $enclosures); |
|
| 2260 | 2260 | } |
| 2261 | 2261 | |
| 2262 | 2262 | |
@@ -2272,16 +2272,16 @@ discard block |
||
| 2272 | 2272 | * @return string Tags RSS Atom `<dc:subject>`. |
| 2273 | 2273 | **/ |
| 2274 | 2274 | function tags2dcsubject($tags) { |
| 2275 | - $subjects = ''; |
|
| 2276 | - foreach (extraire_balises($tags, 'a') as $e) { |
|
| 2277 | - if (extraire_attribut($e, rel) == 'tag') { |
|
| 2278 | - $subjects .= '<dc:subject>' |
|
| 2279 | - . texte_backend(textebrut($e)) |
|
| 2280 | - . '</dc:subject>' . "\n"; |
|
| 2281 | - } |
|
| 2282 | - } |
|
| 2275 | + $subjects = ''; |
|
| 2276 | + foreach (extraire_balises($tags, 'a') as $e) { |
|
| 2277 | + if (extraire_attribut($e, rel) == 'tag') { |
|
| 2278 | + $subjects .= '<dc:subject>' |
|
| 2279 | + . texte_backend(textebrut($e)) |
|
| 2280 | + . '</dc:subject>' . "\n"; |
|
| 2281 | + } |
|
| 2282 | + } |
|
| 2283 | 2283 | |
| 2284 | - return $subjects; |
|
| 2284 | + return $subjects; |
|
| 2285 | 2285 | } |
| 2286 | 2286 | |
| 2287 | 2287 | /** |
@@ -2310,23 +2310,23 @@ discard block |
||
| 2310 | 2310 | * - Tableau de résultats, si tableau en entrée. |
| 2311 | 2311 | **/ |
| 2312 | 2312 | function extraire_balise($texte, $tag = 'a') { |
| 2313 | - if (is_array($texte)) { |
|
| 2314 | - array_walk( |
|
| 2315 | - $texte, |
|
| 2316 | - function(&$a, $key, $t){ |
|
| 2317 | - $a = extraire_balise($a, $t); |
|
| 2318 | - }, |
|
| 2319 | - $tag |
|
| 2320 | - ); |
|
| 2313 | + if (is_array($texte)) { |
|
| 2314 | + array_walk( |
|
| 2315 | + $texte, |
|
| 2316 | + function(&$a, $key, $t){ |
|
| 2317 | + $a = extraire_balise($a, $t); |
|
| 2318 | + }, |
|
| 2319 | + $tag |
|
| 2320 | + ); |
|
| 2321 | 2321 | |
| 2322 | - return $texte; |
|
| 2323 | - } |
|
| 2322 | + return $texte; |
|
| 2323 | + } |
|
| 2324 | 2324 | |
| 2325 | - if (preg_match( |
|
| 2326 | - ",<$tag\b[^>]*(/>|>.*</$tag\b[^>]*>|>),UimsS", |
|
| 2327 | - $texte, $regs)) { |
|
| 2328 | - return $regs[0]; |
|
| 2329 | - } |
|
| 2325 | + if (preg_match( |
|
| 2326 | + ",<$tag\b[^>]*(/>|>.*</$tag\b[^>]*>|>),UimsS", |
|
| 2327 | + $texte, $regs)) { |
|
| 2328 | + return $regs[0]; |
|
| 2329 | + } |
|
| 2330 | 2330 | } |
| 2331 | 2331 | |
| 2332 | 2332 | /** |
@@ -2354,25 +2354,25 @@ discard block |
||
| 2354 | 2354 | * - Tableau de résultats, si tableau en entrée. |
| 2355 | 2355 | **/ |
| 2356 | 2356 | function extraire_balises($texte, $tag = 'a') { |
| 2357 | - if (is_array($texte)) { |
|
| 2358 | - array_walk( |
|
| 2359 | - $texte, |
|
| 2360 | - function(&$a, $key, $t){ |
|
| 2361 | - $a = extraire_balises($a, $t); |
|
| 2362 | - }, |
|
| 2363 | - $tag |
|
| 2364 | - ); |
|
| 2357 | + if (is_array($texte)) { |
|
| 2358 | + array_walk( |
|
| 2359 | + $texte, |
|
| 2360 | + function(&$a, $key, $t){ |
|
| 2361 | + $a = extraire_balises($a, $t); |
|
| 2362 | + }, |
|
| 2363 | + $tag |
|
| 2364 | + ); |
|
| 2365 | 2365 | |
| 2366 | - return $texte; |
|
| 2367 | - } |
|
| 2366 | + return $texte; |
|
| 2367 | + } |
|
| 2368 | 2368 | |
| 2369 | - if (preg_match_all( |
|
| 2370 | - ",<${tag}\b[^>]*(/>|>.*</${tag}\b[^>]*>|>),UimsS", |
|
| 2371 | - $texte, $regs, PREG_PATTERN_ORDER)) { |
|
| 2372 | - return $regs[0]; |
|
| 2373 | - } else { |
|
| 2374 | - return array(); |
|
| 2375 | - } |
|
| 2369 | + if (preg_match_all( |
|
| 2370 | + ",<${tag}\b[^>]*(/>|>.*</${tag}\b[^>]*>|>),UimsS", |
|
| 2371 | + $texte, $regs, PREG_PATTERN_ORDER)) { |
|
| 2372 | + return $regs[0]; |
|
| 2373 | + } else { |
|
| 2374 | + return array(); |
|
| 2375 | + } |
|
| 2376 | 2376 | } |
| 2377 | 2377 | |
| 2378 | 2378 | /** |
@@ -2401,11 +2401,11 @@ discard block |
||
| 2401 | 2401 | * - `$def` si on n'a pas transmis de tableau |
| 2402 | 2402 | **/ |
| 2403 | 2403 | function in_any($val, $vals, $def = '') { |
| 2404 | - if (!is_array($vals) and $v = unserialize($vals)) { |
|
| 2405 | - $vals = $v; |
|
| 2406 | - } |
|
| 2404 | + if (!is_array($vals) and $v = unserialize($vals)) { |
|
| 2405 | + $vals = $v; |
|
| 2406 | + } |
|
| 2407 | 2407 | |
| 2408 | - return (!is_array($vals) ? $def : (in_array($val, $vals) ? ' ' : '')); |
|
| 2408 | + return (!is_array($vals) ? $def : (in_array($val, $vals) ? ' ' : '')); |
|
| 2409 | 2409 | } |
| 2410 | 2410 | |
| 2411 | 2411 | |
@@ -2426,12 +2426,12 @@ discard block |
||
| 2426 | 2426 | * Résultat du calcul |
| 2427 | 2427 | **/ |
| 2428 | 2428 | function valeur_numerique($expr) { |
| 2429 | - $a = 0; |
|
| 2430 | - if (preg_match(',^[0-9]+(\s*[+*-]\s*[0-9]+)*$,S', trim($expr))) { |
|
| 2431 | - eval("\$a = $expr;"); |
|
| 2432 | - } |
|
| 2429 | + $a = 0; |
|
| 2430 | + if (preg_match(',^[0-9]+(\s*[+*-]\s*[0-9]+)*$,S', trim($expr))) { |
|
| 2431 | + eval("\$a = $expr;"); |
|
| 2432 | + } |
|
| 2433 | 2433 | |
| 2434 | - return intval($a); |
|
| 2434 | + return intval($a); |
|
| 2435 | 2435 | } |
| 2436 | 2436 | |
| 2437 | 2437 | /** |
@@ -2450,7 +2450,7 @@ discard block |
||
| 2450 | 2450 | * Retourne `$a*$b/$c` |
| 2451 | 2451 | **/ |
| 2452 | 2452 | function regledetrois($a, $b, $c) { |
| 2453 | - return round($a * $b / $c); |
|
| 2453 | + return round($a * $b / $c); |
|
| 2454 | 2454 | } |
| 2455 | 2455 | |
| 2456 | 2456 | |
@@ -2474,76 +2474,76 @@ discard block |
||
| 2474 | 2474 | **/ |
| 2475 | 2475 | function form_hidden($action) { |
| 2476 | 2476 | |
| 2477 | - $contexte = array(); |
|
| 2478 | - include_spip('inc/urls'); |
|
| 2479 | - if ($p = urls_decoder_url($action, '') |
|
| 2480 | - and reset($p) |
|
| 2481 | - ) { |
|
| 2482 | - $fond = array_shift($p); |
|
| 2483 | - if ($fond != '404') { |
|
| 2484 | - $contexte = array_shift($p); |
|
| 2485 | - $contexte['page'] = $fond; |
|
| 2486 | - $action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2487 | - } |
|
| 2488 | - } |
|
| 2489 | - // defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url |
|
| 2490 | - if (defined('_DEFINIR_CONTEXTE_TYPE') and _DEFINIR_CONTEXTE_TYPE) { |
|
| 2491 | - unset($contexte['type']); |
|
| 2492 | - } |
|
| 2493 | - if (defined('_DEFINIR_CONTEXTE_TYPE_PAGE') and _DEFINIR_CONTEXTE_TYPE_PAGE) { |
|
| 2494 | - unset($contexte['type-page']); |
|
| 2495 | - } |
|
| 2496 | - |
|
| 2497 | - // on va remplir un tableau de valeurs en prenant bien soin de ne pas |
|
| 2498 | - // ecraser les elements de la forme mots[]=1&mots[]=2 |
|
| 2499 | - $values = array(); |
|
| 2500 | - |
|
| 2501 | - // d'abord avec celles de l'url |
|
| 2502 | - if (false !== ($p = strpos($action, '?'))) { |
|
| 2503 | - foreach (preg_split('/&(amp;)?/S', substr($action, $p + 1)) as $c) { |
|
| 2504 | - $c = explode('=', $c, 2); |
|
| 2505 | - $var = array_shift($c); |
|
| 2506 | - $val = array_shift($c); |
|
| 2507 | - if ($var) { |
|
| 2508 | - $val = rawurldecode($val); |
|
| 2509 | - $var = rawurldecode($var); // decoder les [] eventuels |
|
| 2510 | - if (preg_match(',\[\]$,S', $var)) { |
|
| 2511 | - $values[] = array($var, $val); |
|
| 2512 | - } else { |
|
| 2513 | - if (!isset($values[$var])) { |
|
| 2514 | - $values[$var] = array($var, $val); |
|
| 2515 | - } |
|
| 2516 | - } |
|
| 2517 | - } |
|
| 2518 | - } |
|
| 2519 | - } |
|
| 2520 | - |
|
| 2521 | - // ensuite avec celles du contexte, sans doublonner ! |
|
| 2522 | - foreach ($contexte as $var => $val) { |
|
| 2523 | - if (preg_match(',\[\]$,S', $var)) { |
|
| 2524 | - $values[] = array($var, $val); |
|
| 2525 | - } else { |
|
| 2526 | - if (!isset($values[$var])) { |
|
| 2527 | - $values[$var] = array($var, $val); |
|
| 2528 | - } |
|
| 2529 | - } |
|
| 2530 | - } |
|
| 2531 | - |
|
| 2532 | - // puis on rassemble le tout |
|
| 2533 | - $hidden = array(); |
|
| 2534 | - foreach ($values as $value) { |
|
| 2535 | - list($var, $val) = $value; |
|
| 2536 | - $hidden[] = '<input name="' |
|
| 2537 | - . entites_html($var) |
|
| 2538 | - . '"' |
|
| 2539 | - . (is_null($val) |
|
| 2540 | - ? '' |
|
| 2541 | - : ' value="' . entites_html($val) . '"' |
|
| 2542 | - ) |
|
| 2543 | - . ' type="hidden"' . "\n/>"; |
|
| 2544 | - } |
|
| 2545 | - |
|
| 2546 | - return join("", $hidden); |
|
| 2477 | + $contexte = array(); |
|
| 2478 | + include_spip('inc/urls'); |
|
| 2479 | + if ($p = urls_decoder_url($action, '') |
|
| 2480 | + and reset($p) |
|
| 2481 | + ) { |
|
| 2482 | + $fond = array_shift($p); |
|
| 2483 | + if ($fond != '404') { |
|
| 2484 | + $contexte = array_shift($p); |
|
| 2485 | + $contexte['page'] = $fond; |
|
| 2486 | + $action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2487 | + } |
|
| 2488 | + } |
|
| 2489 | + // defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url |
|
| 2490 | + if (defined('_DEFINIR_CONTEXTE_TYPE') and _DEFINIR_CONTEXTE_TYPE) { |
|
| 2491 | + unset($contexte['type']); |
|
| 2492 | + } |
|
| 2493 | + if (defined('_DEFINIR_CONTEXTE_TYPE_PAGE') and _DEFINIR_CONTEXTE_TYPE_PAGE) { |
|
| 2494 | + unset($contexte['type-page']); |
|
| 2495 | + } |
|
| 2496 | + |
|
| 2497 | + // on va remplir un tableau de valeurs en prenant bien soin de ne pas |
|
| 2498 | + // ecraser les elements de la forme mots[]=1&mots[]=2 |
|
| 2499 | + $values = array(); |
|
| 2500 | + |
|
| 2501 | + // d'abord avec celles de l'url |
|
| 2502 | + if (false !== ($p = strpos($action, '?'))) { |
|
| 2503 | + foreach (preg_split('/&(amp;)?/S', substr($action, $p + 1)) as $c) { |
|
| 2504 | + $c = explode('=', $c, 2); |
|
| 2505 | + $var = array_shift($c); |
|
| 2506 | + $val = array_shift($c); |
|
| 2507 | + if ($var) { |
|
| 2508 | + $val = rawurldecode($val); |
|
| 2509 | + $var = rawurldecode($var); // decoder les [] eventuels |
|
| 2510 | + if (preg_match(',\[\]$,S', $var)) { |
|
| 2511 | + $values[] = array($var, $val); |
|
| 2512 | + } else { |
|
| 2513 | + if (!isset($values[$var])) { |
|
| 2514 | + $values[$var] = array($var, $val); |
|
| 2515 | + } |
|
| 2516 | + } |
|
| 2517 | + } |
|
| 2518 | + } |
|
| 2519 | + } |
|
| 2520 | + |
|
| 2521 | + // ensuite avec celles du contexte, sans doublonner ! |
|
| 2522 | + foreach ($contexte as $var => $val) { |
|
| 2523 | + if (preg_match(',\[\]$,S', $var)) { |
|
| 2524 | + $values[] = array($var, $val); |
|
| 2525 | + } else { |
|
| 2526 | + if (!isset($values[$var])) { |
|
| 2527 | + $values[$var] = array($var, $val); |
|
| 2528 | + } |
|
| 2529 | + } |
|
| 2530 | + } |
|
| 2531 | + |
|
| 2532 | + // puis on rassemble le tout |
|
| 2533 | + $hidden = array(); |
|
| 2534 | + foreach ($values as $value) { |
|
| 2535 | + list($var, $val) = $value; |
|
| 2536 | + $hidden[] = '<input name="' |
|
| 2537 | + . entites_html($var) |
|
| 2538 | + . '"' |
|
| 2539 | + . (is_null($val) |
|
| 2540 | + ? '' |
|
| 2541 | + : ' value="' . entites_html($val) . '"' |
|
| 2542 | + ) |
|
| 2543 | + . ' type="hidden"' . "\n/>"; |
|
| 2544 | + } |
|
| 2545 | + |
|
| 2546 | + return join("", $hidden); |
|
| 2547 | 2547 | } |
| 2548 | 2548 | |
| 2549 | 2549 | /** |
@@ -2561,15 +2561,15 @@ discard block |
||
| 2561 | 2561 | * Liste (première page, dernière page). |
| 2562 | 2562 | **/ |
| 2563 | 2563 | function filtre_bornes_pagination_dist($courante, $nombre, $max = 10) { |
| 2564 | - if ($max <= 0 or $max >= $nombre) { |
|
| 2565 | - return array(1, $nombre); |
|
| 2566 | - } |
|
| 2564 | + if ($max <= 0 or $max >= $nombre) { |
|
| 2565 | + return array(1, $nombre); |
|
| 2566 | + } |
|
| 2567 | 2567 | |
| 2568 | - $premiere = max(1, $courante - floor(($max - 1) / 2)); |
|
| 2569 | - $derniere = min($nombre, $premiere + $max - 2); |
|
| 2570 | - $premiere = $derniere == $nombre ? $derniere - $max + 1 : $premiere; |
|
| 2568 | + $premiere = max(1, $courante - floor(($max - 1) / 2)); |
|
| 2569 | + $derniere = min($nombre, $premiere + $max - 2); |
|
| 2570 | + $premiere = $derniere == $nombre ? $derniere - $max + 1 : $premiere; |
|
| 2571 | 2571 | |
| 2572 | - return array($premiere, $derniere); |
|
| 2572 | + return array($premiere, $derniere); |
|
| 2573 | 2573 | } |
| 2574 | 2574 | |
| 2575 | 2575 | |
@@ -2591,7 +2591,7 @@ discard block |
||
| 2591 | 2591 | * - la première valeur du tableau sinon. |
| 2592 | 2592 | **/ |
| 2593 | 2593 | function filtre_reset($array) { |
| 2594 | - return !is_array($array) ? null : reset($array); |
|
| 2594 | + return !is_array($array) ? null : reset($array); |
|
| 2595 | 2595 | } |
| 2596 | 2596 | |
| 2597 | 2597 | /** |
@@ -2612,7 +2612,7 @@ discard block |
||
| 2612 | 2612 | * - la dernière valeur du tableau sinon. |
| 2613 | 2613 | **/ |
| 2614 | 2614 | function filtre_end($array) { |
| 2615 | - return !is_array($array) ? null : end($array); |
|
| 2615 | + return !is_array($array) ? null : end($array); |
|
| 2616 | 2616 | } |
| 2617 | 2617 | |
| 2618 | 2618 | /** |
@@ -2632,11 +2632,11 @@ discard block |
||
| 2632 | 2632 | * |
| 2633 | 2633 | **/ |
| 2634 | 2634 | function filtre_push($array, $val) { |
| 2635 | - if (!is_array($array) or !array_push($array, $val)) { |
|
| 2636 | - return ''; |
|
| 2637 | - } |
|
| 2635 | + if (!is_array($array) or !array_push($array, $val)) { |
|
| 2636 | + return ''; |
|
| 2637 | + } |
|
| 2638 | 2638 | |
| 2639 | - return $array; |
|
| 2639 | + return $array; |
|
| 2640 | 2640 | } |
| 2641 | 2641 | |
| 2642 | 2642 | /** |
@@ -2655,7 +2655,7 @@ discard block |
||
| 2655 | 2655 | * - `true` si la valeur existe dans le tableau, `false` sinon. |
| 2656 | 2656 | **/ |
| 2657 | 2657 | function filtre_find($array, $val) { |
| 2658 | - return (is_array($array) and in_array($val, $array)); |
|
| 2658 | + return (is_array($array) and in_array($val, $array)); |
|
| 2659 | 2659 | } |
| 2660 | 2660 | |
| 2661 | 2661 | |
@@ -2690,58 +2690,58 @@ discard block |
||
| 2690 | 2690 | * Code HTML de la pagination |
| 2691 | 2691 | **/ |
| 2692 | 2692 | function filtre_pagination_dist( |
| 2693 | - $total, |
|
| 2694 | - $nom, |
|
| 2695 | - $position, |
|
| 2696 | - $pas, |
|
| 2697 | - $liste = true, |
|
| 2698 | - $modele = '', |
|
| 2699 | - $connect = '', |
|
| 2700 | - $env = array() |
|
| 2693 | + $total, |
|
| 2694 | + $nom, |
|
| 2695 | + $position, |
|
| 2696 | + $pas, |
|
| 2697 | + $liste = true, |
|
| 2698 | + $modele = '', |
|
| 2699 | + $connect = '', |
|
| 2700 | + $env = array() |
|
| 2701 | 2701 | ) { |
| 2702 | - static $ancres = array(); |
|
| 2703 | - if ($pas < 1) { |
|
| 2704 | - return ''; |
|
| 2705 | - } |
|
| 2706 | - $ancre = 'pagination' . $nom; // #pagination_articles |
|
| 2707 | - $debut = 'debut' . $nom; // 'debut_articles' |
|
| 2708 | - |
|
| 2709 | - // n'afficher l'ancre qu'une fois |
|
| 2710 | - if (!isset($ancres[$ancre])) { |
|
| 2711 | - $bloc_ancre = $ancres[$ancre] = "<a name='" . $ancre . "' id='" . $ancre . "'></a>"; |
|
| 2712 | - } else { |
|
| 2713 | - $bloc_ancre = ''; |
|
| 2714 | - } |
|
| 2715 | - // liste = false : on ne veut que l'ancre |
|
| 2716 | - if (!$liste) { |
|
| 2717 | - return $ancres[$ancre]; |
|
| 2718 | - } |
|
| 2719 | - |
|
| 2720 | - $pagination = array( |
|
| 2721 | - 'debut' => $debut, |
|
| 2722 | - 'url' => parametre_url(self(), 'fragment', ''), // nettoyer l'id ahah eventuel |
|
| 2723 | - 'total' => $total, |
|
| 2724 | - 'position' => intval($position), |
|
| 2725 | - 'pas' => $pas, |
|
| 2726 | - 'nombre_pages' => floor(($total - 1) / $pas) + 1, |
|
| 2727 | - 'page_courante' => floor(intval($position) / $pas) + 1, |
|
| 2728 | - 'ancre' => $ancre, |
|
| 2729 | - 'bloc_ancre' => $bloc_ancre |
|
| 2730 | - ); |
|
| 2731 | - if (is_array($env)) { |
|
| 2732 | - $pagination = array_merge($env, $pagination); |
|
| 2733 | - } |
|
| 2734 | - |
|
| 2735 | - // Pas de pagination |
|
| 2736 | - if ($pagination['nombre_pages'] <= 1) { |
|
| 2737 | - return ''; |
|
| 2738 | - } |
|
| 2739 | - |
|
| 2740 | - if ($modele) { |
|
| 2741 | - $modele = '_' . $modele; |
|
| 2742 | - } |
|
| 2743 | - |
|
| 2744 | - return recuperer_fond("modeles/pagination$modele", $pagination, array('trim' => true), $connect); |
|
| 2702 | + static $ancres = array(); |
|
| 2703 | + if ($pas < 1) { |
|
| 2704 | + return ''; |
|
| 2705 | + } |
|
| 2706 | + $ancre = 'pagination' . $nom; // #pagination_articles |
|
| 2707 | + $debut = 'debut' . $nom; // 'debut_articles' |
|
| 2708 | + |
|
| 2709 | + // n'afficher l'ancre qu'une fois |
|
| 2710 | + if (!isset($ancres[$ancre])) { |
|
| 2711 | + $bloc_ancre = $ancres[$ancre] = "<a name='" . $ancre . "' id='" . $ancre . "'></a>"; |
|
| 2712 | + } else { |
|
| 2713 | + $bloc_ancre = ''; |
|
| 2714 | + } |
|
| 2715 | + // liste = false : on ne veut que l'ancre |
|
| 2716 | + if (!$liste) { |
|
| 2717 | + return $ancres[$ancre]; |
|
| 2718 | + } |
|
| 2719 | + |
|
| 2720 | + $pagination = array( |
|
| 2721 | + 'debut' => $debut, |
|
| 2722 | + 'url' => parametre_url(self(), 'fragment', ''), // nettoyer l'id ahah eventuel |
|
| 2723 | + 'total' => $total, |
|
| 2724 | + 'position' => intval($position), |
|
| 2725 | + 'pas' => $pas, |
|
| 2726 | + 'nombre_pages' => floor(($total - 1) / $pas) + 1, |
|
| 2727 | + 'page_courante' => floor(intval($position) / $pas) + 1, |
|
| 2728 | + 'ancre' => $ancre, |
|
| 2729 | + 'bloc_ancre' => $bloc_ancre |
|
| 2730 | + ); |
|
| 2731 | + if (is_array($env)) { |
|
| 2732 | + $pagination = array_merge($env, $pagination); |
|
| 2733 | + } |
|
| 2734 | + |
|
| 2735 | + // Pas de pagination |
|
| 2736 | + if ($pagination['nombre_pages'] <= 1) { |
|
| 2737 | + return ''; |
|
| 2738 | + } |
|
| 2739 | + |
|
| 2740 | + if ($modele) { |
|
| 2741 | + $modele = '_' . $modele; |
|
| 2742 | + } |
|
| 2743 | + |
|
| 2744 | + return recuperer_fond("modeles/pagination$modele", $pagination, array('trim' => true), $connect); |
|
| 2745 | 2745 | } |
| 2746 | 2746 | |
| 2747 | 2747 | |
@@ -2758,15 +2758,15 @@ discard block |
||
| 2758 | 2758 | * Contenu avec urls en absolus |
| 2759 | 2759 | **/ |
| 2760 | 2760 | function urls_absolues_css($contenu, $source) { |
| 2761 | - $path = suivre_lien(url_absolue($source), './'); |
|
| 2761 | + $path = suivre_lien(url_absolue($source), './'); |
|
| 2762 | 2762 | |
| 2763 | - return preg_replace_callback( |
|
| 2764 | - ",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims", |
|
| 2765 | - function($x) use ($path) { |
|
| 2766 | - return "url('" . suivre_lien($path, $x[1]) . "')"; |
|
| 2767 | - }, |
|
| 2768 | - $contenu |
|
| 2769 | - ); |
|
| 2763 | + return preg_replace_callback( |
|
| 2764 | + ",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims", |
|
| 2765 | + function($x) use ($path) { |
|
| 2766 | + return "url('" . suivre_lien($path, $x[1]) . "')"; |
|
| 2767 | + }, |
|
| 2768 | + $contenu |
|
| 2769 | + ); |
|
| 2770 | 2770 | } |
| 2771 | 2771 | |
| 2772 | 2772 | |
@@ -2795,118 +2795,118 @@ discard block |
||
| 2795 | 2795 | * Chemin du fichier CSS inversé |
| 2796 | 2796 | **/ |
| 2797 | 2797 | function direction_css($css, $voulue = '') { |
| 2798 | - if (!preg_match(',(_rtl)?\.css$,i', $css, $r)) { |
|
| 2799 | - return $css; |
|
| 2800 | - } |
|
| 2801 | - |
|
| 2802 | - // si on a precise le sens voulu en argument, le prendre en compte |
|
| 2803 | - if ($voulue = strtolower($voulue)) { |
|
| 2804 | - if ($voulue != 'rtl' and $voulue != 'ltr') { |
|
| 2805 | - $voulue = lang_dir($voulue); |
|
| 2806 | - } |
|
| 2807 | - } else { |
|
| 2808 | - $voulue = lang_dir(); |
|
| 2809 | - } |
|
| 2810 | - |
|
| 2811 | - $r = count($r) > 1; |
|
| 2812 | - $right = $r ? 'left' : 'right'; // 'right' de la css lue en entree |
|
| 2813 | - $dir = $r ? 'rtl' : 'ltr'; |
|
| 2814 | - $ndir = $r ? 'ltr' : 'rtl'; |
|
| 2815 | - |
|
| 2816 | - if ($voulue == $dir) { |
|
| 2817 | - return $css; |
|
| 2818 | - } |
|
| 2819 | - |
|
| 2820 | - if ( |
|
| 2821 | - // url absolue |
|
| 2822 | - preg_match(",^https?:,i", $css) |
|
| 2823 | - // ou qui contient un ? |
|
| 2824 | - or (($p = strpos($css, '?')) !== false) |
|
| 2825 | - ) { |
|
| 2826 | - $distant = true; |
|
| 2827 | - $cssf = parse_url($css); |
|
| 2828 | - $cssf = $cssf['path'] . ($cssf['query'] ? "?" . $cssf['query'] : ""); |
|
| 2829 | - $cssf = preg_replace(',[?:&=],', "_", $cssf); |
|
| 2830 | - } else { |
|
| 2831 | - $distant = false; |
|
| 2832 | - $cssf = $css; |
|
| 2833 | - // 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi |
|
| 2834 | - //propose (rien a faire dans ce cas) |
|
| 2835 | - $f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css); |
|
| 2836 | - if (@file_exists($f)) { |
|
| 2837 | - return $f; |
|
| 2838 | - } |
|
| 2839 | - } |
|
| 2840 | - |
|
| 2841 | - // 2. |
|
| 2842 | - $dir_var = sous_repertoire(_DIR_VAR, 'cache-css'); |
|
| 2843 | - $f = $dir_var |
|
| 2844 | - . preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf) |
|
| 2845 | - . '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css'; |
|
| 2846 | - |
|
| 2847 | - // la css peut etre distante (url absolue !) |
|
| 2848 | - if ($distant) { |
|
| 2849 | - include_spip('inc/distant'); |
|
| 2850 | - $res = recuperer_url($css); |
|
| 2851 | - if (!$res or !$contenu = $res['page']) { |
|
| 2852 | - return $css; |
|
| 2853 | - } |
|
| 2854 | - } else { |
|
| 2855 | - if ((@filemtime($f) > @filemtime($css)) |
|
| 2856 | - and (_VAR_MODE != 'recalcul') |
|
| 2857 | - ) { |
|
| 2858 | - return $f; |
|
| 2859 | - } |
|
| 2860 | - if (!lire_fichier($css, $contenu)) { |
|
| 2861 | - return $css; |
|
| 2862 | - } |
|
| 2863 | - } |
|
| 2864 | - |
|
| 2865 | - |
|
| 2866 | - // Inverser la direction gauche-droite en utilisant CSSTidy qui gere aussi les shorthands |
|
| 2867 | - include_spip("lib/csstidy/class.csstidy"); |
|
| 2868 | - $parser = new csstidy(); |
|
| 2869 | - $parser->set_cfg('optimise_shorthands', 0); |
|
| 2870 | - $parser->set_cfg('reverse_left_and_right', true); |
|
| 2871 | - $parser->parse($contenu); |
|
| 2872 | - |
|
| 2873 | - $contenu = $parser->print->plain(); |
|
| 2874 | - |
|
| 2875 | - |
|
| 2876 | - // reperer les @import auxquels il faut propager le direction_css |
|
| 2877 | - preg_match_all(",\@import\s*url\s*\(\s*['\"]?([^'\"/][^:]*)['\"]?\s*\),Uims", $contenu, $regs); |
|
| 2878 | - $src = array(); |
|
| 2879 | - $src_direction_css = array(); |
|
| 2880 | - $src_faux_abs = array(); |
|
| 2881 | - $d = dirname($css); |
|
| 2882 | - foreach ($regs[1] as $k => $import_css) { |
|
| 2883 | - $css_direction = direction_css("$d/$import_css", $voulue); |
|
| 2884 | - // si la css_direction est dans le meme path que la css d'origine, on tronque le path, elle sera passee en absolue |
|
| 2885 | - if (substr($css_direction, 0, strlen($d) + 1) == "$d/") { |
|
| 2886 | - $css_direction = substr($css_direction, strlen($d) + 1); |
|
| 2887 | - } // si la css_direction commence par $dir_var on la fait passer pour une absolue |
|
| 2888 | - elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) { |
|
| 2889 | - $css_direction = substr($css_direction, strlen($dir_var)); |
|
| 2890 | - $src_faux_abs["/@@@@@@/" . $css_direction] = $css_direction; |
|
| 2891 | - $css_direction = "/@@@@@@/" . $css_direction; |
|
| 2892 | - } |
|
| 2893 | - $src[] = $regs[0][$k]; |
|
| 2894 | - $src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]); |
|
| 2895 | - } |
|
| 2896 | - $contenu = str_replace($src, $src_direction_css, $contenu); |
|
| 2897 | - |
|
| 2898 | - $contenu = urls_absolues_css($contenu, $css); |
|
| 2899 | - |
|
| 2900 | - // virer les fausses url absolues que l'on a mis dans les import |
|
| 2901 | - if (count($src_faux_abs)) { |
|
| 2902 | - $contenu = str_replace(array_keys($src_faux_abs), $src_faux_abs, $contenu); |
|
| 2903 | - } |
|
| 2904 | - |
|
| 2905 | - if (!ecrire_fichier($f, $contenu)) { |
|
| 2906 | - return $css; |
|
| 2907 | - } |
|
| 2908 | - |
|
| 2909 | - return $f; |
|
| 2798 | + if (!preg_match(',(_rtl)?\.css$,i', $css, $r)) { |
|
| 2799 | + return $css; |
|
| 2800 | + } |
|
| 2801 | + |
|
| 2802 | + // si on a precise le sens voulu en argument, le prendre en compte |
|
| 2803 | + if ($voulue = strtolower($voulue)) { |
|
| 2804 | + if ($voulue != 'rtl' and $voulue != 'ltr') { |
|
| 2805 | + $voulue = lang_dir($voulue); |
|
| 2806 | + } |
|
| 2807 | + } else { |
|
| 2808 | + $voulue = lang_dir(); |
|
| 2809 | + } |
|
| 2810 | + |
|
| 2811 | + $r = count($r) > 1; |
|
| 2812 | + $right = $r ? 'left' : 'right'; // 'right' de la css lue en entree |
|
| 2813 | + $dir = $r ? 'rtl' : 'ltr'; |
|
| 2814 | + $ndir = $r ? 'ltr' : 'rtl'; |
|
| 2815 | + |
|
| 2816 | + if ($voulue == $dir) { |
|
| 2817 | + return $css; |
|
| 2818 | + } |
|
| 2819 | + |
|
| 2820 | + if ( |
|
| 2821 | + // url absolue |
|
| 2822 | + preg_match(",^https?:,i", $css) |
|
| 2823 | + // ou qui contient un ? |
|
| 2824 | + or (($p = strpos($css, '?')) !== false) |
|
| 2825 | + ) { |
|
| 2826 | + $distant = true; |
|
| 2827 | + $cssf = parse_url($css); |
|
| 2828 | + $cssf = $cssf['path'] . ($cssf['query'] ? "?" . $cssf['query'] : ""); |
|
| 2829 | + $cssf = preg_replace(',[?:&=],', "_", $cssf); |
|
| 2830 | + } else { |
|
| 2831 | + $distant = false; |
|
| 2832 | + $cssf = $css; |
|
| 2833 | + // 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi |
|
| 2834 | + //propose (rien a faire dans ce cas) |
|
| 2835 | + $f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css); |
|
| 2836 | + if (@file_exists($f)) { |
|
| 2837 | + return $f; |
|
| 2838 | + } |
|
| 2839 | + } |
|
| 2840 | + |
|
| 2841 | + // 2. |
|
| 2842 | + $dir_var = sous_repertoire(_DIR_VAR, 'cache-css'); |
|
| 2843 | + $f = $dir_var |
|
| 2844 | + . preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf) |
|
| 2845 | + . '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css'; |
|
| 2846 | + |
|
| 2847 | + // la css peut etre distante (url absolue !) |
|
| 2848 | + if ($distant) { |
|
| 2849 | + include_spip('inc/distant'); |
|
| 2850 | + $res = recuperer_url($css); |
|
| 2851 | + if (!$res or !$contenu = $res['page']) { |
|
| 2852 | + return $css; |
|
| 2853 | + } |
|
| 2854 | + } else { |
|
| 2855 | + if ((@filemtime($f) > @filemtime($css)) |
|
| 2856 | + and (_VAR_MODE != 'recalcul') |
|
| 2857 | + ) { |
|
| 2858 | + return $f; |
|
| 2859 | + } |
|
| 2860 | + if (!lire_fichier($css, $contenu)) { |
|
| 2861 | + return $css; |
|
| 2862 | + } |
|
| 2863 | + } |
|
| 2864 | + |
|
| 2865 | + |
|
| 2866 | + // Inverser la direction gauche-droite en utilisant CSSTidy qui gere aussi les shorthands |
|
| 2867 | + include_spip("lib/csstidy/class.csstidy"); |
|
| 2868 | + $parser = new csstidy(); |
|
| 2869 | + $parser->set_cfg('optimise_shorthands', 0); |
|
| 2870 | + $parser->set_cfg('reverse_left_and_right', true); |
|
| 2871 | + $parser->parse($contenu); |
|
| 2872 | + |
|
| 2873 | + $contenu = $parser->print->plain(); |
|
| 2874 | + |
|
| 2875 | + |
|
| 2876 | + // reperer les @import auxquels il faut propager le direction_css |
|
| 2877 | + preg_match_all(",\@import\s*url\s*\(\s*['\"]?([^'\"/][^:]*)['\"]?\s*\),Uims", $contenu, $regs); |
|
| 2878 | + $src = array(); |
|
| 2879 | + $src_direction_css = array(); |
|
| 2880 | + $src_faux_abs = array(); |
|
| 2881 | + $d = dirname($css); |
|
| 2882 | + foreach ($regs[1] as $k => $import_css) { |
|
| 2883 | + $css_direction = direction_css("$d/$import_css", $voulue); |
|
| 2884 | + // si la css_direction est dans le meme path que la css d'origine, on tronque le path, elle sera passee en absolue |
|
| 2885 | + if (substr($css_direction, 0, strlen($d) + 1) == "$d/") { |
|
| 2886 | + $css_direction = substr($css_direction, strlen($d) + 1); |
|
| 2887 | + } // si la css_direction commence par $dir_var on la fait passer pour une absolue |
|
| 2888 | + elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) { |
|
| 2889 | + $css_direction = substr($css_direction, strlen($dir_var)); |
|
| 2890 | + $src_faux_abs["/@@@@@@/" . $css_direction] = $css_direction; |
|
| 2891 | + $css_direction = "/@@@@@@/" . $css_direction; |
|
| 2892 | + } |
|
| 2893 | + $src[] = $regs[0][$k]; |
|
| 2894 | + $src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]); |
|
| 2895 | + } |
|
| 2896 | + $contenu = str_replace($src, $src_direction_css, $contenu); |
|
| 2897 | + |
|
| 2898 | + $contenu = urls_absolues_css($contenu, $css); |
|
| 2899 | + |
|
| 2900 | + // virer les fausses url absolues que l'on a mis dans les import |
|
| 2901 | + if (count($src_faux_abs)) { |
|
| 2902 | + $contenu = str_replace(array_keys($src_faux_abs), $src_faux_abs, $contenu); |
|
| 2903 | + } |
|
| 2904 | + |
|
| 2905 | + if (!ecrire_fichier($f, $contenu)) { |
|
| 2906 | + return $css; |
|
| 2907 | + } |
|
| 2908 | + |
|
| 2909 | + return $f; |
|
| 2910 | 2910 | } |
| 2911 | 2911 | |
| 2912 | 2912 | |
@@ -2929,43 +2929,43 @@ discard block |
||
| 2929 | 2929 | * - Chemin ou URL du fichier CSS source sinon. |
| 2930 | 2930 | **/ |
| 2931 | 2931 | function url_absolue_css($css) { |
| 2932 | - if (!preg_match(',\.css$,i', $css, $r)) { |
|
| 2933 | - return $css; |
|
| 2934 | - } |
|
| 2932 | + if (!preg_match(',\.css$,i', $css, $r)) { |
|
| 2933 | + return $css; |
|
| 2934 | + } |
|
| 2935 | 2935 | |
| 2936 | - $url_absolue_css = url_absolue($css); |
|
| 2936 | + $url_absolue_css = url_absolue($css); |
|
| 2937 | 2937 | |
| 2938 | - $f = basename($css, '.css'); |
|
| 2939 | - $f = sous_repertoire(_DIR_VAR, 'cache-css') |
|
| 2940 | - . preg_replace(",(.*?)(_rtl|_ltr)?$,", "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f) |
|
| 2941 | - . '.css'; |
|
| 2938 | + $f = basename($css, '.css'); |
|
| 2939 | + $f = sous_repertoire(_DIR_VAR, 'cache-css') |
|
| 2940 | + . preg_replace(",(.*?)(_rtl|_ltr)?$,", "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f) |
|
| 2941 | + . '.css'; |
|
| 2942 | 2942 | |
| 2943 | - if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) { |
|
| 2944 | - return $f; |
|
| 2945 | - } |
|
| 2943 | + if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) { |
|
| 2944 | + return $f; |
|
| 2945 | + } |
|
| 2946 | 2946 | |
| 2947 | - if ($url_absolue_css == $css) { |
|
| 2948 | - if (strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0 |
|
| 2949 | - or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu) |
|
| 2950 | - ) { |
|
| 2951 | - include_spip('inc/distant'); |
|
| 2952 | - if (!$contenu = recuperer_page($css)) { |
|
| 2953 | - return $css; |
|
| 2954 | - } |
|
| 2955 | - } |
|
| 2956 | - } elseif (!lire_fichier($css, $contenu)) { |
|
| 2957 | - return $css; |
|
| 2958 | - } |
|
| 2947 | + if ($url_absolue_css == $css) { |
|
| 2948 | + if (strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0 |
|
| 2949 | + or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu) |
|
| 2950 | + ) { |
|
| 2951 | + include_spip('inc/distant'); |
|
| 2952 | + if (!$contenu = recuperer_page($css)) { |
|
| 2953 | + return $css; |
|
| 2954 | + } |
|
| 2955 | + } |
|
| 2956 | + } elseif (!lire_fichier($css, $contenu)) { |
|
| 2957 | + return $css; |
|
| 2958 | + } |
|
| 2959 | 2959 | |
| 2960 | - // passer les url relatives a la css d'origine en url absolues |
|
| 2961 | - $contenu = urls_absolues_css($contenu, $css); |
|
| 2960 | + // passer les url relatives a la css d'origine en url absolues |
|
| 2961 | + $contenu = urls_absolues_css($contenu, $css); |
|
| 2962 | 2962 | |
| 2963 | - // ecrire la css |
|
| 2964 | - if (!ecrire_fichier($f, $contenu)) { |
|
| 2965 | - return $css; |
|
| 2966 | - } |
|
| 2963 | + // ecrire la css |
|
| 2964 | + if (!ecrire_fichier($f, $contenu)) { |
|
| 2965 | + return $css; |
|
| 2966 | + } |
|
| 2967 | 2967 | |
| 2968 | - return $f; |
|
| 2968 | + return $f; |
|
| 2969 | 2969 | } |
| 2970 | 2970 | |
| 2971 | 2971 | |
@@ -2999,24 +2999,24 @@ discard block |
||
| 2999 | 2999 | * Valeur trouvée ou valeur par défaut. |
| 3000 | 3000 | **/ |
| 3001 | 3001 | function table_valeur($table, $cle, $defaut = '', $conserver_null = false) { |
| 3002 | - foreach (explode('/', $cle) as $k) { |
|
| 3002 | + foreach (explode('/', $cle) as $k) { |
|
| 3003 | 3003 | |
| 3004 | - $table = is_string($table) ? @unserialize($table) : $table; |
|
| 3004 | + $table = is_string($table) ? @unserialize($table) : $table; |
|
| 3005 | 3005 | |
| 3006 | - if (is_object($table)) { |
|
| 3007 | - $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; |
|
| 3008 | - } elseif (is_array($table)) { |
|
| 3009 | - if ($conserver_null) { |
|
| 3010 | - $table = array_key_exists($k, $table) ? $table[$k] : $defaut; |
|
| 3011 | - } else { |
|
| 3012 | - $table = isset($table[$k]) ? $table[$k] : $defaut; |
|
| 3013 | - } |
|
| 3014 | - } else { |
|
| 3015 | - $table = $defaut; |
|
| 3016 | - } |
|
| 3017 | - } |
|
| 3006 | + if (is_object($table)) { |
|
| 3007 | + $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; |
|
| 3008 | + } elseif (is_array($table)) { |
|
| 3009 | + if ($conserver_null) { |
|
| 3010 | + $table = array_key_exists($k, $table) ? $table[$k] : $defaut; |
|
| 3011 | + } else { |
|
| 3012 | + $table = isset($table[$k]) ? $table[$k] : $defaut; |
|
| 3013 | + } |
|
| 3014 | + } else { |
|
| 3015 | + $table = $defaut; |
|
| 3016 | + } |
|
| 3017 | + } |
|
| 3018 | 3018 | |
| 3019 | - return $table; |
|
| 3019 | + return $table; |
|
| 3020 | 3020 | } |
| 3021 | 3021 | |
| 3022 | 3022 | /** |
@@ -3049,22 +3049,22 @@ discard block |
||
| 3049 | 3049 | * - string : expression trouvée. |
| 3050 | 3050 | **/ |
| 3051 | 3051 | function match($texte, $expression, $modif = "UimsS", $capte = 0) { |
| 3052 | - if (intval($modif) and $capte == 0) { |
|
| 3053 | - $capte = $modif; |
|
| 3054 | - $modif = "UimsS"; |
|
| 3055 | - } |
|
| 3056 | - $expression = str_replace("\/", "/", $expression); |
|
| 3057 | - $expression = str_replace("/", "\/", $expression); |
|
| 3052 | + if (intval($modif) and $capte == 0) { |
|
| 3053 | + $capte = $modif; |
|
| 3054 | + $modif = "UimsS"; |
|
| 3055 | + } |
|
| 3056 | + $expression = str_replace("\/", "/", $expression); |
|
| 3057 | + $expression = str_replace("/", "\/", $expression); |
|
| 3058 | 3058 | |
| 3059 | - if (preg_match('/' . $expression . '/' . $modif, $texte, $r)) { |
|
| 3060 | - if (isset($r[$capte])) { |
|
| 3061 | - return $r[$capte]; |
|
| 3062 | - } else { |
|
| 3063 | - return true; |
|
| 3064 | - } |
|
| 3065 | - } |
|
| 3059 | + if (preg_match('/' . $expression . '/' . $modif, $texte, $r)) { |
|
| 3060 | + if (isset($r[$capte])) { |
|
| 3061 | + return $r[$capte]; |
|
| 3062 | + } else { |
|
| 3063 | + return true; |
|
| 3064 | + } |
|
| 3065 | + } |
|
| 3066 | 3066 | |
| 3067 | - return false; |
|
| 3067 | + return false; |
|
| 3068 | 3068 | } |
| 3069 | 3069 | |
| 3070 | 3070 | |
@@ -3091,10 +3091,10 @@ discard block |
||
| 3091 | 3091 | * Texte |
| 3092 | 3092 | **/ |
| 3093 | 3093 | function replace($texte, $expression, $replace = '', $modif = "UimsS") { |
| 3094 | - $expression = str_replace("\/", "/", $expression); |
|
| 3095 | - $expression = str_replace("/", "\/", $expression); |
|
| 3094 | + $expression = str_replace("\/", "/", $expression); |
|
| 3095 | + $expression = str_replace("/", "\/", $expression); |
|
| 3096 | 3096 | |
| 3097 | - return preg_replace('/' . $expression . '/' . $modif, $replace, $texte); |
|
| 3097 | + return preg_replace('/' . $expression . '/' . $modif, $replace, $texte); |
|
| 3098 | 3098 | } |
| 3099 | 3099 | |
| 3100 | 3100 | |
@@ -3112,21 +3112,21 @@ discard block |
||
| 3112 | 3112 | **/ |
| 3113 | 3113 | function traiter_doublons_documents(&$doublons, $letexte) { |
| 3114 | 3114 | |
| 3115 | - // Verifier dans le texte & les notes (pas beau, helas) |
|
| 3116 | - $t = $letexte . $GLOBALS['les_notes']; |
|
| 3115 | + // Verifier dans le texte & les notes (pas beau, helas) |
|
| 3116 | + $t = $letexte . $GLOBALS['les_notes']; |
|
| 3117 | 3117 | |
| 3118 | - if (strstr($t, 'spip_document_') // evite le preg_match_all si inutile |
|
| 3119 | - and preg_match_all( |
|
| 3120 | - ',<[^>]+\sclass=["\']spip_document_([0-9]+)[\s"\'],imsS', |
|
| 3121 | - $t, $matches, PREG_PATTERN_ORDER) |
|
| 3122 | - ) { |
|
| 3123 | - if (!isset($doublons['documents'])) { |
|
| 3124 | - $doublons['documents'] = ""; |
|
| 3125 | - } |
|
| 3126 | - $doublons['documents'] .= "," . join(',', $matches[1]); |
|
| 3127 | - } |
|
| 3118 | + if (strstr($t, 'spip_document_') // evite le preg_match_all si inutile |
|
| 3119 | + and preg_match_all( |
|
| 3120 | + ',<[^>]+\sclass=["\']spip_document_([0-9]+)[\s"\'],imsS', |
|
| 3121 | + $t, $matches, PREG_PATTERN_ORDER) |
|
| 3122 | + ) { |
|
| 3123 | + if (!isset($doublons['documents'])) { |
|
| 3124 | + $doublons['documents'] = ""; |
|
| 3125 | + } |
|
| 3126 | + $doublons['documents'] .= "," . join(',', $matches[1]); |
|
| 3127 | + } |
|
| 3128 | 3128 | |
| 3129 | - return $letexte; |
|
| 3129 | + return $letexte; |
|
| 3130 | 3130 | } |
| 3131 | 3131 | |
| 3132 | 3132 | /** |
@@ -3140,7 +3140,7 @@ discard block |
||
| 3140 | 3140 | * @return string Chaîne vide |
| 3141 | 3141 | **/ |
| 3142 | 3142 | function vide($texte) { |
| 3143 | - return ""; |
|
| 3143 | + return ""; |
|
| 3144 | 3144 | } |
| 3145 | 3145 | |
| 3146 | 3146 | // |
@@ -3169,23 +3169,23 @@ discard block |
||
| 3169 | 3169 | * Code HTML résultant |
| 3170 | 3170 | **/ |
| 3171 | 3171 | function env_to_params($env, $ignore_params = array()) { |
| 3172 | - $ignore_params = array_merge( |
|
| 3173 | - array('id', 'lang', 'id_document', 'date', 'date_redac', 'align', 'fond', '', 'recurs', 'emb', 'dir_racine'), |
|
| 3174 | - $ignore_params |
|
| 3175 | - ); |
|
| 3176 | - if (!is_array($env)) { |
|
| 3177 | - $env = unserialize($env); |
|
| 3178 | - } |
|
| 3179 | - $texte = ""; |
|
| 3180 | - if ($env) { |
|
| 3181 | - foreach ($env as $i => $j) { |
|
| 3182 | - if (is_string($j) and !in_array($i, $ignore_params)) { |
|
| 3183 | - $texte .= "<param name='" . $i . "'\n\tvalue='" . $j . "' />"; |
|
| 3184 | - } |
|
| 3185 | - } |
|
| 3186 | - } |
|
| 3187 | - |
|
| 3188 | - return $texte; |
|
| 3172 | + $ignore_params = array_merge( |
|
| 3173 | + array('id', 'lang', 'id_document', 'date', 'date_redac', 'align', 'fond', '', 'recurs', 'emb', 'dir_racine'), |
|
| 3174 | + $ignore_params |
|
| 3175 | + ); |
|
| 3176 | + if (!is_array($env)) { |
|
| 3177 | + $env = unserialize($env); |
|
| 3178 | + } |
|
| 3179 | + $texte = ""; |
|
| 3180 | + if ($env) { |
|
| 3181 | + foreach ($env as $i => $j) { |
|
| 3182 | + if (is_string($j) and !in_array($i, $ignore_params)) { |
|
| 3183 | + $texte .= "<param name='" . $i . "'\n\tvalue='" . $j . "' />"; |
|
| 3184 | + } |
|
| 3185 | + } |
|
| 3186 | + } |
|
| 3187 | + |
|
| 3188 | + return $texte; |
|
| 3189 | 3189 | } |
| 3190 | 3190 | |
| 3191 | 3191 | /** |
@@ -3208,23 +3208,23 @@ discard block |
||
| 3208 | 3208 | * Code HTML résultant |
| 3209 | 3209 | **/ |
| 3210 | 3210 | function env_to_attributs($env, $ignore_params = array()) { |
| 3211 | - $ignore_params = array_merge( |
|
| 3212 | - array('id', 'lang', 'id_document', 'date', 'date_redac', 'align', 'fond', '', 'recurs', 'emb', 'dir_racine'), |
|
| 3213 | - $ignore_params |
|
| 3214 | - ); |
|
| 3215 | - if (!is_array($env)) { |
|
| 3216 | - $env = unserialize($env); |
|
| 3217 | - } |
|
| 3218 | - $texte = ""; |
|
| 3219 | - if ($env) { |
|
| 3220 | - foreach ($env as $i => $j) { |
|
| 3221 | - if (is_string($j) and !in_array($i, $ignore_params)) { |
|
| 3222 | - $texte .= $i . "='" . $j . "' "; |
|
| 3223 | - } |
|
| 3224 | - } |
|
| 3225 | - } |
|
| 3211 | + $ignore_params = array_merge( |
|
| 3212 | + array('id', 'lang', 'id_document', 'date', 'date_redac', 'align', 'fond', '', 'recurs', 'emb', 'dir_racine'), |
|
| 3213 | + $ignore_params |
|
| 3214 | + ); |
|
| 3215 | + if (!is_array($env)) { |
|
| 3216 | + $env = unserialize($env); |
|
| 3217 | + } |
|
| 3218 | + $texte = ""; |
|
| 3219 | + if ($env) { |
|
| 3220 | + foreach ($env as $i => $j) { |
|
| 3221 | + if (is_string($j) and !in_array($i, $ignore_params)) { |
|
| 3222 | + $texte .= $i . "='" . $j . "' "; |
|
| 3223 | + } |
|
| 3224 | + } |
|
| 3225 | + } |
|
| 3226 | 3226 | |
| 3227 | - return $texte; |
|
| 3227 | + return $texte; |
|
| 3228 | 3228 | } |
| 3229 | 3229 | |
| 3230 | 3230 | |
@@ -3241,9 +3241,9 @@ discard block |
||
| 3241 | 3241 | * @return string Chaînes concaténés |
| 3242 | 3242 | **/ |
| 3243 | 3243 | function concat() { |
| 3244 | - $args = func_get_args(); |
|
| 3244 | + $args = func_get_args(); |
|
| 3245 | 3245 | |
| 3246 | - return join('', $args); |
|
| 3246 | + return join('', $args); |
|
| 3247 | 3247 | } |
| 3248 | 3248 | |
| 3249 | 3249 | |
@@ -3263,23 +3263,23 @@ discard block |
||
| 3263 | 3263 | * Contenu du ou des fichiers, concaténé |
| 3264 | 3264 | **/ |
| 3265 | 3265 | function charge_scripts($files, $script = true) { |
| 3266 | - $flux = ""; |
|
| 3267 | - foreach (is_array($files) ? $files : explode("|", $files) as $file) { |
|
| 3268 | - if (!is_string($file)) { |
|
| 3269 | - continue; |
|
| 3270 | - } |
|
| 3271 | - if ($script) { |
|
| 3272 | - $file = preg_match(",^\w+$,", $file) ? "javascript/$file.js" : ''; |
|
| 3273 | - } |
|
| 3274 | - if ($file) { |
|
| 3275 | - $path = find_in_path($file); |
|
| 3276 | - if ($path) { |
|
| 3277 | - $flux .= spip_file_get_contents($path); |
|
| 3278 | - } |
|
| 3279 | - } |
|
| 3280 | - } |
|
| 3266 | + $flux = ""; |
|
| 3267 | + foreach (is_array($files) ? $files : explode("|", $files) as $file) { |
|
| 3268 | + if (!is_string($file)) { |
|
| 3269 | + continue; |
|
| 3270 | + } |
|
| 3271 | + if ($script) { |
|
| 3272 | + $file = preg_match(",^\w+$,", $file) ? "javascript/$file.js" : ''; |
|
| 3273 | + } |
|
| 3274 | + if ($file) { |
|
| 3275 | + $path = find_in_path($file); |
|
| 3276 | + if ($path) { |
|
| 3277 | + $flux .= spip_file_get_contents($path); |
|
| 3278 | + } |
|
| 3279 | + } |
|
| 3280 | + } |
|
| 3281 | 3281 | |
| 3282 | - return $flux; |
|
| 3282 | + return $flux; |
|
| 3283 | 3283 | } |
| 3284 | 3284 | |
| 3285 | 3285 | |
@@ -3299,29 +3299,29 @@ discard block |
||
| 3299 | 3299 | * @return string |
| 3300 | 3300 | */ |
| 3301 | 3301 | function http_img_pack($img, $alt, $atts = '', $title = '', $options = array()) { |
| 3302 | - if (!isset($options['chemin_image']) or $options['chemin_image'] == true) { |
|
| 3303 | - $img = chemin_image($img); |
|
| 3304 | - } |
|
| 3305 | - if (stripos($atts, 'width') === false) { |
|
| 3306 | - // utiliser directement l'info de taille presente dans le nom |
|
| 3307 | - if ((!isset($options['utiliser_suffixe_size']) or $options['utiliser_suffixe_size'] == true) |
|
| 3308 | - and preg_match(',-([0-9]+)[.](png|gif)$,', $img, $regs) |
|
| 3309 | - ) { |
|
| 3310 | - $largeur = $hauteur = intval($regs[1]); |
|
| 3311 | - } else { |
|
| 3312 | - $taille = taille_image($img); |
|
| 3313 | - list($hauteur, $largeur) = $taille; |
|
| 3314 | - if (!$hauteur or !$largeur) { |
|
| 3315 | - return ""; |
|
| 3316 | - } |
|
| 3317 | - } |
|
| 3318 | - $atts .= " width='" . $largeur . "' height='" . $hauteur . "'"; |
|
| 3319 | - } |
|
| 3320 | - |
|
| 3321 | - return "<img src='$img' alt='" . attribut_html($alt ? $alt : $title) . "'" |
|
| 3322 | - . ($title ? ' title="' . attribut_html($title) . '"' : '') |
|
| 3323 | - . " " . ltrim($atts) |
|
| 3324 | - . " />"; |
|
| 3302 | + if (!isset($options['chemin_image']) or $options['chemin_image'] == true) { |
|
| 3303 | + $img = chemin_image($img); |
|
| 3304 | + } |
|
| 3305 | + if (stripos($atts, 'width') === false) { |
|
| 3306 | + // utiliser directement l'info de taille presente dans le nom |
|
| 3307 | + if ((!isset($options['utiliser_suffixe_size']) or $options['utiliser_suffixe_size'] == true) |
|
| 3308 | + and preg_match(',-([0-9]+)[.](png|gif)$,', $img, $regs) |
|
| 3309 | + ) { |
|
| 3310 | + $largeur = $hauteur = intval($regs[1]); |
|
| 3311 | + } else { |
|
| 3312 | + $taille = taille_image($img); |
|
| 3313 | + list($hauteur, $largeur) = $taille; |
|
| 3314 | + if (!$hauteur or !$largeur) { |
|
| 3315 | + return ""; |
|
| 3316 | + } |
|
| 3317 | + } |
|
| 3318 | + $atts .= " width='" . $largeur . "' height='" . $hauteur . "'"; |
|
| 3319 | + } |
|
| 3320 | + |
|
| 3321 | + return "<img src='$img' alt='" . attribut_html($alt ? $alt : $title) . "'" |
|
| 3322 | + . ($title ? ' title="' . attribut_html($title) . '"' : '') |
|
| 3323 | + . " " . ltrim($atts) |
|
| 3324 | + . " />"; |
|
| 3325 | 3325 | } |
| 3326 | 3326 | |
| 3327 | 3327 | /** |
@@ -3332,7 +3332,7 @@ discard block |
||
| 3332 | 3332 | * @return string |
| 3333 | 3333 | */ |
| 3334 | 3334 | function http_style_background($img, $att = '') { |
| 3335 | - return " style='background" . ($att ? "" : "-image") . ": url(\"" . chemin_image($img) . "\")" . ($att ? (' ' . $att) : '') . ";'"; |
|
| 3335 | + return " style='background" . ($att ? "" : "-image") . ": url(\"" . chemin_image($img) . "\")" . ($att ? (' ' . $att) : '') . ";'"; |
|
| 3336 | 3336 | } |
| 3337 | 3337 | |
| 3338 | 3338 | /** |
@@ -3347,8 +3347,8 @@ discard block |
||
| 3347 | 3347 | * Code HTML de la balise IMG |
| 3348 | 3348 | */ |
| 3349 | 3349 | function filtre_balise_img_dist($img, $alt = "", $class = "") { |
| 3350 | - return http_img_pack($img, $alt, $class ? " class='" . attribut_html($class) . "'" : '', '', |
|
| 3351 | - array('chemin_image' => false, 'utiliser_suffixe_size' => false)); |
|
| 3350 | + return http_img_pack($img, $alt, $class ? " class='" . attribut_html($class) . "'" : '', '', |
|
| 3351 | + array('chemin_image' => false, 'utiliser_suffixe_size' => false)); |
|
| 3352 | 3352 | } |
| 3353 | 3353 | |
| 3354 | 3354 | |
@@ -3370,17 +3370,17 @@ discard block |
||
| 3370 | 3370 | * Code HTML résultant |
| 3371 | 3371 | **/ |
| 3372 | 3372 | function filtre_foreach_dist($tableau, $modele = 'foreach') { |
| 3373 | - $texte = ''; |
|
| 3374 | - if (is_array($tableau)) { |
|
| 3375 | - foreach ($tableau as $k => $v) { |
|
| 3376 | - $res = recuperer_fond('modeles/' . $modele, |
|
| 3377 | - array_merge(array('cle' => $k), (is_array($v) ? $v : array('valeur' => $v))) |
|
| 3378 | - ); |
|
| 3379 | - $texte .= $res; |
|
| 3380 | - } |
|
| 3381 | - } |
|
| 3373 | + $texte = ''; |
|
| 3374 | + if (is_array($tableau)) { |
|
| 3375 | + foreach ($tableau as $k => $v) { |
|
| 3376 | + $res = recuperer_fond('modeles/' . $modele, |
|
| 3377 | + array_merge(array('cle' => $k), (is_array($v) ? $v : array('valeur' => $v))) |
|
| 3378 | + ); |
|
| 3379 | + $texte .= $res; |
|
| 3380 | + } |
|
| 3381 | + } |
|
| 3382 | 3382 | |
| 3383 | - return $texte; |
|
| 3383 | + return $texte; |
|
| 3384 | 3384 | } |
| 3385 | 3385 | |
| 3386 | 3386 | |
@@ -3405,37 +3405,37 @@ discard block |
||
| 3405 | 3405 | * - tout : retourne toutes les informations du plugin actif |
| 3406 | 3406 | **/ |
| 3407 | 3407 | function filtre_info_plugin_dist($plugin, $type_info, $reload = false) { |
| 3408 | - include_spip('inc/plugin'); |
|
| 3409 | - $plugin = strtoupper($plugin); |
|
| 3410 | - $plugins_actifs = liste_plugin_actifs(); |
|
| 3411 | - |
|
| 3412 | - if (!$plugin) { |
|
| 3413 | - return serialize(array_keys($plugins_actifs)); |
|
| 3414 | - } elseif (empty($plugins_actifs[$plugin]) and !$reload) { |
|
| 3415 | - return ''; |
|
| 3416 | - } elseif (($type_info == 'est_actif') and !$reload) { |
|
| 3417 | - return $plugins_actifs[$plugin] ? 1 : 0; |
|
| 3418 | - } elseif (isset($plugins_actifs[$plugin][$type_info]) and !$reload) { |
|
| 3419 | - return $plugins_actifs[$plugin][$type_info]; |
|
| 3420 | - } else { |
|
| 3421 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 3422 | - // On prend en compte les extensions |
|
| 3423 | - if (!is_dir($plugins_actifs[$plugin]['dir_type'])) { |
|
| 3424 | - $dir_plugins = constant($plugins_actifs[$plugin]['dir_type']); |
|
| 3425 | - } else { |
|
| 3426 | - $dir_plugins = $plugins_actifs[$plugin]['dir_type']; |
|
| 3427 | - } |
|
| 3428 | - if (!$infos = $get_infos($plugins_actifs[$plugin]['dir'], $reload, $dir_plugins)) { |
|
| 3429 | - return ''; |
|
| 3430 | - } |
|
| 3431 | - if ($type_info == 'tout') { |
|
| 3432 | - return $infos; |
|
| 3433 | - } elseif ($type_info == 'est_actif') { |
|
| 3434 | - return $infos ? 1 : 0; |
|
| 3435 | - } else { |
|
| 3436 | - return strval($infos[$type_info]); |
|
| 3437 | - } |
|
| 3438 | - } |
|
| 3408 | + include_spip('inc/plugin'); |
|
| 3409 | + $plugin = strtoupper($plugin); |
|
| 3410 | + $plugins_actifs = liste_plugin_actifs(); |
|
| 3411 | + |
|
| 3412 | + if (!$plugin) { |
|
| 3413 | + return serialize(array_keys($plugins_actifs)); |
|
| 3414 | + } elseif (empty($plugins_actifs[$plugin]) and !$reload) { |
|
| 3415 | + return ''; |
|
| 3416 | + } elseif (($type_info == 'est_actif') and !$reload) { |
|
| 3417 | + return $plugins_actifs[$plugin] ? 1 : 0; |
|
| 3418 | + } elseif (isset($plugins_actifs[$plugin][$type_info]) and !$reload) { |
|
| 3419 | + return $plugins_actifs[$plugin][$type_info]; |
|
| 3420 | + } else { |
|
| 3421 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 3422 | + // On prend en compte les extensions |
|
| 3423 | + if (!is_dir($plugins_actifs[$plugin]['dir_type'])) { |
|
| 3424 | + $dir_plugins = constant($plugins_actifs[$plugin]['dir_type']); |
|
| 3425 | + } else { |
|
| 3426 | + $dir_plugins = $plugins_actifs[$plugin]['dir_type']; |
|
| 3427 | + } |
|
| 3428 | + if (!$infos = $get_infos($plugins_actifs[$plugin]['dir'], $reload, $dir_plugins)) { |
|
| 3429 | + return ''; |
|
| 3430 | + } |
|
| 3431 | + if ($type_info == 'tout') { |
|
| 3432 | + return $infos; |
|
| 3433 | + } elseif ($type_info == 'est_actif') { |
|
| 3434 | + return $infos ? 1 : 0; |
|
| 3435 | + } else { |
|
| 3436 | + return strval($infos[$type_info]); |
|
| 3437 | + } |
|
| 3438 | + } |
|
| 3439 | 3439 | } |
| 3440 | 3440 | |
| 3441 | 3441 | |
@@ -3462,9 +3462,9 @@ discard block |
||
| 3462 | 3462 | * Code HTML de l'image de puce de statut à insérer (et du menu de changement si présent) |
| 3463 | 3463 | */ |
| 3464 | 3464 | function puce_changement_statut($id_objet, $statut, $id_rubrique, $type, $ajax = false) { |
| 3465 | - $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 3465 | + $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 3466 | 3466 | |
| 3467 | - return $puce_statut($id_objet, $statut, $id_rubrique, $type, $ajax); |
|
| 3467 | + return $puce_statut($id_objet, $statut, $id_rubrique, $type, $ajax); |
|
| 3468 | 3468 | } |
| 3469 | 3469 | |
| 3470 | 3470 | |
@@ -3494,13 +3494,13 @@ discard block |
||
| 3494 | 3494 | * Code HTML de l'image de puce de statut à insérer (et du menu de changement si présent) |
| 3495 | 3495 | */ |
| 3496 | 3496 | function filtre_puce_statut_dist($statut, $objet, $id_objet = 0, $id_parent = 0) { |
| 3497 | - static $puce_statut = null; |
|
| 3498 | - if (!$puce_statut) { |
|
| 3499 | - $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 3500 | - } |
|
| 3497 | + static $puce_statut = null; |
|
| 3498 | + if (!$puce_statut) { |
|
| 3499 | + $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 3500 | + } |
|
| 3501 | 3501 | |
| 3502 | - return $puce_statut($id_objet, $statut, $id_parent, $objet, false, |
|
| 3503 | - objet_info($objet, 'editable') ? _ACTIVER_PUCE_RAPIDE : false); |
|
| 3502 | + return $puce_statut($id_objet, $statut, $id_parent, $objet, false, |
|
| 3503 | + objet_info($objet, 'editable') ? _ACTIVER_PUCE_RAPIDE : false); |
|
| 3504 | 3504 | } |
| 3505 | 3505 | |
| 3506 | 3506 | |
@@ -3527,88 +3527,88 @@ discard block |
||
| 3527 | 3527 | * hash du contexte |
| 3528 | 3528 | */ |
| 3529 | 3529 | function encoder_contexte_ajax($c, $form = '', $emboite = null, $ajaxid = '') { |
| 3530 | - if (is_string($c) |
|
| 3531 | - and @unserialize($c) !== false |
|
| 3532 | - ) { |
|
| 3533 | - $c = unserialize($c); |
|
| 3534 | - } |
|
| 3535 | - |
|
| 3536 | - // supprimer les parametres debut_x |
|
| 3537 | - // pour que la pagination ajax ne soit pas plantee |
|
| 3538 | - // si on charge la page &debut_x=1 : car alors en cliquant sur l'item 0, |
|
| 3539 | - // le debut_x=0 n'existe pas, et on resterait sur 1 |
|
| 3540 | - if (is_array($c)) { |
|
| 3541 | - foreach ($c as $k => $v) { |
|
| 3542 | - if (strpos($k, 'debut_') === 0) { |
|
| 3543 | - unset($c[$k]); |
|
| 3544 | - } |
|
| 3545 | - } |
|
| 3546 | - } |
|
| 3547 | - |
|
| 3548 | - if (!function_exists('calculer_cle_action')) { |
|
| 3549 | - include_spip("inc/securiser_action"); |
|
| 3550 | - } |
|
| 3551 | - |
|
| 3552 | - $c = serialize($c); |
|
| 3553 | - $cle = calculer_cle_action($form . $c); |
|
| 3554 | - $c = "$cle:$c"; |
|
| 3555 | - |
|
| 3556 | - // on ne stocke pas les contextes dans des fichiers caches |
|
| 3557 | - // par defaut, sauf si cette configuration a ete forcee |
|
| 3558 | - // OU que la longueur de l''argument generee est plus long |
|
| 3559 | - // que ce que telere Suhosin. |
|
| 3560 | - $cache_contextes_ajax = (defined('_CACHE_CONTEXTES_AJAX') and _CACHE_CONTEXTES_AJAX); |
|
| 3561 | - if (!$cache_contextes_ajax) { |
|
| 3562 | - $env = $c; |
|
| 3563 | - if (function_exists('gzdeflate') && function_exists('gzinflate')) { |
|
| 3564 | - $env = gzdeflate($env); |
|
| 3565 | - // http://core.spip.net/issues/2667 | https://bugs.php.net/bug.php?id=61287 |
|
| 3566 | - if ((PHP_VERSION_ID == 50400) and !@gzinflate($env)) { |
|
| 3567 | - $cache_contextes_ajax = true; |
|
| 3568 | - spip_log("Contextes AJAX forces en fichiers ! Erreur PHP 5.4.0", _LOG_AVERTISSEMENT); |
|
| 3569 | - } |
|
| 3570 | - } |
|
| 3571 | - $env = _xor($env); |
|
| 3572 | - $env = base64_encode($env); |
|
| 3573 | - // tester Suhosin et la valeur maximale des variables en GET... |
|
| 3574 | - if ($max_len = @ini_get('suhosin.get.max_value_length') |
|
| 3575 | - and $max_len < ($len = strlen($env)) |
|
| 3576 | - ) { |
|
| 3577 | - $cache_contextes_ajax = true; |
|
| 3578 | - spip_log("Contextes AJAX forces en fichiers !" |
|
| 3579 | - . " Cela arrive lorsque la valeur du contexte" |
|
| 3580 | - . " depasse la longueur maximale autorisee par Suhosin" |
|
| 3581 | - . " ($max_len) dans 'suhosin.get.max_value_length'. Ici : $len." |
|
| 3582 | - . " Vous devriez modifier les parametres de Suhosin" |
|
| 3583 | - . " pour accepter au moins 1024 caracteres.", _LOG_AVERTISSEMENT); |
|
| 3584 | - } |
|
| 3585 | - } |
|
| 3586 | - |
|
| 3587 | - if ($cache_contextes_ajax) { |
|
| 3588 | - $dir = sous_repertoire(_DIR_CACHE, 'contextes'); |
|
| 3589 | - // stocker les contextes sur disque et ne passer qu'un hash dans l'url |
|
| 3590 | - $md5 = md5($c); |
|
| 3591 | - ecrire_fichier("$dir/c$md5", $c); |
|
| 3592 | - $env = $md5; |
|
| 3593 | - } |
|
| 3594 | - |
|
| 3595 | - if ($emboite === null) { |
|
| 3596 | - return $env; |
|
| 3597 | - } |
|
| 3598 | - if (!trim($emboite)) { |
|
| 3599 | - return ""; |
|
| 3600 | - } |
|
| 3601 | - // toujours encoder l'url source dans le bloc ajax |
|
| 3602 | - $r = self(); |
|
| 3603 | - $r = ' data-origin="' . $r . '"'; |
|
| 3604 | - $class = 'ajaxbloc'; |
|
| 3605 | - if ($ajaxid and is_string($ajaxid)) { |
|
| 3606 | - // ajaxid est normalement conforme a un nom de classe css |
|
| 3607 | - // on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution |
|
| 3608 | - $class .= ' ajax-id-' . entites_html($ajaxid); |
|
| 3609 | - } |
|
| 3610 | - |
|
| 3611 | - return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 3530 | + if (is_string($c) |
|
| 3531 | + and @unserialize($c) !== false |
|
| 3532 | + ) { |
|
| 3533 | + $c = unserialize($c); |
|
| 3534 | + } |
|
| 3535 | + |
|
| 3536 | + // supprimer les parametres debut_x |
|
| 3537 | + // pour que la pagination ajax ne soit pas plantee |
|
| 3538 | + // si on charge la page &debut_x=1 : car alors en cliquant sur l'item 0, |
|
| 3539 | + // le debut_x=0 n'existe pas, et on resterait sur 1 |
|
| 3540 | + if (is_array($c)) { |
|
| 3541 | + foreach ($c as $k => $v) { |
|
| 3542 | + if (strpos($k, 'debut_') === 0) { |
|
| 3543 | + unset($c[$k]); |
|
| 3544 | + } |
|
| 3545 | + } |
|
| 3546 | + } |
|
| 3547 | + |
|
| 3548 | + if (!function_exists('calculer_cle_action')) { |
|
| 3549 | + include_spip("inc/securiser_action"); |
|
| 3550 | + } |
|
| 3551 | + |
|
| 3552 | + $c = serialize($c); |
|
| 3553 | + $cle = calculer_cle_action($form . $c); |
|
| 3554 | + $c = "$cle:$c"; |
|
| 3555 | + |
|
| 3556 | + // on ne stocke pas les contextes dans des fichiers caches |
|
| 3557 | + // par defaut, sauf si cette configuration a ete forcee |
|
| 3558 | + // OU que la longueur de l''argument generee est plus long |
|
| 3559 | + // que ce que telere Suhosin. |
|
| 3560 | + $cache_contextes_ajax = (defined('_CACHE_CONTEXTES_AJAX') and _CACHE_CONTEXTES_AJAX); |
|
| 3561 | + if (!$cache_contextes_ajax) { |
|
| 3562 | + $env = $c; |
|
| 3563 | + if (function_exists('gzdeflate') && function_exists('gzinflate')) { |
|
| 3564 | + $env = gzdeflate($env); |
|
| 3565 | + // http://core.spip.net/issues/2667 | https://bugs.php.net/bug.php?id=61287 |
|
| 3566 | + if ((PHP_VERSION_ID == 50400) and !@gzinflate($env)) { |
|
| 3567 | + $cache_contextes_ajax = true; |
|
| 3568 | + spip_log("Contextes AJAX forces en fichiers ! Erreur PHP 5.4.0", _LOG_AVERTISSEMENT); |
|
| 3569 | + } |
|
| 3570 | + } |
|
| 3571 | + $env = _xor($env); |
|
| 3572 | + $env = base64_encode($env); |
|
| 3573 | + // tester Suhosin et la valeur maximale des variables en GET... |
|
| 3574 | + if ($max_len = @ini_get('suhosin.get.max_value_length') |
|
| 3575 | + and $max_len < ($len = strlen($env)) |
|
| 3576 | + ) { |
|
| 3577 | + $cache_contextes_ajax = true; |
|
| 3578 | + spip_log("Contextes AJAX forces en fichiers !" |
|
| 3579 | + . " Cela arrive lorsque la valeur du contexte" |
|
| 3580 | + . " depasse la longueur maximale autorisee par Suhosin" |
|
| 3581 | + . " ($max_len) dans 'suhosin.get.max_value_length'. Ici : $len." |
|
| 3582 | + . " Vous devriez modifier les parametres de Suhosin" |
|
| 3583 | + . " pour accepter au moins 1024 caracteres.", _LOG_AVERTISSEMENT); |
|
| 3584 | + } |
|
| 3585 | + } |
|
| 3586 | + |
|
| 3587 | + if ($cache_contextes_ajax) { |
|
| 3588 | + $dir = sous_repertoire(_DIR_CACHE, 'contextes'); |
|
| 3589 | + // stocker les contextes sur disque et ne passer qu'un hash dans l'url |
|
| 3590 | + $md5 = md5($c); |
|
| 3591 | + ecrire_fichier("$dir/c$md5", $c); |
|
| 3592 | + $env = $md5; |
|
| 3593 | + } |
|
| 3594 | + |
|
| 3595 | + if ($emboite === null) { |
|
| 3596 | + return $env; |
|
| 3597 | + } |
|
| 3598 | + if (!trim($emboite)) { |
|
| 3599 | + return ""; |
|
| 3600 | + } |
|
| 3601 | + // toujours encoder l'url source dans le bloc ajax |
|
| 3602 | + $r = self(); |
|
| 3603 | + $r = ' data-origin="' . $r . '"'; |
|
| 3604 | + $class = 'ajaxbloc'; |
|
| 3605 | + if ($ajaxid and is_string($ajaxid)) { |
|
| 3606 | + // ajaxid est normalement conforme a un nom de classe css |
|
| 3607 | + // on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution |
|
| 3608 | + $class .= ' ajax-id-' . entites_html($ajaxid); |
|
| 3609 | + } |
|
| 3610 | + |
|
| 3611 | + return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 3612 | 3612 | } |
| 3613 | 3613 | |
| 3614 | 3614 | /** |
@@ -3628,36 +3628,36 @@ discard block |
||
| 3628 | 3628 | * - false : erreur de décodage |
| 3629 | 3629 | */ |
| 3630 | 3630 | function decoder_contexte_ajax($c, $form = '') { |
| 3631 | - if (!function_exists('calculer_cle_action')) { |
|
| 3632 | - include_spip("inc/securiser_action"); |
|
| 3633 | - } |
|
| 3634 | - if (((defined('_CACHE_CONTEXTES_AJAX') and _CACHE_CONTEXTES_AJAX) or strlen($c) == 32) |
|
| 3635 | - and $dir = sous_repertoire(_DIR_CACHE, 'contextes') |
|
| 3636 | - and lire_fichier("$dir/c$c", $contexte) |
|
| 3637 | - ) { |
|
| 3638 | - $c = $contexte; |
|
| 3639 | - } else { |
|
| 3640 | - $c = @base64_decode($c); |
|
| 3641 | - $c = _xor($c); |
|
| 3642 | - if (function_exists('gzdeflate') && function_exists('gzinflate')) { |
|
| 3643 | - $c = @gzinflate($c); |
|
| 3644 | - } |
|
| 3645 | - } |
|
| 3646 | - |
|
| 3647 | - // extraire la signature en debut de contexte |
|
| 3648 | - // et la verifier avant de deserializer |
|
| 3649 | - // format : signature:donneesserializees |
|
| 3650 | - if ($p = strpos($c,":")){ |
|
| 3651 | - $cle = substr($c,0,$p); |
|
| 3652 | - $c = substr($c,$p+1); |
|
| 3653 | - |
|
| 3654 | - if ($cle == calculer_cle_action($form . $c)) { |
|
| 3655 | - $env = @unserialize($c); |
|
| 3656 | - return $env; |
|
| 3657 | - } |
|
| 3658 | - } |
|
| 3659 | - |
|
| 3660 | - return false; |
|
| 3631 | + if (!function_exists('calculer_cle_action')) { |
|
| 3632 | + include_spip("inc/securiser_action"); |
|
| 3633 | + } |
|
| 3634 | + if (((defined('_CACHE_CONTEXTES_AJAX') and _CACHE_CONTEXTES_AJAX) or strlen($c) == 32) |
|
| 3635 | + and $dir = sous_repertoire(_DIR_CACHE, 'contextes') |
|
| 3636 | + and lire_fichier("$dir/c$c", $contexte) |
|
| 3637 | + ) { |
|
| 3638 | + $c = $contexte; |
|
| 3639 | + } else { |
|
| 3640 | + $c = @base64_decode($c); |
|
| 3641 | + $c = _xor($c); |
|
| 3642 | + if (function_exists('gzdeflate') && function_exists('gzinflate')) { |
|
| 3643 | + $c = @gzinflate($c); |
|
| 3644 | + } |
|
| 3645 | + } |
|
| 3646 | + |
|
| 3647 | + // extraire la signature en debut de contexte |
|
| 3648 | + // et la verifier avant de deserializer |
|
| 3649 | + // format : signature:donneesserializees |
|
| 3650 | + if ($p = strpos($c,":")){ |
|
| 3651 | + $cle = substr($c,0,$p); |
|
| 3652 | + $c = substr($c,$p+1); |
|
| 3653 | + |
|
| 3654 | + if ($cle == calculer_cle_action($form . $c)) { |
|
| 3655 | + $env = @unserialize($c); |
|
| 3656 | + return $env; |
|
| 3657 | + } |
|
| 3658 | + } |
|
| 3659 | + |
|
| 3660 | + return false; |
|
| 3661 | 3661 | } |
| 3662 | 3662 | |
| 3663 | 3663 | |
@@ -3675,20 +3675,20 @@ discard block |
||
| 3675 | 3675 | * Message décrypté ou encrypté |
| 3676 | 3676 | **/ |
| 3677 | 3677 | function _xor($message, $key = null) { |
| 3678 | - if (is_null($key)) { |
|
| 3679 | - if (!function_exists('calculer_cle_action')) { |
|
| 3680 | - include_spip("inc/securiser_action"); |
|
| 3681 | - } |
|
| 3682 | - $key = pack("H*", calculer_cle_action('_xor')); |
|
| 3683 | - } |
|
| 3678 | + if (is_null($key)) { |
|
| 3679 | + if (!function_exists('calculer_cle_action')) { |
|
| 3680 | + include_spip("inc/securiser_action"); |
|
| 3681 | + } |
|
| 3682 | + $key = pack("H*", calculer_cle_action('_xor')); |
|
| 3683 | + } |
|
| 3684 | 3684 | |
| 3685 | - $keylen = strlen($key); |
|
| 3686 | - $messagelen = strlen($message); |
|
| 3687 | - for ($i = 0; $i < $messagelen; $i++) { |
|
| 3688 | - $message[$i] = ~($message[$i] ^ $key[$i % $keylen]); |
|
| 3689 | - } |
|
| 3685 | + $keylen = strlen($key); |
|
| 3686 | + $messagelen = strlen($message); |
|
| 3687 | + for ($i = 0; $i < $messagelen; $i++) { |
|
| 3688 | + $message[$i] = ~($message[$i] ^ $key[$i % $keylen]); |
|
| 3689 | + } |
|
| 3690 | 3690 | |
| 3691 | - return $message; |
|
| 3691 | + return $message; |
|
| 3692 | 3692 | } |
| 3693 | 3693 | |
| 3694 | 3694 | /** |
@@ -3746,22 +3746,22 @@ discard block |
||
| 3746 | 3746 | * Code HTML |
| 3747 | 3747 | */ |
| 3748 | 3748 | function lien_ou_expose($url, $libelle = null, $on = false, $class = "", $title = "", $rel = "", $evt = '') { |
| 3749 | - if ($on) { |
|
| 3750 | - $bal = "strong"; |
|
| 3751 | - $att = "class='on'"; |
|
| 3752 | - } else { |
|
| 3753 | - $bal = 'a'; |
|
| 3754 | - $att = "href='$url'" |
|
| 3755 | - . ($title ? " title='" . attribut_html($title) . "'" : '') |
|
| 3756 | - . ($class ? " class='" . attribut_html($class) . "'" : '') |
|
| 3757 | - . ($rel ? " rel='" . attribut_html($rel) . "'" : '') |
|
| 3758 | - . $evt; |
|
| 3759 | - } |
|
| 3760 | - if ($libelle === null) { |
|
| 3761 | - $libelle = $url; |
|
| 3762 | - } |
|
| 3749 | + if ($on) { |
|
| 3750 | + $bal = "strong"; |
|
| 3751 | + $att = "class='on'"; |
|
| 3752 | + } else { |
|
| 3753 | + $bal = 'a'; |
|
| 3754 | + $att = "href='$url'" |
|
| 3755 | + . ($title ? " title='" . attribut_html($title) . "'" : '') |
|
| 3756 | + . ($class ? " class='" . attribut_html($class) . "'" : '') |
|
| 3757 | + . ($rel ? " rel='" . attribut_html($rel) . "'" : '') |
|
| 3758 | + . $evt; |
|
| 3759 | + } |
|
| 3760 | + if ($libelle === null) { |
|
| 3761 | + $libelle = $url; |
|
| 3762 | + } |
|
| 3763 | 3763 | |
| 3764 | - return "<$bal $att>$libelle</$bal>"; |
|
| 3764 | + return "<$bal $att>$libelle</$bal>"; |
|
| 3765 | 3765 | } |
| 3766 | 3766 | |
| 3767 | 3767 | |
@@ -3778,18 +3778,18 @@ discard block |
||
| 3778 | 3778 | * @return string : la chaine de langue finale en utilisant la fonction _T() |
| 3779 | 3779 | */ |
| 3780 | 3780 | function singulier_ou_pluriel($nb, $chaine_un, $chaine_plusieurs, $var = 'nb', $vars = array()) { |
| 3781 | - if (!$nb = intval($nb)) { |
|
| 3782 | - return ""; |
|
| 3783 | - } |
|
| 3784 | - if (!is_array($vars)) { |
|
| 3785 | - return ""; |
|
| 3786 | - } |
|
| 3787 | - $vars[$var] = $nb; |
|
| 3788 | - if ($nb > 1) { |
|
| 3789 | - return _T($chaine_plusieurs, $vars); |
|
| 3790 | - } else { |
|
| 3791 | - return _T($chaine_un, $vars); |
|
| 3792 | - } |
|
| 3781 | + if (!$nb = intval($nb)) { |
|
| 3782 | + return ""; |
|
| 3783 | + } |
|
| 3784 | + if (!is_array($vars)) { |
|
| 3785 | + return ""; |
|
| 3786 | + } |
|
| 3787 | + $vars[$var] = $nb; |
|
| 3788 | + if ($nb > 1) { |
|
| 3789 | + return _T($chaine_plusieurs, $vars); |
|
| 3790 | + } else { |
|
| 3791 | + return _T($chaine_un, $vars); |
|
| 3792 | + } |
|
| 3793 | 3793 | } |
| 3794 | 3794 | |
| 3795 | 3795 | |
@@ -3814,60 +3814,60 @@ discard block |
||
| 3814 | 3814 | * @return string |
| 3815 | 3815 | */ |
| 3816 | 3816 | function prepare_icone_base($type, $lien, $texte, $fond, $fonction = "", $class = "", $javascript = "") { |
| 3817 | - if (in_array($fonction, array("del", "supprimer.gif"))) { |
|
| 3818 | - $class .= ' danger'; |
|
| 3819 | - } elseif ($fonction == "rien.gif") { |
|
| 3820 | - $fonction = ""; |
|
| 3821 | - } elseif ($fonction == "delsafe") { |
|
| 3822 | - $fonction = "del"; |
|
| 3823 | - } |
|
| 3824 | - |
|
| 3825 | - // remappage des icone : article-24.png+new => article-new-24.png |
|
| 3826 | - if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) { |
|
| 3827 | - list($fond, $fonction) = $icone_renommer($fond, $fonction); |
|
| 3828 | - } |
|
| 3829 | - |
|
| 3830 | - // ajouter le type d'objet dans la class de l'icone |
|
| 3831 | - $class .= " " . substr(basename($fond), 0, -4); |
|
| 3832 | - |
|
| 3833 | - $alt = attribut_html($texte); |
|
| 3834 | - $title = " title=\"$alt\""; // est-ce pertinent de doubler le alt par un title ? |
|
| 3835 | - |
|
| 3836 | - $ajax = ""; |
|
| 3837 | - if (strpos($class, "ajax") !== false) { |
|
| 3838 | - $ajax = "ajax"; |
|
| 3839 | - if (strpos($class, "preload") !== false) { |
|
| 3840 | - $ajax .= " preload"; |
|
| 3841 | - } |
|
| 3842 | - if (strpos($class, "nocache") !== false) { |
|
| 3843 | - $ajax .= " nocache"; |
|
| 3844 | - } |
|
| 3845 | - $ajax = " class='$ajax'"; |
|
| 3846 | - } |
|
| 3847 | - |
|
| 3848 | - $size = 24; |
|
| 3849 | - if (preg_match("/-([0-9]{1,3})[.](gif|png)$/i", $fond, $match)) { |
|
| 3850 | - $size = $match[1]; |
|
| 3851 | - } |
|
| 3852 | - |
|
| 3853 | - if ($fonction) { |
|
| 3854 | - // 2 images pour composer l'icone : le fond (article) en background, |
|
| 3855 | - // la fonction (new) en image |
|
| 3856 | - $icone = http_img_pack($fonction, $alt, "width='$size' height='$size'\n" . |
|
| 3857 | - http_style_background($fond)); |
|
| 3858 | - } else { |
|
| 3859 | - $icone = http_img_pack($fond, $alt, "width='$size' height='$size'"); |
|
| 3860 | - } |
|
| 3861 | - |
|
| 3862 | - if ($type == 'lien') { |
|
| 3863 | - return "<span class='icone s$size $class'>" |
|
| 3864 | - . "<a href='$lien'$title$ajax$javascript>" |
|
| 3865 | - . $icone |
|
| 3866 | - . "<b>$texte</b>" |
|
| 3867 | - . "</a></span>\n"; |
|
| 3868 | - } else { |
|
| 3869 | - return bouton_action("$icone<b>$texte</b>", $lien, "icone s$size $class", $javascript, $alt); |
|
| 3870 | - } |
|
| 3817 | + if (in_array($fonction, array("del", "supprimer.gif"))) { |
|
| 3818 | + $class .= ' danger'; |
|
| 3819 | + } elseif ($fonction == "rien.gif") { |
|
| 3820 | + $fonction = ""; |
|
| 3821 | + } elseif ($fonction == "delsafe") { |
|
| 3822 | + $fonction = "del"; |
|
| 3823 | + } |
|
| 3824 | + |
|
| 3825 | + // remappage des icone : article-24.png+new => article-new-24.png |
|
| 3826 | + if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) { |
|
| 3827 | + list($fond, $fonction) = $icone_renommer($fond, $fonction); |
|
| 3828 | + } |
|
| 3829 | + |
|
| 3830 | + // ajouter le type d'objet dans la class de l'icone |
|
| 3831 | + $class .= " " . substr(basename($fond), 0, -4); |
|
| 3832 | + |
|
| 3833 | + $alt = attribut_html($texte); |
|
| 3834 | + $title = " title=\"$alt\""; // est-ce pertinent de doubler le alt par un title ? |
|
| 3835 | + |
|
| 3836 | + $ajax = ""; |
|
| 3837 | + if (strpos($class, "ajax") !== false) { |
|
| 3838 | + $ajax = "ajax"; |
|
| 3839 | + if (strpos($class, "preload") !== false) { |
|
| 3840 | + $ajax .= " preload"; |
|
| 3841 | + } |
|
| 3842 | + if (strpos($class, "nocache") !== false) { |
|
| 3843 | + $ajax .= " nocache"; |
|
| 3844 | + } |
|
| 3845 | + $ajax = " class='$ajax'"; |
|
| 3846 | + } |
|
| 3847 | + |
|
| 3848 | + $size = 24; |
|
| 3849 | + if (preg_match("/-([0-9]{1,3})[.](gif|png)$/i", $fond, $match)) { |
|
| 3850 | + $size = $match[1]; |
|
| 3851 | + } |
|
| 3852 | + |
|
| 3853 | + if ($fonction) { |
|
| 3854 | + // 2 images pour composer l'icone : le fond (article) en background, |
|
| 3855 | + // la fonction (new) en image |
|
| 3856 | + $icone = http_img_pack($fonction, $alt, "width='$size' height='$size'\n" . |
|
| 3857 | + http_style_background($fond)); |
|
| 3858 | + } else { |
|
| 3859 | + $icone = http_img_pack($fond, $alt, "width='$size' height='$size'"); |
|
| 3860 | + } |
|
| 3861 | + |
|
| 3862 | + if ($type == 'lien') { |
|
| 3863 | + return "<span class='icone s$size $class'>" |
|
| 3864 | + . "<a href='$lien'$title$ajax$javascript>" |
|
| 3865 | + . $icone |
|
| 3866 | + . "<b>$texte</b>" |
|
| 3867 | + . "</a></span>\n"; |
|
| 3868 | + } else { |
|
| 3869 | + return bouton_action("$icone<b>$texte</b>", $lien, "icone s$size $class", $javascript, $alt); |
|
| 3870 | + } |
|
| 3871 | 3871 | } |
| 3872 | 3872 | |
| 3873 | 3873 | /** |
@@ -3891,7 +3891,7 @@ discard block |
||
| 3891 | 3891 | * Code HTML du lien |
| 3892 | 3892 | **/ |
| 3893 | 3893 | function icone_base($lien, $texte, $fond, $fonction = "", $class = "", $javascript = "") { |
| 3894 | - return prepare_icone_base('lien', $lien, $texte, $fond, $fonction, $class, $javascript); |
|
| 3894 | + return prepare_icone_base('lien', $lien, $texte, $fond, $fonction, $class, $javascript); |
|
| 3895 | 3895 | } |
| 3896 | 3896 | |
| 3897 | 3897 | /** |
@@ -3926,7 +3926,7 @@ discard block |
||
| 3926 | 3926 | * Code HTML du lien |
| 3927 | 3927 | **/ |
| 3928 | 3928 | function filtre_icone_verticale_dist($lien, $texte, $fond, $fonction = "", $class = "", $javascript = "") { |
| 3929 | - return icone_base($lien, $texte, $fond, $fonction, "verticale $class", $javascript); |
|
| 3929 | + return icone_base($lien, $texte, $fond, $fonction, "verticale $class", $javascript); |
|
| 3930 | 3930 | } |
| 3931 | 3931 | |
| 3932 | 3932 | /** |
@@ -3971,7 +3971,7 @@ discard block |
||
| 3971 | 3971 | * Code HTML du lien |
| 3972 | 3972 | **/ |
| 3973 | 3973 | function filtre_icone_horizontale_dist($lien, $texte, $fond, $fonction = "", $class = "", $javascript = "") { |
| 3974 | - return icone_base($lien, $texte, $fond, $fonction, "horizontale $class", $javascript); |
|
| 3974 | + return icone_base($lien, $texte, $fond, $fonction, "horizontale $class", $javascript); |
|
| 3975 | 3975 | } |
| 3976 | 3976 | |
| 3977 | 3977 | /** |
@@ -4002,7 +4002,7 @@ discard block |
||
| 4002 | 4002 | * Code HTML du lien |
| 4003 | 4003 | **/ |
| 4004 | 4004 | function filtre_bouton_action_horizontal_dist($lien, $texte, $fond, $fonction = "", $class = "", $confirm = "") { |
| 4005 | - return prepare_icone_base('bouton', $lien, $texte, $fond, $fonction, "horizontale $class", $confirm); |
|
| 4005 | + return prepare_icone_base('bouton', $lien, $texte, $fond, $fonction, "horizontale $class", $confirm); |
|
| 4006 | 4006 | } |
| 4007 | 4007 | |
| 4008 | 4008 | /** |
@@ -4032,7 +4032,7 @@ discard block |
||
| 4032 | 4032 | * Code HTML du lien |
| 4033 | 4033 | */ |
| 4034 | 4034 | function filtre_icone_dist($lien, $texte, $fond, $align = "", $fonction = "", $class = "", $javascript = "") { |
| 4035 | - return icone_base($lien, $texte, $fond, $fonction, "verticale $align $class", $javascript); |
|
| 4035 | + return icone_base($lien, $texte, $fond, $fonction, "verticale $align $class", $javascript); |
|
| 4036 | 4036 | } |
| 4037 | 4037 | |
| 4038 | 4038 | |
@@ -4080,26 +4080,26 @@ discard block |
||
| 4080 | 4080 | * @return string Code CSS |
| 4081 | 4081 | */ |
| 4082 | 4082 | function bando_images_background() { |
| 4083 | - include_spip('inc/bandeau'); |
|
| 4084 | - // recuperer tous les boutons et leurs images |
|
| 4085 | - $boutons = definir_barre_boutons(definir_barre_contexte(), true, false); |
|
| 4083 | + include_spip('inc/bandeau'); |
|
| 4084 | + // recuperer tous les boutons et leurs images |
|
| 4085 | + $boutons = definir_barre_boutons(definir_barre_contexte(), true, false); |
|
| 4086 | 4086 | |
| 4087 | - $res = ""; |
|
| 4088 | - foreach ($boutons as $page => $detail) { |
|
| 4089 | - if ($detail->icone and strlen(trim($detail->icone))) { |
|
| 4090 | - $res .= "\n.navigation_avec_icones #bando1_$page {background-image:url(" . $detail->icone . ");}"; |
|
| 4091 | - } |
|
| 4092 | - $selecteur = (in_array($page, array('outils_rapides', 'outils_collaboratifs')) ? "" : ".navigation_avec_icones "); |
|
| 4093 | - if (is_array($detail->sousmenu)) { |
|
| 4094 | - foreach ($detail->sousmenu as $souspage => $sousdetail) { |
|
| 4095 | - if ($sousdetail->icone and strlen(trim($sousdetail->icone))) { |
|
| 4096 | - $res .= "\n$selecteur.bando2_$souspage {background-image:url(" . $sousdetail->icone . ");}"; |
|
| 4097 | - } |
|
| 4098 | - } |
|
| 4099 | - } |
|
| 4100 | - } |
|
| 4087 | + $res = ""; |
|
| 4088 | + foreach ($boutons as $page => $detail) { |
|
| 4089 | + if ($detail->icone and strlen(trim($detail->icone))) { |
|
| 4090 | + $res .= "\n.navigation_avec_icones #bando1_$page {background-image:url(" . $detail->icone . ");}"; |
|
| 4091 | + } |
|
| 4092 | + $selecteur = (in_array($page, array('outils_rapides', 'outils_collaboratifs')) ? "" : ".navigation_avec_icones "); |
|
| 4093 | + if (is_array($detail->sousmenu)) { |
|
| 4094 | + foreach ($detail->sousmenu as $souspage => $sousdetail) { |
|
| 4095 | + if ($sousdetail->icone and strlen(trim($sousdetail->icone))) { |
|
| 4096 | + $res .= "\n$selecteur.bando2_$souspage {background-image:url(" . $sousdetail->icone . ");}"; |
|
| 4097 | + } |
|
| 4098 | + } |
|
| 4099 | + } |
|
| 4100 | + } |
|
| 4101 | 4101 | |
| 4102 | - return $res; |
|
| 4102 | + return $res; |
|
| 4103 | 4103 | } |
| 4104 | 4104 | |
| 4105 | 4105 | /** |
@@ -4118,19 +4118,19 @@ discard block |
||
| 4118 | 4118 | * @return string |
| 4119 | 4119 | */ |
| 4120 | 4120 | function bouton_action($libelle, $url, $class = "", $confirm = "", $title = "", $callback = "") { |
| 4121 | - if ($confirm) { |
|
| 4122 | - $confirm = "confirm(\"" . attribut_html($confirm) . "\")"; |
|
| 4123 | - if ($callback) { |
|
| 4124 | - $callback = "$confirm?($callback):false"; |
|
| 4125 | - } else { |
|
| 4126 | - $callback = $confirm; |
|
| 4127 | - } |
|
| 4128 | - } |
|
| 4129 | - $onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : ""; |
|
| 4130 | - $title = $title ? " title='$title'" : ""; |
|
| 4121 | + if ($confirm) { |
|
| 4122 | + $confirm = "confirm(\"" . attribut_html($confirm) . "\")"; |
|
| 4123 | + if ($callback) { |
|
| 4124 | + $callback = "$confirm?($callback):false"; |
|
| 4125 | + } else { |
|
| 4126 | + $callback = $confirm; |
|
| 4127 | + } |
|
| 4128 | + } |
|
| 4129 | + $onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : ""; |
|
| 4130 | + $title = $title ? " title='$title'" : ""; |
|
| 4131 | 4131 | |
| 4132 | - return "<form class='bouton_action_post $class' method='post' action='$url'><div>" . form_hidden($url) |
|
| 4133 | - . "<button type='submit' class='submit'$title$onclick>$libelle</button></div></form>"; |
|
| 4132 | + return "<form class='bouton_action_post $class' method='post' action='$url'><div>" . form_hidden($url) |
|
| 4133 | + . "<button type='submit' class='submit'$title$onclick>$libelle</button></div></form>"; |
|
| 4134 | 4134 | } |
| 4135 | 4135 | |
| 4136 | 4136 | |
@@ -4142,7 +4142,7 @@ discard block |
||
| 4142 | 4142 | * @return string |
| 4143 | 4143 | */ |
| 4144 | 4144 | function tri_protege_champ($t) { |
| 4145 | - return preg_replace(',[^\s\w.+],', '', $t); |
|
| 4145 | + return preg_replace(',[^\s\w.+],', '', $t); |
|
| 4146 | 4146 | } |
| 4147 | 4147 | |
| 4148 | 4148 | /** |
@@ -4155,34 +4155,34 @@ discard block |
||
| 4155 | 4155 | * @return string |
| 4156 | 4156 | */ |
| 4157 | 4157 | function tri_champ_order($t, $from = null) { |
| 4158 | - if (strncmp($t, 'multi ', 6) == 0) { |
|
| 4159 | - return "multi"; |
|
| 4160 | - } |
|
| 4161 | - |
|
| 4162 | - $champ = $t; |
|
| 4163 | - |
|
| 4164 | - if (strncmp($t, 'num ', 4) == 0) { |
|
| 4165 | - $champ = substr($t, 4); |
|
| 4166 | - } |
|
| 4167 | - // enlever les autres espaces non evacues par tri_protege_champ |
|
| 4168 | - $champ = preg_replace(',\s,', '', $champ); |
|
| 4169 | - |
|
| 4170 | - if (is_array($from)) { |
|
| 4171 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 4172 | - foreach ($from as $idt => $table_sql) { |
|
| 4173 | - if ($desc = $trouver_table($table_sql) |
|
| 4174 | - and isset($desc['field'][$champ]) |
|
| 4175 | - ) { |
|
| 4176 | - $champ = "$idt.$champ"; |
|
| 4177 | - break; |
|
| 4178 | - } |
|
| 4179 | - } |
|
| 4180 | - } |
|
| 4181 | - if (strncmp($t, 'num ', 4) == 0) { |
|
| 4182 | - return "0+$champ"; |
|
| 4183 | - } else { |
|
| 4184 | - return $champ; |
|
| 4185 | - } |
|
| 4158 | + if (strncmp($t, 'multi ', 6) == 0) { |
|
| 4159 | + return "multi"; |
|
| 4160 | + } |
|
| 4161 | + |
|
| 4162 | + $champ = $t; |
|
| 4163 | + |
|
| 4164 | + if (strncmp($t, 'num ', 4) == 0) { |
|
| 4165 | + $champ = substr($t, 4); |
|
| 4166 | + } |
|
| 4167 | + // enlever les autres espaces non evacues par tri_protege_champ |
|
| 4168 | + $champ = preg_replace(',\s,', '', $champ); |
|
| 4169 | + |
|
| 4170 | + if (is_array($from)) { |
|
| 4171 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 4172 | + foreach ($from as $idt => $table_sql) { |
|
| 4173 | + if ($desc = $trouver_table($table_sql) |
|
| 4174 | + and isset($desc['field'][$champ]) |
|
| 4175 | + ) { |
|
| 4176 | + $champ = "$idt.$champ"; |
|
| 4177 | + break; |
|
| 4178 | + } |
|
| 4179 | + } |
|
| 4180 | + } |
|
| 4181 | + if (strncmp($t, 'num ', 4) == 0) { |
|
| 4182 | + return "0+$champ"; |
|
| 4183 | + } else { |
|
| 4184 | + return $champ; |
|
| 4185 | + } |
|
| 4186 | 4186 | } |
| 4187 | 4187 | |
| 4188 | 4188 | /** |
@@ -4196,18 +4196,18 @@ discard block |
||
| 4196 | 4196 | * @return string |
| 4197 | 4197 | */ |
| 4198 | 4198 | function tri_champ_select($t) { |
| 4199 | - if (strncmp($t, 'multi ', 6) == 0) { |
|
| 4200 | - $t = substr($t, 6); |
|
| 4201 | - $t = preg_replace(',\s,', '', $t); |
|
| 4202 | - $t = sql_multi($t, $GLOBALS['spip_lang']); |
|
| 4199 | + if (strncmp($t, 'multi ', 6) == 0) { |
|
| 4200 | + $t = substr($t, 6); |
|
| 4201 | + $t = preg_replace(',\s,', '', $t); |
|
| 4202 | + $t = sql_multi($t, $GLOBALS['spip_lang']); |
|
| 4203 | 4203 | |
| 4204 | - return $t; |
|
| 4205 | - } |
|
| 4206 | - if (trim($t) == 'hasard') { |
|
| 4207 | - return 'rand() AS hasard'; |
|
| 4208 | - } |
|
| 4204 | + return $t; |
|
| 4205 | + } |
|
| 4206 | + if (trim($t) == 'hasard') { |
|
| 4207 | + return 'rand() AS hasard'; |
|
| 4208 | + } |
|
| 4209 | 4209 | |
| 4210 | - return "''"; |
|
| 4210 | + return "''"; |
|
| 4211 | 4211 | } |
| 4212 | 4212 | |
| 4213 | 4213 | |
@@ -4229,78 +4229,78 @@ discard block |
||
| 4229 | 4229 | * @return string |
| 4230 | 4230 | */ |
| 4231 | 4231 | function generer_info_entite($id_objet, $type_objet, $info, $etoile = "") { |
| 4232 | - static $trouver_table = null; |
|
| 4233 | - static $objets; |
|
| 4234 | - |
|
| 4235 | - // On verifie qu'on a tout ce qu'il faut |
|
| 4236 | - $id_objet = intval($id_objet); |
|
| 4237 | - if (!($id_objet and $type_objet and $info)) { |
|
| 4238 | - return ''; |
|
| 4239 | - } |
|
| 4240 | - |
|
| 4241 | - // si on a deja note que l'objet n'existe pas, ne pas aller plus loin |
|
| 4242 | - if (isset($objets[$type_objet]) and $objets[$type_objet] === false) { |
|
| 4243 | - return ''; |
|
| 4244 | - } |
|
| 4245 | - |
|
| 4246 | - // Si on demande l'url, on retourne direct la fonction |
|
| 4247 | - if ($info == 'url') { |
|
| 4248 | - return generer_url_entite($id_objet, $type_objet); |
|
| 4249 | - } |
|
| 4250 | - |
|
| 4251 | - // Sinon on va tout chercher dans la table et on garde en memoire |
|
| 4252 | - $demande_titre = ($info == 'titre'); |
|
| 4253 | - |
|
| 4254 | - // On ne fait la requete que si on a pas deja l'objet ou si on demande le titre mais qu'on ne l'a pas encore |
|
| 4255 | - if (!isset($objets[$type_objet][$id_objet]) |
|
| 4256 | - or |
|
| 4257 | - ($demande_titre and !isset($objets[$type_objet][$id_objet]['titre'])) |
|
| 4258 | - ) { |
|
| 4259 | - if (!$trouver_table) { |
|
| 4260 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 4261 | - } |
|
| 4262 | - $desc = $trouver_table(table_objet_sql($type_objet)); |
|
| 4263 | - if (!$desc) { |
|
| 4264 | - return $objets[$type_objet] = false; |
|
| 4265 | - } |
|
| 4266 | - |
|
| 4267 | - // Si on demande le titre, on le gere en interne |
|
| 4268 | - $champ_titre = ""; |
|
| 4269 | - if ($demande_titre) { |
|
| 4270 | - // si pas de titre declare mais champ titre, il sera peuple par le select * |
|
| 4271 | - $champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : ''; |
|
| 4272 | - } |
|
| 4273 | - include_spip('base/abstract_sql'); |
|
| 4274 | - include_spip('base/connect_sql'); |
|
| 4275 | - $objets[$type_objet][$id_objet] = sql_fetsel( |
|
| 4276 | - '*' . $champ_titre, |
|
| 4277 | - $desc['table_sql'], |
|
| 4278 | - id_table_objet($type_objet) . ' = ' . intval($id_objet) |
|
| 4279 | - ); |
|
| 4280 | - } |
|
| 4281 | - |
|
| 4282 | - // Si la fonction generer_TRUC_TYPE existe, on l'utilise pour formater $info_generee |
|
| 4283 | - if ($generer = charger_fonction("generer_${info}_${type_objet}", '', true)) { |
|
| 4284 | - $info_generee = $generer($id_objet, $objets[$type_objet][$id_objet]); |
|
| 4285 | - } // Si la fonction generer_TRUC_entite existe, on l'utilise pour formater $info_generee |
|
| 4286 | - else { |
|
| 4287 | - if ($generer = charger_fonction("generer_${info}_entite", '', true)) { |
|
| 4288 | - $info_generee = $generer($id_objet, $type_objet, $objets[$type_objet][$id_objet]); |
|
| 4289 | - } // Sinon on prend directement le champ SQL tel quel |
|
| 4290 | - else { |
|
| 4291 | - $info_generee = (isset($objets[$type_objet][$id_objet][$info]) ? $objets[$type_objet][$id_objet][$info] : ''); |
|
| 4292 | - } |
|
| 4293 | - } |
|
| 4294 | - |
|
| 4295 | - // On va ensuite appliquer les traitements automatiques si besoin |
|
| 4296 | - if (!$etoile) { |
|
| 4297 | - // FIXME: on fournit un ENV minimum avec id et type et connect='' |
|
| 4298 | - // mais ce fonctionnement est a ameliorer ! |
|
| 4299 | - $info_generee = appliquer_traitement_champ($info_generee, $info, table_objet($type_objet), |
|
| 4300 | - array('id_objet' => $id_objet, 'objet' => $type_objet, '')); |
|
| 4301 | - } |
|
| 4302 | - |
|
| 4303 | - return $info_generee; |
|
| 4232 | + static $trouver_table = null; |
|
| 4233 | + static $objets; |
|
| 4234 | + |
|
| 4235 | + // On verifie qu'on a tout ce qu'il faut |
|
| 4236 | + $id_objet = intval($id_objet); |
|
| 4237 | + if (!($id_objet and $type_objet and $info)) { |
|
| 4238 | + return ''; |
|
| 4239 | + } |
|
| 4240 | + |
|
| 4241 | + // si on a deja note que l'objet n'existe pas, ne pas aller plus loin |
|
| 4242 | + if (isset($objets[$type_objet]) and $objets[$type_objet] === false) { |
|
| 4243 | + return ''; |
|
| 4244 | + } |
|
| 4245 | + |
|
| 4246 | + // Si on demande l'url, on retourne direct la fonction |
|
| 4247 | + if ($info == 'url') { |
|
| 4248 | + return generer_url_entite($id_objet, $type_objet); |
|
| 4249 | + } |
|
| 4250 | + |
|
| 4251 | + // Sinon on va tout chercher dans la table et on garde en memoire |
|
| 4252 | + $demande_titre = ($info == 'titre'); |
|
| 4253 | + |
|
| 4254 | + // On ne fait la requete que si on a pas deja l'objet ou si on demande le titre mais qu'on ne l'a pas encore |
|
| 4255 | + if (!isset($objets[$type_objet][$id_objet]) |
|
| 4256 | + or |
|
| 4257 | + ($demande_titre and !isset($objets[$type_objet][$id_objet]['titre'])) |
|
| 4258 | + ) { |
|
| 4259 | + if (!$trouver_table) { |
|
| 4260 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 4261 | + } |
|
| 4262 | + $desc = $trouver_table(table_objet_sql($type_objet)); |
|
| 4263 | + if (!$desc) { |
|
| 4264 | + return $objets[$type_objet] = false; |
|
| 4265 | + } |
|
| 4266 | + |
|
| 4267 | + // Si on demande le titre, on le gere en interne |
|
| 4268 | + $champ_titre = ""; |
|
| 4269 | + if ($demande_titre) { |
|
| 4270 | + // si pas de titre declare mais champ titre, il sera peuple par le select * |
|
| 4271 | + $champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : ''; |
|
| 4272 | + } |
|
| 4273 | + include_spip('base/abstract_sql'); |
|
| 4274 | + include_spip('base/connect_sql'); |
|
| 4275 | + $objets[$type_objet][$id_objet] = sql_fetsel( |
|
| 4276 | + '*' . $champ_titre, |
|
| 4277 | + $desc['table_sql'], |
|
| 4278 | + id_table_objet($type_objet) . ' = ' . intval($id_objet) |
|
| 4279 | + ); |
|
| 4280 | + } |
|
| 4281 | + |
|
| 4282 | + // Si la fonction generer_TRUC_TYPE existe, on l'utilise pour formater $info_generee |
|
| 4283 | + if ($generer = charger_fonction("generer_${info}_${type_objet}", '', true)) { |
|
| 4284 | + $info_generee = $generer($id_objet, $objets[$type_objet][$id_objet]); |
|
| 4285 | + } // Si la fonction generer_TRUC_entite existe, on l'utilise pour formater $info_generee |
|
| 4286 | + else { |
|
| 4287 | + if ($generer = charger_fonction("generer_${info}_entite", '', true)) { |
|
| 4288 | + $info_generee = $generer($id_objet, $type_objet, $objets[$type_objet][$id_objet]); |
|
| 4289 | + } // Sinon on prend directement le champ SQL tel quel |
|
| 4290 | + else { |
|
| 4291 | + $info_generee = (isset($objets[$type_objet][$id_objet][$info]) ? $objets[$type_objet][$id_objet][$info] : ''); |
|
| 4292 | + } |
|
| 4293 | + } |
|
| 4294 | + |
|
| 4295 | + // On va ensuite appliquer les traitements automatiques si besoin |
|
| 4296 | + if (!$etoile) { |
|
| 4297 | + // FIXME: on fournit un ENV minimum avec id et type et connect='' |
|
| 4298 | + // mais ce fonctionnement est a ameliorer ! |
|
| 4299 | + $info_generee = appliquer_traitement_champ($info_generee, $info, table_objet($type_objet), |
|
| 4300 | + array('id_objet' => $id_objet, 'objet' => $type_objet, '')); |
|
| 4301 | + } |
|
| 4302 | + |
|
| 4303 | + return $info_generee; |
|
| 4304 | 4304 | } |
| 4305 | 4305 | |
| 4306 | 4306 | /** |
@@ -4314,44 +4314,44 @@ discard block |
||
| 4314 | 4314 | * @return string |
| 4315 | 4315 | */ |
| 4316 | 4316 | function appliquer_traitement_champ($texte, $champ, $table_objet = '', $env = array(), $connect = '') { |
| 4317 | - if (!$champ) { |
|
| 4318 | - return $texte; |
|
| 4319 | - } |
|
| 4317 | + if (!$champ) { |
|
| 4318 | + return $texte; |
|
| 4319 | + } |
|
| 4320 | 4320 | |
| 4321 | - // On charge toujours les filtres de texte car la majorité des traitements les utilisent |
|
| 4322 | - // et il ne faut pas partir du principe que c'est déjà chargé (form ajax, etc) |
|
| 4323 | - include_spip('inc/texte'); |
|
| 4321 | + // On charge toujours les filtres de texte car la majorité des traitements les utilisent |
|
| 4322 | + // et il ne faut pas partir du principe que c'est déjà chargé (form ajax, etc) |
|
| 4323 | + include_spip('inc/texte'); |
|
| 4324 | 4324 | |
| 4325 | - $champ = strtoupper($champ); |
|
| 4326 | - $traitements = isset($GLOBALS['table_des_traitements'][$champ]) ? $GLOBALS['table_des_traitements'][$champ] : false; |
|
| 4327 | - if (!$traitements or !is_array($traitements)) { |
|
| 4328 | - return $texte; |
|
| 4329 | - } |
|
| 4325 | + $champ = strtoupper($champ); |
|
| 4326 | + $traitements = isset($GLOBALS['table_des_traitements'][$champ]) ? $GLOBALS['table_des_traitements'][$champ] : false; |
|
| 4327 | + if (!$traitements or !is_array($traitements)) { |
|
| 4328 | + return $texte; |
|
| 4329 | + } |
|
| 4330 | 4330 | |
| 4331 | - $traitement = ''; |
|
| 4332 | - if ($table_objet and (!isset($traitements[0]) or count($traitements) > 1)) { |
|
| 4333 | - // necessaire pour prendre en charge les vieux appels avec un table_objet_sql en 3e arg |
|
| 4334 | - $table_objet = table_objet($table_objet); |
|
| 4335 | - if (isset($traitements[$table_objet])) { |
|
| 4336 | - $traitement = $traitements[$table_objet]; |
|
| 4337 | - } |
|
| 4338 | - } |
|
| 4339 | - if (!$traitement and isset($traitements[0])) { |
|
| 4340 | - $traitement = $traitements[0]; |
|
| 4341 | - } |
|
| 4342 | - // (sinon prendre le premier de la liste par defaut ?) |
|
| 4331 | + $traitement = ''; |
|
| 4332 | + if ($table_objet and (!isset($traitements[0]) or count($traitements) > 1)) { |
|
| 4333 | + // necessaire pour prendre en charge les vieux appels avec un table_objet_sql en 3e arg |
|
| 4334 | + $table_objet = table_objet($table_objet); |
|
| 4335 | + if (isset($traitements[$table_objet])) { |
|
| 4336 | + $traitement = $traitements[$table_objet]; |
|
| 4337 | + } |
|
| 4338 | + } |
|
| 4339 | + if (!$traitement and isset($traitements[0])) { |
|
| 4340 | + $traitement = $traitements[0]; |
|
| 4341 | + } |
|
| 4342 | + // (sinon prendre le premier de la liste par defaut ?) |
|
| 4343 | 4343 | |
| 4344 | - if (!$traitement) { |
|
| 4345 | - return $texte; |
|
| 4346 | - } |
|
| 4344 | + if (!$traitement) { |
|
| 4345 | + return $texte; |
|
| 4346 | + } |
|
| 4347 | 4347 | |
| 4348 | - $traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement); |
|
| 4348 | + $traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement); |
|
| 4349 | 4349 | |
| 4350 | - // Fournir $connect et $Pile[0] au traitement si besoin |
|
| 4351 | - $Pile = array(0 => $env); |
|
| 4352 | - eval("\$texte = $traitement;"); |
|
| 4350 | + // Fournir $connect et $Pile[0] au traitement si besoin |
|
| 4351 | + $Pile = array(0 => $env); |
|
| 4352 | + eval("\$texte = $traitement;"); |
|
| 4353 | 4353 | |
| 4354 | - return $texte; |
|
| 4354 | + return $texte; |
|
| 4355 | 4355 | } |
| 4356 | 4356 | |
| 4357 | 4357 | |
@@ -4365,21 +4365,21 @@ discard block |
||
| 4365 | 4365 | * @return string |
| 4366 | 4366 | */ |
| 4367 | 4367 | function generer_lien_entite($id_objet, $objet, $longueur = 80, $connect = null) { |
| 4368 | - include_spip('inc/liens'); |
|
| 4369 | - $titre = traiter_raccourci_titre($id_objet, $objet, $connect); |
|
| 4370 | - // lorsque l'objet n'est plus declare (plugin desactive par exemple) |
|
| 4371 | - // le raccourcis n'est plus valide |
|
| 4372 | - $titre = isset($titre['titre']) ? typo($titre['titre']) : ''; |
|
| 4373 | - // on essaye avec generer_info_entite ? |
|
| 4374 | - if (!strlen($titre) and !$connect) { |
|
| 4375 | - $titre = generer_info_entite($id_objet, $objet, 'titre'); |
|
| 4376 | - } |
|
| 4377 | - if (!strlen($titre)) { |
|
| 4378 | - $titre = _T('info_sans_titre'); |
|
| 4379 | - } |
|
| 4380 | - $url = generer_url_entite($id_objet, $objet, '', '', $connect); |
|
| 4368 | + include_spip('inc/liens'); |
|
| 4369 | + $titre = traiter_raccourci_titre($id_objet, $objet, $connect); |
|
| 4370 | + // lorsque l'objet n'est plus declare (plugin desactive par exemple) |
|
| 4371 | + // le raccourcis n'est plus valide |
|
| 4372 | + $titre = isset($titre['titre']) ? typo($titre['titre']) : ''; |
|
| 4373 | + // on essaye avec generer_info_entite ? |
|
| 4374 | + if (!strlen($titre) and !$connect) { |
|
| 4375 | + $titre = generer_info_entite($id_objet, $objet, 'titre'); |
|
| 4376 | + } |
|
| 4377 | + if (!strlen($titre)) { |
|
| 4378 | + $titre = _T('info_sans_titre'); |
|
| 4379 | + } |
|
| 4380 | + $url = generer_url_entite($id_objet, $objet, '', '', $connect); |
|
| 4381 | 4381 | |
| 4382 | - return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . "</a>"; |
|
| 4382 | + return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . "</a>"; |
|
| 4383 | 4383 | } |
| 4384 | 4384 | |
| 4385 | 4385 | |
@@ -4396,15 +4396,15 @@ discard block |
||
| 4396 | 4396 | * @return string |
| 4397 | 4397 | */ |
| 4398 | 4398 | function wrap($texte, $wrap) { |
| 4399 | - $balises = extraire_balises($wrap); |
|
| 4400 | - if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) { |
|
| 4401 | - $texte = $wrap . $texte; |
|
| 4402 | - $regs = array_reverse($regs[1]); |
|
| 4403 | - $wrap = "</" . implode("></", $regs) . ">"; |
|
| 4404 | - $texte = $texte . $wrap; |
|
| 4405 | - } |
|
| 4399 | + $balises = extraire_balises($wrap); |
|
| 4400 | + if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) { |
|
| 4401 | + $texte = $wrap . $texte; |
|
| 4402 | + $regs = array_reverse($regs[1]); |
|
| 4403 | + $wrap = "</" . implode("></", $regs) . ">"; |
|
| 4404 | + $texte = $texte . $wrap; |
|
| 4405 | + } |
|
| 4406 | 4406 | |
| 4407 | - return $texte; |
|
| 4407 | + return $texte; |
|
| 4408 | 4408 | } |
| 4409 | 4409 | |
| 4410 | 4410 | |
@@ -4424,43 +4424,43 @@ discard block |
||
| 4424 | 4424 | * @return array|mixed|string |
| 4425 | 4425 | */ |
| 4426 | 4426 | function filtre_print_dist($u, $join = "<br />", $indent = 0) { |
| 4427 | - if (is_string($u)) { |
|
| 4428 | - $u = typo($u); |
|
| 4427 | + if (is_string($u)) { |
|
| 4428 | + $u = typo($u); |
|
| 4429 | 4429 | |
| 4430 | - return $u; |
|
| 4431 | - } |
|
| 4430 | + return $u; |
|
| 4431 | + } |
|
| 4432 | 4432 | |
| 4433 | - // caster $u en array si besoin |
|
| 4434 | - if (is_object($u)) { |
|
| 4435 | - $u = (array)$u; |
|
| 4436 | - } |
|
| 4433 | + // caster $u en array si besoin |
|
| 4434 | + if (is_object($u)) { |
|
| 4435 | + $u = (array)$u; |
|
| 4436 | + } |
|
| 4437 | 4437 | |
| 4438 | - if (is_array($u)) { |
|
| 4439 | - $out = ""; |
|
| 4440 | - // toutes les cles sont numeriques ? |
|
| 4441 | - // et aucun enfant n'est un tableau |
|
| 4442 | - // liste simple separee par des virgules |
|
| 4443 | - $numeric_keys = array_map('is_numeric', array_keys($u)); |
|
| 4444 | - $array_values = array_map('is_array', $u); |
|
| 4445 | - $object_values = array_map('is_object', $u); |
|
| 4446 | - if (array_sum($numeric_keys) == count($numeric_keys) |
|
| 4447 | - and !array_sum($array_values) |
|
| 4448 | - and !array_sum($object_values) |
|
| 4449 | - ) { |
|
| 4450 | - return join(", ", array_map('filtre_print_dist', $u)); |
|
| 4451 | - } |
|
| 4438 | + if (is_array($u)) { |
|
| 4439 | + $out = ""; |
|
| 4440 | + // toutes les cles sont numeriques ? |
|
| 4441 | + // et aucun enfant n'est un tableau |
|
| 4442 | + // liste simple separee par des virgules |
|
| 4443 | + $numeric_keys = array_map('is_numeric', array_keys($u)); |
|
| 4444 | + $array_values = array_map('is_array', $u); |
|
| 4445 | + $object_values = array_map('is_object', $u); |
|
| 4446 | + if (array_sum($numeric_keys) == count($numeric_keys) |
|
| 4447 | + and !array_sum($array_values) |
|
| 4448 | + and !array_sum($object_values) |
|
| 4449 | + ) { |
|
| 4450 | + return join(", ", array_map('filtre_print_dist', $u)); |
|
| 4451 | + } |
|
| 4452 | 4452 | |
| 4453 | - // sinon on passe a la ligne et on indente |
|
| 4454 | - $i_str = str_pad("", $indent, " "); |
|
| 4455 | - foreach ($u as $k => $v) { |
|
| 4456 | - $out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2); |
|
| 4457 | - } |
|
| 4453 | + // sinon on passe a la ligne et on indente |
|
| 4454 | + $i_str = str_pad("", $indent, " "); |
|
| 4455 | + foreach ($u as $k => $v) { |
|
| 4456 | + $out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2); |
|
| 4457 | + } |
|
| 4458 | 4458 | |
| 4459 | - return $out; |
|
| 4460 | - } |
|
| 4459 | + return $out; |
|
| 4460 | + } |
|
| 4461 | 4461 | |
| 4462 | - // on sait pas quoi faire... |
|
| 4463 | - return $u; |
|
| 4462 | + // on sait pas quoi faire... |
|
| 4463 | + return $u; |
|
| 4464 | 4464 | } |
| 4465 | 4465 | |
| 4466 | 4466 | |
@@ -4473,10 +4473,10 @@ discard block |
||
| 4473 | 4473 | * @return string |
| 4474 | 4474 | */ |
| 4475 | 4475 | function objet_info($objet, $info) { |
| 4476 | - $table = table_objet_sql($objet); |
|
| 4477 | - $infos = lister_tables_objets_sql($table); |
|
| 4476 | + $table = table_objet_sql($objet); |
|
| 4477 | + $infos = lister_tables_objets_sql($table); |
|
| 4478 | 4478 | |
| 4479 | - return (isset($infos[$info]) ? $infos[$info] : ''); |
|
| 4479 | + return (isset($infos[$info]) ? $infos[$info] : ''); |
|
| 4480 | 4480 | } |
| 4481 | 4481 | |
| 4482 | 4482 | /** |
@@ -4491,11 +4491,11 @@ discard block |
||
| 4491 | 4491 | * Texte traduit du comptage, tel que '3 articles' |
| 4492 | 4492 | */ |
| 4493 | 4493 | function objet_afficher_nb($nb, $objet) { |
| 4494 | - if (!$nb) { |
|
| 4495 | - return _T(objet_info($objet, 'info_aucun_objet')); |
|
| 4496 | - } else { |
|
| 4497 | - return _T(objet_info($objet, $nb == 1 ? 'info_1_objet' : 'info_nb_objets'), array('nb' => $nb)); |
|
| 4498 | - } |
|
| 4494 | + if (!$nb) { |
|
| 4495 | + return _T(objet_info($objet, 'info_aucun_objet')); |
|
| 4496 | + } else { |
|
| 4497 | + return _T(objet_info($objet, $nb == 1 ? 'info_1_objet' : 'info_nb_objets'), array('nb' => $nb)); |
|
| 4498 | + } |
|
| 4499 | 4499 | } |
| 4500 | 4500 | |
| 4501 | 4501 | /** |
@@ -4506,11 +4506,11 @@ discard block |
||
| 4506 | 4506 | * @return string |
| 4507 | 4507 | */ |
| 4508 | 4508 | function objet_icone($objet, $taille = 24) { |
| 4509 | - $icone = objet_info($objet, 'icone_objet') . "-" . $taille . ".png"; |
|
| 4510 | - $icone = chemin_image($icone); |
|
| 4511 | - $balise_img = charger_filtre('balise_img'); |
|
| 4509 | + $icone = objet_info($objet, 'icone_objet') . "-" . $taille . ".png"; |
|
| 4510 | + $icone = chemin_image($icone); |
|
| 4511 | + $balise_img = charger_filtre('balise_img'); |
|
| 4512 | 4512 | |
| 4513 | - return $icone ? $balise_img($icone, _T(objet_info($objet, 'texte_objet'))) : ''; |
|
| 4513 | + return $icone ? $balise_img($icone, _T(objet_info($objet, 'texte_objet'))) : ''; |
|
| 4514 | 4514 | } |
| 4515 | 4515 | |
| 4516 | 4516 | /** |
@@ -4531,12 +4531,12 @@ discard block |
||
| 4531 | 4531 | * @return string |
| 4532 | 4532 | */ |
| 4533 | 4533 | function objet_T($objet, $chaine, $args = array(), $options = array()){ |
| 4534 | - $chaine = explode(':',$chaine); |
|
| 4535 | - if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, array('force'=>false)))) { |
|
| 4536 | - return $t; |
|
| 4537 | - } |
|
| 4538 | - $chaine = implode(':',$chaine); |
|
| 4539 | - return _T($chaine, $args, $options); |
|
| 4534 | + $chaine = explode(':',$chaine); |
|
| 4535 | + if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, array('force'=>false)))) { |
|
| 4536 | + return $t; |
|
| 4537 | + } |
|
| 4538 | + $chaine = implode(':',$chaine); |
|
| 4539 | + return _T($chaine, $args, $options); |
|
| 4540 | 4540 | } |
| 4541 | 4541 | |
| 4542 | 4542 | /** |
@@ -4550,17 +4550,17 @@ discard block |
||
| 4550 | 4550 | * @return string Code HTML |
| 4551 | 4551 | */ |
| 4552 | 4552 | function insert_head_css_conditionnel($flux) { |
| 4553 | - if (strpos($flux, '<!-- insert_head_css -->') === false |
|
| 4554 | - and $p = strpos($flux, '<!-- insert_head -->') |
|
| 4555 | - ) { |
|
| 4556 | - // plutot avant le premier js externe (jquery) pour etre non bloquant |
|
| 4557 | - if ($p1 = stripos($flux, '<script src=') and $p1 < $p) { |
|
| 4558 | - $p = $p1; |
|
| 4559 | - } |
|
| 4560 | - $flux = substr_replace($flux, pipeline('insert_head_css', '<!-- insert_head_css -->'), $p, 0); |
|
| 4561 | - } |
|
| 4553 | + if (strpos($flux, '<!-- insert_head_css -->') === false |
|
| 4554 | + and $p = strpos($flux, '<!-- insert_head -->') |
|
| 4555 | + ) { |
|
| 4556 | + // plutot avant le premier js externe (jquery) pour etre non bloquant |
|
| 4557 | + if ($p1 = stripos($flux, '<script src=') and $p1 < $p) { |
|
| 4558 | + $p = $p1; |
|
| 4559 | + } |
|
| 4560 | + $flux = substr_replace($flux, pipeline('insert_head_css', '<!-- insert_head_css -->'), $p, 0); |
|
| 4561 | + } |
|
| 4562 | 4562 | |
| 4563 | - return $flux; |
|
| 4563 | + return $flux; |
|
| 4564 | 4564 | } |
| 4565 | 4565 | |
| 4566 | 4566 | /** |
@@ -4581,66 +4581,66 @@ discard block |
||
| 4581 | 4581 | * @return string |
| 4582 | 4582 | */ |
| 4583 | 4583 | function produire_fond_statique($fond, $contexte = array(), $options = array(), $connect = '') { |
| 4584 | - if (isset($contexte['format'])) { |
|
| 4585 | - $extension = $contexte['format']; |
|
| 4586 | - unset($contexte['format']); |
|
| 4587 | - } else { |
|
| 4588 | - $extension = "html"; |
|
| 4589 | - if (preg_match(',[.](css|js|json)$,', $fond, $m)) { |
|
| 4590 | - $extension = $m[1]; |
|
| 4591 | - } |
|
| 4592 | - } |
|
| 4593 | - // recuperer le contenu produit par le squelette |
|
| 4594 | - $options['raw'] = true; |
|
| 4595 | - $cache = recuperer_fond($fond, $contexte, $options, $connect); |
|
| 4596 | - |
|
| 4597 | - // calculer le nom de la css |
|
| 4598 | - $dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension); |
|
| 4599 | - $nom_safe = preg_replace(",\W,", '_', str_replace('.', '_', $fond)); |
|
| 4600 | - $contexte_implicite = calculer_contexte_implicite(); |
|
| 4601 | - $filename = $dir_var . $extension . "dyn-$nom_safe-" |
|
| 4602 | - . substr(md5($fond . serialize($contexte_implicite) . serialize($contexte) . $connect), 0, 8) |
|
| 4603 | - . ".$extension"; |
|
| 4604 | - |
|
| 4605 | - // mettre a jour le fichier si il n'existe pas |
|
| 4606 | - // ou trop ancien |
|
| 4607 | - // le dernier fichier produit est toujours suffixe par .last |
|
| 4608 | - // et recopie sur le fichier cible uniquement si il change |
|
| 4609 | - if (!file_exists($filename) |
|
| 4610 | - or !file_exists($filename . ".last") |
|
| 4611 | - or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . ".last") < $cache['lastmodified']) |
|
| 4612 | - or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') |
|
| 4613 | - ) { |
|
| 4614 | - $contenu = $cache['texte']; |
|
| 4615 | - // passer les urls en absolu si c'est une css |
|
| 4616 | - if ($extension == "css") { |
|
| 4617 | - $contenu = urls_absolues_css($contenu, |
|
| 4618 | - test_espace_prive() ? generer_url_ecrire('accueil') : generer_url_public($fond)); |
|
| 4619 | - } |
|
| 4620 | - |
|
| 4621 | - $comment = ''; |
|
| 4622 | - // ne pas insérer de commentaire si c'est du json |
|
| 4623 | - if ($extension != "json") { |
|
| 4624 | - $comment = "/* #PRODUIRE{fond=$fond"; |
|
| 4625 | - foreach ($contexte as $k => $v) { |
|
| 4626 | - $comment .= ",$k=$v"; |
|
| 4627 | - } |
|
| 4628 | - // pas de date dans le commentaire car sinon ca invalide le md5 et force la maj |
|
| 4629 | - // mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non |
|
| 4630 | - $comment .= "}\n md5:" . md5($contenu) . " */\n"; |
|
| 4631 | - } |
|
| 4632 | - // et ecrire le fichier |
|
| 4633 | - ecrire_fichier($filename . ".last", $comment . $contenu); |
|
| 4634 | - // regarder si on recopie |
|
| 4635 | - if (!file_exists($filename) |
|
| 4636 | - or md5_file($filename) !== md5_file($filename . ".last") |
|
| 4637 | - ) { |
|
| 4638 | - @copy($filename . ".last", $filename); |
|
| 4639 | - clearstatcache(true, $filename); // eviter que PHP ne reserve le vieux timestamp |
|
| 4640 | - } |
|
| 4641 | - } |
|
| 4642 | - |
|
| 4643 | - return timestamp($filename); |
|
| 4584 | + if (isset($contexte['format'])) { |
|
| 4585 | + $extension = $contexte['format']; |
|
| 4586 | + unset($contexte['format']); |
|
| 4587 | + } else { |
|
| 4588 | + $extension = "html"; |
|
| 4589 | + if (preg_match(',[.](css|js|json)$,', $fond, $m)) { |
|
| 4590 | + $extension = $m[1]; |
|
| 4591 | + } |
|
| 4592 | + } |
|
| 4593 | + // recuperer le contenu produit par le squelette |
|
| 4594 | + $options['raw'] = true; |
|
| 4595 | + $cache = recuperer_fond($fond, $contexte, $options, $connect); |
|
| 4596 | + |
|
| 4597 | + // calculer le nom de la css |
|
| 4598 | + $dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension); |
|
| 4599 | + $nom_safe = preg_replace(",\W,", '_', str_replace('.', '_', $fond)); |
|
| 4600 | + $contexte_implicite = calculer_contexte_implicite(); |
|
| 4601 | + $filename = $dir_var . $extension . "dyn-$nom_safe-" |
|
| 4602 | + . substr(md5($fond . serialize($contexte_implicite) . serialize($contexte) . $connect), 0, 8) |
|
| 4603 | + . ".$extension"; |
|
| 4604 | + |
|
| 4605 | + // mettre a jour le fichier si il n'existe pas |
|
| 4606 | + // ou trop ancien |
|
| 4607 | + // le dernier fichier produit est toujours suffixe par .last |
|
| 4608 | + // et recopie sur le fichier cible uniquement si il change |
|
| 4609 | + if (!file_exists($filename) |
|
| 4610 | + or !file_exists($filename . ".last") |
|
| 4611 | + or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . ".last") < $cache['lastmodified']) |
|
| 4612 | + or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') |
|
| 4613 | + ) { |
|
| 4614 | + $contenu = $cache['texte']; |
|
| 4615 | + // passer les urls en absolu si c'est une css |
|
| 4616 | + if ($extension == "css") { |
|
| 4617 | + $contenu = urls_absolues_css($contenu, |
|
| 4618 | + test_espace_prive() ? generer_url_ecrire('accueil') : generer_url_public($fond)); |
|
| 4619 | + } |
|
| 4620 | + |
|
| 4621 | + $comment = ''; |
|
| 4622 | + // ne pas insérer de commentaire si c'est du json |
|
| 4623 | + if ($extension != "json") { |
|
| 4624 | + $comment = "/* #PRODUIRE{fond=$fond"; |
|
| 4625 | + foreach ($contexte as $k => $v) { |
|
| 4626 | + $comment .= ",$k=$v"; |
|
| 4627 | + } |
|
| 4628 | + // pas de date dans le commentaire car sinon ca invalide le md5 et force la maj |
|
| 4629 | + // mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non |
|
| 4630 | + $comment .= "}\n md5:" . md5($contenu) . " */\n"; |
|
| 4631 | + } |
|
| 4632 | + // et ecrire le fichier |
|
| 4633 | + ecrire_fichier($filename . ".last", $comment . $contenu); |
|
| 4634 | + // regarder si on recopie |
|
| 4635 | + if (!file_exists($filename) |
|
| 4636 | + or md5_file($filename) !== md5_file($filename . ".last") |
|
| 4637 | + ) { |
|
| 4638 | + @copy($filename . ".last", $filename); |
|
| 4639 | + clearstatcache(true, $filename); // eviter que PHP ne reserve le vieux timestamp |
|
| 4640 | + } |
|
| 4641 | + } |
|
| 4642 | + |
|
| 4643 | + return timestamp($filename); |
|
| 4644 | 4644 | } |
| 4645 | 4645 | |
| 4646 | 4646 | /** |
@@ -4653,14 +4653,14 @@ discard block |
||
| 4653 | 4653 | * $fichier auquel on a ajouté le timestamp |
| 4654 | 4654 | */ |
| 4655 | 4655 | function timestamp($fichier) { |
| 4656 | - if (!$fichier |
|
| 4657 | - or !file_exists($fichier) |
|
| 4658 | - or !$m = filemtime($fichier) |
|
| 4659 | - ) { |
|
| 4660 | - return $fichier; |
|
| 4661 | - } |
|
| 4656 | + if (!$fichier |
|
| 4657 | + or !file_exists($fichier) |
|
| 4658 | + or !$m = filemtime($fichier) |
|
| 4659 | + ) { |
|
| 4660 | + return $fichier; |
|
| 4661 | + } |
|
| 4662 | 4662 | |
| 4663 | - return "$fichier?$m"; |
|
| 4663 | + return "$fichier?$m"; |
|
| 4664 | 4664 | } |
| 4665 | 4665 | |
| 4666 | 4666 | /** |
@@ -4670,11 +4670,11 @@ discard block |
||
| 4670 | 4670 | * @return string |
| 4671 | 4671 | */ |
| 4672 | 4672 | function supprimer_timestamp($url) { |
| 4673 | - if (strpos($url, "?") === false) { |
|
| 4674 | - return $url; |
|
| 4675 | - } |
|
| 4673 | + if (strpos($url, "?") === false) { |
|
| 4674 | + return $url; |
|
| 4675 | + } |
|
| 4676 | 4676 | |
| 4677 | - return preg_replace(",\?[[:digit:]]+$,", "", $url); |
|
| 4677 | + return preg_replace(",\?[[:digit:]]+$,", "", $url); |
|
| 4678 | 4678 | } |
| 4679 | 4679 | |
| 4680 | 4680 | /** |
@@ -4689,9 +4689,9 @@ discard block |
||
| 4689 | 4689 | * @return string |
| 4690 | 4690 | */ |
| 4691 | 4691 | function filtre_nettoyer_titre_email_dist($titre) { |
| 4692 | - include_spip('inc/envoyer_mail'); |
|
| 4692 | + include_spip('inc/envoyer_mail'); |
|
| 4693 | 4693 | |
| 4694 | - return nettoyer_titre_email($titre); |
|
| 4694 | + return nettoyer_titre_email($titre); |
|
| 4695 | 4695 | } |
| 4696 | 4696 | |
| 4697 | 4697 | /** |
@@ -4713,19 +4713,19 @@ discard block |
||
| 4713 | 4713 | * @return string |
| 4714 | 4714 | */ |
| 4715 | 4715 | function filtre_chercher_rubrique_dist( |
| 4716 | - $titre, |
|
| 4717 | - $id_objet, |
|
| 4718 | - $id_parent, |
|
| 4719 | - $objet, |
|
| 4720 | - $id_secteur, |
|
| 4721 | - $restreint, |
|
| 4722 | - $actionable = false, |
|
| 4723 | - $retour_sans_cadre = false |
|
| 4716 | + $titre, |
|
| 4717 | + $id_objet, |
|
| 4718 | + $id_parent, |
|
| 4719 | + $objet, |
|
| 4720 | + $id_secteur, |
|
| 4721 | + $restreint, |
|
| 4722 | + $actionable = false, |
|
| 4723 | + $retour_sans_cadre = false |
|
| 4724 | 4724 | ) { |
| 4725 | - include_spip('inc/filtres_ecrire'); |
|
| 4725 | + include_spip('inc/filtres_ecrire'); |
|
| 4726 | 4726 | |
| 4727 | - return chercher_rubrique($titre, $id_objet, $id_parent, $objet, $id_secteur, $restreint, $actionable, |
|
| 4728 | - $retour_sans_cadre); |
|
| 4727 | + return chercher_rubrique($titre, $id_objet, $id_parent, $objet, $id_secteur, $restreint, $actionable, |
|
| 4728 | + $retour_sans_cadre); |
|
| 4729 | 4729 | } |
| 4730 | 4730 | |
| 4731 | 4731 | /** |
@@ -4754,56 +4754,56 @@ discard block |
||
| 4754 | 4754 | * Chaîne vide si l'accès est autorisé |
| 4755 | 4755 | */ |
| 4756 | 4756 | function sinon_interdire_acces($ok = false, $url = '', $statut = 0, $message = null) { |
| 4757 | - if ($ok) { |
|
| 4758 | - return ''; |
|
| 4759 | - } |
|
| 4760 | - |
|
| 4761 | - // Vider tous les tampons |
|
| 4762 | - $level = @ob_get_level(); |
|
| 4763 | - while ($level--) { |
|
| 4764 | - @ob_end_clean(); |
|
| 4765 | - } |
|
| 4766 | - |
|
| 4767 | - include_spip('inc/headers'); |
|
| 4768 | - |
|
| 4769 | - // S'il y a une URL, on redirige (si pas de statut, la fonction mettra 302 par défaut) |
|
| 4770 | - if ($url) { |
|
| 4771 | - redirige_par_entete($url, '', $statut); |
|
| 4772 | - } |
|
| 4773 | - |
|
| 4774 | - // ecriture simplifiee avec message en 3eme argument (= statut 403) |
|
| 4775 | - if (!is_numeric($statut) and is_null($message)) { |
|
| 4776 | - $message = $statut; |
|
| 4777 | - $statut = 0; |
|
| 4778 | - } |
|
| 4779 | - if (!$message) { |
|
| 4780 | - $message = ''; |
|
| 4781 | - } |
|
| 4782 | - $statut = intval($statut); |
|
| 4783 | - |
|
| 4784 | - // Si on est dans l'espace privé, on génère du 403 Forbidden par defaut ou du 404 |
|
| 4785 | - if (test_espace_prive()) { |
|
| 4786 | - if (!$statut or !in_array($statut, array(404, 403))) { |
|
| 4787 | - $statut = 403; |
|
| 4788 | - } |
|
| 4789 | - http_status(403); |
|
| 4790 | - $echec = charger_fonction('403', 'exec'); |
|
| 4791 | - $echec($message); |
|
| 4792 | - } else { |
|
| 4793 | - // Sinon dans l'espace public on redirige vers une 404 par défaut, car elle toujours présente normalement |
|
| 4794 | - if (!$statut) { |
|
| 4795 | - $statut = 404; |
|
| 4796 | - } |
|
| 4797 | - // Dans tous les cas on modifie l'entité avec ce qui est demandé |
|
| 4798 | - http_status($statut); |
|
| 4799 | - // Si le statut est une erreur et qu'il n'y a pas de redirection on va chercher le squelette du même nom |
|
| 4800 | - if ($statut >= 400) { |
|
| 4801 | - echo recuperer_fond("$statut", array('erreur' => $message)); |
|
| 4802 | - } |
|
| 4803 | - } |
|
| 4804 | - |
|
| 4805 | - |
|
| 4806 | - exit; |
|
| 4757 | + if ($ok) { |
|
| 4758 | + return ''; |
|
| 4759 | + } |
|
| 4760 | + |
|
| 4761 | + // Vider tous les tampons |
|
| 4762 | + $level = @ob_get_level(); |
|
| 4763 | + while ($level--) { |
|
| 4764 | + @ob_end_clean(); |
|
| 4765 | + } |
|
| 4766 | + |
|
| 4767 | + include_spip('inc/headers'); |
|
| 4768 | + |
|
| 4769 | + // S'il y a une URL, on redirige (si pas de statut, la fonction mettra 302 par défaut) |
|
| 4770 | + if ($url) { |
|
| 4771 | + redirige_par_entete($url, '', $statut); |
|
| 4772 | + } |
|
| 4773 | + |
|
| 4774 | + // ecriture simplifiee avec message en 3eme argument (= statut 403) |
|
| 4775 | + if (!is_numeric($statut) and is_null($message)) { |
|
| 4776 | + $message = $statut; |
|
| 4777 | + $statut = 0; |
|
| 4778 | + } |
|
| 4779 | + if (!$message) { |
|
| 4780 | + $message = ''; |
|
| 4781 | + } |
|
| 4782 | + $statut = intval($statut); |
|
| 4783 | + |
|
| 4784 | + // Si on est dans l'espace privé, on génère du 403 Forbidden par defaut ou du 404 |
|
| 4785 | + if (test_espace_prive()) { |
|
| 4786 | + if (!$statut or !in_array($statut, array(404, 403))) { |
|
| 4787 | + $statut = 403; |
|
| 4788 | + } |
|
| 4789 | + http_status(403); |
|
| 4790 | + $echec = charger_fonction('403', 'exec'); |
|
| 4791 | + $echec($message); |
|
| 4792 | + } else { |
|
| 4793 | + // Sinon dans l'espace public on redirige vers une 404 par défaut, car elle toujours présente normalement |
|
| 4794 | + if (!$statut) { |
|
| 4795 | + $statut = 404; |
|
| 4796 | + } |
|
| 4797 | + // Dans tous les cas on modifie l'entité avec ce qui est demandé |
|
| 4798 | + http_status($statut); |
|
| 4799 | + // Si le statut est une erreur et qu'il n'y a pas de redirection on va chercher le squelette du même nom |
|
| 4800 | + if ($statut >= 400) { |
|
| 4801 | + echo recuperer_fond("$statut", array('erreur' => $message)); |
|
| 4802 | + } |
|
| 4803 | + } |
|
| 4804 | + |
|
| 4805 | + |
|
| 4806 | + exit; |
|
| 4807 | 4807 | } |
| 4808 | 4808 | |
| 4809 | 4809 | /** |
@@ -4814,9 +4814,9 @@ discard block |
||
| 4814 | 4814 | * @return string |
| 4815 | 4815 | */ |
| 4816 | 4816 | function filtre_compacte_dist($source, $format = null) { |
| 4817 | - if (function_exists('compacte')) { |
|
| 4818 | - return compacte($source, $format); |
|
| 4819 | - } |
|
| 4817 | + if (function_exists('compacte')) { |
|
| 4818 | + return compacte($source, $format); |
|
| 4819 | + } |
|
| 4820 | 4820 | |
| 4821 | - return $source; |
|
| 4821 | + return $source; |
|
| 4822 | 4822 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | return $f; |
| 94 | 94 | } |
| 95 | - foreach (array('filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc) as $f) { |
|
| 95 | + foreach (array('filtre_'.$fonc, 'filtre_'.$fonc.'_dist', $fonc) as $f) { |
|
| 96 | 96 | trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels |
| 97 | 97 | // fonction ou name\space\fonction |
| 98 | 98 | if (is_callable($f)) { |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | function spip_version() { |
| 160 | 160 | $version = $GLOBALS['spip_version_affichee']; |
| 161 | 161 | if ($svn_revision = version_svn_courante(_DIR_RACINE)) { |
| 162 | - $version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']'; |
|
| 162 | + $version .= ($svn_revision < 0 ? ' SVN' : '').' ['.abs($svn_revision).']'; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | return $version; |
@@ -186,15 +186,15 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | // version installee par paquet ZIP |
| 189 | - if (lire_fichier($dir . '/svn.revision', $c) |
|
| 189 | + if (lire_fichier($dir.'/svn.revision', $c) |
|
| 190 | 190 | and preg_match(',Revision: (\d+),', $c, $d) |
| 191 | 191 | ) { |
| 192 | 192 | return intval($d[1]); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // version installee par SVN |
| 196 | - if (file_exists($dir . '/.svn/wc.db') && class_exists('SQLite3')) { |
|
| 197 | - $db = new SQLite3($dir . '/.svn/wc.db'); |
|
| 196 | + if (file_exists($dir.'/.svn/wc.db') && class_exists('SQLite3')) { |
|
| 197 | + $db = new SQLite3($dir.'/.svn/wc.db'); |
|
| 198 | 198 | $result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1'); |
| 199 | 199 | if ($result) { |
| 200 | 200 | $row = $result->fetchArray(); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | return -$row['changed_revision']; |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | - } else if (lire_fichier($dir . '/.svn/entries', $c) |
|
| 205 | + } else if (lire_fichier($dir.'/.svn/entries', $c) |
|
| 206 | 206 | and ( |
| 207 | 207 | (preg_match_all( |
| 208 | 208 | ',committed-rev="([0-9]+)",', $c, $r1, PREG_PATTERN_ORDER) |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images |
| 224 | 224 | // et laisser passer les fonctions personnelles baptisees image_... |
| 225 | -$GLOBALS['spip_matrice']['image_graver'] = true;//'inc/filtres_images_mini.php'; |
|
| 226 | -$GLOBALS['spip_matrice']['image_select'] = true;//'inc/filtres_images_mini.php'; |
|
| 227 | -$GLOBALS['spip_matrice']['image_reduire'] = true;//'inc/filtres_images_mini.php'; |
|
| 228 | -$GLOBALS['spip_matrice']['image_reduire_par'] = true;//'inc/filtres_images_mini.php'; |
|
| 229 | -$GLOBALS['spip_matrice']['image_passe_partout'] = true;//'inc/filtres_images_mini.php'; |
|
| 225 | +$GLOBALS['spip_matrice']['image_graver'] = true; //'inc/filtres_images_mini.php'; |
|
| 226 | +$GLOBALS['spip_matrice']['image_select'] = true; //'inc/filtres_images_mini.php'; |
|
| 227 | +$GLOBALS['spip_matrice']['image_reduire'] = true; //'inc/filtres_images_mini.php'; |
|
| 228 | +$GLOBALS['spip_matrice']['image_reduire_par'] = true; //'inc/filtres_images_mini.php'; |
|
| 229 | +$GLOBALS['spip_matrice']['image_passe_partout'] = true; //'inc/filtres_images_mini.php'; |
|
| 230 | 230 | |
| 231 | 231 | $GLOBALS['spip_matrice']['couleur_html_to_hex'] = 'inc/filtres_images_mini.php'; |
| 232 | 232 | $GLOBALS['spip_matrice']['couleur_foncer'] = 'inc/filtres_images_mini.php'; |
@@ -372,8 +372,8 @@ discard block |
||
| 372 | 372 | */ |
| 373 | 373 | function filtre_debug($val, $key = null) { |
| 374 | 374 | $debug = ( |
| 375 | - is_null($key) ? '' : (var_export($key, true) . " = ") |
|
| 376 | - ) . var_export($val, true); |
|
| 375 | + is_null($key) ? '' : (var_export($key, true)." = ") |
|
| 376 | + ).var_export($val, true); |
|
| 377 | 377 | |
| 378 | 378 | include_spip('inc/autoriser'); |
| 379 | 379 | if (autoriser('webmestre')) { |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) { |
| 462 | 462 | $srcover = $match[1]; |
| 463 | 463 | array_shift($args); |
| 464 | - array_unshift($args, "<img src='" . $match[1] . "' />"); |
|
| 464 | + array_unshift($args, "<img src='".$match[1]."' />"); |
|
| 465 | 465 | $srcover_filter = call_user_func_array($filtre, $args); |
| 466 | 466 | $srcover_filter = extraire_attribut($srcover_filter, 'src'); |
| 467 | 467 | $reduit = str_replace($srcover, $srcover_filter, $reduit); |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | // " -> " et tout ce genre de choses |
| 812 | 812 | $u = $GLOBALS['meta']['pcre_u']; |
| 813 | 813 | $texte = str_replace(" ", " ", $texte); |
| 814 | - $texte = preg_replace('/\s{2,}/S' . $u, " ", $texte); |
|
| 814 | + $texte = preg_replace('/\s{2,}/S'.$u, " ", $texte); |
|
| 815 | 815 | // ne pas echapper les sinqle quotes car certains outils de syndication gerent mal |
| 816 | 816 | $texte = entites_html($texte, false, false); |
| 817 | 817 | // mais bien echapper les double quotes ! |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | **/ |
| 872 | 872 | function supprimer_numero($texte) { |
| 873 | 873 | return preg_replace( |
| 874 | - ",^[[:space:]]*([0-9]+)([.)]|" . chr(194) . '?' . chr(176) . ")[[:space:]]+,S", |
|
| 874 | + ",^[[:space:]]*([0-9]+)([.)]|".chr(194).'?'.chr(176).")[[:space:]]+,S", |
|
| 875 | 875 | "", $texte); |
| 876 | 876 | } |
| 877 | 877 | |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | **/ |
| 897 | 897 | function recuperer_numero($texte) { |
| 898 | 898 | if (preg_match( |
| 899 | - ",^[[:space:]]*([0-9]+)([.)]|" . chr(194) . '?' . chr(176) . ")[[:space:]]+,S", |
|
| 899 | + ",^[[:space:]]*([0-9]+)([.)]|".chr(194).'?'.chr(176).")[[:space:]]+,S", |
|
| 900 | 900 | $texte, $regs)) { |
| 901 | 901 | return strval($regs[1]); |
| 902 | 902 | } else { |
@@ -981,8 +981,8 @@ discard block |
||
| 981 | 981 | **/ |
| 982 | 982 | function textebrut($texte) { |
| 983 | 983 | $u = $GLOBALS['meta']['pcre_u']; |
| 984 | - $texte = preg_replace('/\s+/S' . $u, " ", $texte); |
|
| 985 | - $texte = preg_replace("/<(p|br)( [^>]*)?" . ">/iS", "\n\n", $texte); |
|
| 984 | + $texte = preg_replace('/\s+/S'.$u, " ", $texte); |
|
| 985 | + $texte = preg_replace("/<(p|br)( [^>]*)?".">/iS", "\n\n", $texte); |
|
| 986 | 986 | $texte = preg_replace("/^\n+/", "", $texte); |
| 987 | 987 | $texte = preg_replace("/\n+$/", "", $texte); |
| 988 | 988 | $texte = preg_replace("/\n +/", "\n", $texte); |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | if (preg_match_all(",(<a\s+[^>]*https?://[^>]*class=[\"']spip_(out|url)\b[^>]+>),imsS", |
| 1011 | 1011 | $texte, $liens, PREG_PATTERN_ORDER)) { |
| 1012 | 1012 | foreach ($liens[0] as $a) { |
| 1013 | - $rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel'); |
|
| 1013 | + $rel = 'noopener noreferrer '.extraire_attribut($a, 'rel'); |
|
| 1014 | 1014 | $ablank = inserer_attribut($a, 'rel', $rel); |
| 1015 | 1015 | $ablank = inserer_attribut($ablank, 'target', '_blank'); |
| 1016 | 1016 | $texte = str_replace($a, $ablank, $texte); |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | foreach ($regs[0] as $a) { |
| 1036 | 1036 | $rel = extraire_attribut($a, "rel"); |
| 1037 | 1037 | if (strpos($rel, "nofollow") === false) { |
| 1038 | - $rel = "nofollow" . ($rel ? " $rel" : ""); |
|
| 1038 | + $rel = "nofollow".($rel ? " $rel" : ""); |
|
| 1039 | 1039 | $anofollow = inserer_attribut($a, "rel", $rel); |
| 1040 | 1040 | $texte = str_replace($a, $anofollow, $texte); |
| 1041 | 1041 | } |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | $u = $GLOBALS['meta']['pcre_u']; |
| 1065 | 1065 | $texte = preg_replace("@</p>@iS", "\n", $texte); |
| 1066 | 1066 | $texte = preg_replace("@<p\b.*>@UiS", "<br />", $texte); |
| 1067 | - $texte = preg_replace("@^\s*<br />@S" . $u, "", $texte); |
|
| 1067 | + $texte = preg_replace("@^\s*<br />@S".$u, "", $texte); |
|
| 1068 | 1068 | |
| 1069 | 1069 | return $texte; |
| 1070 | 1070 | } |
@@ -1094,7 +1094,7 @@ discard block |
||
| 1094 | 1094 | return $texte; |
| 1095 | 1095 | } |
| 1096 | 1096 | include_spip('inc/texte'); |
| 1097 | - $tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ? |
|
| 1097 | + $tag = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $texte) ? |
|
| 1098 | 1098 | 'div' : 'span'; |
| 1099 | 1099 | |
| 1100 | 1100 | return "<$tag style='word-wrap:break-word;'>$texte</$tag>"; |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | function attribut_html($texte, $textebrut = true) { |
| 1204 | 1204 | $u = $GLOBALS['meta']['pcre_u']; |
| 1205 | 1205 | if ($textebrut) { |
| 1206 | - $texte = preg_replace(array(",\n,", ",\s(?=\s),msS" . $u), array(" ", ""), textebrut($texte)); |
|
| 1206 | + $texte = preg_replace(array(",\n,", ",\s(?=\s),msS".$u), array(" ", ""), textebrut($texte)); |
|
| 1207 | 1207 | } |
| 1208 | 1208 | $texte = texte_backend($texte); |
| 1209 | 1209 | $texte = str_replace(array("'", '"'), array(''', '"'), $texte); |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | # un message pour abs_url |
| 1233 | 1233 | $GLOBALS['mode_abs_url'] = 'url'; |
| 1234 | 1234 | $url = trim($url); |
| 1235 | - $r = ",^(?:" . _PROTOCOLES_STD . '):?/?/?$,iS'; |
|
| 1235 | + $r = ",^(?:"._PROTOCOLES_STD.'):?/?/?$,iS'; |
|
| 1236 | 1236 | |
| 1237 | 1237 | return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url); |
| 1238 | 1238 | } |
@@ -1434,14 +1434,14 @@ discard block |
||
| 1434 | 1434 | if (strpos($texte, "<") !== false) { |
| 1435 | 1435 | include_spip('inc/lien'); |
| 1436 | 1436 | if (defined('_PREG_MODELE')) { |
| 1437 | - $preg_modeles = "@" . _PREG_MODELE . "@imsS"; |
|
| 1437 | + $preg_modeles = "@"._PREG_MODELE."@imsS"; |
|
| 1438 | 1438 | $texte = echappe_html($texte, '', true, $preg_modeles); |
| 1439 | 1439 | } |
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | 1442 | $debut = ''; |
| 1443 | 1443 | $suite = $texte; |
| 1444 | - while ($t = strpos('-' . $suite, "\n", 1)) { |
|
| 1444 | + while ($t = strpos('-'.$suite, "\n", 1)) { |
|
| 1445 | 1445 | $debut .= substr($suite, 0, $t - 1); |
| 1446 | 1446 | $suite = substr($suite, $t); |
| 1447 | 1447 | $car = substr($suite, 0, 1); |
@@ -1458,11 +1458,11 @@ discard block |
||
| 1458 | 1458 | $suite = substr($suite, strlen($regs[0])); |
| 1459 | 1459 | } |
| 1460 | 1460 | } |
| 1461 | - $texte = $debut . $suite; |
|
| 1461 | + $texte = $debut.$suite; |
|
| 1462 | 1462 | |
| 1463 | 1463 | $texte = echappe_retour($texte); |
| 1464 | 1464 | |
| 1465 | - return $texte . $fin; |
|
| 1465 | + return $texte.$fin; |
|
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | 1468 | |
@@ -1523,7 +1523,7 @@ discard block |
||
| 1523 | 1523 | } |
| 1524 | 1524 | |
| 1525 | 1525 | foreach ($regs as $reg) { |
| 1526 | - $cle = ($reg[1] ? $reg[1] . ':' : '') . $reg[2]; |
|
| 1526 | + $cle = ($reg[1] ? $reg[1].':' : '').$reg[2]; |
|
| 1527 | 1527 | $desc = $traduire($cle, $lang, true); |
| 1528 | 1528 | $l = $desc->langue; |
| 1529 | 1529 | // si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte. |
@@ -1636,7 +1636,7 @@ discard block |
||
| 1636 | 1636 | // il ne faut pas echapper en div si propre produit un seul paragraphe |
| 1637 | 1637 | include_spip('inc/texte'); |
| 1638 | 1638 | $trad_propre = preg_replace(",(^<p[^>]*>|</p>$),Uims", "", propre($trad)); |
| 1639 | - $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span'; |
|
| 1639 | + $mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $trad_propre) ? 'div' : 'span'; |
|
| 1640 | 1640 | $trad = code_echappement($trad, 'multi', false, $mode); |
| 1641 | 1641 | $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l)); |
| 1642 | 1642 | if (lang_dir($l) !== lang_dir($lang)) { |
@@ -1829,7 +1829,7 @@ discard block |
||
| 1829 | 1829 | if (is_array($balise)) { |
| 1830 | 1830 | array_walk( |
| 1831 | 1831 | $balise, |
| 1832 | - function(&$a, $key, $t){ |
|
| 1832 | + function(&$a, $key, $t) { |
|
| 1833 | 1833 | $a = extraire_attribut($a, $t); |
| 1834 | 1834 | }, |
| 1835 | 1835 | $attribut |
@@ -1916,14 +1916,14 @@ discard block |
||
| 1916 | 1916 | |
| 1917 | 1917 | if ($old !== null) { |
| 1918 | 1918 | // Remplacer l'ancien attribut du meme nom |
| 1919 | - $balise = $r[1] . $insert . $r[5]; |
|
| 1919 | + $balise = $r[1].$insert.$r[5]; |
|
| 1920 | 1920 | } else { |
| 1921 | 1921 | // preferer une balise " />" (comme <img />) |
| 1922 | 1922 | if (preg_match(',/>,', $balise)) { |
| 1923 | - $balise = preg_replace(",\s?/>,S", $insert . " />", $balise, 1); |
|
| 1923 | + $balise = preg_replace(",\s?/>,S", $insert." />", $balise, 1); |
|
| 1924 | 1924 | } // sinon une balise <a ...> ... </a> |
| 1925 | 1925 | else { |
| 1926 | - $balise = preg_replace(",\s?>,S", $insert . ">", $balise, 1); |
|
| 1926 | + $balise = preg_replace(",\s?>,S", $insert.">", $balise, 1); |
|
| 1927 | 1927 | } |
| 1928 | 1928 | } |
| 1929 | 1929 | |
@@ -1965,8 +1965,8 @@ discard block |
||
| 1965 | 1965 | // |
| 1966 | 1966 | // Quelques fonctions de calcul arithmetique |
| 1967 | 1967 | // |
| 1968 | -function floatstr($a) { return str_replace(',','.',(string)floatval($a)); } |
|
| 1969 | -function strize($f, $a, $b) { return floatstr($f(floatstr($a),floatstr($b))); } |
|
| 1968 | +function floatstr($a) { return str_replace(',', '.', (string) floatval($a)); } |
|
| 1969 | +function strize($f, $a, $b) { return floatstr($f(floatstr($a), floatstr($b))); } |
|
| 1970 | 1970 | |
| 1971 | 1971 | /** |
| 1972 | 1972 | * Additionne 2 nombres |
@@ -1986,7 +1986,7 @@ discard block |
||
| 1986 | 1986 | function plus($a, $b) { |
| 1987 | 1987 | return $a + $b; |
| 1988 | 1988 | } |
| 1989 | -function strplus($a, $b) {return strize('plus', $a, $b);} |
|
| 1989 | +function strplus($a, $b) {return strize('plus', $a, $b); } |
|
| 1990 | 1990 | /** |
| 1991 | 1991 | * Soustrait 2 nombres |
| 1992 | 1992 | * |
@@ -2005,7 +2005,7 @@ discard block |
||
| 2005 | 2005 | function moins($a, $b) { |
| 2006 | 2006 | return $a - $b; |
| 2007 | 2007 | } |
| 2008 | -function strmoins($a, $b) {return strize('moins', $a, $b);} |
|
| 2008 | +function strmoins($a, $b) {return strize('moins', $a, $b); } |
|
| 2009 | 2009 | |
| 2010 | 2010 | /** |
| 2011 | 2011 | * Multiplie 2 nombres |
@@ -2026,7 +2026,7 @@ discard block |
||
| 2026 | 2026 | function mult($a, $b) { |
| 2027 | 2027 | return $a * $b; |
| 2028 | 2028 | } |
| 2029 | -function strmult($a, $b) {return strize('mult', $a, $b);} |
|
| 2029 | +function strmult($a, $b) {return strize('mult', $a, $b); } |
|
| 2030 | 2030 | |
| 2031 | 2031 | /** |
| 2032 | 2032 | * Divise 2 nombres |
@@ -2047,7 +2047,7 @@ discard block |
||
| 2047 | 2047 | function div($a, $b) { |
| 2048 | 2048 | return $b ? $a / $b : 0; |
| 2049 | 2049 | } |
| 2050 | -function strdiv($a, $b) {return strize('div', $a, $b);} |
|
| 2050 | +function strdiv($a, $b) {return strize('div', $a, $b); } |
|
| 2051 | 2051 | |
| 2052 | 2052 | /** |
| 2053 | 2053 | * Retourne le modulo 2 nombres |
@@ -2088,13 +2088,13 @@ discard block |
||
| 2088 | 2088 | if (!defined('_TAGS_NOM_AUTEUR')) { |
| 2089 | 2089 | define('_TAGS_NOM_AUTEUR', ''); |
| 2090 | 2090 | } |
| 2091 | - $tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR)); |
|
| 2091 | + $tags_acceptes = array_unique(explode(',', 'multi,'._TAGS_NOM_AUTEUR)); |
|
| 2092 | 2092 | foreach ($tags_acceptes as $tag) { |
| 2093 | 2093 | if (strlen($tag)) { |
| 2094 | - $remp1[] = '<' . trim($tag) . '>'; |
|
| 2095 | - $remp1[] = '</' . trim($tag) . '>'; |
|
| 2096 | - $remp2[] = '\x60' . trim($tag) . '\x61'; |
|
| 2097 | - $remp2[] = '\x60/' . trim($tag) . '\x61'; |
|
| 2094 | + $remp1[] = '<'.trim($tag).'>'; |
|
| 2095 | + $remp1[] = '</'.trim($tag).'>'; |
|
| 2096 | + $remp2[] = '\x60'.trim($tag).'\x61'; |
|
| 2097 | + $remp2[] = '\x60/'.trim($tag).'\x61'; |
|
| 2098 | 2098 | } |
| 2099 | 2099 | } |
| 2100 | 2100 | $v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom))); |
@@ -2157,7 +2157,7 @@ discard block |
||
| 2157 | 2157 | $s[] = preg_replace(',>[^<]+</a>,S', |
| 2158 | 2158 | '>' |
| 2159 | 2159 | . http_img_pack('attachment-16.png', $t, |
| 2160 | - 'title="' . attribut_html($t) . '"') |
|
| 2160 | + 'title="'.attribut_html($t).'"') |
|
| 2161 | 2161 | . '</a>', $tag); |
| 2162 | 2162 | } |
| 2163 | 2163 | } |
@@ -2218,10 +2218,10 @@ discard block |
||
| 2218 | 2218 | $fichier = basename($url); |
| 2219 | 2219 | |
| 2220 | 2220 | return '<a rel="enclosure"' |
| 2221 | - . ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2222 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2223 | - . ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '') |
|
| 2224 | - . '>' . $fichier . '</a>'; |
|
| 2221 | + . ($url ? ' href="'.spip_htmlspecialchars($url).'"' : '') |
|
| 2222 | + . ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '') |
|
| 2223 | + . ($length ? ' title="'.spip_htmlspecialchars($length).'"' : '') |
|
| 2224 | + . '>'.$fichier.'</a>'; |
|
| 2225 | 2225 | } |
| 2226 | 2226 | |
| 2227 | 2227 | /** |
@@ -2249,9 +2249,9 @@ discard block |
||
| 2249 | 2249 | } # vieux data |
| 2250 | 2250 | $fichier = basename($url); |
| 2251 | 2251 | $enclosures[] = '<enclosure' |
| 2252 | - . ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2253 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2254 | - . ($length ? ' length="' . $length . '"' : '') |
|
| 2252 | + . ($url ? ' url="'.spip_htmlspecialchars($url).'"' : '') |
|
| 2253 | + . ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '') |
|
| 2254 | + . ($length ? ' length="'.$length.'"' : '') |
|
| 2255 | 2255 | . ' />'; |
| 2256 | 2256 | } |
| 2257 | 2257 | } |
@@ -2277,7 +2277,7 @@ discard block |
||
| 2277 | 2277 | if (extraire_attribut($e, rel) == 'tag') { |
| 2278 | 2278 | $subjects .= '<dc:subject>' |
| 2279 | 2279 | . texte_backend(textebrut($e)) |
| 2280 | - . '</dc:subject>' . "\n"; |
|
| 2280 | + . '</dc:subject>'."\n"; |
|
| 2281 | 2281 | } |
| 2282 | 2282 | } |
| 2283 | 2283 | |
@@ -2313,7 +2313,7 @@ discard block |
||
| 2313 | 2313 | if (is_array($texte)) { |
| 2314 | 2314 | array_walk( |
| 2315 | 2315 | $texte, |
| 2316 | - function(&$a, $key, $t){ |
|
| 2316 | + function(&$a, $key, $t) { |
|
| 2317 | 2317 | $a = extraire_balise($a, $t); |
| 2318 | 2318 | }, |
| 2319 | 2319 | $tag |
@@ -2357,7 +2357,7 @@ discard block |
||
| 2357 | 2357 | if (is_array($texte)) { |
| 2358 | 2358 | array_walk( |
| 2359 | 2359 | $texte, |
| 2360 | - function(&$a, $key, $t){ |
|
| 2360 | + function(&$a, $key, $t) { |
|
| 2361 | 2361 | $a = extraire_balises($a, $t); |
| 2362 | 2362 | }, |
| 2363 | 2363 | $tag |
@@ -2483,7 +2483,7 @@ discard block |
||
| 2483 | 2483 | if ($fond != '404') { |
| 2484 | 2484 | $contexte = array_shift($p); |
| 2485 | 2485 | $contexte['page'] = $fond; |
| 2486 | - $action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2486 | + $action = preg_replace('/([?]'.preg_quote($fond).'[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2487 | 2487 | } |
| 2488 | 2488 | } |
| 2489 | 2489 | // defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url |
@@ -2538,9 +2538,9 @@ discard block |
||
| 2538 | 2538 | . '"' |
| 2539 | 2539 | . (is_null($val) |
| 2540 | 2540 | ? '' |
| 2541 | - : ' value="' . entites_html($val) . '"' |
|
| 2541 | + : ' value="'.entites_html($val).'"' |
|
| 2542 | 2542 | ) |
| 2543 | - . ' type="hidden"' . "\n/>"; |
|
| 2543 | + . ' type="hidden"'."\n/>"; |
|
| 2544 | 2544 | } |
| 2545 | 2545 | |
| 2546 | 2546 | return join("", $hidden); |
@@ -2703,12 +2703,12 @@ discard block |
||
| 2703 | 2703 | if ($pas < 1) { |
| 2704 | 2704 | return ''; |
| 2705 | 2705 | } |
| 2706 | - $ancre = 'pagination' . $nom; // #pagination_articles |
|
| 2707 | - $debut = 'debut' . $nom; // 'debut_articles' |
|
| 2706 | + $ancre = 'pagination'.$nom; // #pagination_articles |
|
| 2707 | + $debut = 'debut'.$nom; // 'debut_articles' |
|
| 2708 | 2708 | |
| 2709 | 2709 | // n'afficher l'ancre qu'une fois |
| 2710 | 2710 | if (!isset($ancres[$ancre])) { |
| 2711 | - $bloc_ancre = $ancres[$ancre] = "<a name='" . $ancre . "' id='" . $ancre . "'></a>"; |
|
| 2711 | + $bloc_ancre = $ancres[$ancre] = "<a name='".$ancre."' id='".$ancre."'></a>"; |
|
| 2712 | 2712 | } else { |
| 2713 | 2713 | $bloc_ancre = ''; |
| 2714 | 2714 | } |
@@ -2738,7 +2738,7 @@ discard block |
||
| 2738 | 2738 | } |
| 2739 | 2739 | |
| 2740 | 2740 | if ($modele) { |
| 2741 | - $modele = '_' . $modele; |
|
| 2741 | + $modele = '_'.$modele; |
|
| 2742 | 2742 | } |
| 2743 | 2743 | |
| 2744 | 2744 | return recuperer_fond("modeles/pagination$modele", $pagination, array('trim' => true), $connect); |
@@ -2763,7 +2763,7 @@ discard block |
||
| 2763 | 2763 | return preg_replace_callback( |
| 2764 | 2764 | ",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims", |
| 2765 | 2765 | function($x) use ($path) { |
| 2766 | - return "url('" . suivre_lien($path, $x[1]) . "')"; |
|
| 2766 | + return "url('".suivre_lien($path, $x[1])."')"; |
|
| 2767 | 2767 | }, |
| 2768 | 2768 | $contenu |
| 2769 | 2769 | ); |
@@ -2825,14 +2825,14 @@ discard block |
||
| 2825 | 2825 | ) { |
| 2826 | 2826 | $distant = true; |
| 2827 | 2827 | $cssf = parse_url($css); |
| 2828 | - $cssf = $cssf['path'] . ($cssf['query'] ? "?" . $cssf['query'] : ""); |
|
| 2828 | + $cssf = $cssf['path'].($cssf['query'] ? "?".$cssf['query'] : ""); |
|
| 2829 | 2829 | $cssf = preg_replace(',[?:&=],', "_", $cssf); |
| 2830 | 2830 | } else { |
| 2831 | 2831 | $distant = false; |
| 2832 | 2832 | $cssf = $css; |
| 2833 | 2833 | // 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi |
| 2834 | 2834 | //propose (rien a faire dans ce cas) |
| 2835 | - $f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css); |
|
| 2835 | + $f = preg_replace(',(_rtl)?\.css$,i', '_'.$ndir.'.css', $css); |
|
| 2836 | 2836 | if (@file_exists($f)) { |
| 2837 | 2837 | return $f; |
| 2838 | 2838 | } |
@@ -2842,7 +2842,7 @@ discard block |
||
| 2842 | 2842 | $dir_var = sous_repertoire(_DIR_VAR, 'cache-css'); |
| 2843 | 2843 | $f = $dir_var |
| 2844 | 2844 | . preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf) |
| 2845 | - . '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css'; |
|
| 2845 | + . '.'.substr(md5($cssf), 0, 4).'_'.$ndir.'.css'; |
|
| 2846 | 2846 | |
| 2847 | 2847 | // la css peut etre distante (url absolue !) |
| 2848 | 2848 | if ($distant) { |
@@ -2887,8 +2887,8 @@ discard block |
||
| 2887 | 2887 | } // si la css_direction commence par $dir_var on la fait passer pour une absolue |
| 2888 | 2888 | elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) { |
| 2889 | 2889 | $css_direction = substr($css_direction, strlen($dir_var)); |
| 2890 | - $src_faux_abs["/@@@@@@/" . $css_direction] = $css_direction; |
|
| 2891 | - $css_direction = "/@@@@@@/" . $css_direction; |
|
| 2890 | + $src_faux_abs["/@@@@@@/".$css_direction] = $css_direction; |
|
| 2891 | + $css_direction = "/@@@@@@/".$css_direction; |
|
| 2892 | 2892 | } |
| 2893 | 2893 | $src[] = $regs[0][$k]; |
| 2894 | 2894 | $src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]); |
@@ -2937,7 +2937,7 @@ discard block |
||
| 2937 | 2937 | |
| 2938 | 2938 | $f = basename($css, '.css'); |
| 2939 | 2939 | $f = sous_repertoire(_DIR_VAR, 'cache-css') |
| 2940 | - . preg_replace(",(.*?)(_rtl|_ltr)?$,", "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f) |
|
| 2940 | + . preg_replace(",(.*?)(_rtl|_ltr)?$,", "\\1-urlabs-".substr(md5("$css-urlabs"), 0, 4)."\\2", $f) |
|
| 2941 | 2941 | . '.css'; |
| 2942 | 2942 | |
| 2943 | 2943 | if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) { |
@@ -2946,7 +2946,7 @@ discard block |
||
| 2946 | 2946 | |
| 2947 | 2947 | if ($url_absolue_css == $css) { |
| 2948 | 2948 | if (strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0 |
| 2949 | - or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu) |
|
| 2949 | + or !lire_fichier(_DIR_RACINE.substr($css, $l), $contenu) |
|
| 2950 | 2950 | ) { |
| 2951 | 2951 | include_spip('inc/distant'); |
| 2952 | 2952 | if (!$contenu = recuperer_page($css)) { |
@@ -3056,7 +3056,7 @@ discard block |
||
| 3056 | 3056 | $expression = str_replace("\/", "/", $expression); |
| 3057 | 3057 | $expression = str_replace("/", "\/", $expression); |
| 3058 | 3058 | |
| 3059 | - if (preg_match('/' . $expression . '/' . $modif, $texte, $r)) { |
|
| 3059 | + if (preg_match('/'.$expression.'/'.$modif, $texte, $r)) { |
|
| 3060 | 3060 | if (isset($r[$capte])) { |
| 3061 | 3061 | return $r[$capte]; |
| 3062 | 3062 | } else { |
@@ -3094,7 +3094,7 @@ discard block |
||
| 3094 | 3094 | $expression = str_replace("\/", "/", $expression); |
| 3095 | 3095 | $expression = str_replace("/", "\/", $expression); |
| 3096 | 3096 | |
| 3097 | - return preg_replace('/' . $expression . '/' . $modif, $replace, $texte); |
|
| 3097 | + return preg_replace('/'.$expression.'/'.$modif, $replace, $texte); |
|
| 3098 | 3098 | } |
| 3099 | 3099 | |
| 3100 | 3100 | |
@@ -3113,7 +3113,7 @@ discard block |
||
| 3113 | 3113 | function traiter_doublons_documents(&$doublons, $letexte) { |
| 3114 | 3114 | |
| 3115 | 3115 | // Verifier dans le texte & les notes (pas beau, helas) |
| 3116 | - $t = $letexte . $GLOBALS['les_notes']; |
|
| 3116 | + $t = $letexte.$GLOBALS['les_notes']; |
|
| 3117 | 3117 | |
| 3118 | 3118 | if (strstr($t, 'spip_document_') // evite le preg_match_all si inutile |
| 3119 | 3119 | and preg_match_all( |
@@ -3123,7 +3123,7 @@ discard block |
||
| 3123 | 3123 | if (!isset($doublons['documents'])) { |
| 3124 | 3124 | $doublons['documents'] = ""; |
| 3125 | 3125 | } |
| 3126 | - $doublons['documents'] .= "," . join(',', $matches[1]); |
|
| 3126 | + $doublons['documents'] .= ",".join(',', $matches[1]); |
|
| 3127 | 3127 | } |
| 3128 | 3128 | |
| 3129 | 3129 | return $letexte; |
@@ -3180,7 +3180,7 @@ discard block |
||
| 3180 | 3180 | if ($env) { |
| 3181 | 3181 | foreach ($env as $i => $j) { |
| 3182 | 3182 | if (is_string($j) and !in_array($i, $ignore_params)) { |
| 3183 | - $texte .= "<param name='" . $i . "'\n\tvalue='" . $j . "' />"; |
|
| 3183 | + $texte .= "<param name='".$i."'\n\tvalue='".$j."' />"; |
|
| 3184 | 3184 | } |
| 3185 | 3185 | } |
| 3186 | 3186 | } |
@@ -3219,7 +3219,7 @@ discard block |
||
| 3219 | 3219 | if ($env) { |
| 3220 | 3220 | foreach ($env as $i => $j) { |
| 3221 | 3221 | if (is_string($j) and !in_array($i, $ignore_params)) { |
| 3222 | - $texte .= $i . "='" . $j . "' "; |
|
| 3222 | + $texte .= $i."='".$j."' "; |
|
| 3223 | 3223 | } |
| 3224 | 3224 | } |
| 3225 | 3225 | } |
@@ -3315,12 +3315,12 @@ discard block |
||
| 3315 | 3315 | return ""; |
| 3316 | 3316 | } |
| 3317 | 3317 | } |
| 3318 | - $atts .= " width='" . $largeur . "' height='" . $hauteur . "'"; |
|
| 3318 | + $atts .= " width='".$largeur."' height='".$hauteur."'"; |
|
| 3319 | 3319 | } |
| 3320 | 3320 | |
| 3321 | - return "<img src='$img' alt='" . attribut_html($alt ? $alt : $title) . "'" |
|
| 3322 | - . ($title ? ' title="' . attribut_html($title) . '"' : '') |
|
| 3323 | - . " " . ltrim($atts) |
|
| 3321 | + return "<img src='$img' alt='".attribut_html($alt ? $alt : $title)."'" |
|
| 3322 | + . ($title ? ' title="'.attribut_html($title).'"' : '') |
|
| 3323 | + . " ".ltrim($atts) |
|
| 3324 | 3324 | . " />"; |
| 3325 | 3325 | } |
| 3326 | 3326 | |
@@ -3332,7 +3332,7 @@ discard block |
||
| 3332 | 3332 | * @return string |
| 3333 | 3333 | */ |
| 3334 | 3334 | function http_style_background($img, $att = '') { |
| 3335 | - return " style='background" . ($att ? "" : "-image") . ": url(\"" . chemin_image($img) . "\")" . ($att ? (' ' . $att) : '') . ";'"; |
|
| 3335 | + return " style='background".($att ? "" : "-image").": url(\"".chemin_image($img)."\")".($att ? (' '.$att) : '').";'"; |
|
| 3336 | 3336 | } |
| 3337 | 3337 | |
| 3338 | 3338 | /** |
@@ -3347,7 +3347,7 @@ discard block |
||
| 3347 | 3347 | * Code HTML de la balise IMG |
| 3348 | 3348 | */ |
| 3349 | 3349 | function filtre_balise_img_dist($img, $alt = "", $class = "") { |
| 3350 | - return http_img_pack($img, $alt, $class ? " class='" . attribut_html($class) . "'" : '', '', |
|
| 3350 | + return http_img_pack($img, $alt, $class ? " class='".attribut_html($class)."'" : '', '', |
|
| 3351 | 3351 | array('chemin_image' => false, 'utiliser_suffixe_size' => false)); |
| 3352 | 3352 | } |
| 3353 | 3353 | |
@@ -3373,7 +3373,7 @@ discard block |
||
| 3373 | 3373 | $texte = ''; |
| 3374 | 3374 | if (is_array($tableau)) { |
| 3375 | 3375 | foreach ($tableau as $k => $v) { |
| 3376 | - $res = recuperer_fond('modeles/' . $modele, |
|
| 3376 | + $res = recuperer_fond('modeles/'.$modele, |
|
| 3377 | 3377 | array_merge(array('cle' => $k), (is_array($v) ? $v : array('valeur' => $v))) |
| 3378 | 3378 | ); |
| 3379 | 3379 | $texte .= $res; |
@@ -3550,7 +3550,7 @@ discard block |
||
| 3550 | 3550 | } |
| 3551 | 3551 | |
| 3552 | 3552 | $c = serialize($c); |
| 3553 | - $cle = calculer_cle_action($form . $c); |
|
| 3553 | + $cle = calculer_cle_action($form.$c); |
|
| 3554 | 3554 | $c = "$cle:$c"; |
| 3555 | 3555 | |
| 3556 | 3556 | // on ne stocke pas les contextes dans des fichiers caches |
@@ -3600,15 +3600,15 @@ discard block |
||
| 3600 | 3600 | } |
| 3601 | 3601 | // toujours encoder l'url source dans le bloc ajax |
| 3602 | 3602 | $r = self(); |
| 3603 | - $r = ' data-origin="' . $r . '"'; |
|
| 3603 | + $r = ' data-origin="'.$r.'"'; |
|
| 3604 | 3604 | $class = 'ajaxbloc'; |
| 3605 | 3605 | if ($ajaxid and is_string($ajaxid)) { |
| 3606 | 3606 | // ajaxid est normalement conforme a un nom de classe css |
| 3607 | 3607 | // on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution |
| 3608 | - $class .= ' ajax-id-' . entites_html($ajaxid); |
|
| 3608 | + $class .= ' ajax-id-'.entites_html($ajaxid); |
|
| 3609 | 3609 | } |
| 3610 | 3610 | |
| 3611 | - return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 3611 | + return "<div class='$class' "."data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 3612 | 3612 | } |
| 3613 | 3613 | |
| 3614 | 3614 | /** |
@@ -3647,11 +3647,11 @@ discard block |
||
| 3647 | 3647 | // extraire la signature en debut de contexte |
| 3648 | 3648 | // et la verifier avant de deserializer |
| 3649 | 3649 | // format : signature:donneesserializees |
| 3650 | - if ($p = strpos($c,":")){ |
|
| 3651 | - $cle = substr($c,0,$p); |
|
| 3652 | - $c = substr($c,$p+1); |
|
| 3650 | + if ($p = strpos($c, ":")) { |
|
| 3651 | + $cle = substr($c, 0, $p); |
|
| 3652 | + $c = substr($c, $p + 1); |
|
| 3653 | 3653 | |
| 3654 | - if ($cle == calculer_cle_action($form . $c)) { |
|
| 3654 | + if ($cle == calculer_cle_action($form.$c)) { |
|
| 3655 | 3655 | $env = @unserialize($c); |
| 3656 | 3656 | return $env; |
| 3657 | 3657 | } |
@@ -3752,9 +3752,9 @@ discard block |
||
| 3752 | 3752 | } else { |
| 3753 | 3753 | $bal = 'a'; |
| 3754 | 3754 | $att = "href='$url'" |
| 3755 | - . ($title ? " title='" . attribut_html($title) . "'" : '') |
|
| 3756 | - . ($class ? " class='" . attribut_html($class) . "'" : '') |
|
| 3757 | - . ($rel ? " rel='" . attribut_html($rel) . "'" : '') |
|
| 3755 | + . ($title ? " title='".attribut_html($title)."'" : '') |
|
| 3756 | + . ($class ? " class='".attribut_html($class)."'" : '') |
|
| 3757 | + . ($rel ? " rel='".attribut_html($rel)."'" : '') |
|
| 3758 | 3758 | . $evt; |
| 3759 | 3759 | } |
| 3760 | 3760 | if ($libelle === null) { |
@@ -3828,7 +3828,7 @@ discard block |
||
| 3828 | 3828 | } |
| 3829 | 3829 | |
| 3830 | 3830 | // ajouter le type d'objet dans la class de l'icone |
| 3831 | - $class .= " " . substr(basename($fond), 0, -4); |
|
| 3831 | + $class .= " ".substr(basename($fond), 0, -4); |
|
| 3832 | 3832 | |
| 3833 | 3833 | $alt = attribut_html($texte); |
| 3834 | 3834 | $title = " title=\"$alt\""; // est-ce pertinent de doubler le alt par un title ? |
@@ -3853,7 +3853,7 @@ discard block |
||
| 3853 | 3853 | if ($fonction) { |
| 3854 | 3854 | // 2 images pour composer l'icone : le fond (article) en background, |
| 3855 | 3855 | // la fonction (new) en image |
| 3856 | - $icone = http_img_pack($fonction, $alt, "width='$size' height='$size'\n" . |
|
| 3856 | + $icone = http_img_pack($fonction, $alt, "width='$size' height='$size'\n". |
|
| 3857 | 3857 | http_style_background($fond)); |
| 3858 | 3858 | } else { |
| 3859 | 3859 | $icone = http_img_pack($fond, $alt, "width='$size' height='$size'"); |
@@ -4087,13 +4087,13 @@ discard block |
||
| 4087 | 4087 | $res = ""; |
| 4088 | 4088 | foreach ($boutons as $page => $detail) { |
| 4089 | 4089 | if ($detail->icone and strlen(trim($detail->icone))) { |
| 4090 | - $res .= "\n.navigation_avec_icones #bando1_$page {background-image:url(" . $detail->icone . ");}"; |
|
| 4090 | + $res .= "\n.navigation_avec_icones #bando1_$page {background-image:url(".$detail->icone.");}"; |
|
| 4091 | 4091 | } |
| 4092 | 4092 | $selecteur = (in_array($page, array('outils_rapides', 'outils_collaboratifs')) ? "" : ".navigation_avec_icones "); |
| 4093 | 4093 | if (is_array($detail->sousmenu)) { |
| 4094 | 4094 | foreach ($detail->sousmenu as $souspage => $sousdetail) { |
| 4095 | 4095 | if ($sousdetail->icone and strlen(trim($sousdetail->icone))) { |
| 4096 | - $res .= "\n$selecteur.bando2_$souspage {background-image:url(" . $sousdetail->icone . ");}"; |
|
| 4096 | + $res .= "\n$selecteur.bando2_$souspage {background-image:url(".$sousdetail->icone.");}"; |
|
| 4097 | 4097 | } |
| 4098 | 4098 | } |
| 4099 | 4099 | } |
@@ -4119,17 +4119,17 @@ discard block |
||
| 4119 | 4119 | */ |
| 4120 | 4120 | function bouton_action($libelle, $url, $class = "", $confirm = "", $title = "", $callback = "") { |
| 4121 | 4121 | if ($confirm) { |
| 4122 | - $confirm = "confirm(\"" . attribut_html($confirm) . "\")"; |
|
| 4122 | + $confirm = "confirm(\"".attribut_html($confirm)."\")"; |
|
| 4123 | 4123 | if ($callback) { |
| 4124 | 4124 | $callback = "$confirm?($callback):false"; |
| 4125 | 4125 | } else { |
| 4126 | 4126 | $callback = $confirm; |
| 4127 | 4127 | } |
| 4128 | 4128 | } |
| 4129 | - $onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : ""; |
|
| 4129 | + $onclick = $callback ? " onclick='return ".addcslashes($callback, "'")."'" : ""; |
|
| 4130 | 4130 | $title = $title ? " title='$title'" : ""; |
| 4131 | 4131 | |
| 4132 | - return "<form class='bouton_action_post $class' method='post' action='$url'><div>" . form_hidden($url) |
|
| 4132 | + return "<form class='bouton_action_post $class' method='post' action='$url'><div>".form_hidden($url) |
|
| 4133 | 4133 | . "<button type='submit' class='submit'$title$onclick>$libelle</button></div></form>"; |
| 4134 | 4134 | } |
| 4135 | 4135 | |
@@ -4268,14 +4268,14 @@ discard block |
||
| 4268 | 4268 | $champ_titre = ""; |
| 4269 | 4269 | if ($demande_titre) { |
| 4270 | 4270 | // si pas de titre declare mais champ titre, il sera peuple par le select * |
| 4271 | - $champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : ''; |
|
| 4271 | + $champ_titre = (!empty($desc['titre'])) ? ', '.$desc['titre'] : ''; |
|
| 4272 | 4272 | } |
| 4273 | 4273 | include_spip('base/abstract_sql'); |
| 4274 | 4274 | include_spip('base/connect_sql'); |
| 4275 | 4275 | $objets[$type_objet][$id_objet] = sql_fetsel( |
| 4276 | - '*' . $champ_titre, |
|
| 4276 | + '*'.$champ_titre, |
|
| 4277 | 4277 | $desc['table_sql'], |
| 4278 | - id_table_objet($type_objet) . ' = ' . intval($id_objet) |
|
| 4278 | + id_table_objet($type_objet).' = '.intval($id_objet) |
|
| 4279 | 4279 | ); |
| 4280 | 4280 | } |
| 4281 | 4281 | |
@@ -4345,7 +4345,7 @@ discard block |
||
| 4345 | 4345 | return $texte; |
| 4346 | 4346 | } |
| 4347 | 4347 | |
| 4348 | - $traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement); |
|
| 4348 | + $traitement = str_replace('%s', "'".texte_script($texte)."'", $traitement); |
|
| 4349 | 4349 | |
| 4350 | 4350 | // Fournir $connect et $Pile[0] au traitement si besoin |
| 4351 | 4351 | $Pile = array(0 => $env); |
@@ -4379,7 +4379,7 @@ discard block |
||
| 4379 | 4379 | } |
| 4380 | 4380 | $url = generer_url_entite($id_objet, $objet, '', '', $connect); |
| 4381 | 4381 | |
| 4382 | - return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . "</a>"; |
|
| 4382 | + return "<a href='$url' class='$objet'>".couper($titre, $longueur)."</a>"; |
|
| 4383 | 4383 | } |
| 4384 | 4384 | |
| 4385 | 4385 | |
@@ -4398,10 +4398,10 @@ discard block |
||
| 4398 | 4398 | function wrap($texte, $wrap) { |
| 4399 | 4399 | $balises = extraire_balises($wrap); |
| 4400 | 4400 | if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) { |
| 4401 | - $texte = $wrap . $texte; |
|
| 4401 | + $texte = $wrap.$texte; |
|
| 4402 | 4402 | $regs = array_reverse($regs[1]); |
| 4403 | - $wrap = "</" . implode("></", $regs) . ">"; |
|
| 4404 | - $texte = $texte . $wrap; |
|
| 4403 | + $wrap = "</".implode("></", $regs).">"; |
|
| 4404 | + $texte = $texte.$wrap; |
|
| 4405 | 4405 | } |
| 4406 | 4406 | |
| 4407 | 4407 | return $texte; |
@@ -4432,7 +4432,7 @@ discard block |
||
| 4432 | 4432 | |
| 4433 | 4433 | // caster $u en array si besoin |
| 4434 | 4434 | if (is_object($u)) { |
| 4435 | - $u = (array)$u; |
|
| 4435 | + $u = (array) $u; |
|
| 4436 | 4436 | } |
| 4437 | 4437 | |
| 4438 | 4438 | if (is_array($u)) { |
@@ -4453,7 +4453,7 @@ discard block |
||
| 4453 | 4453 | // sinon on passe a la ligne et on indente |
| 4454 | 4454 | $i_str = str_pad("", $indent, " "); |
| 4455 | 4455 | foreach ($u as $k => $v) { |
| 4456 | - $out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2); |
|
| 4456 | + $out .= $join.$i_str."$k: ".filtre_print_dist($v, $join, $indent + 2); |
|
| 4457 | 4457 | } |
| 4458 | 4458 | |
| 4459 | 4459 | return $out; |
@@ -4506,7 +4506,7 @@ discard block |
||
| 4506 | 4506 | * @return string |
| 4507 | 4507 | */ |
| 4508 | 4508 | function objet_icone($objet, $taille = 24) { |
| 4509 | - $icone = objet_info($objet, 'icone_objet') . "-" . $taille . ".png"; |
|
| 4509 | + $icone = objet_info($objet, 'icone_objet')."-".$taille.".png"; |
|
| 4510 | 4510 | $icone = chemin_image($icone); |
| 4511 | 4511 | $balise_img = charger_filtre('balise_img'); |
| 4512 | 4512 | |
@@ -4530,12 +4530,12 @@ discard block |
||
| 4530 | 4530 | * @param array $options |
| 4531 | 4531 | * @return string |
| 4532 | 4532 | */ |
| 4533 | -function objet_T($objet, $chaine, $args = array(), $options = array()){ |
|
| 4534 | - $chaine = explode(':',$chaine); |
|
| 4535 | - if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, array('force'=>false)))) { |
|
| 4533 | +function objet_T($objet, $chaine, $args = array(), $options = array()) { |
|
| 4534 | + $chaine = explode(':', $chaine); |
|
| 4535 | + if ($t = _T($objet.':'.end($chaine), $args, array_merge($options, array('force'=>false)))) { |
|
| 4536 | 4536 | return $t; |
| 4537 | 4537 | } |
| 4538 | - $chaine = implode(':',$chaine); |
|
| 4538 | + $chaine = implode(':', $chaine); |
|
| 4539 | 4539 | return _T($chaine, $args, $options); |
| 4540 | 4540 | } |
| 4541 | 4541 | |
@@ -4595,11 +4595,11 @@ discard block |
||
| 4595 | 4595 | $cache = recuperer_fond($fond, $contexte, $options, $connect); |
| 4596 | 4596 | |
| 4597 | 4597 | // calculer le nom de la css |
| 4598 | - $dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension); |
|
| 4598 | + $dir_var = sous_repertoire(_DIR_VAR, 'cache-'.$extension); |
|
| 4599 | 4599 | $nom_safe = preg_replace(",\W,", '_', str_replace('.', '_', $fond)); |
| 4600 | 4600 | $contexte_implicite = calculer_contexte_implicite(); |
| 4601 | - $filename = $dir_var . $extension . "dyn-$nom_safe-" |
|
| 4602 | - . substr(md5($fond . serialize($contexte_implicite) . serialize($contexte) . $connect), 0, 8) |
|
| 4601 | + $filename = $dir_var.$extension."dyn-$nom_safe-" |
|
| 4602 | + . substr(md5($fond.serialize($contexte_implicite).serialize($contexte).$connect), 0, 8) |
|
| 4603 | 4603 | . ".$extension"; |
| 4604 | 4604 | |
| 4605 | 4605 | // mettre a jour le fichier si il n'existe pas |
@@ -4607,8 +4607,8 @@ discard block |
||
| 4607 | 4607 | // le dernier fichier produit est toujours suffixe par .last |
| 4608 | 4608 | // et recopie sur le fichier cible uniquement si il change |
| 4609 | 4609 | if (!file_exists($filename) |
| 4610 | - or !file_exists($filename . ".last") |
|
| 4611 | - or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . ".last") < $cache['lastmodified']) |
|
| 4610 | + or !file_exists($filename.".last") |
|
| 4611 | + or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename.".last") < $cache['lastmodified']) |
|
| 4612 | 4612 | or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') |
| 4613 | 4613 | ) { |
| 4614 | 4614 | $contenu = $cache['texte']; |
@@ -4627,15 +4627,15 @@ discard block |
||
| 4627 | 4627 | } |
| 4628 | 4628 | // pas de date dans le commentaire car sinon ca invalide le md5 et force la maj |
| 4629 | 4629 | // mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non |
| 4630 | - $comment .= "}\n md5:" . md5($contenu) . " */\n"; |
|
| 4630 | + $comment .= "}\n md5:".md5($contenu)." */\n"; |
|
| 4631 | 4631 | } |
| 4632 | 4632 | // et ecrire le fichier |
| 4633 | - ecrire_fichier($filename . ".last", $comment . $contenu); |
|
| 4633 | + ecrire_fichier($filename.".last", $comment.$contenu); |
|
| 4634 | 4634 | // regarder si on recopie |
| 4635 | 4635 | if (!file_exists($filename) |
| 4636 | - or md5_file($filename) !== md5_file($filename . ".last") |
|
| 4636 | + or md5_file($filename) !== md5_file($filename.".last") |
|
| 4637 | 4637 | ) { |
| 4638 | - @copy($filename . ".last", $filename); |
|
| 4638 | + @copy($filename.".last", $filename); |
|
| 4639 | 4639 | clearstatcache(true, $filename); // eviter que PHP ne reserve le vieux timestamp |
| 4640 | 4640 | } |
| 4641 | 4641 | } |