@@ -799,147 +799,147 @@ |
||
| 799 | 799 | |
| 800 | 800 | switch($p->type) { |
| 801 | 801 | // texte seul |
| 802 | - case 'texte': |
|
| 803 | - $code = sandbox_composer_texte($p->texte, $p); |
|
| 804 | - $commentaire= strlen($p->texte) . " signes"; |
|
| 805 | - $avant=''; |
|
| 806 | - $apres=''; |
|
| 807 | - $altern = "''"; |
|
| 808 | - break; |
|
| 809 | - |
|
| 810 | - case 'polyglotte': |
|
| 811 | - $code = ""; |
|
| 812 | - foreach($p->traductions as $k => $v) { |
|
| 813 | - $code .= ",'" . |
|
| 814 | - str_replace(array("\\","'"),array("\\\\","\\'"), $k) . |
|
| 815 | - "' => '" . |
|
| 816 | - str_replace(array("\\","'"),array("\\\\","\\'"), $v) . |
|
| 817 | - "'"; |
|
| 818 | - } |
|
| 819 | - $code = "choisir_traduction(array(" . |
|
| 820 | - substr($code,1) . |
|
| 821 | - "))"; |
|
| 822 | - $commentaire= '&'; |
|
| 823 | - $avant=''; |
|
| 824 | - $apres=''; |
|
| 825 | - $altern = "''"; |
|
| 826 | - break; |
|
| 827 | - |
|
| 828 | - // inclure |
|
| 829 | - case 'include': |
|
| 830 | - $p->descr = $descr; |
|
| 831 | - $code = calculer_inclure($p, $boucles, $id_boucle); |
|
| 832 | - if ($code === false) { |
|
| 833 | - $err_e_c = true; |
|
| 834 | - $code = "''"; |
|
| 835 | - } else { |
|
| 836 | - $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 837 | - $avant=''; |
|
| 838 | - $apres=''; |
|
| 839 | - $altern = "''"; |
|
| 840 | - } |
|
| 841 | - break; |
|
| 842 | - |
|
| 843 | - // boucle |
|
| 844 | - case TYPE_RECURSIF: |
|
| 845 | - $nom = $p->id_boucle; |
|
| 846 | - $newdescr = $descr; |
|
| 847 | - $newdescr['id_mere'] = $nom; |
|
| 848 | - $newdescr['niv']++; |
|
| 849 | - $avant = calculer_liste($p->avant, |
|
| 850 | - $newdescr, $boucles, $id_boucle); |
|
| 851 | - $apres = calculer_liste($p->apres, |
|
| 852 | - $newdescr, $boucles, $id_boucle); |
|
| 853 | - $newdescr['niv']--; |
|
| 854 | - $altern = calculer_liste($p->altern, |
|
| 855 | - $newdescr, $boucles, $id_boucle); |
|
| 856 | - if (($avant === false) OR ($apres === false) OR ($altern === false)) { |
|
| 857 | - $err_e_c = true; |
|
| 858 | - $code = "''"; |
|
| 859 | - } else { |
|
| 860 | - $code = 'BOUCLE' . |
|
| 861 | - str_replace("-","_", $nom) . $descr['nom'] . |
|
| 862 | - '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
|
| 863 | - $commentaire= "?$nom"; |
|
| 864 | - if (!$boucles[$nom]->milieu |
|
| 865 | - AND $boucles[$nom]->type_requete <> TYPE_RECURSIF) { |
|
| 866 | - if ($altern != "''") $code .= "\n. $altern"; |
|
| 867 | - if ($avant<>"''" OR $apres<>"''") |
|
| 868 | - spip_log("boucle $nom toujours vide, code superflu dans $id"); |
|
| 869 | - $avant = $apres = $altern = "''"; |
|
| 870 | - } else if ($altern != "''") $altern = "($altern)"; |
|
| 871 | - } |
|
| 872 | - break; |
|
| 873 | - |
|
| 874 | - case 'idiome': |
|
| 875 | - $l = array(); |
|
| 876 | - $code = ''; |
|
| 877 | - foreach ($p->arg as $k => $v) { |
|
| 878 | - $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
|
| 879 | - if ($k) { |
|
| 880 | - $l[] = _q($k) . ' => ' . $_v; |
|
| 881 | - } else { |
|
| 882 | - $code = $_v; |
|
| 883 | - } |
|
| 884 | - } |
|
| 885 | - // Si le module n'est pas fourni, l'expliciter sauf si calculé |
|
| 886 | - if ($p->module) { |
|
| 887 | - $m = $p->module .':'.$p->nom_champ; |
|
| 888 | - } elseif ($p->nom_champ) { |
|
| 889 | - $m = MODULES_IDIOMES .':'.$p->nom_champ; |
|
| 890 | - } else { |
|
| 891 | - $m = ''; |
|
| 892 | - } |
|
| 893 | - $code = (!$code ? "'$m'" : |
|
| 894 | - ($m ? "'$m' . $code" : |
|
| 895 | - ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 896 | - . (!$l ? '' : (", array(" . implode(",\n", $l) . ")")); |
|
| 897 | - $code = "_T($code)"; |
|
| 898 | - if ($p->param) { |
|
| 899 | - $p->id_boucle = $id_boucle; |
|
| 900 | - $p->boucles = &$boucles; |
|
| 901 | - $code = compose_filtres($p, $code); |
|
| 902 | - } |
|
| 903 | - $commentaire = ":"; |
|
| 904 | - $avant=''; |
|
| 905 | - $apres=''; |
|
| 906 | - $altern = "''"; |
|
| 907 | - break; |
|
| 908 | - |
|
| 909 | - case 'champ': |
|
| 910 | - |
|
| 911 | - // cette structure pourrait etre completee des le phrase' (a faire) |
|
| 912 | - $p->id_boucle = $id_boucle; |
|
| 913 | - $p->boucles = &$boucles; |
|
| 914 | - $p->descr = $descr; |
|
| 915 | - #$p->interdire_scripts = true; |
|
| 916 | - $p->type_requete = $type; |
|
| 917 | - |
|
| 918 | - $code = calculer_champ($p); |
|
| 919 | - $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 920 | - $avant = calculer_liste($p->avant, |
|
| 921 | - $descr, $boucles, $id_boucle); |
|
| 922 | - $apres = calculer_liste($p->apres, |
|
| 923 | - $descr, $boucles, $id_boucle); |
|
| 924 | - $altern = "''"; |
|
| 925 | - // Si la valeur est destinee a une comparaison a '' |
|
| 926 | - // forcer la conversion en une chaine par strval |
|
| 927 | - // si ca peut etre autre chose qu'une chaine |
|
| 928 | - if (($avant != "''" OR $apres != "''") |
|
| 929 | - AND $code[0]!= "'" |
|
| 930 | -# AND (strpos($code,'interdire_scripts') !== 0) |
|
| 931 | - AND !preg_match(_REGEXP_COND_VIDE_NONVIDE, $code) |
|
| 932 | - AND !preg_match(_REGEXP_COND_NONVIDE_VIDE, $code) |
|
| 933 | - AND !preg_match(_REGEXP_CONCAT_NON_VIDE, $code)) |
|
| 934 | - $code = "strval($code)"; |
|
| 935 | - break; |
|
| 936 | - |
|
| 937 | - default: |
|
| 938 | - // Erreur de construction de l'arbre de syntaxe abstraite |
|
| 939 | - $code = "''"; |
|
| 940 | - $p->descr = $descr; |
|
| 941 | - $err_e_c = _T('zbug_erreur_compilation'); |
|
| 942 | - erreur_squelette($err_e_c, $p); |
|
| 802 | + case 'texte': |
|
| 803 | + $code = sandbox_composer_texte($p->texte, $p); |
|
| 804 | + $commentaire= strlen($p->texte) . " signes"; |
|
| 805 | + $avant=''; |
|
| 806 | + $apres=''; |
|
| 807 | + $altern = "''"; |
|
| 808 | + break; |
|
| 809 | + |
|
| 810 | + case 'polyglotte': |
|
| 811 | + $code = ""; |
|
| 812 | + foreach($p->traductions as $k => $v) { |
|
| 813 | + $code .= ",'" . |
|
| 814 | + str_replace(array("\\","'"),array("\\\\","\\'"), $k) . |
|
| 815 | + "' => '" . |
|
| 816 | + str_replace(array("\\","'"),array("\\\\","\\'"), $v) . |
|
| 817 | + "'"; |
|
| 818 | + } |
|
| 819 | + $code = "choisir_traduction(array(" . |
|
| 820 | + substr($code,1) . |
|
| 821 | + "))"; |
|
| 822 | + $commentaire= '&'; |
|
| 823 | + $avant=''; |
|
| 824 | + $apres=''; |
|
| 825 | + $altern = "''"; |
|
| 826 | + break; |
|
| 827 | + |
|
| 828 | + // inclure |
|
| 829 | + case 'include': |
|
| 830 | + $p->descr = $descr; |
|
| 831 | + $code = calculer_inclure($p, $boucles, $id_boucle); |
|
| 832 | + if ($code === false) { |
|
| 833 | + $err_e_c = true; |
|
| 834 | + $code = "''"; |
|
| 835 | + } else { |
|
| 836 | + $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 837 | + $avant=''; |
|
| 838 | + $apres=''; |
|
| 839 | + $altern = "''"; |
|
| 840 | + } |
|
| 841 | + break; |
|
| 842 | + |
|
| 843 | + // boucle |
|
| 844 | + case TYPE_RECURSIF: |
|
| 845 | + $nom = $p->id_boucle; |
|
| 846 | + $newdescr = $descr; |
|
| 847 | + $newdescr['id_mere'] = $nom; |
|
| 848 | + $newdescr['niv']++; |
|
| 849 | + $avant = calculer_liste($p->avant, |
|
| 850 | + $newdescr, $boucles, $id_boucle); |
|
| 851 | + $apres = calculer_liste($p->apres, |
|
| 852 | + $newdescr, $boucles, $id_boucle); |
|
| 853 | + $newdescr['niv']--; |
|
| 854 | + $altern = calculer_liste($p->altern, |
|
| 855 | + $newdescr, $boucles, $id_boucle); |
|
| 856 | + if (($avant === false) OR ($apres === false) OR ($altern === false)) { |
|
| 857 | + $err_e_c = true; |
|
| 858 | + $code = "''"; |
|
| 859 | + } else { |
|
| 860 | + $code = 'BOUCLE' . |
|
| 861 | + str_replace("-","_", $nom) . $descr['nom'] . |
|
| 862 | + '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
|
| 863 | + $commentaire= "?$nom"; |
|
| 864 | + if (!$boucles[$nom]->milieu |
|
| 865 | + AND $boucles[$nom]->type_requete <> TYPE_RECURSIF) { |
|
| 866 | + if ($altern != "''") $code .= "\n. $altern"; |
|
| 867 | + if ($avant<>"''" OR $apres<>"''") |
|
| 868 | + spip_log("boucle $nom toujours vide, code superflu dans $id"); |
|
| 869 | + $avant = $apres = $altern = "''"; |
|
| 870 | + } else if ($altern != "''") $altern = "($altern)"; |
|
| 871 | + } |
|
| 872 | + break; |
|
| 873 | + |
|
| 874 | + case 'idiome': |
|
| 875 | + $l = array(); |
|
| 876 | + $code = ''; |
|
| 877 | + foreach ($p->arg as $k => $v) { |
|
| 878 | + $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
|
| 879 | + if ($k) { |
|
| 880 | + $l[] = _q($k) . ' => ' . $_v; |
|
| 881 | + } else { |
|
| 882 | + $code = $_v; |
|
| 883 | + } |
|
| 884 | + } |
|
| 885 | + // Si le module n'est pas fourni, l'expliciter sauf si calculé |
|
| 886 | + if ($p->module) { |
|
| 887 | + $m = $p->module .':'.$p->nom_champ; |
|
| 888 | + } elseif ($p->nom_champ) { |
|
| 889 | + $m = MODULES_IDIOMES .':'.$p->nom_champ; |
|
| 890 | + } else { |
|
| 891 | + $m = ''; |
|
| 892 | + } |
|
| 893 | + $code = (!$code ? "'$m'" : |
|
| 894 | + ($m ? "'$m' . $code" : |
|
| 895 | + ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 896 | + . (!$l ? '' : (", array(" . implode(",\n", $l) . ")")); |
|
| 897 | + $code = "_T($code)"; |
|
| 898 | + if ($p->param) { |
|
| 899 | + $p->id_boucle = $id_boucle; |
|
| 900 | + $p->boucles = &$boucles; |
|
| 901 | + $code = compose_filtres($p, $code); |
|
| 902 | + } |
|
| 903 | + $commentaire = ":"; |
|
| 904 | + $avant=''; |
|
| 905 | + $apres=''; |
|
| 906 | + $altern = "''"; |
|
| 907 | + break; |
|
| 908 | + |
|
| 909 | + case 'champ': |
|
| 910 | + |
|
| 911 | + // cette structure pourrait etre completee des le phrase' (a faire) |
|
| 912 | + $p->id_boucle = $id_boucle; |
|
| 913 | + $p->boucles = &$boucles; |
|
| 914 | + $p->descr = $descr; |
|
| 915 | + #$p->interdire_scripts = true; |
|
| 916 | + $p->type_requete = $type; |
|
| 917 | + |
|
| 918 | + $code = calculer_champ($p); |
|
| 919 | + $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 920 | + $avant = calculer_liste($p->avant, |
|
| 921 | + $descr, $boucles, $id_boucle); |
|
| 922 | + $apres = calculer_liste($p->apres, |
|
| 923 | + $descr, $boucles, $id_boucle); |
|
| 924 | + $altern = "''"; |
|
| 925 | + // Si la valeur est destinee a une comparaison a '' |
|
| 926 | + // forcer la conversion en une chaine par strval |
|
| 927 | + // si ca peut etre autre chose qu'une chaine |
|
| 928 | + if (($avant != "''" OR $apres != "''") |
|
| 929 | + AND $code[0]!= "'" |
|
| 930 | + # AND (strpos($code,'interdire_scripts') !== 0) |
|
| 931 | + AND !preg_match(_REGEXP_COND_VIDE_NONVIDE, $code) |
|
| 932 | + AND !preg_match(_REGEXP_COND_NONVIDE_VIDE, $code) |
|
| 933 | + AND !preg_match(_REGEXP_CONCAT_NON_VIDE, $code)) |
|
| 934 | + $code = "strval($code)"; |
|
| 935 | + break; |
|
| 936 | + |
|
| 937 | + default: |
|
| 938 | + // Erreur de construction de l'arbre de syntaxe abstraite |
|
| 939 | + $code = "''"; |
|
| 940 | + $p->descr = $descr; |
|
| 941 | + $err_e_c = _T('zbug_erreur_compilation'); |
|
| 942 | + erreur_squelette($err_e_c, $p); |
|
| 943 | 943 | } // switch |
| 944 | 944 | |
| 945 | 945 | if ($code != "''") { |
@@ -74,14 +74,14 @@ |
||
| 74 | 74 | function phraser_logo_faux_filtres($nom) |
| 75 | 75 | { |
| 76 | 76 | switch($nom) { |
| 77 | - case 'top': |
|
| 78 | - case 'left': |
|
| 79 | - case 'right': |
|
| 80 | - case 'center': |
|
| 81 | - case 'bottom': return 0; |
|
| 82 | - case 'lien': return 1; |
|
| 83 | - case 'fichier': return 2; |
|
| 84 | - default: return $nom; |
|
| 77 | + case 'top': |
|
| 78 | + case 'left': |
|
| 79 | + case 'right': |
|
| 80 | + case 'center': |
|
| 81 | + case 'bottom': return 0; |
|
| 82 | + case 'lien': return 1; |
|
| 83 | + case 'fichier': return 2; |
|
| 84 | + default: return $nom; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -354,48 +354,48 @@ discard block |
||
| 354 | 354 | $charset = strtolower($charset); |
| 355 | 355 | |
| 356 | 356 | switch ($charset) { |
| 357 | - case 'utf-8': |
|
| 358 | - case 'utf8': |
|
| 359 | - return utf_8_to_unicode($texte); |
|
| 360 | - |
|
| 361 | - case 'iso-8859-1': |
|
| 362 | - $texte = corriger_caracteres_windows($texte, 'iso-8859-1'); |
|
| 363 | - // pas de break; ici, on suit sur default: |
|
| 364 | - |
|
| 365 | - default: |
|
| 366 | - // mbstring presente ? |
|
| 367 | - if (init_mb_string()) { |
|
| 368 | - if ($order = mb_detect_order() # mb_string connait-il $charset? |
|
| 369 | - AND mb_detect_order($charset)) { |
|
| 370 | - $s = mb_convert_encoding($texte, 'utf-8', $charset); |
|
| 371 | - if ($s && $s != $texte) return utf_8_to_unicode($s); |
|
| 372 | - } |
|
| 373 | - mb_detect_order($order); # remettre comme precedemment |
|
| 374 | - } |
|
| 375 | - |
|
| 376 | - // Sinon, peut-etre connaissons-nous ce charset ? |
|
| 377 | - if (!isset($trans[$charset])) { |
|
| 378 | - global $CHARSET; |
|
| 379 | - if ($cset = load_charset($charset) |
|
| 380 | - AND is_array($CHARSET[$cset])) |
|
| 381 | - foreach ($CHARSET[$cset] as $key => $val) { |
|
| 382 | - $trans[$charset][chr($key)] = '&#'.$val.';'; |
|
| 383 | - } |
|
| 384 | - } |
|
| 385 | - if (count($trans[$charset])) |
|
| 386 | - return str_replace(array_keys($trans[$charset]),array_values($trans[$charset]),$texte); |
|
| 387 | - |
|
| 388 | - // Sinon demander a iconv (malgre le fait qu'il coupe quand un |
|
| 389 | - // caractere n'appartient pas au charset, mais c'est un probleme |
|
| 390 | - // surtout en utf-8, gere ci-dessus) |
|
| 391 | - if (test_iconv()) { |
|
| 392 | - $s = iconv($charset, 'utf-32le', $texte); |
|
| 393 | - if ($s) return utf_32_to_unicode($s); |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - // Au pire ne rien faire |
|
| 397 | - spip_log("erreur charset '$charset' non supporte"); |
|
| 398 | - return $texte; |
|
| 357 | + case 'utf-8': |
|
| 358 | + case 'utf8': |
|
| 359 | + return utf_8_to_unicode($texte); |
|
| 360 | + |
|
| 361 | + case 'iso-8859-1': |
|
| 362 | + $texte = corriger_caracteres_windows($texte, 'iso-8859-1'); |
|
| 363 | + // pas de break; ici, on suit sur default: |
|
| 364 | + |
|
| 365 | + default: |
|
| 366 | + // mbstring presente ? |
|
| 367 | + if (init_mb_string()) { |
|
| 368 | + if ($order = mb_detect_order() # mb_string connait-il $charset? |
|
| 369 | + AND mb_detect_order($charset)) { |
|
| 370 | + $s = mb_convert_encoding($texte, 'utf-8', $charset); |
|
| 371 | + if ($s && $s != $texte) return utf_8_to_unicode($s); |
|
| 372 | + } |
|
| 373 | + mb_detect_order($order); # remettre comme precedemment |
|
| 374 | + } |
|
| 375 | + |
|
| 376 | + // Sinon, peut-etre connaissons-nous ce charset ? |
|
| 377 | + if (!isset($trans[$charset])) { |
|
| 378 | + global $CHARSET; |
|
| 379 | + if ($cset = load_charset($charset) |
|
| 380 | + AND is_array($CHARSET[$cset])) |
|
| 381 | + foreach ($CHARSET[$cset] as $key => $val) { |
|
| 382 | + $trans[$charset][chr($key)] = '&#'.$val.';'; |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | + if (count($trans[$charset])) |
|
| 386 | + return str_replace(array_keys($trans[$charset]),array_values($trans[$charset]),$texte); |
|
| 387 | + |
|
| 388 | + // Sinon demander a iconv (malgre le fait qu'il coupe quand un |
|
| 389 | + // caractere n'appartient pas au charset, mais c'est un probleme |
|
| 390 | + // surtout en utf-8, gere ci-dessus) |
|
| 391 | + if (test_iconv()) { |
|
| 392 | + $s = iconv($charset, 'utf-32le', $texte); |
|
| 393 | + if ($s) return utf_32_to_unicode($s); |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + // Au pire ne rien faire |
|
| 397 | + spip_log("erreur charset '$charset' non supporte"); |
|
| 398 | + return $texte; |
|
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
@@ -422,35 +422,35 @@ discard block |
||
| 422 | 422 | $charset = $GLOBALS['meta']['charset']; |
| 423 | 423 | |
| 424 | 424 | switch($charset) { |
| 425 | - case 'utf-8': |
|
| 426 | - return unicode_to_utf_8($texte); |
|
| 427 | - break; |
|
| 428 | - |
|
| 429 | - default: |
|
| 430 | - $charset = load_charset($charset); |
|
| 431 | - |
|
| 432 | - if (!is_array($CHARSET_REVERSE[$charset])) { |
|
| 433 | - $CHARSET_REVERSE[$charset] = array_flip($GLOBALS['CHARSET'][$charset]); |
|
| 434 | - } |
|
| 435 | - |
|
| 436 | - if (!isset($trans[$charset])){ |
|
| 437 | - $trans[$charset]=array(); |
|
| 438 | - $t = &$trans[$charset]; |
|
| 439 | - for($e=128;$e<255;$e++){ |
|
| 440 | - $h = dechex($e); |
|
| 441 | - if ($s = isset($CHARSET_REVERSE[$charset][$e])){ |
|
| 442 | - $s = $CHARSET_REVERSE[$charset][$e]; |
|
| 443 | - $t['&#'.$e.';'] = $t['�'.$e.';'] = $t['�'.$e.';'] = chr($s); |
|
| 444 | - $t['&#x'.$h.';'] = $t['�'.$h.';'] = $t['�'.$h.';'] = chr($s); |
|
| 445 | - } |
|
| 446 | - else{ |
|
| 447 | - $t['&#'.$e.';'] = $t['�'.$e.';'] = $t['�'.$e.';'] = chr($e); |
|
| 448 | - $t['&#x'.$h.';'] = $t['�'.$h.';'] = $t['�'.$h.';'] = chr($e); |
|
| 449 | - } |
|
| 450 | - } |
|
| 451 | - } |
|
| 452 | - $texte = str_replace(array_keys($trans[$charset]),array_values($trans[$charset]),$texte); |
|
| 453 | - return $texte; |
|
| 425 | + case 'utf-8': |
|
| 426 | + return unicode_to_utf_8($texte); |
|
| 427 | + break; |
|
| 428 | + |
|
| 429 | + default: |
|
| 430 | + $charset = load_charset($charset); |
|
| 431 | + |
|
| 432 | + if (!is_array($CHARSET_REVERSE[$charset])) { |
|
| 433 | + $CHARSET_REVERSE[$charset] = array_flip($GLOBALS['CHARSET'][$charset]); |
|
| 434 | + } |
|
| 435 | + |
|
| 436 | + if (!isset($trans[$charset])){ |
|
| 437 | + $trans[$charset]=array(); |
|
| 438 | + $t = &$trans[$charset]; |
|
| 439 | + for($e=128;$e<255;$e++){ |
|
| 440 | + $h = dechex($e); |
|
| 441 | + if ($s = isset($CHARSET_REVERSE[$charset][$e])){ |
|
| 442 | + $s = $CHARSET_REVERSE[$charset][$e]; |
|
| 443 | + $t['&#'.$e.';'] = $t['�'.$e.';'] = $t['�'.$e.';'] = chr($s); |
|
| 444 | + $t['&#x'.$h.';'] = $t['�'.$h.';'] = $t['�'.$h.';'] = chr($s); |
|
| 445 | + } |
|
| 446 | + else{ |
|
| 447 | + $t['&#'.$e.';'] = $t['�'.$e.';'] = $t['�'.$e.';'] = chr($e); |
|
| 448 | + $t['&#x'.$h.';'] = $t['�'.$h.';'] = $t['�'.$h.';'] = chr($e); |
|
| 449 | + } |
|
| 450 | + } |
|
| 451 | + } |
|
| 452 | + $texte = str_replace(array_keys($trans[$charset]),array_values($trans[$charset]),$texte); |
|
| 453 | + return $texte; |
|
| 454 | 454 | } |
| 455 | 455 | } |
| 456 | 456 | |
@@ -1019,79 +1019,79 @@ |
||
| 1019 | 1019 | else $avjc = false; |
| 1020 | 1020 | |
| 1021 | 1021 | switch ($vue) { |
| 1022 | - case 'saison': |
|
| 1023 | - case 'saison_annee': |
|
| 1024 | - $saison = ''; |
|
| 1025 | - if ($mois > 0){ |
|
| 1026 | - $saison = 1; |
|
| 1027 | - if (($mois == 3 AND $jour >= 21) OR $mois > 3) $saison = 2; |
|
| 1028 | - if (($mois == 6 AND $jour >= 21) OR $mois > 6) $saison = 3; |
|
| 1029 | - if (($mois == 9 AND $jour >= 21) OR $mois > 9) $saison = 4; |
|
| 1030 | - if (($mois == 12 AND $jour >= 21) OR $mois > 12) $saison = 1; |
|
| 1031 | - } |
|
| 1032 | - if($vue == 'saison') |
|
| 1033 | - return $saison?_T('date_saison_'.$saison):''; |
|
| 1034 | - else |
|
| 1035 | - return $saison?trim(_T('date_fmt_saison_annee', array('saison'=>_T('date_saison_'.$saison), 'annee'=>$annee))) :''; |
|
| 1036 | - |
|
| 1037 | - case 'court': |
|
| 1038 | - if ($avjc) return $annee; |
|
| 1039 | - $a = ((isset($options['annee_courante']) AND $options['annee_courante'])?$options['annee_courante']:date('Y')); |
|
| 1040 | - if ($annee < ($a - 100) OR $annee > ($a + 100)) return $annee; |
|
| 1041 | - if ($annee != $a) return _T('date_fmt_mois_annee', array ('mois'=>$mois, 'nommois'=>spip_ucfirst($nommois), 'annee'=>$annee)); |
|
| 1042 | - return _T('date_fmt_jour_mois', array ('jourmois'=>$jourmois, 'jour'=>$jour, 'mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee)); |
|
| 1043 | - |
|
| 1044 | - case 'jourcourt': |
|
| 1045 | - if ($avjc) return $annee; |
|
| 1046 | - $a = ((isset($options['annee_courante']) AND $options['annee_courante'])?$options['annee_courante']:date('Y')); |
|
| 1047 | - if ($annee < ($a - 100) OR $annee > ($a + 100)) return $annee; |
|
| 1048 | - if ($annee != $a) return _T('date_fmt_jour_mois_annee', array ('jourmois'=>$jourmois, 'jour'=>$jour, 'mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee)); |
|
| 1049 | - return _T('date_fmt_jour_mois', array ('jourmois'=>$jourmois, 'jour'=>$jour, 'mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee)); |
|
| 1050 | - |
|
| 1051 | - case 'entier': |
|
| 1052 | - if ($avjc) return $annee; |
|
| 1053 | - if ($jour) |
|
| 1054 | - return _T('date_fmt_jour_mois_annee', array ('jourmois'=>$jourmois, 'jour'=>$jour, 'mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee)); |
|
| 1055 | - elseif ($mois) |
|
| 1056 | - return trim(_T('date_fmt_mois_annee', array ('mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee))); |
|
| 1057 | - else |
|
| 1058 | - return $annee; |
|
| 1059 | - |
|
| 1060 | - case 'nom_mois': |
|
| 1061 | - $param = ((isset($options['param']) AND $options['param']) ? '_'.$options['param'] : ''); |
|
| 1062 | - if ($param and $mois) { |
|
| 1063 | - return _T('date_mois_'.$mois.$param); |
|
| 1064 | - } |
|
| 1065 | - return $nommois; |
|
| 1066 | - |
|
| 1067 | - case 'mois': |
|
| 1068 | - return sprintf("%02s",$mois); |
|
| 1069 | - |
|
| 1070 | - case 'jour': |
|
| 1071 | - return $jour; |
|
| 1072 | - |
|
| 1073 | - case 'journum': |
|
| 1074 | - return $journum; |
|
| 1075 | - |
|
| 1076 | - case 'nom_jour': |
|
| 1077 | - if (!$mois OR !$njour) |
|
| 1078 | - return ''; |
|
| 1079 | - $nom = mktime(1,1,1,$mois,$njour,$annee); |
|
| 1080 | - $nom = 1+date('w',$nom); |
|
| 1081 | - $param = ((isset($options['param']) AND $options['param']) ? '_'.$options['param'] : ''); |
|
| 1082 | - return _T('date_jour_'.$nom.$param); |
|
| 1083 | - |
|
| 1084 | - case 'mois_annee': |
|
| 1085 | - if ($avjc) return $annee; |
|
| 1086 | - return trim(_T('date_fmt_mois_annee', array('mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee))); |
|
| 1087 | - |
|
| 1088 | - case 'annee': |
|
| 1089 | - return $annee; |
|
| 1090 | - |
|
| 1091 | - // Cas d'une vue non definie : retomber sur le format |
|
| 1092 | - // de date propose par http://www.php.net/date |
|
| 1093 | - default: |
|
| 1094 | - return date($vue, strtotime($numdate)); |
|
| 1022 | + case 'saison': |
|
| 1023 | + case 'saison_annee': |
|
| 1024 | + $saison = ''; |
|
| 1025 | + if ($mois > 0){ |
|
| 1026 | + $saison = 1; |
|
| 1027 | + if (($mois == 3 AND $jour >= 21) OR $mois > 3) $saison = 2; |
|
| 1028 | + if (($mois == 6 AND $jour >= 21) OR $mois > 6) $saison = 3; |
|
| 1029 | + if (($mois == 9 AND $jour >= 21) OR $mois > 9) $saison = 4; |
|
| 1030 | + if (($mois == 12 AND $jour >= 21) OR $mois > 12) $saison = 1; |
|
| 1031 | + } |
|
| 1032 | + if($vue == 'saison') |
|
| 1033 | + return $saison?_T('date_saison_'.$saison):''; |
|
| 1034 | + else |
|
| 1035 | + return $saison?trim(_T('date_fmt_saison_annee', array('saison'=>_T('date_saison_'.$saison), 'annee'=>$annee))) :''; |
|
| 1036 | + |
|
| 1037 | + case 'court': |
|
| 1038 | + if ($avjc) return $annee; |
|
| 1039 | + $a = ((isset($options['annee_courante']) AND $options['annee_courante'])?$options['annee_courante']:date('Y')); |
|
| 1040 | + if ($annee < ($a - 100) OR $annee > ($a + 100)) return $annee; |
|
| 1041 | + if ($annee != $a) return _T('date_fmt_mois_annee', array ('mois'=>$mois, 'nommois'=>spip_ucfirst($nommois), 'annee'=>$annee)); |
|
| 1042 | + return _T('date_fmt_jour_mois', array ('jourmois'=>$jourmois, 'jour'=>$jour, 'mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee)); |
|
| 1043 | + |
|
| 1044 | + case 'jourcourt': |
|
| 1045 | + if ($avjc) return $annee; |
|
| 1046 | + $a = ((isset($options['annee_courante']) AND $options['annee_courante'])?$options['annee_courante']:date('Y')); |
|
| 1047 | + if ($annee < ($a - 100) OR $annee > ($a + 100)) return $annee; |
|
| 1048 | + if ($annee != $a) return _T('date_fmt_jour_mois_annee', array ('jourmois'=>$jourmois, 'jour'=>$jour, 'mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee)); |
|
| 1049 | + return _T('date_fmt_jour_mois', array ('jourmois'=>$jourmois, 'jour'=>$jour, 'mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee)); |
|
| 1050 | + |
|
| 1051 | + case 'entier': |
|
| 1052 | + if ($avjc) return $annee; |
|
| 1053 | + if ($jour) |
|
| 1054 | + return _T('date_fmt_jour_mois_annee', array ('jourmois'=>$jourmois, 'jour'=>$jour, 'mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee)); |
|
| 1055 | + elseif ($mois) |
|
| 1056 | + return trim(_T('date_fmt_mois_annee', array ('mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee))); |
|
| 1057 | + else |
|
| 1058 | + return $annee; |
|
| 1059 | + |
|
| 1060 | + case 'nom_mois': |
|
| 1061 | + $param = ((isset($options['param']) AND $options['param']) ? '_'.$options['param'] : ''); |
|
| 1062 | + if ($param and $mois) { |
|
| 1063 | + return _T('date_mois_'.$mois.$param); |
|
| 1064 | + } |
|
| 1065 | + return $nommois; |
|
| 1066 | + |
|
| 1067 | + case 'mois': |
|
| 1068 | + return sprintf("%02s",$mois); |
|
| 1069 | + |
|
| 1070 | + case 'jour': |
|
| 1071 | + return $jour; |
|
| 1072 | + |
|
| 1073 | + case 'journum': |
|
| 1074 | + return $journum; |
|
| 1075 | + |
|
| 1076 | + case 'nom_jour': |
|
| 1077 | + if (!$mois OR !$njour) |
|
| 1078 | + return ''; |
|
| 1079 | + $nom = mktime(1,1,1,$mois,$njour,$annee); |
|
| 1080 | + $nom = 1+date('w',$nom); |
|
| 1081 | + $param = ((isset($options['param']) AND $options['param']) ? '_'.$options['param'] : ''); |
|
| 1082 | + return _T('date_jour_'.$nom.$param); |
|
| 1083 | + |
|
| 1084 | + case 'mois_annee': |
|
| 1085 | + if ($avjc) return $annee; |
|
| 1086 | + return trim(_T('date_fmt_mois_annee', array('mois'=>$mois, 'nommois'=>$nommois, 'annee'=>$annee))); |
|
| 1087 | + |
|
| 1088 | + case 'annee': |
|
| 1089 | + return $annee; |
|
| 1090 | + |
|
| 1091 | + // Cas d'une vue non definie : retomber sur le format |
|
| 1092 | + // de date propose par http://www.php.net/date |
|
| 1093 | + default: |
|
| 1094 | + return date($vue, strtotime($numdate)); |
|
| 1095 | 1095 | } |
| 1096 | 1096 | } |
| 1097 | 1097 | |