@@ -2884,8 +2884,7 @@ |
||
| 2884 | 2884 | $_const = interprete_argument_balise(1, $p); |
| 2885 | 2885 | if (!strlen($_const)) { |
| 2886 | 2886 | $p->code = "''"; |
| 2887 | - } |
|
| 2888 | - else { |
|
| 2887 | + } else { |
|
| 2889 | 2888 | $p->code = "(defined($_const)?constant($_const):'')"; |
| 2890 | 2889 | } |
| 2891 | 2890 | $p->interdire_scripts = false; |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | function balise_DOSSIER_SQUELETTE_dist($p) { |
| 366 | 366 | $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
| 367 | - $p->code = "_DIR_RACINE . '$code'" . |
|
| 367 | + $p->code = "_DIR_RACINE . '$code'". |
|
| 368 | 368 | $p->interdire_scripts = false; |
| 369 | 369 | |
| 370 | 370 | return $p; |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | function balise_SQUELETTE_dist($p) { |
| 385 | 385 | $code = addslashes($p->descr['sourcefile']); |
| 386 | - $p->code = "'$code'" . |
|
| 386 | + $p->code = "'$code'". |
|
| 387 | 387 | $p->interdire_scripts = false; |
| 388 | 388 | |
| 389 | 389 | return $p; |
@@ -435,9 +435,9 @@ discard block |
||
| 435 | 435 | **/ |
| 436 | 436 | function balise_NOM_SITE_dist($p) { |
| 437 | 437 | if (!$p->etoile) { |
| 438 | - $p->code = 'supprimer_numero(calculer_url(' . |
|
| 439 | - champ_sql('url_site', $p) . ',' . |
|
| 440 | - champ_sql('nom_site', $p) . |
|
| 438 | + $p->code = 'supprimer_numero(calculer_url('. |
|
| 439 | + champ_sql('url_site', $p).','. |
|
| 440 | + champ_sql('nom_site', $p). |
|
| 441 | 441 | ", 'titre', \$connect, false))"; |
| 442 | 442 | } else { |
| 443 | 443 | $p->code = champ_sql('nom_site', $p); |
@@ -588,8 +588,8 @@ discard block |
||
| 588 | 588 | * Pile complétée par le code à générer |
| 589 | 589 | **/ |
| 590 | 590 | function balise_POPULARITE_ABSOLUE_dist($p) { |
| 591 | - $p->code = 'ceil(' . |
|
| 592 | - champ_sql('popularite', $p) . |
|
| 591 | + $p->code = 'ceil('. |
|
| 592 | + champ_sql('popularite', $p). |
|
| 593 | 593 | ')'; |
| 594 | 594 | $p->interdire_scripts = false; |
| 595 | 595 | |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b); |
| 671 | 671 | ; |
| 672 | 672 | if (($v = interprete_argument_balise(1, $p)) !== null) { |
| 673 | - $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 673 | + $p->code = 'table_valeur('.$p->code.', '.$v.')'; |
|
| 674 | 674 | } |
| 675 | 675 | $p->interdire_scripts = true; |
| 676 | 676 | |
@@ -809,16 +809,16 @@ discard block |
||
| 809 | 809 | $trouver_table = charger_fonction('trouver_table', 'base'); |
| 810 | 810 | if ($desc = $trouver_table(table_objet_sql($type_objet))) { |
| 811 | 811 | if (isset($desc['field']['descriptif'])) { |
| 812 | - $_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ','; |
|
| 812 | + $_ligne .= "'descriptif' => ".champ_sql('descriptif', $p).','; |
|
| 813 | 813 | } |
| 814 | 814 | if (isset($desc['field']['texte'])) { |
| 815 | - $_ligne .= "'texte' => " . champ_sql('texte', $p) . ','; |
|
| 815 | + $_ligne .= "'texte' => ".champ_sql('texte', $p).','; |
|
| 816 | 816 | } |
| 817 | 817 | if (isset($desc['field']['chapo'])) { |
| 818 | - $_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ','; |
|
| 818 | + $_ligne .= "'chapo' => ".champ_sql('chapo', $p).','; |
|
| 819 | 819 | } |
| 820 | 820 | if (isset($desc['introduction_longueur'])) { |
| 821 | - $_introduction_longueur = "'" . $desc['introduction_longueur'] . "'"; |
|
| 821 | + $_introduction_longueur = "'".$desc['introduction_longueur']."'"; |
|
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | $_ligne .= ')'; |
@@ -917,10 +917,10 @@ discard block |
||
| 917 | 917 | $p->code = sprintf( |
| 918 | 918 | CODE_RECUPERER_FOND, |
| 919 | 919 | "'modeles/lesauteurs'", |
| 920 | - "array('objet'=>'" . $objet . |
|
| 921 | - "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 922 | - ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 923 | - ($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 920 | + "array('objet'=>'".$objet. |
|
| 921 | + "','id_objet' => ".champ_sql($id_table_objet, $p). |
|
| 922 | + ",'$id_table_objet' => ".champ_sql($id_table_objet, $p). |
|
| 923 | + ($objet == 'article' ? '' : ",'id_article' => ".champ_sql('id_article', $p)). |
|
| 924 | 924 | ')', |
| 925 | 925 | "'trim'=>true, 'compil'=>array($c)", |
| 926 | 926 | _q($connect) |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | $m = trim($m); |
| 990 | 990 | if ($m != "''") { |
| 991 | 991 | if (!preg_match(',\W,', $m)) { |
| 992 | - $m = $boucle->id_table . ".$m"; |
|
| 992 | + $m = $boucle->id_table.".$m"; |
|
| 993 | 993 | } |
| 994 | 994 | |
| 995 | 995 | $m .= ' AS titre_rang'; |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | $f_pagination = chercher_filtre('pagination'); |
| 1151 | 1151 | $type = $p->boucles[$b]->modificateur['debut_nom']; |
| 1152 | 1152 | $modif = ($type[0] !== "'") ? "'debut'.$type" |
| 1153 | - : ("'debut" . substr($type, 1)); |
|
| 1153 | + : ("'debut".substr($type, 1)); |
|
| 1154 | 1154 | |
| 1155 | 1155 | $p->code = sprintf( |
| 1156 | 1156 | CODE_PAGINATION, |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']]; |
| 1295 | 1295 | erreur_squelette($msg, $p); |
| 1296 | 1296 | } else { |
| 1297 | - $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1297 | + $p->code = 'find_in_path('.$arg.')'; |
|
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | $p->interdire_scripts = false; |
@@ -1329,7 +1329,7 @@ discard block |
||
| 1329 | 1329 | $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']]; |
| 1330 | 1330 | erreur_squelette($msg, $p); |
| 1331 | 1331 | } else { |
| 1332 | - $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1332 | + $p->code = 'chemin_image('.$arg.')'; |
|
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | $p->interdire_scripts = false; |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | // cas de #ENV sans argument : on retourne le serialize() du tableau |
| 1384 | 1384 | // une belle fonction [(#ENV|affiche_env)] serait pratique |
| 1385 | 1385 | if ($src) { |
| 1386 | - $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1386 | + $p->code = '(is_array($a = ('.$src.')) ? serialize($a) : "")'; |
|
| 1387 | 1387 | } else { |
| 1388 | 1388 | $p->code = 'serialize($Pile[0]??[])'; |
| 1389 | 1389 | } |
@@ -1436,8 +1436,8 @@ discard block |
||
| 1436 | 1436 | $_sinon = interprete_argument_balise(2, $p); |
| 1437 | 1437 | $_unserialize = sinon(interprete_argument_balise(3, $p), 'false'); |
| 1438 | 1438 | |
| 1439 | - $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1440 | - ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1439 | + $p->code = '(include_spip(\'inc/config\')?lire_config('.$arg.','. |
|
| 1440 | + ($_sinon && $_sinon != "''" ? $_sinon : 'null').','.$_unserialize."):'')"; |
|
| 1441 | 1441 | |
| 1442 | 1442 | return $p; |
| 1443 | 1443 | } |
@@ -1530,7 +1530,7 @@ discard block |
||
| 1530 | 1530 | $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']]; |
| 1531 | 1531 | erreur_squelette($err_b_s_a, $p); |
| 1532 | 1532 | } else { |
| 1533 | - $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1533 | + $p->code = '(include_spip("inc/session") AND session_set('.$_nom.','.$_val.'))'; |
|
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | $p->interdire_scripts = false; |
@@ -1578,7 +1578,7 @@ discard block |
||
| 1578 | 1578 | ) |
| 1579 | 1579 | ) { |
| 1580 | 1580 | $p->code = /* $r[1]. */ |
| 1581 | - '(' . $r[2] . ')'; |
|
| 1581 | + '('.$r[2].')'; |
|
| 1582 | 1582 | } else { |
| 1583 | 1583 | $p->code = "eval('return '.$php.';')"; |
| 1584 | 1584 | } |
@@ -1822,9 +1822,9 @@ discard block |
||
| 1822 | 1822 | |
| 1823 | 1823 | // noter la duree du cache dans un entete proprietaire |
| 1824 | 1824 | |
| 1825 | - $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1825 | + $code = "'<'.'".'?php header("X-Spip-Cache: ' |
|
| 1826 | 1826 | . $duree |
| 1827 | - . '"); ?' . "'.'>'"; |
|
| 1827 | + . '"); ?'."'.'>'"; |
|
| 1828 | 1828 | |
| 1829 | 1829 | // Remplir le header Cache-Control |
| 1830 | 1830 | // cas #CACHE{0} |
@@ -1845,9 +1845,9 @@ discard block |
||
| 1845 | 1845 | $pa == 'cache-client' |
| 1846 | 1846 | and $duree > 0 |
| 1847 | 1847 | ) { |
| 1848 | - $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1848 | + $code .= ".'<'.'".'?php header("Cache-Control: max-age=' |
|
| 1849 | 1849 | . $duree |
| 1850 | - . '"); ?' . "'.'>'"; |
|
| 1850 | + . '"); ?'."'.'>'"; |
|
| 1851 | 1851 | // il semble logique, si on cache-client, de ne pas invalider |
| 1852 | 1852 | $pa = 'statique'; |
| 1853 | 1853 | } |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | $pa == 'statique' |
| 1857 | 1857 | and $duree > 0 |
| 1858 | 1858 | ) { |
| 1859 | - $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1859 | + $code .= ".'<'.'".'?php header("X-Spip-Statique: oui"); ?'."'.'>'"; |
|
| 1860 | 1860 | } |
| 1861 | 1861 | } |
| 1862 | 1862 | } else { |
@@ -2020,9 +2020,9 @@ discard block |
||
| 2020 | 2020 | if ($p->etoile) { |
| 2021 | 2021 | $_options[] = "'etoile'=>true"; |
| 2022 | 2022 | } |
| 2023 | - $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')'; |
|
| 2023 | + $_options[] = "'compil'=>array(".memoriser_contexte_compil($p).')'; |
|
| 2024 | 2024 | |
| 2025 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2025 | + $_l = 'array('.join(",\n\t", $_contexte).')'; |
|
| 2026 | 2026 | if ($flag_env) { |
| 2027 | 2027 | $_l = "array_merge(\$Pile[0],$_l)"; |
| 2028 | 2028 | } |
@@ -2032,7 +2032,7 @@ discard block |
||
| 2032 | 2032 | $msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']]; |
| 2033 | 2033 | erreur_squelette($msg, $p); |
| 2034 | 2034 | } else { |
| 2035 | - $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2035 | + $p->code = 'charge_scripts('.$_contexte[1].',false)'; |
|
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | 2038 | $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
@@ -2080,7 +2080,7 @@ discard block |
||
| 2080 | 2080 | unset($_contexte[1]); |
| 2081 | 2081 | |
| 2082 | 2082 | if (preg_match("/^\s*'[^']*'/s", $nom)) { |
| 2083 | - $nom = "'modeles/" . substr($nom, 1); |
|
| 2083 | + $nom = "'modeles/".substr($nom, 1); |
|
| 2084 | 2084 | } else { |
| 2085 | 2085 | $nom = "'modeles/' . $nom"; |
| 2086 | 2086 | } |
@@ -2097,8 +2097,8 @@ discard block |
||
| 2097 | 2097 | $primary = $p->boucles[$p->id_boucle]->primary; |
| 2098 | 2098 | if (!strpos($primary, ',')) { |
| 2099 | 2099 | $id = champ_sql($primary, $p); |
| 2100 | - $_contexte[] = "'$primary'=>" . $id; |
|
| 2101 | - $_contexte[] = "'id'=>" . $id; |
|
| 2100 | + $_contexte[] = "'$primary'=>".$id; |
|
| 2101 | + $_contexte[] = "'id'=>".$id; |
|
| 2102 | 2102 | } |
| 2103 | 2103 | } |
| 2104 | 2104 | $_contexte[] = "'recurs'=>(++\$recurs)"; |
@@ -2110,11 +2110,11 @@ discard block |
||
| 2110 | 2110 | $_options = memoriser_contexte_compil($p); |
| 2111 | 2111 | $_options = "'compil'=>array($_options), 'trim'=>true"; |
| 2112 | 2112 | if (isset($_contexte['ajax'])) { |
| 2113 | - $_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2113 | + $_options .= ', '.preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2114 | 2114 | unset($_contexte['ajax']); |
| 2115 | 2115 | } |
| 2116 | 2116 | |
| 2117 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2117 | + $_l = 'array('.join(",\n\t", $_contexte).')'; |
|
| 2118 | 2118 | if ($flag_env) { |
| 2119 | 2119 | $_l = "array_merge(\$Pile[0],$_l)"; |
| 2120 | 2120 | } |
@@ -2224,12 +2224,12 @@ discard block |
||
| 2224 | 2224 | function balise_DOUBLONS_dist($p) { |
| 2225 | 2225 | if ($type = interprete_argument_balise(1, $p)) { |
| 2226 | 2226 | if ($famille = interprete_argument_balise(2, $p)) { |
| 2227 | - $type .= '.' . $famille; |
|
| 2227 | + $type .= '.'.$famille; |
|
| 2228 | 2228 | } |
| 2229 | - $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2229 | + $p->code = '(isset($doublons['.$type.']) ? $doublons['.$type.'] : "")'; |
|
| 2230 | 2230 | if (!$p->etoile) { |
| 2231 | 2231 | $p->code = 'array_filter(array_map("intval",explode(",",' |
| 2232 | - . $p->code . ')))'; |
|
| 2232 | + . $p->code.')))'; |
|
| 2233 | 2233 | } |
| 2234 | 2234 | } else { |
| 2235 | 2235 | $p->code = '$doublons'; |
@@ -2358,7 +2358,7 @@ discard block |
||
| 2358 | 2358 | $_code[] = "$_key => $_val"; |
| 2359 | 2359 | } |
| 2360 | 2360 | } while ($_key && $_val); |
| 2361 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2361 | + $p->code = 'array('.join(', ', $_code).')'; |
|
| 2362 | 2362 | $p->interdire_scripts = false; |
| 2363 | 2363 | |
| 2364 | 2364 | return $p; |
@@ -2385,7 +2385,7 @@ discard block |
||
| 2385 | 2385 | while ($_val = interprete_argument_balise($n++, $p)) { |
| 2386 | 2386 | $_code[] = $_val; |
| 2387 | 2387 | } |
| 2388 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2388 | + $p->code = 'array('.join(', ', $_code).')'; |
|
| 2389 | 2389 | $p->interdire_scripts = false; |
| 2390 | 2390 | |
| 2391 | 2391 | return $p; |
@@ -2430,10 +2430,10 @@ discard block |
||
| 2430 | 2430 | $_code[] = $_v; |
| 2431 | 2431 | } |
| 2432 | 2432 | |
| 2433 | - $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join( |
|
| 2433 | + $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser('.join( |
|
| 2434 | 2434 | ', ', |
| 2435 | 2435 | $_code |
| 2436 | - ) . ')?" ":"")'; |
|
| 2436 | + ).')?" ":"")'; |
|
| 2437 | 2437 | $p->interdire_scripts = false; |
| 2438 | 2438 | |
| 2439 | 2439 | return $p; |
@@ -2466,7 +2466,7 @@ discard block |
||
| 2466 | 2466 | $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
| 2467 | 2467 | |
| 2468 | 2468 | $f = chercher_filtre('info_plugin'); |
| 2469 | - $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2469 | + $p->code = $f.'('.$plugin.', '.$type_info.')'; |
|
| 2470 | 2470 | |
| 2471 | 2471 | return $p; |
| 2472 | 2472 | } |
@@ -2716,12 +2716,12 @@ discard block |
||
| 2716 | 2716 | $_issens = "in_array($_champ,array('>','<'))"; |
| 2717 | 2717 | $_sens = "(strpos('< >',$_champ)-1)"; |
| 2718 | 2718 | |
| 2719 | - $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2719 | + $_variable = "((\$s=$_issens)?'sens':'tri').".$boucle->modificateur['tri_nom']; |
|
| 2720 | 2720 | $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
| 2721 | - $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2722 | - $_on = '$s?(' . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2721 | + $_url = "parametre_url($_url,'var_memotri',strncmp(".$boucle->modificateur['tri_nom'].",'session',7)==0?$_variable:'')"; |
|
| 2722 | + $_on = '$s?('.$boucle->modificateur['tri_sens']."==$_sens".'):('.$boucle->modificateur['tri_champ']."==$_champ)"; |
|
| 2723 | 2723 | |
| 2724 | - $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : '') . ')'; |
|
| 2724 | + $p->code = "lien_ou_expose($_url,$_libelle,$_on".($_class ? ",$_class" : '').')'; |
|
| 2725 | 2725 | //$p->code = "''"; |
| 2726 | 2726 | $p->interdire_scripts = false; |
| 2727 | 2727 | |
@@ -2795,7 +2795,7 @@ discard block |
||
| 2795 | 2795 | $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
| 2796 | 2796 | } |
| 2797 | 2797 | |
| 2798 | - $p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')"; |
|
| 2798 | + $p->code = '(objet_test_si_publie('.$_type.',intval('.$_id.'),'._q($connect).")?' ':'')"; |
|
| 2799 | 2799 | $p->interdire_scripts = false; |
| 2800 | 2800 | |
| 2801 | 2801 | return $p; |
@@ -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,16 +48,16 @@ discard block |
||
| 48 | 48 | * Code PHP si cet argument est présent, sinon null |
| 49 | 49 | **/ |
| 50 | 50 | function interprete_argument_balise(int $n, Champ $p): ?string { |
| 51 | - if (($p->param) && (!$p->param[0][0]) && ((is_countable($p->param[0]) ? count($p->param[0]) : 0) > $n)) { |
|
| 52 | - return calculer_liste( |
|
| 53 | - $p->param[0][$n], |
|
| 54 | - $p->descr, |
|
| 55 | - $p->boucles, |
|
| 56 | - $p->id_boucle |
|
| 57 | - ); |
|
| 58 | - } else { |
|
| 59 | - return null; |
|
| 60 | - } |
|
| 51 | + if (($p->param) && (!$p->param[0][0]) && ((is_countable($p->param[0]) ? count($p->param[0]) : 0) > $n)) { |
|
| 52 | + return calculer_liste( |
|
| 53 | + $p->param[0][$n], |
|
| 54 | + $p->descr, |
|
| 55 | + $p->boucles, |
|
| 56 | + $p->id_boucle |
|
| 57 | + ); |
|
| 58 | + } else { |
|
| 59 | + return null; |
|
| 60 | + } |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | * Pile complétée par le code à générer |
| 78 | 78 | **/ |
| 79 | 79 | function balise_NOM_SITE_SPIP_dist($p) { |
| 80 | - $p->code = "\$GLOBALS['meta']['nom_site']"; |
|
| 80 | + $p->code = "\$GLOBALS['meta']['nom_site']"; |
|
| 81 | 81 | |
| 82 | - #$p->interdire_scripts = true; |
|
| 83 | - return $p; |
|
| 82 | + #$p->interdire_scripts = true; |
|
| 83 | + return $p; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | * Pile complétée par le code à générer |
| 97 | 97 | **/ |
| 98 | 98 | function balise_EMAIL_WEBMASTER_dist($p) { |
| 99 | - $p->code = "\$GLOBALS['meta']['email_webmaster']"; |
|
| 99 | + $p->code = "\$GLOBALS['meta']['email_webmaster']"; |
|
| 100 | 100 | |
| 101 | - #$p->interdire_scripts = true; |
|
| 102 | - return $p; |
|
| 101 | + #$p->interdire_scripts = true; |
|
| 102 | + return $p; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | * Pile complétée par le code à générer |
| 116 | 116 | **/ |
| 117 | 117 | function balise_DESCRIPTIF_SITE_SPIP_dist($p) { |
| 118 | - $p->code = "\$GLOBALS['meta']['descriptif_site']"; |
|
| 118 | + $p->code = "\$GLOBALS['meta']['descriptif_site']"; |
|
| 119 | 119 | |
| 120 | - #$p->interdire_scripts = true; |
|
| 121 | - return $p; |
|
| 120 | + #$p->interdire_scripts = true; |
|
| 121 | + return $p; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | * Pile complétée par le code à générer |
| 140 | 140 | **/ |
| 141 | 141 | function balise_CHARSET_dist($p) { |
| 142 | - $p->code = "\$GLOBALS['meta']['charset']"; |
|
| 142 | + $p->code = "\$GLOBALS['meta']['charset']"; |
|
| 143 | 143 | |
| 144 | - #$p->interdire_scripts = true; |
|
| 145 | - return $p; |
|
| 144 | + #$p->interdire_scripts = true; |
|
| 145 | + return $p; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | * Pile complétée par le code à générer |
| 168 | 168 | **/ |
| 169 | 169 | function balise_LANG_LEFT_dist($p) { |
| 170 | - $_lang = champ_sql('lang', $p); |
|
| 171 | - $p->code = "lang_dir($_lang, 'left','right')"; |
|
| 172 | - $p->interdire_scripts = false; |
|
| 170 | + $_lang = champ_sql('lang', $p); |
|
| 171 | + $p->code = "lang_dir($_lang, 'left','right')"; |
|
| 172 | + $p->interdire_scripts = false; |
|
| 173 | 173 | |
| 174 | - return $p; |
|
| 174 | + return $p; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | * Pile complétée par le code à générer |
| 192 | 192 | **/ |
| 193 | 193 | function balise_LANG_RIGHT_dist($p) { |
| 194 | - $_lang = champ_sql('lang', $p); |
|
| 195 | - $p->code = "lang_dir($_lang, 'right','left')"; |
|
| 196 | - $p->interdire_scripts = false; |
|
| 194 | + $_lang = champ_sql('lang', $p); |
|
| 195 | + $p->code = "lang_dir($_lang, 'right','left')"; |
|
| 196 | + $p->interdire_scripts = false; |
|
| 197 | 197 | |
| 198 | - return $p; |
|
| 198 | + return $p; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | * Pile complétée par le code à générer |
| 221 | 221 | **/ |
| 222 | 222 | function balise_LANG_DIR_dist($p) { |
| 223 | - $_lang = champ_sql('lang', $p); |
|
| 224 | - $p->code = "lang_dir($_lang, 'ltr','rtl')"; |
|
| 225 | - $p->interdire_scripts = false; |
|
| 223 | + $_lang = champ_sql('lang', $p); |
|
| 224 | + $p->code = "lang_dir($_lang, 'ltr','rtl')"; |
|
| 225 | + $p->interdire_scripts = false; |
|
| 226 | 226 | |
| 227 | - return $p; |
|
| 227 | + return $p; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | |
@@ -241,10 +241,10 @@ discard block |
||
| 241 | 241 | * Pile complétée par le code à générer |
| 242 | 242 | **/ |
| 243 | 243 | function balise_PUCE_dist($p) { |
| 244 | - $p->code = 'definir_puce()'; |
|
| 245 | - $p->interdire_scripts = false; |
|
| 244 | + $p->code = 'definir_puce()'; |
|
| 245 | + $p->interdire_scripts = false; |
|
| 246 | 246 | |
| 247 | - return $p; |
|
| 247 | + return $p; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -268,9 +268,9 @@ discard block |
||
| 268 | 268 | * Pile completée du code PHP d'exécution de la balise |
| 269 | 269 | */ |
| 270 | 270 | function balise_DATE_dist($p) { |
| 271 | - $p->code = champ_sql('date', $p); |
|
| 271 | + $p->code = champ_sql('date', $p); |
|
| 272 | 272 | |
| 273 | - return $p; |
|
| 273 | + return $p; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | * Pile completée du code PHP d'exécution de la balise |
| 291 | 291 | */ |
| 292 | 292 | function balise_DATE_REDAC_dist($p) { |
| 293 | - $p->code = champ_sql('date_redac', $p); |
|
| 294 | - $p->interdire_scripts = false; |
|
| 293 | + $p->code = champ_sql('date_redac', $p); |
|
| 294 | + $p->interdire_scripts = false; |
|
| 295 | 295 | |
| 296 | - return $p; |
|
| 296 | + return $p; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | * Pile completée du code PHP d'exécution de la balise |
| 313 | 313 | */ |
| 314 | 314 | function balise_DATE_MODIF_dist($p) { |
| 315 | - $p->code = champ_sql('date_modif', $p); |
|
| 316 | - $p->interdire_scripts = false; |
|
| 315 | + $p->code = champ_sql('date_modif', $p); |
|
| 316 | + $p->interdire_scripts = false; |
|
| 317 | 317 | |
| 318 | - return $p; |
|
| 318 | + return $p; |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | /** |
@@ -333,13 +333,13 @@ discard block |
||
| 333 | 333 | * Pile completée du code PHP d'exécution de la balise |
| 334 | 334 | */ |
| 335 | 335 | function balise_DATE_NOUVEAUTES_dist($p) { |
| 336 | - $p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui' |
|
| 336 | + $p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui' |
|
| 337 | 337 | AND isset(\$GLOBALS['meta']['dernier_envoi_neuf'])) ? |
| 338 | 338 | \$GLOBALS['meta']['dernier_envoi_neuf'] : |
| 339 | 339 | \"'0000-00-00'\")"; |
| 340 | - $p->interdire_scripts = false; |
|
| 340 | + $p->interdire_scripts = false; |
|
| 341 | 341 | |
| 342 | - return $p; |
|
| 342 | + return $p; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | |
@@ -357,11 +357,11 @@ discard block |
||
| 357 | 357 | * Pile completée du code PHP d'exécution de la balise |
| 358 | 358 | */ |
| 359 | 359 | function balise_DOSSIER_SQUELETTE_dist($p) { |
| 360 | - $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
|
| 361 | - $p->code = "_DIR_RACINE . '$code'" . |
|
| 362 | - $p->interdire_scripts = false; |
|
| 360 | + $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
|
| 361 | + $p->code = "_DIR_RACINE . '$code'" . |
|
| 362 | + $p->interdire_scripts = false; |
|
| 363 | 363 | |
| 364 | - return $p; |
|
| 364 | + return $p; |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /** |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | * Pile completée du code PHP d'exécution de la balise |
| 377 | 377 | */ |
| 378 | 378 | function balise_SQUELETTE_dist($p) { |
| 379 | - $code = addslashes($p->descr['sourcefile']); |
|
| 380 | - $p->code = "'$code'" . |
|
| 381 | - $p->interdire_scripts = false; |
|
| 379 | + $code = addslashes($p->descr['sourcefile']); |
|
| 380 | + $p->code = "'$code'" . |
|
| 381 | + $p->interdire_scripts = false; |
|
| 382 | 382 | |
| 383 | - return $p; |
|
| 383 | + return $p; |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
@@ -399,10 +399,10 @@ discard block |
||
| 399 | 399 | * Pile completée du code PHP d'exécution de la balise |
| 400 | 400 | */ |
| 401 | 401 | function balise_SPIP_VERSION_dist($p) { |
| 402 | - $p->code = 'spip_version()'; |
|
| 403 | - $p->interdire_scripts = false; |
|
| 402 | + $p->code = 'spip_version()'; |
|
| 403 | + $p->interdire_scripts = false; |
|
| 404 | 404 | |
| 405 | - return $p; |
|
| 405 | + return $p; |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | |
@@ -428,18 +428,18 @@ discard block |
||
| 428 | 428 | * Pile complétée par le code à générer |
| 429 | 429 | **/ |
| 430 | 430 | function balise_NOM_SITE_dist($p) { |
| 431 | - if (!$p->etoile) { |
|
| 432 | - $p->code = 'supprimer_numero(calculer_url(' . |
|
| 433 | - champ_sql('url_site', $p) . ',' . |
|
| 434 | - champ_sql('nom_site', $p) . |
|
| 435 | - ", 'titre', \$connect, false))"; |
|
| 436 | - } else { |
|
| 437 | - $p->code = champ_sql('nom_site', $p); |
|
| 438 | - } |
|
| 431 | + if (!$p->etoile) { |
|
| 432 | + $p->code = 'supprimer_numero(calculer_url(' . |
|
| 433 | + champ_sql('url_site', $p) . ',' . |
|
| 434 | + champ_sql('nom_site', $p) . |
|
| 435 | + ", 'titre', \$connect, false))"; |
|
| 436 | + } else { |
|
| 437 | + $p->code = champ_sql('nom_site', $p); |
|
| 438 | + } |
|
| 439 | 439 | |
| 440 | - $p->interdire_scripts = true; |
|
| 440 | + $p->interdire_scripts = true; |
|
| 441 | 441 | |
| 442 | - return $p; |
|
| 442 | + return $p; |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | |
@@ -456,11 +456,11 @@ discard block |
||
| 456 | 456 | * Pile complétée par le code à générer |
| 457 | 457 | **/ |
| 458 | 458 | function balise_NOTES_dist($p) { |
| 459 | - // Recuperer les notes |
|
| 460 | - $p->code = 'calculer_notes()'; |
|
| 459 | + // Recuperer les notes |
|
| 460 | + $p->code = 'calculer_notes()'; |
|
| 461 | 461 | |
| 462 | - #$p->interdire_scripts = true; |
|
| 463 | - return $p; |
|
| 462 | + #$p->interdire_scripts = true; |
|
| 463 | + return $p; |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | |
@@ -482,10 +482,10 @@ discard block |
||
| 482 | 482 | * Pile complétée par le code à générer |
| 483 | 483 | **/ |
| 484 | 484 | function balise_RECHERCHE_dist($p) { |
| 485 | - $p->code = 'entites_html(_request("recherche"))'; |
|
| 486 | - $p->interdire_scripts = false; |
|
| 485 | + $p->code = 'entites_html(_request("recherche"))'; |
|
| 486 | + $p->interdire_scripts = false; |
|
| 487 | 487 | |
| 488 | - return $p; |
|
| 488 | + return $p; |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | |
@@ -503,17 +503,17 @@ discard block |
||
| 503 | 503 | * Pile complétée par le code à générer |
| 504 | 504 | **/ |
| 505 | 505 | function balise_COMPTEUR_BOUCLE_dist($p) { |
| 506 | - $b = index_boucle_mere($p); |
|
| 507 | - if ($b === '') { |
|
| 508 | - $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 509 | - erreur_squelette($msg, $p); |
|
| 510 | - } else { |
|
| 511 | - $p->code = "(\$Numrows['$b']['compteur_boucle'] ?? 0)"; |
|
| 512 | - $p->boucles[$b]->cptrows = true; |
|
| 513 | - $p->interdire_scripts = false; |
|
| 506 | + $b = index_boucle_mere($p); |
|
| 507 | + if ($b === '') { |
|
| 508 | + $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 509 | + erreur_squelette($msg, $p); |
|
| 510 | + } else { |
|
| 511 | + $p->code = "(\$Numrows['$b']['compteur_boucle'] ?? 0)"; |
|
| 512 | + $p->boucles[$b]->cptrows = true; |
|
| 513 | + $p->interdire_scripts = false; |
|
| 514 | 514 | |
| 515 | - return $p; |
|
| 516 | - } |
|
| 515 | + return $p; |
|
| 516 | + } |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | /** |
@@ -531,17 +531,17 @@ discard block |
||
| 531 | 531 | * Pile complétée par le code à générer |
| 532 | 532 | **/ |
| 533 | 533 | function balise_TOTAL_BOUCLE_dist($p) { |
| 534 | - $b = index_boucle_mere($p); |
|
| 535 | - if ($b === '') { |
|
| 536 | - $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 537 | - erreur_squelette($msg, $p); |
|
| 538 | - } else { |
|
| 539 | - $p->code = "(\$Numrows['$b']['total'] ?? 0)"; |
|
| 540 | - $p->boucles[$b]->numrows = true; |
|
| 541 | - $p->interdire_scripts = false; |
|
| 542 | - } |
|
| 534 | + $b = index_boucle_mere($p); |
|
| 535 | + if ($b === '') { |
|
| 536 | + $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 537 | + erreur_squelette($msg, $p); |
|
| 538 | + } else { |
|
| 539 | + $p->code = "(\$Numrows['$b']['total'] ?? 0)"; |
|
| 540 | + $p->boucles[$b]->numrows = true; |
|
| 541 | + $p->interdire_scripts = false; |
|
| 542 | + } |
|
| 543 | 543 | |
| 544 | - return $p; |
|
| 544 | + return $p; |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | * Pile complétée par le code à générer |
| 562 | 562 | **/ |
| 563 | 563 | function balise_POINTS_dist($p) { |
| 564 | - return rindex_pile($p, 'points', 'recherche'); |
|
| 564 | + return rindex_pile($p, 'points', 'recherche'); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | |
@@ -582,12 +582,12 @@ discard block |
||
| 582 | 582 | * Pile complétée par le code à générer |
| 583 | 583 | **/ |
| 584 | 584 | function balise_POPULARITE_ABSOLUE_dist($p) { |
| 585 | - $p->code = 'ceil(' . |
|
| 586 | - champ_sql('popularite', $p) . |
|
| 587 | - ')'; |
|
| 588 | - $p->interdire_scripts = false; |
|
| 585 | + $p->code = 'ceil(' . |
|
| 586 | + champ_sql('popularite', $p) . |
|
| 587 | + ')'; |
|
| 588 | + $p->interdire_scripts = false; |
|
| 589 | 589 | |
| 590 | - return $p; |
|
| 590 | + return $p; |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | /** |
@@ -607,10 +607,10 @@ discard block |
||
| 607 | 607 | * Pile complétée par le code à générer |
| 608 | 608 | **/ |
| 609 | 609 | function balise_POPULARITE_SITE_dist($p) { |
| 610 | - $p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])'; |
|
| 611 | - $p->interdire_scripts = false; |
|
| 610 | + $p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])'; |
|
| 611 | + $p->interdire_scripts = false; |
|
| 612 | 612 | |
| 613 | - return $p; |
|
| 613 | + return $p; |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | /** |
@@ -631,10 +631,10 @@ discard block |
||
| 631 | 631 | * Pile complétée par le code à générer |
| 632 | 632 | **/ |
| 633 | 633 | function balise_POPULARITE_MAX_dist($p) { |
| 634 | - $p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])'; |
|
| 635 | - $p->interdire_scripts = false; |
|
| 634 | + $p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])'; |
|
| 635 | + $p->interdire_scripts = false; |
|
| 636 | 636 | |
| 637 | - return $p; |
|
| 637 | + return $p; |
|
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | |
@@ -660,15 +660,15 @@ discard block |
||
| 660 | 660 | * Pile complétée par le code à générer |
| 661 | 661 | **/ |
| 662 | 662 | function balise_VALEUR_dist($p) { |
| 663 | - $b = $p->nom_boucle ?: $p->id_boucle; |
|
| 664 | - $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b); |
|
| 663 | + $b = $p->nom_boucle ?: $p->id_boucle; |
|
| 664 | + $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b); |
|
| 665 | 665 | ; |
| 666 | - if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 667 | - $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 668 | - } |
|
| 669 | - $p->interdire_scripts = true; |
|
| 666 | + if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 667 | + $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 668 | + } |
|
| 669 | + $p->interdire_scripts = true; |
|
| 670 | 670 | |
| 671 | - return $p; |
|
| 671 | + return $p; |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | /** |
@@ -697,16 +697,16 @@ discard block |
||
| 697 | 697 | * Pile complétée par le code à générer |
| 698 | 698 | **/ |
| 699 | 699 | function balise_EXPOSE_dist($p) { |
| 700 | - $on = "'on'"; |
|
| 701 | - $off = "''"; |
|
| 702 | - if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 703 | - $on = $v; |
|
| 704 | - if (($v = interprete_argument_balise(2, $p)) !== null) { |
|
| 705 | - $off = $v; |
|
| 706 | - } |
|
| 707 | - } |
|
| 700 | + $on = "'on'"; |
|
| 701 | + $off = "''"; |
|
| 702 | + if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 703 | + $on = $v; |
|
| 704 | + if (($v = interprete_argument_balise(2, $p)) !== null) { |
|
| 705 | + $off = $v; |
|
| 706 | + } |
|
| 707 | + } |
|
| 708 | 708 | |
| 709 | - return calculer_balise_expose($p, $on, $off); |
|
| 709 | + return calculer_balise_expose($p, $on, $off); |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | /** |
@@ -724,35 +724,35 @@ discard block |
||
| 724 | 724 | * Pile complétée par le code à générer |
| 725 | 725 | **/ |
| 726 | 726 | function calculer_balise_expose($p, $on, $off) { |
| 727 | - $b = index_boucle($p); |
|
| 728 | - if (empty($p->boucles[$b]->primary)) { |
|
| 729 | - $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 730 | - erreur_squelette($msg, $p); |
|
| 731 | - } else { |
|
| 732 | - $key = $p->boucles[$b]->primary; |
|
| 733 | - $type = $p->boucles[$p->id_boucle]->primary; |
|
| 734 | - $desc = $p->boucles[$b]->show; |
|
| 735 | - $connect = sql_quote($p->boucles[$b]->sql_serveur); |
|
| 727 | + $b = index_boucle($p); |
|
| 728 | + if (empty($p->boucles[$b]->primary)) { |
|
| 729 | + $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 730 | + erreur_squelette($msg, $p); |
|
| 731 | + } else { |
|
| 732 | + $key = $p->boucles[$b]->primary; |
|
| 733 | + $type = $p->boucles[$p->id_boucle]->primary; |
|
| 734 | + $desc = $p->boucles[$b]->show; |
|
| 735 | + $connect = sql_quote($p->boucles[$b]->sql_serveur); |
|
| 736 | 736 | |
| 737 | - // Ne pas utiliser champ_sql, on jongle avec le nom boucle explicite |
|
| 738 | - $c = index_pile($p->id_boucle, $type, $p->boucles); |
|
| 737 | + // Ne pas utiliser champ_sql, on jongle avec le nom boucle explicite |
|
| 738 | + $c = index_pile($p->id_boucle, $type, $p->boucles); |
|
| 739 | 739 | |
| 740 | - if (isset($desc['field']['id_parent'])) { |
|
| 741 | - $parent = 0; // pour if (!$parent) dans calculer_expose |
|
| 742 | - } elseif (isset($desc['field']['id_rubrique'])) { |
|
| 743 | - $parent = index_pile($p->id_boucle, 'id_rubrique', $p->boucles, $b); |
|
| 744 | - } elseif (isset($desc['field']['id_groupe'])) { |
|
| 745 | - $parent = index_pile($p->id_boucle, 'id_groupe', $p->boucles, $b); |
|
| 746 | - } else { |
|
| 747 | - $parent = "''"; |
|
| 748 | - } |
|
| 740 | + if (isset($desc['field']['id_parent'])) { |
|
| 741 | + $parent = 0; // pour if (!$parent) dans calculer_expose |
|
| 742 | + } elseif (isset($desc['field']['id_rubrique'])) { |
|
| 743 | + $parent = index_pile($p->id_boucle, 'id_rubrique', $p->boucles, $b); |
|
| 744 | + } elseif (isset($desc['field']['id_groupe'])) { |
|
| 745 | + $parent = index_pile($p->id_boucle, 'id_groupe', $p->boucles, $b); |
|
| 746 | + } else { |
|
| 747 | + $parent = "''"; |
|
| 748 | + } |
|
| 749 | 749 | |
| 750 | - $p->code = "(calcul_exposer($c, '$type', \$Pile[0], $parent, '$key', $connect) ? $on : $off)"; |
|
| 751 | - } |
|
| 750 | + $p->code = "(calcul_exposer($c, '$type', \$Pile[0], $parent, '$key', $connect) ? $on : $off)"; |
|
| 751 | + } |
|
| 752 | 752 | |
| 753 | - $p->interdire_scripts = false; |
|
| 753 | + $p->interdire_scripts = false; |
|
| 754 | 754 | |
| 755 | - return $p; |
|
| 755 | + return $p; |
|
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | |
@@ -793,46 +793,46 @@ discard block |
||
| 793 | 793 | **/ |
| 794 | 794 | function balise_INTRODUCTION_dist($p) { |
| 795 | 795 | |
| 796 | - $type_objet = $p->type_requete; |
|
| 797 | - $cle_objet = id_table_objet($type_objet); |
|
| 798 | - $_id_objet = champ_sql($cle_objet, $p); |
|
| 799 | - |
|
| 800 | - // Récupérer les valeurs sql nécessaires : descriptif, texte et chapo |
|
| 801 | - // ainsi que le longueur d'introduction donnée dans la description de l'objet. |
|
| 802 | - $_introduction_longueur = 'null'; |
|
| 803 | - $_ligne = 'array('; |
|
| 804 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 805 | - if ($desc = $trouver_table(table_objet_sql($type_objet))) { |
|
| 806 | - if (isset($desc['field']['descriptif'])) { |
|
| 807 | - $_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ','; |
|
| 808 | - } |
|
| 809 | - if (isset($desc['field']['texte'])) { |
|
| 810 | - $_ligne .= "'texte' => " . champ_sql('texte', $p) . ','; |
|
| 811 | - } |
|
| 812 | - if (isset($desc['field']['chapo'])) { |
|
| 813 | - $_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ','; |
|
| 814 | - } |
|
| 815 | - if (isset($desc['introduction_longueur'])) { |
|
| 816 | - $_introduction_longueur = "'" . $desc['introduction_longueur'] . "'"; |
|
| 817 | - } |
|
| 818 | - } |
|
| 819 | - $_ligne .= ')'; |
|
| 820 | - |
|
| 821 | - // Récupérer la longueur et la suite passés en paramètres |
|
| 822 | - $_longueur_ou_suite = 'null'; |
|
| 823 | - if (($v1 = interprete_argument_balise(1, $p)) !== null) { |
|
| 824 | - $_longueur_ou_suite = $v1; |
|
| 825 | - } |
|
| 826 | - $_suite = 'null'; |
|
| 827 | - if (($v2 = interprete_argument_balise(2, $p)) !== null) { |
|
| 828 | - $_suite = $v2; |
|
| 829 | - } |
|
| 830 | - |
|
| 831 | - $p->code = "generer_objet_introduction($_id_objet, '$type_objet', $_ligne, $_introduction_longueur, $_longueur_ou_suite, $_suite, \$connect)"; |
|
| 832 | - |
|
| 833 | - #$p->interdire_scripts = true; |
|
| 834 | - $p->etoile = '*'; // propre est deja fait dans le calcul de l'intro |
|
| 835 | - return $p; |
|
| 796 | + $type_objet = $p->type_requete; |
|
| 797 | + $cle_objet = id_table_objet($type_objet); |
|
| 798 | + $_id_objet = champ_sql($cle_objet, $p); |
|
| 799 | + |
|
| 800 | + // Récupérer les valeurs sql nécessaires : descriptif, texte et chapo |
|
| 801 | + // ainsi que le longueur d'introduction donnée dans la description de l'objet. |
|
| 802 | + $_introduction_longueur = 'null'; |
|
| 803 | + $_ligne = 'array('; |
|
| 804 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 805 | + if ($desc = $trouver_table(table_objet_sql($type_objet))) { |
|
| 806 | + if (isset($desc['field']['descriptif'])) { |
|
| 807 | + $_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ','; |
|
| 808 | + } |
|
| 809 | + if (isset($desc['field']['texte'])) { |
|
| 810 | + $_ligne .= "'texte' => " . champ_sql('texte', $p) . ','; |
|
| 811 | + } |
|
| 812 | + if (isset($desc['field']['chapo'])) { |
|
| 813 | + $_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ','; |
|
| 814 | + } |
|
| 815 | + if (isset($desc['introduction_longueur'])) { |
|
| 816 | + $_introduction_longueur = "'" . $desc['introduction_longueur'] . "'"; |
|
| 817 | + } |
|
| 818 | + } |
|
| 819 | + $_ligne .= ')'; |
|
| 820 | + |
|
| 821 | + // Récupérer la longueur et la suite passés en paramètres |
|
| 822 | + $_longueur_ou_suite = 'null'; |
|
| 823 | + if (($v1 = interprete_argument_balise(1, $p)) !== null) { |
|
| 824 | + $_longueur_ou_suite = $v1; |
|
| 825 | + } |
|
| 826 | + $_suite = 'null'; |
|
| 827 | + if (($v2 = interprete_argument_balise(2, $p)) !== null) { |
|
| 828 | + $_suite = $v2; |
|
| 829 | + } |
|
| 830 | + |
|
| 831 | + $p->code = "generer_objet_introduction($_id_objet, '$type_objet', $_ligne, $_introduction_longueur, $_longueur_ou_suite, $_suite, \$connect)"; |
|
| 832 | + |
|
| 833 | + #$p->interdire_scripts = true; |
|
| 834 | + $p->etoile = '*'; // propre est deja fait dans le calcul de l'intro |
|
| 835 | + return $p; |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | |
@@ -852,15 +852,15 @@ discard block |
||
| 852 | 852 | * Pile complétée par le code à générer |
| 853 | 853 | **/ |
| 854 | 854 | function balise_LANG_dist($p) { |
| 855 | - $_lang = champ_sql('lang', $p); |
|
| 856 | - if (!$p->etoile) { |
|
| 857 | - $p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])"; |
|
| 858 | - } else { |
|
| 859 | - $p->code = "spip_htmlentities($_lang)"; |
|
| 860 | - } |
|
| 861 | - $p->interdire_scripts = false; |
|
| 855 | + $_lang = champ_sql('lang', $p); |
|
| 856 | + if (!$p->etoile) { |
|
| 857 | + $p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])"; |
|
| 858 | + } else { |
|
| 859 | + $p->code = "spip_htmlentities($_lang)"; |
|
| 860 | + } |
|
| 861 | + $p->interdire_scripts = false; |
|
| 862 | 862 | |
| 863 | - return $p; |
|
| 863 | + return $p; |
|
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | /** |
@@ -882,45 +882,45 @@ discard block |
||
| 882 | 882 | * Pile complétée par le code à générer |
| 883 | 883 | */ |
| 884 | 884 | function balise_LESAUTEURS_dist($p) { |
| 885 | - // Cherche le champ 'lesauteurs' dans la pile |
|
| 886 | - $_lesauteurs = champ_sql('lesauteurs', $p, ''); |
|
| 887 | - |
|
| 888 | - // Si le champ n'existe pas (cas de spip_articles), on applique |
|
| 889 | - // le modele lesauteurs.html en passant id_article dans le contexte; |
|
| 890 | - // dans le cas contraire on prend le champ 'lesauteurs' |
|
| 891 | - // (cf extension sites/) |
|
| 892 | - if ($_lesauteurs) { |
|
| 893 | - $p->code = "safehtml($_lesauteurs)"; |
|
| 894 | - // $p->interdire_scripts = true; |
|
| 895 | - } else { |
|
| 896 | - if (!$p->id_boucle) { |
|
| 897 | - $connect = ''; |
|
| 898 | - $objet = 'article'; |
|
| 899 | - $id_table_objet = 'id_article'; |
|
| 900 | - } else { |
|
| 901 | - $b = $p->nom_boucle ?: $p->id_boucle; |
|
| 902 | - $connect = $p->boucles[$b]->sql_serveur; |
|
| 903 | - $type_boucle = $p->boucles[$b]->type_requete; |
|
| 904 | - $objet = objet_type($type_boucle); |
|
| 905 | - $id_table_objet = id_table_objet($type_boucle); |
|
| 906 | - } |
|
| 907 | - $c = memoriser_contexte_compil($p); |
|
| 908 | - |
|
| 909 | - $p->code = sprintf( |
|
| 910 | - CODE_RECUPERER_FOND, |
|
| 911 | - "'modeles/lesauteurs'", |
|
| 912 | - "array('objet'=>'" . $objet . |
|
| 913 | - "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 914 | - ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 915 | - ($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 916 | - ')', |
|
| 917 | - "'trim'=>true, 'compil'=>array($c)", |
|
| 918 | - _q($connect) |
|
| 919 | - ); |
|
| 920 | - $p->interdire_scripts = false; // securite apposee par recuperer_fond() |
|
| 921 | - } |
|
| 922 | - |
|
| 923 | - return $p; |
|
| 885 | + // Cherche le champ 'lesauteurs' dans la pile |
|
| 886 | + $_lesauteurs = champ_sql('lesauteurs', $p, ''); |
|
| 887 | + |
|
| 888 | + // Si le champ n'existe pas (cas de spip_articles), on applique |
|
| 889 | + // le modele lesauteurs.html en passant id_article dans le contexte; |
|
| 890 | + // dans le cas contraire on prend le champ 'lesauteurs' |
|
| 891 | + // (cf extension sites/) |
|
| 892 | + if ($_lesauteurs) { |
|
| 893 | + $p->code = "safehtml($_lesauteurs)"; |
|
| 894 | + // $p->interdire_scripts = true; |
|
| 895 | + } else { |
|
| 896 | + if (!$p->id_boucle) { |
|
| 897 | + $connect = ''; |
|
| 898 | + $objet = 'article'; |
|
| 899 | + $id_table_objet = 'id_article'; |
|
| 900 | + } else { |
|
| 901 | + $b = $p->nom_boucle ?: $p->id_boucle; |
|
| 902 | + $connect = $p->boucles[$b]->sql_serveur; |
|
| 903 | + $type_boucle = $p->boucles[$b]->type_requete; |
|
| 904 | + $objet = objet_type($type_boucle); |
|
| 905 | + $id_table_objet = id_table_objet($type_boucle); |
|
| 906 | + } |
|
| 907 | + $c = memoriser_contexte_compil($p); |
|
| 908 | + |
|
| 909 | + $p->code = sprintf( |
|
| 910 | + CODE_RECUPERER_FOND, |
|
| 911 | + "'modeles/lesauteurs'", |
|
| 912 | + "array('objet'=>'" . $objet . |
|
| 913 | + "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 914 | + ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 915 | + ($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 916 | + ')', |
|
| 917 | + "'trim'=>true, 'compil'=>array($c)", |
|
| 918 | + _q($connect) |
|
| 919 | + ); |
|
| 920 | + $p->interdire_scripts = false; // securite apposee par recuperer_fond() |
|
| 921 | + } |
|
| 922 | + |
|
| 923 | + return $p; |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | |
@@ -947,76 +947,76 @@ discard block |
||
| 947 | 947 | * Pile complétée par le code à générer |
| 948 | 948 | */ |
| 949 | 949 | function balise_RANG_dist($p) { |
| 950 | - $b = index_boucle($p); |
|
| 951 | - if ($b === '') { |
|
| 952 | - $msg = [ |
|
| 953 | - 'zbug_champ_hors_boucle', |
|
| 954 | - ['champ' => '#RANG'] |
|
| 955 | - ]; |
|
| 956 | - erreur_squelette($msg, $p); |
|
| 957 | - } else { |
|
| 958 | - // chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql) |
|
| 959 | - // dans la boucle immediatement englobante uniquement |
|
| 960 | - // sinon on compose le champ calcule |
|
| 961 | - $_rang = champ_sql('rang', $p, '', false); |
|
| 962 | - |
|
| 963 | - // si pas trouve de champ sql rang : |
|
| 964 | - if (!$_rang or $_rang == "''") { |
|
| 965 | - $boucle = &$p->boucles[$b]; |
|
| 966 | - |
|
| 967 | - // on gere le cas ou #RANG est une extraction du numero dans le titre |
|
| 968 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 969 | - $desc = $trouver_table($boucle->id_table); |
|
| 970 | - $_titre = ''; # où extraire le numero ? |
|
| 971 | - |
|
| 972 | - if (isset($desc['titre'])) { |
|
| 973 | - $t = $desc['titre']; |
|
| 974 | - if ( |
|
| 975 | - // Soit on trouve avec la déclaration de la lang AVANT |
|
| 976 | - preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m) |
|
| 977 | - // Soit on prend depuis le début |
|
| 978 | - or preg_match(';^(.*?titre)\s*(,|$);', $t, $m) |
|
| 979 | - ) { |
|
| 980 | - $m = preg_replace(',as\s+titre$,i', '', $m[1]); |
|
| 981 | - $m = trim($m); |
|
| 982 | - if ($m != "''") { |
|
| 983 | - if (!preg_match(',\W,', $m)) { |
|
| 984 | - $m = $boucle->id_table . ".$m"; |
|
| 985 | - } |
|
| 986 | - |
|
| 987 | - $m .= ' AS titre_rang'; |
|
| 988 | - |
|
| 989 | - $boucle->select[] = $m; |
|
| 990 | - $_titre = '$Pile[$SP][\'titre_rang\']'; |
|
| 991 | - } |
|
| 992 | - } |
|
| 993 | - } |
|
| 994 | - |
|
| 995 | - // si on n'a rien trouvé, on utilise le champ titre classique |
|
| 996 | - if (!$_titre) { |
|
| 997 | - $_titre = champ_sql('titre', $p); |
|
| 998 | - } |
|
| 999 | - |
|
| 1000 | - // et on recupere aussi les infos de liaison si on est en train d'editer les liens justement |
|
| 1001 | - // cas des formulaires xxx_lies utilises par #FORMULAIRE_EDITER_LIENS |
|
| 1002 | - $type_boucle = $boucle->type_requete; |
|
| 1003 | - $objet = objet_type($type_boucle); |
|
| 1004 | - $id_table_objet = id_table_objet($type_boucle); |
|
| 1005 | - $_primary = champ_sql($id_table_objet, $p, '', false); |
|
| 1006 | - $_env = '$Pile[0]'; |
|
| 1007 | - |
|
| 1008 | - if (!$_titre) {$_titre = "''"; |
|
| 1009 | - } |
|
| 1010 | - if (!$_primary) {$_primary = "''"; |
|
| 1011 | - } |
|
| 1012 | - $_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)"; |
|
| 1013 | - } |
|
| 1014 | - |
|
| 1015 | - $p->code = $_rang; |
|
| 1016 | - $p->interdire_scripts = false; |
|
| 1017 | - } |
|
| 1018 | - |
|
| 1019 | - return $p; |
|
| 950 | + $b = index_boucle($p); |
|
| 951 | + if ($b === '') { |
|
| 952 | + $msg = [ |
|
| 953 | + 'zbug_champ_hors_boucle', |
|
| 954 | + ['champ' => '#RANG'] |
|
| 955 | + ]; |
|
| 956 | + erreur_squelette($msg, $p); |
|
| 957 | + } else { |
|
| 958 | + // chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql) |
|
| 959 | + // dans la boucle immediatement englobante uniquement |
|
| 960 | + // sinon on compose le champ calcule |
|
| 961 | + $_rang = champ_sql('rang', $p, '', false); |
|
| 962 | + |
|
| 963 | + // si pas trouve de champ sql rang : |
|
| 964 | + if (!$_rang or $_rang == "''") { |
|
| 965 | + $boucle = &$p->boucles[$b]; |
|
| 966 | + |
|
| 967 | + // on gere le cas ou #RANG est une extraction du numero dans le titre |
|
| 968 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 969 | + $desc = $trouver_table($boucle->id_table); |
|
| 970 | + $_titre = ''; # où extraire le numero ? |
|
| 971 | + |
|
| 972 | + if (isset($desc['titre'])) { |
|
| 973 | + $t = $desc['titre']; |
|
| 974 | + if ( |
|
| 975 | + // Soit on trouve avec la déclaration de la lang AVANT |
|
| 976 | + preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m) |
|
| 977 | + // Soit on prend depuis le début |
|
| 978 | + or preg_match(';^(.*?titre)\s*(,|$);', $t, $m) |
|
| 979 | + ) { |
|
| 980 | + $m = preg_replace(',as\s+titre$,i', '', $m[1]); |
|
| 981 | + $m = trim($m); |
|
| 982 | + if ($m != "''") { |
|
| 983 | + if (!preg_match(',\W,', $m)) { |
|
| 984 | + $m = $boucle->id_table . ".$m"; |
|
| 985 | + } |
|
| 986 | + |
|
| 987 | + $m .= ' AS titre_rang'; |
|
| 988 | + |
|
| 989 | + $boucle->select[] = $m; |
|
| 990 | + $_titre = '$Pile[$SP][\'titre_rang\']'; |
|
| 991 | + } |
|
| 992 | + } |
|
| 993 | + } |
|
| 994 | + |
|
| 995 | + // si on n'a rien trouvé, on utilise le champ titre classique |
|
| 996 | + if (!$_titre) { |
|
| 997 | + $_titre = champ_sql('titre', $p); |
|
| 998 | + } |
|
| 999 | + |
|
| 1000 | + // et on recupere aussi les infos de liaison si on est en train d'editer les liens justement |
|
| 1001 | + // cas des formulaires xxx_lies utilises par #FORMULAIRE_EDITER_LIENS |
|
| 1002 | + $type_boucle = $boucle->type_requete; |
|
| 1003 | + $objet = objet_type($type_boucle); |
|
| 1004 | + $id_table_objet = id_table_objet($type_boucle); |
|
| 1005 | + $_primary = champ_sql($id_table_objet, $p, '', false); |
|
| 1006 | + $_env = '$Pile[0]'; |
|
| 1007 | + |
|
| 1008 | + if (!$_titre) {$_titre = "''"; |
|
| 1009 | + } |
|
| 1010 | + if (!$_primary) {$_primary = "''"; |
|
| 1011 | + } |
|
| 1012 | + $_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)"; |
|
| 1013 | + } |
|
| 1014 | + |
|
| 1015 | + $p->code = $_rang; |
|
| 1016 | + $p->interdire_scripts = false; |
|
| 1017 | + } |
|
| 1018 | + |
|
| 1019 | + return $p; |
|
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | |
@@ -1038,12 +1038,12 @@ discard block |
||
| 1038 | 1038 | * Pile complétée par le code à générer |
| 1039 | 1039 | **/ |
| 1040 | 1040 | function balise_POPULARITE_dist($p) { |
| 1041 | - $_popularite = champ_sql('popularite', $p); |
|
| 1042 | - $p->code = "(ceil(min(100, 100 * $_popularite |
|
| 1041 | + $_popularite = champ_sql('popularite', $p); |
|
| 1042 | + $p->code = "(ceil(min(100, 100 * $_popularite |
|
| 1043 | 1043 | / max(1 , 0 + \$GLOBALS['meta']['popularite_max']))))"; |
| 1044 | - $p->interdire_scripts = false; |
|
| 1044 | + $p->interdire_scripts = false; |
|
| 1045 | 1045 | |
| 1046 | - return $p; |
|
| 1046 | + return $p; |
|
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | /** |
@@ -1054,8 +1054,8 @@ discard block |
||
| 1054 | 1054 | * l'absence peut-être due à une faute de frappe dans le contexte inclus. |
| 1055 | 1055 | */ |
| 1056 | 1056 | define( |
| 1057 | - 'CODE_PAGINATION', |
|
| 1058 | - '%s($Numrows["%s"]["grand_total"], |
|
| 1057 | + 'CODE_PAGINATION', |
|
| 1058 | + '%s($Numrows["%s"]["grand_total"], |
|
| 1059 | 1059 | %s, |
| 1060 | 1060 | isset($Pile[0][%4$s])?$Pile[0][%4$s]:intval(_request(%4$s)), |
| 1061 | 1061 | %5$s, %6$s, %7$s, %8$s, array(%9$s))' |
@@ -1092,75 +1092,75 @@ discard block |
||
| 1092 | 1092 | * Pile complétée par le code à générer |
| 1093 | 1093 | */ |
| 1094 | 1094 | function balise_PAGINATION_dist($p, $liste = 'true') { |
| 1095 | - $b = index_boucle_mere($p); |
|
| 1096 | - |
|
| 1097 | - // s'il n'y a pas de nom de boucle, on ne peut pas paginer |
|
| 1098 | - if ($b === '') { |
|
| 1099 | - $msg = [ |
|
| 1100 | - 'zbug_champ_hors_boucle', |
|
| 1101 | - ['champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION'] |
|
| 1102 | - ]; |
|
| 1103 | - erreur_squelette($msg, $p); |
|
| 1104 | - |
|
| 1105 | - return $p; |
|
| 1106 | - } |
|
| 1107 | - |
|
| 1108 | - // s'il n'y a pas de mode_partie, c'est qu'on se trouve |
|
| 1109 | - // dans un boucle recursive ou qu'on a oublie le critere {pagination} |
|
| 1110 | - if (!$p->boucles[$b]->mode_partie) { |
|
| 1111 | - if (!$p->boucles[$b]->table_optionnelle) { |
|
| 1112 | - $msg = [ |
|
| 1113 | - 'zbug_pagination_sans_critere', |
|
| 1114 | - ['champ' => '#PAGINATION'] |
|
| 1115 | - ]; |
|
| 1116 | - erreur_squelette($msg, $p); |
|
| 1117 | - } |
|
| 1118 | - |
|
| 1119 | - return $p; |
|
| 1120 | - } |
|
| 1121 | - |
|
| 1122 | - // a priori true |
|
| 1123 | - // si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise |
|
| 1124 | - // si true, les arguments simples (sans truc=chose) vont degager |
|
| 1125 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false); |
|
| 1126 | - if (is_countable($_contexte) ? count($_contexte) : 0) { |
|
| 1127 | - $key = key($_contexte); |
|
| 1128 | - if (is_numeric($key)) { |
|
| 1129 | - array_shift($_contexte); |
|
| 1130 | - $__modele = interprete_argument_balise(1, $p); |
|
| 1131 | - } |
|
| 1132 | - } |
|
| 1133 | - |
|
| 1134 | - if (is_countable($_contexte) ? count($_contexte) : 0) { |
|
| 1135 | - $code_contexte = implode(',', $_contexte); |
|
| 1136 | - } else { |
|
| 1137 | - $code_contexte = ''; |
|
| 1138 | - } |
|
| 1139 | - |
|
| 1140 | - $connect = $p->boucles[$b]->sql_serveur; |
|
| 1141 | - $pas = $p->boucles[$b]->total_parties; |
|
| 1142 | - $f_pagination = chercher_filtre('pagination'); |
|
| 1143 | - $type = $p->boucles[$b]->modificateur['debut_nom']; |
|
| 1144 | - $modif = ($type[0] !== "'") ? "'debut'.$type" |
|
| 1145 | - : ("'debut" . substr($type, 1)); |
|
| 1146 | - |
|
| 1147 | - $p->code = sprintf( |
|
| 1148 | - CODE_PAGINATION, |
|
| 1149 | - $f_pagination, |
|
| 1150 | - $b, |
|
| 1151 | - $type, |
|
| 1152 | - $modif, |
|
| 1153 | - $pas, |
|
| 1154 | - $liste, |
|
| 1155 | - ((isset($__modele) and $__modele) ? $__modele : "''"), |
|
| 1156 | - _q($connect), |
|
| 1157 | - $code_contexte |
|
| 1158 | - ); |
|
| 1159 | - |
|
| 1160 | - $p->boucles[$b]->numrows = true; |
|
| 1161 | - $p->interdire_scripts = false; |
|
| 1162 | - |
|
| 1163 | - return $p; |
|
| 1095 | + $b = index_boucle_mere($p); |
|
| 1096 | + |
|
| 1097 | + // s'il n'y a pas de nom de boucle, on ne peut pas paginer |
|
| 1098 | + if ($b === '') { |
|
| 1099 | + $msg = [ |
|
| 1100 | + 'zbug_champ_hors_boucle', |
|
| 1101 | + ['champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION'] |
|
| 1102 | + ]; |
|
| 1103 | + erreur_squelette($msg, $p); |
|
| 1104 | + |
|
| 1105 | + return $p; |
|
| 1106 | + } |
|
| 1107 | + |
|
| 1108 | + // s'il n'y a pas de mode_partie, c'est qu'on se trouve |
|
| 1109 | + // dans un boucle recursive ou qu'on a oublie le critere {pagination} |
|
| 1110 | + if (!$p->boucles[$b]->mode_partie) { |
|
| 1111 | + if (!$p->boucles[$b]->table_optionnelle) { |
|
| 1112 | + $msg = [ |
|
| 1113 | + 'zbug_pagination_sans_critere', |
|
| 1114 | + ['champ' => '#PAGINATION'] |
|
| 1115 | + ]; |
|
| 1116 | + erreur_squelette($msg, $p); |
|
| 1117 | + } |
|
| 1118 | + |
|
| 1119 | + return $p; |
|
| 1120 | + } |
|
| 1121 | + |
|
| 1122 | + // a priori true |
|
| 1123 | + // si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise |
|
| 1124 | + // si true, les arguments simples (sans truc=chose) vont degager |
|
| 1125 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false); |
|
| 1126 | + if (is_countable($_contexte) ? count($_contexte) : 0) { |
|
| 1127 | + $key = key($_contexte); |
|
| 1128 | + if (is_numeric($key)) { |
|
| 1129 | + array_shift($_contexte); |
|
| 1130 | + $__modele = interprete_argument_balise(1, $p); |
|
| 1131 | + } |
|
| 1132 | + } |
|
| 1133 | + |
|
| 1134 | + if (is_countable($_contexte) ? count($_contexte) : 0) { |
|
| 1135 | + $code_contexte = implode(',', $_contexte); |
|
| 1136 | + } else { |
|
| 1137 | + $code_contexte = ''; |
|
| 1138 | + } |
|
| 1139 | + |
|
| 1140 | + $connect = $p->boucles[$b]->sql_serveur; |
|
| 1141 | + $pas = $p->boucles[$b]->total_parties; |
|
| 1142 | + $f_pagination = chercher_filtre('pagination'); |
|
| 1143 | + $type = $p->boucles[$b]->modificateur['debut_nom']; |
|
| 1144 | + $modif = ($type[0] !== "'") ? "'debut'.$type" |
|
| 1145 | + : ("'debut" . substr($type, 1)); |
|
| 1146 | + |
|
| 1147 | + $p->code = sprintf( |
|
| 1148 | + CODE_PAGINATION, |
|
| 1149 | + $f_pagination, |
|
| 1150 | + $b, |
|
| 1151 | + $type, |
|
| 1152 | + $modif, |
|
| 1153 | + $pas, |
|
| 1154 | + $liste, |
|
| 1155 | + ((isset($__modele) and $__modele) ? $__modele : "''"), |
|
| 1156 | + _q($connect), |
|
| 1157 | + $code_contexte |
|
| 1158 | + ); |
|
| 1159 | + |
|
| 1160 | + $p->boucles[$b]->numrows = true; |
|
| 1161 | + $p->interdire_scripts = false; |
|
| 1162 | + |
|
| 1163 | + return $p; |
|
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | 1166 | |
@@ -1187,11 +1187,11 @@ discard block |
||
| 1187 | 1187 | * Pile complétée par le code à générer |
| 1188 | 1188 | **/ |
| 1189 | 1189 | function balise_ANCRE_PAGINATION_dist($p) { |
| 1190 | - if ($f = charger_fonction('PAGINATION', 'balise', true)) { |
|
| 1191 | - return $f($p, $liste = 'false'); |
|
| 1192 | - } else { |
|
| 1193 | - return null; |
|
| 1194 | - } // ou une erreur ? |
|
| 1190 | + if ($f = charger_fonction('PAGINATION', 'balise', true)) { |
|
| 1191 | + return $f($p, $liste = 'false'); |
|
| 1192 | + } else { |
|
| 1193 | + return null; |
|
| 1194 | + } // ou une erreur ? |
|
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | 1197 | |
@@ -1212,17 +1212,17 @@ discard block |
||
| 1212 | 1212 | * Pile complétée par le code à générer |
| 1213 | 1213 | **/ |
| 1214 | 1214 | function balise_GRAND_TOTAL_dist($p) { |
| 1215 | - $b = index_boucle_mere($p); |
|
| 1216 | - if ($b === '') { |
|
| 1217 | - $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 1218 | - erreur_squelette($msg, $p); |
|
| 1219 | - } else { |
|
| 1220 | - $p->code = "(\$Numrows['$b']['grand_total'] ?? \$Numrows['$b']['total'] ?? 0)"; |
|
| 1221 | - $p->boucles[$b]->numrows = true; |
|
| 1222 | - $p->interdire_scripts = false; |
|
| 1223 | - } |
|
| 1215 | + $b = index_boucle_mere($p); |
|
| 1216 | + if ($b === '') { |
|
| 1217 | + $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 1218 | + erreur_squelette($msg, $p); |
|
| 1219 | + } else { |
|
| 1220 | + $p->code = "(\$Numrows['$b']['grand_total'] ?? \$Numrows['$b']['total'] ?? 0)"; |
|
| 1221 | + $p->boucles[$b]->numrows = true; |
|
| 1222 | + $p->interdire_scripts = false; |
|
| 1223 | + } |
|
| 1224 | 1224 | |
| 1225 | - return $p; |
|
| 1225 | + return $p; |
|
| 1226 | 1226 | } |
| 1227 | 1227 | |
| 1228 | 1228 | |
@@ -1250,10 +1250,10 @@ discard block |
||
| 1250 | 1250 | * Pile complétée par le code à générer |
| 1251 | 1251 | **/ |
| 1252 | 1252 | function balise_SELF_dist($p) { |
| 1253 | - $p->code = 'self()'; |
|
| 1254 | - $p->interdire_scripts = false; |
|
| 1253 | + $p->code = 'self()'; |
|
| 1254 | + $p->interdire_scripts = false; |
|
| 1255 | 1255 | |
| 1256 | - return $p; |
|
| 1256 | + return $p; |
|
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | 1259 | |
@@ -1280,17 +1280,17 @@ discard block |
||
| 1280 | 1280 | * Pile complétée par le code à générer |
| 1281 | 1281 | **/ |
| 1282 | 1282 | function balise_CHEMIN_dist($p) { |
| 1283 | - $arg = interprete_argument_balise(1, $p); |
|
| 1284 | - if (!$arg) { |
|
| 1285 | - $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']]; |
|
| 1286 | - erreur_squelette($msg, $p); |
|
| 1287 | - } else { |
|
| 1288 | - $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1289 | - } |
|
| 1283 | + $arg = interprete_argument_balise(1, $p); |
|
| 1284 | + if (!$arg) { |
|
| 1285 | + $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']]; |
|
| 1286 | + erreur_squelette($msg, $p); |
|
| 1287 | + } else { |
|
| 1288 | + $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1289 | + } |
|
| 1290 | 1290 | |
| 1291 | - $p->interdire_scripts = false; |
|
| 1291 | + $p->interdire_scripts = false; |
|
| 1292 | 1292 | |
| 1293 | - return $p; |
|
| 1293 | + return $p; |
|
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | 1296 | /** |
@@ -1315,16 +1315,16 @@ discard block |
||
| 1315 | 1315 | * Pile complétée par le code à générer |
| 1316 | 1316 | **/ |
| 1317 | 1317 | function balise_CHEMIN_IMAGE_dist($p) { |
| 1318 | - $arg = interprete_argument_balise(1, $p); |
|
| 1319 | - if (!$arg) { |
|
| 1320 | - $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']]; |
|
| 1321 | - erreur_squelette($msg, $p); |
|
| 1322 | - } else { |
|
| 1323 | - $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1324 | - } |
|
| 1318 | + $arg = interprete_argument_balise(1, $p); |
|
| 1319 | + if (!$arg) { |
|
| 1320 | + $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']]; |
|
| 1321 | + erreur_squelette($msg, $p); |
|
| 1322 | + } else { |
|
| 1323 | + $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1324 | + } |
|
| 1325 | 1325 | |
| 1326 | - $p->interdire_scripts = false; |
|
| 1327 | - return $p; |
|
| 1326 | + $p->interdire_scripts = false; |
|
| 1327 | + return $p; |
|
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | 1330 | |
@@ -1362,36 +1362,36 @@ discard block |
||
| 1362 | 1362 | **/ |
| 1363 | 1363 | function balise_ENV_dist($p, $src = null) { |
| 1364 | 1364 | |
| 1365 | - // cle du tableau desiree |
|
| 1366 | - $_nom = interprete_argument_balise(1, $p); |
|
| 1367 | - // valeur par defaut |
|
| 1368 | - $_sinon = interprete_argument_balise(2, $p); |
|
| 1365 | + // cle du tableau desiree |
|
| 1366 | + $_nom = interprete_argument_balise(1, $p); |
|
| 1367 | + // valeur par defaut |
|
| 1368 | + $_sinon = interprete_argument_balise(2, $p); |
|
| 1369 | 1369 | |
| 1370 | - // $src est un tableau de donnees sources eventuellement transmis |
|
| 1371 | - // en absence, on utilise l'environnement du squelette $Pile[0] |
|
| 1370 | + // $src est un tableau de donnees sources eventuellement transmis |
|
| 1371 | + // en absence, on utilise l'environnement du squelette $Pile[0] |
|
| 1372 | 1372 | |
| 1373 | - if (!$_nom) { |
|
| 1374 | - // cas de #ENV sans argument : on retourne le serialize() du tableau |
|
| 1375 | - // une belle fonction [(#ENV|affiche_env)] serait pratique |
|
| 1376 | - if ($src) { |
|
| 1377 | - $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1378 | - } else { |
|
| 1379 | - $p->code = 'serialize($Pile[0]??[])'; |
|
| 1380 | - } |
|
| 1381 | - } else { |
|
| 1382 | - if (!$src) { |
|
| 1383 | - $src = '$Pile[0]??[]'; |
|
| 1384 | - } |
|
| 1385 | - if ($_sinon) { |
|
| 1386 | - $p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)"; |
|
| 1387 | - } else { |
|
| 1388 | - $p->code = "table_valeur($src, (string)$_nom, null)"; |
|
| 1389 | - } |
|
| 1390 | - } |
|
| 1373 | + if (!$_nom) { |
|
| 1374 | + // cas de #ENV sans argument : on retourne le serialize() du tableau |
|
| 1375 | + // une belle fonction [(#ENV|affiche_env)] serait pratique |
|
| 1376 | + if ($src) { |
|
| 1377 | + $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1378 | + } else { |
|
| 1379 | + $p->code = 'serialize($Pile[0]??[])'; |
|
| 1380 | + } |
|
| 1381 | + } else { |
|
| 1382 | + if (!$src) { |
|
| 1383 | + $src = '$Pile[0]??[]'; |
|
| 1384 | + } |
|
| 1385 | + if ($_sinon) { |
|
| 1386 | + $p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)"; |
|
| 1387 | + } else { |
|
| 1388 | + $p->code = "table_valeur($src, (string)$_nom, null)"; |
|
| 1389 | + } |
|
| 1390 | + } |
|
| 1391 | 1391 | |
| 1392 | - #$p->interdire_scripts = true; |
|
| 1392 | + #$p->interdire_scripts = true; |
|
| 1393 | 1393 | |
| 1394 | - return $p; |
|
| 1394 | + return $p; |
|
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 1397 | /** |
@@ -1421,16 +1421,16 @@ discard block |
||
| 1421 | 1421 | * Pile completée du code PHP d'exécution de la balise |
| 1422 | 1422 | */ |
| 1423 | 1423 | function balise_CONFIG_dist($p) { |
| 1424 | - if (!$arg = interprete_argument_balise(1, $p)) { |
|
| 1425 | - $arg = "''"; |
|
| 1426 | - } |
|
| 1427 | - $_sinon = interprete_argument_balise(2, $p); |
|
| 1428 | - $_unserialize = sinon(interprete_argument_balise(3, $p), 'false'); |
|
| 1424 | + if (!$arg = interprete_argument_balise(1, $p)) { |
|
| 1425 | + $arg = "''"; |
|
| 1426 | + } |
|
| 1427 | + $_sinon = interprete_argument_balise(2, $p); |
|
| 1428 | + $_unserialize = sinon(interprete_argument_balise(3, $p), 'false'); |
|
| 1429 | 1429 | |
| 1430 | - $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1431 | - ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1430 | + $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1431 | + ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1432 | 1432 | |
| 1433 | - return $p; |
|
| 1433 | + return $p; |
|
| 1434 | 1434 | } |
| 1435 | 1435 | |
| 1436 | 1436 | |
@@ -1453,10 +1453,10 @@ discard block |
||
| 1453 | 1453 | * Pile completée du code PHP d'exécution de la balise |
| 1454 | 1454 | */ |
| 1455 | 1455 | function balise_CONNECT_dist($p) { |
| 1456 | - $p->code = '($connect ? $connect : NULL)'; |
|
| 1457 | - $p->interdire_scripts = false; |
|
| 1456 | + $p->code = '($connect ? $connect : NULL)'; |
|
| 1457 | + $p->interdire_scripts = false; |
|
| 1458 | 1458 | |
| 1459 | - return $p; |
|
| 1459 | + return $p; |
|
| 1460 | 1460 | } |
| 1461 | 1461 | |
| 1462 | 1462 | |
@@ -1484,15 +1484,15 @@ discard block |
||
| 1484 | 1484 | * Pile completée du code PHP d'exécution de la balise |
| 1485 | 1485 | **/ |
| 1486 | 1486 | function balise_SESSION_dist($p) { |
| 1487 | - $p->descr['session'] = true; |
|
| 1487 | + $p->descr['session'] = true; |
|
| 1488 | 1488 | |
| 1489 | - $f = function_exists('balise_ENV') |
|
| 1490 | - ? 'balise_ENV' |
|
| 1491 | - : 'balise_ENV_dist'; |
|
| 1489 | + $f = function_exists('balise_ENV') |
|
| 1490 | + ? 'balise_ENV' |
|
| 1491 | + : 'balise_ENV_dist'; |
|
| 1492 | 1492 | |
| 1493 | - $p = $f($p, '$GLOBALS["visiteur_session"]??[]'); |
|
| 1493 | + $p = $f($p, '$GLOBALS["visiteur_session"]??[]'); |
|
| 1494 | 1494 | |
| 1495 | - return $p; |
|
| 1495 | + return $p; |
|
| 1496 | 1496 | } |
| 1497 | 1497 | |
| 1498 | 1498 | |
@@ -1515,18 +1515,18 @@ discard block |
||
| 1515 | 1515 | * Pile completée du code PHP d'exécution de la balise |
| 1516 | 1516 | **/ |
| 1517 | 1517 | function balise_SESSION_SET_dist($p) { |
| 1518 | - $_nom = interprete_argument_balise(1, $p); |
|
| 1519 | - $_val = interprete_argument_balise(2, $p); |
|
| 1520 | - if (!$_nom or !$_val) { |
|
| 1521 | - $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']]; |
|
| 1522 | - erreur_squelette($err_b_s_a, $p); |
|
| 1523 | - } else { |
|
| 1524 | - $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1525 | - } |
|
| 1518 | + $_nom = interprete_argument_balise(1, $p); |
|
| 1519 | + $_val = interprete_argument_balise(2, $p); |
|
| 1520 | + if (!$_nom or !$_val) { |
|
| 1521 | + $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']]; |
|
| 1522 | + erreur_squelette($err_b_s_a, $p); |
|
| 1523 | + } else { |
|
| 1524 | + $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1525 | + } |
|
| 1526 | 1526 | |
| 1527 | - $p->interdire_scripts = false; |
|
| 1527 | + $p->interdire_scripts = false; |
|
| 1528 | 1528 | |
| 1529 | - return $p; |
|
| 1529 | + return $p; |
|
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | |
@@ -1557,30 +1557,30 @@ discard block |
||
| 1557 | 1557 | * Pile completée du code PHP d'exécution de la balise |
| 1558 | 1558 | **/ |
| 1559 | 1559 | function balise_EVAL_dist($p) { |
| 1560 | - $php = interprete_argument_balise(1, $p); |
|
| 1561 | - if ($php) { |
|
| 1562 | - # optimisation sur les #EVAL{une expression sans #BALISE} |
|
| 1563 | - # attention au commentaire "// x signes" qui precede |
|
| 1564 | - if ( |
|
| 1565 | - preg_match( |
|
| 1566 | - ",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms", |
|
| 1567 | - $php, |
|
| 1568 | - $r |
|
| 1569 | - ) |
|
| 1570 | - ) { |
|
| 1571 | - $p->code = /* $r[1]. */ |
|
| 1572 | - '(' . $r[2] . ')'; |
|
| 1573 | - } else { |
|
| 1574 | - $p->code = "eval('return '.$php.';')"; |
|
| 1575 | - } |
|
| 1576 | - } else { |
|
| 1577 | - $msg = ['zbug_balise_sans_argument', ['balise' => ' EVAL']]; |
|
| 1578 | - erreur_squelette($msg, $p); |
|
| 1579 | - } |
|
| 1580 | - |
|
| 1581 | - #$p->interdire_scripts = true; |
|
| 1582 | - |
|
| 1583 | - return $p; |
|
| 1560 | + $php = interprete_argument_balise(1, $p); |
|
| 1561 | + if ($php) { |
|
| 1562 | + # optimisation sur les #EVAL{une expression sans #BALISE} |
|
| 1563 | + # attention au commentaire "// x signes" qui precede |
|
| 1564 | + if ( |
|
| 1565 | + preg_match( |
|
| 1566 | + ",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms", |
|
| 1567 | + $php, |
|
| 1568 | + $r |
|
| 1569 | + ) |
|
| 1570 | + ) { |
|
| 1571 | + $p->code = /* $r[1]. */ |
|
| 1572 | + '(' . $r[2] . ')'; |
|
| 1573 | + } else { |
|
| 1574 | + $p->code = "eval('return '.$php.';')"; |
|
| 1575 | + } |
|
| 1576 | + } else { |
|
| 1577 | + $msg = ['zbug_balise_sans_argument', ['balise' => ' EVAL']]; |
|
| 1578 | + erreur_squelette($msg, $p); |
|
| 1579 | + } |
|
| 1580 | + |
|
| 1581 | + #$p->interdire_scripts = true; |
|
| 1582 | + |
|
| 1583 | + return $p; |
|
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | 1586 | |
@@ -1610,19 +1610,19 @@ discard block |
||
| 1610 | 1610 | **/ |
| 1611 | 1611 | function balise_CHAMP_SQL_dist($p) { |
| 1612 | 1612 | |
| 1613 | - if ( |
|
| 1614 | - $p->param |
|
| 1615 | - and isset($p->param[0][1][0]) |
|
| 1616 | - and $champ = ($p->param[0][1][0]->texte) |
|
| 1617 | - ) { |
|
| 1618 | - $p->code = champ_sql($champ, $p); |
|
| 1619 | - } else { |
|
| 1620 | - $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => ' CHAMP_SQL']]; |
|
| 1621 | - erreur_squelette($err_b_s_a, $p); |
|
| 1622 | - } |
|
| 1613 | + if ( |
|
| 1614 | + $p->param |
|
| 1615 | + and isset($p->param[0][1][0]) |
|
| 1616 | + and $champ = ($p->param[0][1][0]->texte) |
|
| 1617 | + ) { |
|
| 1618 | + $p->code = champ_sql($champ, $p); |
|
| 1619 | + } else { |
|
| 1620 | + $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => ' CHAMP_SQL']]; |
|
| 1621 | + erreur_squelette($err_b_s_a, $p); |
|
| 1622 | + } |
|
| 1623 | 1623 | |
| 1624 | - #$p->interdire_scripts = true; |
|
| 1625 | - return $p; |
|
| 1624 | + #$p->interdire_scripts = true; |
|
| 1625 | + return $p; |
|
| 1626 | 1626 | } |
| 1627 | 1627 | |
| 1628 | 1628 | /** |
@@ -1648,13 +1648,13 @@ discard block |
||
| 1648 | 1648 | * Pile complétée par le code à générer |
| 1649 | 1649 | **/ |
| 1650 | 1650 | function balise_VAL_dist($p) { |
| 1651 | - $p->code = interprete_argument_balise(1, $p); |
|
| 1652 | - if ($p->code === null || !strlen($p->code)) { |
|
| 1653 | - $p->code = "''"; |
|
| 1654 | - } |
|
| 1655 | - $p->interdire_scripts = false; |
|
| 1651 | + $p->code = interprete_argument_balise(1, $p); |
|
| 1652 | + if ($p->code === null || !strlen($p->code)) { |
|
| 1653 | + $p->code = "''"; |
|
| 1654 | + } |
|
| 1655 | + $p->interdire_scripts = false; |
|
| 1656 | 1656 | |
| 1657 | - return $p; |
|
| 1657 | + return $p; |
|
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | 1660 | /** |
@@ -1683,10 +1683,10 @@ discard block |
||
| 1683 | 1683 | * Pile complétée par le code à générer |
| 1684 | 1684 | **/ |
| 1685 | 1685 | function balise_REM_dist($p) { |
| 1686 | - $p->code = "''"; |
|
| 1687 | - $p->interdire_scripts = false; |
|
| 1686 | + $p->code = "''"; |
|
| 1687 | + $p->interdire_scripts = false; |
|
| 1688 | 1688 | |
| 1689 | - return $p; |
|
| 1689 | + return $p; |
|
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | 1692 | /** |
@@ -1696,10 +1696,10 @@ discard block |
||
| 1696 | 1696 | * @return mixed |
| 1697 | 1697 | */ |
| 1698 | 1698 | function balise_NULL_dist($p) { |
| 1699 | - $p->code = 'null'; |
|
| 1700 | - $p->interdire_scripts = false; |
|
| 1699 | + $p->code = 'null'; |
|
| 1700 | + $p->interdire_scripts = false; |
|
| 1701 | 1701 | |
| 1702 | - return $p; |
|
| 1702 | + return $p; |
|
| 1703 | 1703 | } |
| 1704 | 1704 | |
| 1705 | 1705 | |
@@ -1723,18 +1723,18 @@ discard block |
||
| 1723 | 1723 | **/ |
| 1724 | 1724 | function balise_HTTP_HEADER_dist($p) { |
| 1725 | 1725 | |
| 1726 | - $header = interprete_argument_balise(1, $p); |
|
| 1727 | - if (!$header) { |
|
| 1728 | - $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'HTTP_HEADER']]; |
|
| 1729 | - erreur_squelette($err_b_s_a, $p); |
|
| 1730 | - } else { |
|
| 1731 | - $p->code = "'<'.'?php header(' . _q(" |
|
| 1732 | - . $header |
|
| 1733 | - . ") . '); ?'.'>'"; |
|
| 1734 | - } |
|
| 1735 | - $p->interdire_scripts = false; |
|
| 1726 | + $header = interprete_argument_balise(1, $p); |
|
| 1727 | + if (!$header) { |
|
| 1728 | + $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'HTTP_HEADER']]; |
|
| 1729 | + erreur_squelette($err_b_s_a, $p); |
|
| 1730 | + } else { |
|
| 1731 | + $p->code = "'<'.'?php header(' . _q(" |
|
| 1732 | + . $header |
|
| 1733 | + . ") . '); ?'.'>'"; |
|
| 1734 | + } |
|
| 1735 | + $p->interdire_scripts = false; |
|
| 1736 | 1736 | |
| 1737 | - return $p; |
|
| 1737 | + return $p; |
|
| 1738 | 1738 | } |
| 1739 | 1739 | |
| 1740 | 1740 | |
@@ -1759,20 +1759,20 @@ discard block |
||
| 1759 | 1759 | * Pile complétée par le code à générer |
| 1760 | 1760 | **/ |
| 1761 | 1761 | function balise_FILTRE_dist($p) { |
| 1762 | - if ($p->param) { |
|
| 1763 | - $args = []; |
|
| 1764 | - foreach ($p->param as $i => $ignore) { |
|
| 1765 | - $args[] = interprete_argument_balise($i + 1, $p); |
|
| 1766 | - } |
|
| 1767 | - $p->code = "'<' . '" |
|
| 1768 | - . '?php header("X-Spip-Filtre: \'.' |
|
| 1769 | - . join('.\'|\'.', $args) |
|
| 1770 | - . " . '\"); ?'.'>'"; |
|
| 1762 | + if ($p->param) { |
|
| 1763 | + $args = []; |
|
| 1764 | + foreach ($p->param as $i => $ignore) { |
|
| 1765 | + $args[] = interprete_argument_balise($i + 1, $p); |
|
| 1766 | + } |
|
| 1767 | + $p->code = "'<' . '" |
|
| 1768 | + . '?php header("X-Spip-Filtre: \'.' |
|
| 1769 | + . join('.\'|\'.', $args) |
|
| 1770 | + . " . '\"); ?'.'>'"; |
|
| 1771 | 1771 | |
| 1772 | - $p->interdire_scripts = false; |
|
| 1772 | + $p->interdire_scripts = false; |
|
| 1773 | 1773 | |
| 1774 | - return $p; |
|
| 1775 | - } |
|
| 1774 | + return $p; |
|
| 1775 | + } |
|
| 1776 | 1776 | } |
| 1777 | 1777 | |
| 1778 | 1778 | |
@@ -1808,55 +1808,55 @@ discard block |
||
| 1808 | 1808 | **/ |
| 1809 | 1809 | function balise_CACHE_dist($p) { |
| 1810 | 1810 | |
| 1811 | - if ($p->param) { |
|
| 1812 | - $duree = valeur_numerique($p->param[0][1][0]->texte); |
|
| 1813 | - |
|
| 1814 | - // noter la duree du cache dans un entete proprietaire |
|
| 1815 | - |
|
| 1816 | - $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1817 | - . $duree |
|
| 1818 | - . '"); ?' . "'.'>'"; |
|
| 1819 | - |
|
| 1820 | - // Remplir le header Cache-Control |
|
| 1821 | - // cas #CACHE{0} |
|
| 1822 | - if ($duree == 0) { |
|
| 1823 | - $code .= ".'<'.'" |
|
| 1824 | - . '?php header("Cache-Control: no-cache, must-revalidate"); ?' |
|
| 1825 | - . "'.'><'.'" |
|
| 1826 | - . '?php header("Pragma: no-cache"); ?' |
|
| 1827 | - . "'.'>'"; |
|
| 1828 | - } |
|
| 1829 | - |
|
| 1830 | - // recuperer les parametres suivants |
|
| 1831 | - $i = 1; |
|
| 1832 | - while (isset($p->param[0][++$i])) { |
|
| 1833 | - $pa = ($p->param[0][$i][0]->texte); |
|
| 1834 | - |
|
| 1835 | - if ( |
|
| 1836 | - $pa == 'cache-client' |
|
| 1837 | - and $duree > 0 |
|
| 1838 | - ) { |
|
| 1839 | - $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1840 | - . $duree |
|
| 1841 | - . '"); ?' . "'.'>'"; |
|
| 1842 | - // il semble logique, si on cache-client, de ne pas invalider |
|
| 1843 | - $pa = 'statique'; |
|
| 1844 | - } |
|
| 1845 | - |
|
| 1846 | - if ( |
|
| 1847 | - $pa == 'statique' |
|
| 1848 | - and $duree > 0 |
|
| 1849 | - ) { |
|
| 1850 | - $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1851 | - } |
|
| 1852 | - } |
|
| 1853 | - } else { |
|
| 1854 | - $code = "''"; |
|
| 1855 | - } |
|
| 1856 | - $p->code = $code; |
|
| 1857 | - $p->interdire_scripts = false; |
|
| 1858 | - |
|
| 1859 | - return $p; |
|
| 1811 | + if ($p->param) { |
|
| 1812 | + $duree = valeur_numerique($p->param[0][1][0]->texte); |
|
| 1813 | + |
|
| 1814 | + // noter la duree du cache dans un entete proprietaire |
|
| 1815 | + |
|
| 1816 | + $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1817 | + . $duree |
|
| 1818 | + . '"); ?' . "'.'>'"; |
|
| 1819 | + |
|
| 1820 | + // Remplir le header Cache-Control |
|
| 1821 | + // cas #CACHE{0} |
|
| 1822 | + if ($duree == 0) { |
|
| 1823 | + $code .= ".'<'.'" |
|
| 1824 | + . '?php header("Cache-Control: no-cache, must-revalidate"); ?' |
|
| 1825 | + . "'.'><'.'" |
|
| 1826 | + . '?php header("Pragma: no-cache"); ?' |
|
| 1827 | + . "'.'>'"; |
|
| 1828 | + } |
|
| 1829 | + |
|
| 1830 | + // recuperer les parametres suivants |
|
| 1831 | + $i = 1; |
|
| 1832 | + while (isset($p->param[0][++$i])) { |
|
| 1833 | + $pa = ($p->param[0][$i][0]->texte); |
|
| 1834 | + |
|
| 1835 | + if ( |
|
| 1836 | + $pa == 'cache-client' |
|
| 1837 | + and $duree > 0 |
|
| 1838 | + ) { |
|
| 1839 | + $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1840 | + . $duree |
|
| 1841 | + . '"); ?' . "'.'>'"; |
|
| 1842 | + // il semble logique, si on cache-client, de ne pas invalider |
|
| 1843 | + $pa = 'statique'; |
|
| 1844 | + } |
|
| 1845 | + |
|
| 1846 | + if ( |
|
| 1847 | + $pa == 'statique' |
|
| 1848 | + and $duree > 0 |
|
| 1849 | + ) { |
|
| 1850 | + $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1851 | + } |
|
| 1852 | + } |
|
| 1853 | + } else { |
|
| 1854 | + $code = "''"; |
|
| 1855 | + } |
|
| 1856 | + $p->code = $code; |
|
| 1857 | + $p->interdire_scripts = false; |
|
| 1858 | + |
|
| 1859 | + return $p; |
|
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | 1862 | |
@@ -1888,13 +1888,13 @@ discard block |
||
| 1888 | 1888 | * Pile complétée par le code à générer |
| 1889 | 1889 | */ |
| 1890 | 1890 | function balise_INSERT_HEAD_dist($p) { |
| 1891 | - $p->code = "'<'.'" |
|
| 1892 | - . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?' |
|
| 1893 | - . "'.'>'"; |
|
| 1894 | - $p->code .= ". pipeline('insert_head','<!-- insert_head -->')"; |
|
| 1895 | - $p->interdire_scripts = false; |
|
| 1891 | + $p->code = "'<'.'" |
|
| 1892 | + . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?' |
|
| 1893 | + . "'.'>'"; |
|
| 1894 | + $p->code .= ". pipeline('insert_head','<!-- insert_head -->')"; |
|
| 1895 | + $p->interdire_scripts = false; |
|
| 1896 | 1896 | |
| 1897 | - return $p; |
|
| 1897 | + return $p; |
|
| 1898 | 1898 | } |
| 1899 | 1899 | |
| 1900 | 1900 | /** |
@@ -1912,10 +1912,10 @@ discard block |
||
| 1912 | 1912 | * Pile complétée par le code à générer |
| 1913 | 1913 | */ |
| 1914 | 1914 | function balise_INSERT_HEAD_CSS_dist($p) { |
| 1915 | - $p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')"; |
|
| 1916 | - $p->interdire_scripts = false; |
|
| 1915 | + $p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')"; |
|
| 1916 | + $p->interdire_scripts = false; |
|
| 1917 | 1917 | |
| 1918 | - return $p; |
|
| 1918 | + return $p; |
|
| 1919 | 1919 | } |
| 1920 | 1920 | |
| 1921 | 1921 | /** |
@@ -1930,11 +1930,11 @@ discard block |
||
| 1930 | 1930 | * Pile complétée par le code à générer |
| 1931 | 1931 | **/ |
| 1932 | 1932 | function balise_INCLUDE_dist($p) { |
| 1933 | - if (function_exists('balise_INCLURE')) { |
|
| 1934 | - return balise_INCLURE($p); |
|
| 1935 | - } else { |
|
| 1936 | - return balise_INCLURE_dist($p); |
|
| 1937 | - } |
|
| 1933 | + if (function_exists('balise_INCLURE')) { |
|
| 1934 | + return balise_INCLURE($p); |
|
| 1935 | + } else { |
|
| 1936 | + return balise_INCLURE_dist($p); |
|
| 1937 | + } |
|
| 1938 | 1938 | } |
| 1939 | 1939 | |
| 1940 | 1940 | /** |
@@ -1968,66 +1968,66 @@ discard block |
||
| 1968 | 1968 | * Pile complétée par le code à générer |
| 1969 | 1969 | **/ |
| 1970 | 1970 | function balise_INCLURE_dist($p) { |
| 1971 | - $id_boucle = $p->id_boucle; |
|
| 1972 | - // la lang n'est pas passe de facon automatique par argumenter |
|
| 1973 | - // mais le sera pas recuperer_fond, sauf si etoile=>true est passe |
|
| 1974 | - // en option |
|
| 1975 | - |
|
| 1976 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false); |
|
| 1977 | - |
|
| 1978 | - // erreur de syntaxe = fond absent |
|
| 1979 | - // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 1980 | - if (!$_contexte) { |
|
| 1981 | - $contexte = []; |
|
| 1982 | - } |
|
| 1983 | - |
|
| 1984 | - if (isset($_contexte['fond'])) { |
|
| 1985 | - $f = $_contexte['fond']; |
|
| 1986 | - // toujours vrai : |
|
| 1987 | - if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) { |
|
| 1988 | - $f = $r[1]; |
|
| 1989 | - unset($_contexte['fond']); |
|
| 1990 | - } else { |
|
| 1991 | - spip_log('compilation de #INCLURE a revoir'); |
|
| 1992 | - } |
|
| 1993 | - |
|
| 1994 | - // #INCLURE{doublons} |
|
| 1995 | - if (isset($_contexte['doublons'])) { |
|
| 1996 | - $_contexte['doublons'] = "'doublons' => \$doublons"; |
|
| 1997 | - } |
|
| 1998 | - |
|
| 1999 | - // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 2000 | - $flag_env = false; |
|
| 2001 | - if (isset($_contexte['env']) or isset($_contexte['self'])) { |
|
| 2002 | - $flag_env = true; |
|
| 2003 | - unset($_contexte['env']); |
|
| 2004 | - } |
|
| 2005 | - |
|
| 2006 | - $_options = []; |
|
| 2007 | - if (isset($_contexte['ajax'])) { |
|
| 2008 | - $_options[] = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2009 | - unset($_contexte['ajax']); |
|
| 2010 | - } |
|
| 2011 | - if ($p->etoile) { |
|
| 2012 | - $_options[] = "'etoile'=>true"; |
|
| 2013 | - } |
|
| 2014 | - $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')'; |
|
| 2015 | - |
|
| 2016 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2017 | - if ($flag_env) { |
|
| 2018 | - $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2019 | - } |
|
| 2020 | - |
|
| 2021 | - $p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect') ?? ''"); |
|
| 2022 | - } elseif (!isset($_contexte[1])) { |
|
| 2023 | - $msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']]; |
|
| 2024 | - erreur_squelette($msg, $p); |
|
| 2025 | - } else { |
|
| 2026 | - $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2027 | - } |
|
| 2028 | - |
|
| 2029 | - $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
|
| 2030 | - return $p; |
|
| 1971 | + $id_boucle = $p->id_boucle; |
|
| 1972 | + // la lang n'est pas passe de facon automatique par argumenter |
|
| 1973 | + // mais le sera pas recuperer_fond, sauf si etoile=>true est passe |
|
| 1974 | + // en option |
|
| 1975 | + |
|
| 1976 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false); |
|
| 1977 | + |
|
| 1978 | + // erreur de syntaxe = fond absent |
|
| 1979 | + // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 1980 | + if (!$_contexte) { |
|
| 1981 | + $contexte = []; |
|
| 1982 | + } |
|
| 1983 | + |
|
| 1984 | + if (isset($_contexte['fond'])) { |
|
| 1985 | + $f = $_contexte['fond']; |
|
| 1986 | + // toujours vrai : |
|
| 1987 | + if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) { |
|
| 1988 | + $f = $r[1]; |
|
| 1989 | + unset($_contexte['fond']); |
|
| 1990 | + } else { |
|
| 1991 | + spip_log('compilation de #INCLURE a revoir'); |
|
| 1992 | + } |
|
| 1993 | + |
|
| 1994 | + // #INCLURE{doublons} |
|
| 1995 | + if (isset($_contexte['doublons'])) { |
|
| 1996 | + $_contexte['doublons'] = "'doublons' => \$doublons"; |
|
| 1997 | + } |
|
| 1998 | + |
|
| 1999 | + // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 2000 | + $flag_env = false; |
|
| 2001 | + if (isset($_contexte['env']) or isset($_contexte['self'])) { |
|
| 2002 | + $flag_env = true; |
|
| 2003 | + unset($_contexte['env']); |
|
| 2004 | + } |
|
| 2005 | + |
|
| 2006 | + $_options = []; |
|
| 2007 | + if (isset($_contexte['ajax'])) { |
|
| 2008 | + $_options[] = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2009 | + unset($_contexte['ajax']); |
|
| 2010 | + } |
|
| 2011 | + if ($p->etoile) { |
|
| 2012 | + $_options[] = "'etoile'=>true"; |
|
| 2013 | + } |
|
| 2014 | + $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')'; |
|
| 2015 | + |
|
| 2016 | + $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2017 | + if ($flag_env) { |
|
| 2018 | + $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2019 | + } |
|
| 2020 | + |
|
| 2021 | + $p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect') ?? ''"); |
|
| 2022 | + } elseif (!isset($_contexte[1])) { |
|
| 2023 | + $msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']]; |
|
| 2024 | + erreur_squelette($msg, $p); |
|
| 2025 | + } else { |
|
| 2026 | + $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2027 | + } |
|
| 2028 | + |
|
| 2029 | + $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
|
| 2030 | + return $p; |
|
| 2031 | 2031 | } |
| 2032 | 2032 | |
| 2033 | 2033 | |
@@ -2055,69 +2055,69 @@ discard block |
||
| 2055 | 2055 | **/ |
| 2056 | 2056 | function balise_MODELE_dist($p) { |
| 2057 | 2057 | |
| 2058 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false); |
|
| 2059 | - |
|
| 2060 | - // erreur de syntaxe = fond absent |
|
| 2061 | - // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 2062 | - if (!$_contexte) { |
|
| 2063 | - $_contexte = []; |
|
| 2064 | - } |
|
| 2065 | - |
|
| 2066 | - if (!isset($_contexte[1])) { |
|
| 2067 | - $msg = ['zbug_balise_sans_argument', ['balise' => ' MODELE']]; |
|
| 2068 | - erreur_squelette($msg, $p); |
|
| 2069 | - } else { |
|
| 2070 | - $nom = $_contexte[1]; |
|
| 2071 | - unset($_contexte[1]); |
|
| 2072 | - |
|
| 2073 | - if (preg_match("/^\s*'[^']*'/s", $nom)) { |
|
| 2074 | - $nom = "'modeles/" . substr($nom, 1); |
|
| 2075 | - } else { |
|
| 2076 | - $nom = "'modeles/' . $nom"; |
|
| 2077 | - } |
|
| 2078 | - |
|
| 2079 | - $flag_env = false; |
|
| 2080 | - if (isset($_contexte['env'])) { |
|
| 2081 | - $flag_env = true; |
|
| 2082 | - unset($_contexte['env']); |
|
| 2083 | - } |
|
| 2084 | - |
|
| 2085 | - // Incoherence dans la syntaxe du contexte. A revoir. |
|
| 2086 | - // Reserver la cle primaire de la boucle courante si elle existe |
|
| 2087 | - if (isset($p->boucles[$p->id_boucle]->primary)) { |
|
| 2088 | - $primary = $p->boucles[$p->id_boucle]->primary; |
|
| 2089 | - if (!strpos($primary, ',')) { |
|
| 2090 | - $id = champ_sql($primary, $p); |
|
| 2091 | - $_contexte[] = "'$primary'=>" . $id; |
|
| 2092 | - $_contexte[] = "'id'=>" . $id; |
|
| 2093 | - } |
|
| 2094 | - } |
|
| 2095 | - $_contexte[] = "'recurs'=>(++\$recurs)"; |
|
| 2096 | - $connect = ''; |
|
| 2097 | - if (isset($p->boucles[$p->id_boucle])) { |
|
| 2098 | - $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2099 | - } |
|
| 2100 | - |
|
| 2101 | - $_options = memoriser_contexte_compil($p); |
|
| 2102 | - $_options = "'compil'=>array($_options), 'trim'=>true"; |
|
| 2103 | - if (isset($_contexte['ajax'])) { |
|
| 2104 | - $_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2105 | - unset($_contexte['ajax']); |
|
| 2106 | - } |
|
| 2107 | - |
|
| 2108 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2109 | - if ($flag_env) { |
|
| 2110 | - $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2111 | - } |
|
| 2112 | - |
|
| 2113 | - $page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect)); |
|
| 2114 | - |
|
| 2115 | - $p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n"; |
|
| 2116 | - |
|
| 2117 | - $p->interdire_scripts = false; // securite assuree par le squelette |
|
| 2118 | - } |
|
| 2119 | - |
|
| 2120 | - return $p; |
|
| 2058 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false); |
|
| 2059 | + |
|
| 2060 | + // erreur de syntaxe = fond absent |
|
| 2061 | + // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 2062 | + if (!$_contexte) { |
|
| 2063 | + $_contexte = []; |
|
| 2064 | + } |
|
| 2065 | + |
|
| 2066 | + if (!isset($_contexte[1])) { |
|
| 2067 | + $msg = ['zbug_balise_sans_argument', ['balise' => ' MODELE']]; |
|
| 2068 | + erreur_squelette($msg, $p); |
|
| 2069 | + } else { |
|
| 2070 | + $nom = $_contexte[1]; |
|
| 2071 | + unset($_contexte[1]); |
|
| 2072 | + |
|
| 2073 | + if (preg_match("/^\s*'[^']*'/s", $nom)) { |
|
| 2074 | + $nom = "'modeles/" . substr($nom, 1); |
|
| 2075 | + } else { |
|
| 2076 | + $nom = "'modeles/' . $nom"; |
|
| 2077 | + } |
|
| 2078 | + |
|
| 2079 | + $flag_env = false; |
|
| 2080 | + if (isset($_contexte['env'])) { |
|
| 2081 | + $flag_env = true; |
|
| 2082 | + unset($_contexte['env']); |
|
| 2083 | + } |
|
| 2084 | + |
|
| 2085 | + // Incoherence dans la syntaxe du contexte. A revoir. |
|
| 2086 | + // Reserver la cle primaire de la boucle courante si elle existe |
|
| 2087 | + if (isset($p->boucles[$p->id_boucle]->primary)) { |
|
| 2088 | + $primary = $p->boucles[$p->id_boucle]->primary; |
|
| 2089 | + if (!strpos($primary, ',')) { |
|
| 2090 | + $id = champ_sql($primary, $p); |
|
| 2091 | + $_contexte[] = "'$primary'=>" . $id; |
|
| 2092 | + $_contexte[] = "'id'=>" . $id; |
|
| 2093 | + } |
|
| 2094 | + } |
|
| 2095 | + $_contexte[] = "'recurs'=>(++\$recurs)"; |
|
| 2096 | + $connect = ''; |
|
| 2097 | + if (isset($p->boucles[$p->id_boucle])) { |
|
| 2098 | + $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2099 | + } |
|
| 2100 | + |
|
| 2101 | + $_options = memoriser_contexte_compil($p); |
|
| 2102 | + $_options = "'compil'=>array($_options), 'trim'=>true"; |
|
| 2103 | + if (isset($_contexte['ajax'])) { |
|
| 2104 | + $_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2105 | + unset($_contexte['ajax']); |
|
| 2106 | + } |
|
| 2107 | + |
|
| 2108 | + $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2109 | + if ($flag_env) { |
|
| 2110 | + $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2111 | + } |
|
| 2112 | + |
|
| 2113 | + $page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect)); |
|
| 2114 | + |
|
| 2115 | + $p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n"; |
|
| 2116 | + |
|
| 2117 | + $p->interdire_scripts = false; // securite assuree par le squelette |
|
| 2118 | + } |
|
| 2119 | + |
|
| 2120 | + return $p; |
|
| 2121 | 2121 | } |
| 2122 | 2122 | |
| 2123 | 2123 | |
@@ -2141,21 +2141,21 @@ discard block |
||
| 2141 | 2141 | * Pile complétée par le code à générer |
| 2142 | 2142 | **/ |
| 2143 | 2143 | function balise_SET_dist($p) { |
| 2144 | - $_nom = interprete_argument_balise(1, $p); |
|
| 2145 | - $_val = interprete_argument_balise(2, $p); |
|
| 2144 | + $_nom = interprete_argument_balise(1, $p); |
|
| 2145 | + $_val = interprete_argument_balise(2, $p); |
|
| 2146 | 2146 | |
| 2147 | - if (!$_nom or !$_val) { |
|
| 2148 | - $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SET']]; |
|
| 2149 | - erreur_squelette($err_b_s_a, $p); |
|
| 2150 | - } |
|
| 2151 | - // affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4 |
|
| 2152 | - // cf https://bugs.php.net/bug.php?id=65845 |
|
| 2153 | - else { |
|
| 2154 | - $p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)"; |
|
| 2155 | - } |
|
| 2147 | + if (!$_nom or !$_val) { |
|
| 2148 | + $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SET']]; |
|
| 2149 | + erreur_squelette($err_b_s_a, $p); |
|
| 2150 | + } |
|
| 2151 | + // affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4 |
|
| 2152 | + // cf https://bugs.php.net/bug.php?id=65845 |
|
| 2153 | + else { |
|
| 2154 | + $p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)"; |
|
| 2155 | + } |
|
| 2156 | 2156 | |
| 2157 | - $p->interdire_scripts = false; // la balise ne renvoie rien |
|
| 2158 | - return $p; |
|
| 2157 | + $p->interdire_scripts = false; // la balise ne renvoie rien |
|
| 2158 | + return $p; |
|
| 2159 | 2159 | } |
| 2160 | 2160 | |
| 2161 | 2161 | |
@@ -2185,12 +2185,12 @@ discard block |
||
| 2185 | 2185 | * Pile complétée par le code à générer |
| 2186 | 2186 | **/ |
| 2187 | 2187 | function balise_GET_dist($p) { |
| 2188 | - $p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance |
|
| 2189 | - if (function_exists('balise_ENV')) { |
|
| 2190 | - return balise_ENV($p, '$Pile["vars"]??[]'); |
|
| 2191 | - } else { |
|
| 2192 | - return balise_ENV_dist($p, '$Pile["vars"]??[]'); |
|
| 2193 | - } |
|
| 2188 | + $p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance |
|
| 2189 | + if (function_exists('balise_ENV')) { |
|
| 2190 | + return balise_ENV($p, '$Pile["vars"]??[]'); |
|
| 2191 | + } else { |
|
| 2192 | + return balise_ENV_dist($p, '$Pile["vars"]??[]'); |
|
| 2193 | + } |
|
| 2194 | 2194 | } |
| 2195 | 2195 | |
| 2196 | 2196 | |
@@ -2213,22 +2213,22 @@ discard block |
||
| 2213 | 2213 | * Pile complétée par le code à générer |
| 2214 | 2214 | **/ |
| 2215 | 2215 | function balise_DOUBLONS_dist($p) { |
| 2216 | - if ($type = interprete_argument_balise(1, $p)) { |
|
| 2217 | - if ($famille = interprete_argument_balise(2, $p)) { |
|
| 2218 | - $type .= '.' . $famille; |
|
| 2219 | - } |
|
| 2220 | - $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2221 | - if (!$p->etoile) { |
|
| 2222 | - $p->code = 'array_filter(array_map("intval",explode(",",' |
|
| 2223 | - . $p->code . ')))'; |
|
| 2224 | - } |
|
| 2225 | - } else { |
|
| 2226 | - $p->code = '$doublons'; |
|
| 2227 | - } |
|
| 2216 | + if ($type = interprete_argument_balise(1, $p)) { |
|
| 2217 | + if ($famille = interprete_argument_balise(2, $p)) { |
|
| 2218 | + $type .= '.' . $famille; |
|
| 2219 | + } |
|
| 2220 | + $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2221 | + if (!$p->etoile) { |
|
| 2222 | + $p->code = 'array_filter(array_map("intval",explode(",",' |
|
| 2223 | + . $p->code . ')))'; |
|
| 2224 | + } |
|
| 2225 | + } else { |
|
| 2226 | + $p->code = '$doublons'; |
|
| 2227 | + } |
|
| 2228 | 2228 | |
| 2229 | - $p->interdire_scripts = false; |
|
| 2229 | + $p->interdire_scripts = false; |
|
| 2230 | 2230 | |
| 2231 | - return $p; |
|
| 2231 | + return $p; |
|
| 2232 | 2232 | } |
| 2233 | 2233 | |
| 2234 | 2234 | |
@@ -2251,18 +2251,18 @@ discard block |
||
| 2251 | 2251 | * Pile complétée par le code à générer |
| 2252 | 2252 | **/ |
| 2253 | 2253 | function balise_PIPELINE_dist($p) { |
| 2254 | - $_pipe = interprete_argument_balise(1, $p); |
|
| 2255 | - if (!$_pipe) { |
|
| 2256 | - $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'PIPELINE']]; |
|
| 2257 | - erreur_squelette($err_b_s_a, $p); |
|
| 2258 | - } else { |
|
| 2259 | - $_flux = interprete_argument_balise(2, $p); |
|
| 2260 | - $_flux = $_flux ?: "''"; |
|
| 2261 | - $p->code = "pipeline( $_pipe , $_flux )"; |
|
| 2262 | - $p->interdire_scripts = false; |
|
| 2263 | - } |
|
| 2254 | + $_pipe = interprete_argument_balise(1, $p); |
|
| 2255 | + if (!$_pipe) { |
|
| 2256 | + $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'PIPELINE']]; |
|
| 2257 | + erreur_squelette($err_b_s_a, $p); |
|
| 2258 | + } else { |
|
| 2259 | + $_flux = interprete_argument_balise(2, $p); |
|
| 2260 | + $_flux = $_flux ?: "''"; |
|
| 2261 | + $p->code = "pipeline( $_pipe , $_flux )"; |
|
| 2262 | + $p->interdire_scripts = false; |
|
| 2263 | + } |
|
| 2264 | 2264 | |
| 2265 | - return $p; |
|
| 2265 | + return $p; |
|
| 2266 | 2266 | } |
| 2267 | 2267 | |
| 2268 | 2268 | |
@@ -2287,10 +2287,10 @@ discard block |
||
| 2287 | 2287 | * Pile complétée par le code à générer |
| 2288 | 2288 | **/ |
| 2289 | 2289 | function balise_EDIT_dist($p) { |
| 2290 | - $p->code = "''"; |
|
| 2291 | - $p->interdire_scripts = false; |
|
| 2290 | + $p->code = "''"; |
|
| 2291 | + $p->interdire_scripts = false; |
|
| 2292 | 2292 | |
| 2293 | - return $p; |
|
| 2293 | + return $p; |
|
| 2294 | 2294 | } |
| 2295 | 2295 | |
| 2296 | 2296 | |
@@ -2313,11 +2313,11 @@ discard block |
||
| 2313 | 2313 | * Pile complétée par le code à générer |
| 2314 | 2314 | **/ |
| 2315 | 2315 | function balise_TOTAL_UNIQUE_dist($p) { |
| 2316 | - $_famille = interprete_argument_balise(1, $p); |
|
| 2317 | - $_famille = $_famille ?: "''"; |
|
| 2318 | - $p->code = "unique('', $_famille, true)"; |
|
| 2316 | + $_famille = interprete_argument_balise(1, $p); |
|
| 2317 | + $_famille = $_famille ?: "''"; |
|
| 2318 | + $p->code = "unique('', $_famille, true)"; |
|
| 2319 | 2319 | |
| 2320 | - return $p; |
|
| 2320 | + return $p; |
|
| 2321 | 2321 | } |
| 2322 | 2322 | |
| 2323 | 2323 | /** |
@@ -2340,19 +2340,19 @@ discard block |
||
| 2340 | 2340 | * Pile complétée par le code à générer |
| 2341 | 2341 | **/ |
| 2342 | 2342 | function balise_ARRAY_dist($p) { |
| 2343 | - $_code = []; |
|
| 2344 | - $n = 1; |
|
| 2345 | - do { |
|
| 2346 | - $_key = interprete_argument_balise($n++, $p); |
|
| 2347 | - $_val = interprete_argument_balise($n++, $p); |
|
| 2348 | - if ($_key and $_val) { |
|
| 2349 | - $_code[] = "$_key => $_val"; |
|
| 2350 | - } |
|
| 2351 | - } while ($_key && $_val); |
|
| 2352 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2353 | - $p->interdire_scripts = false; |
|
| 2343 | + $_code = []; |
|
| 2344 | + $n = 1; |
|
| 2345 | + do { |
|
| 2346 | + $_key = interprete_argument_balise($n++, $p); |
|
| 2347 | + $_val = interprete_argument_balise($n++, $p); |
|
| 2348 | + if ($_key and $_val) { |
|
| 2349 | + $_code[] = "$_key => $_val"; |
|
| 2350 | + } |
|
| 2351 | + } while ($_key && $_val); |
|
| 2352 | + $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2353 | + $p->interdire_scripts = false; |
|
| 2354 | 2354 | |
| 2355 | - return $p; |
|
| 2355 | + return $p; |
|
| 2356 | 2356 | } |
| 2357 | 2357 | |
| 2358 | 2358 | /** |
@@ -2371,15 +2371,15 @@ discard block |
||
| 2371 | 2371 | * Pile complétée par le code à générer |
| 2372 | 2372 | */ |
| 2373 | 2373 | function balise_LISTE_dist($p) { |
| 2374 | - $_code = []; |
|
| 2375 | - $n = 1; |
|
| 2376 | - while ($_val = interprete_argument_balise($n++, $p)) { |
|
| 2377 | - $_code[] = $_val; |
|
| 2378 | - } |
|
| 2379 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2380 | - $p->interdire_scripts = false; |
|
| 2374 | + $_code = []; |
|
| 2375 | + $n = 1; |
|
| 2376 | + while ($_val = interprete_argument_balise($n++, $p)) { |
|
| 2377 | + $_code[] = $_val; |
|
| 2378 | + } |
|
| 2379 | + $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2380 | + $p->interdire_scripts = false; |
|
| 2381 | 2381 | |
| 2382 | - return $p; |
|
| 2382 | + return $p; |
|
| 2383 | 2383 | } |
| 2384 | 2384 | |
| 2385 | 2385 | |
@@ -2413,21 +2413,21 @@ discard block |
||
| 2413 | 2413 | * Pile complétée par le code à générer |
| 2414 | 2414 | **/ |
| 2415 | 2415 | function balise_AUTORISER_dist($p) { |
| 2416 | - $_code = []; |
|
| 2417 | - $p->descr['session'] = true; // faire un cache par session |
|
| 2416 | + $_code = []; |
|
| 2417 | + $p->descr['session'] = true; // faire un cache par session |
|
| 2418 | 2418 | |
| 2419 | - $n = 1; |
|
| 2420 | - while ($_v = interprete_argument_balise($n++, $p)) { |
|
| 2421 | - $_code[] = $_v; |
|
| 2422 | - } |
|
| 2419 | + $n = 1; |
|
| 2420 | + while ($_v = interprete_argument_balise($n++, $p)) { |
|
| 2421 | + $_code[] = $_v; |
|
| 2422 | + } |
|
| 2423 | 2423 | |
| 2424 | - $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join( |
|
| 2425 | - ', ', |
|
| 2426 | - $_code |
|
| 2427 | - ) . ')?" ":"")'; |
|
| 2428 | - $p->interdire_scripts = false; |
|
| 2424 | + $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join( |
|
| 2425 | + ', ', |
|
| 2426 | + $_code |
|
| 2427 | + ) . ')?" ":"")'; |
|
| 2428 | + $p->interdire_scripts = false; |
|
| 2429 | 2429 | |
| 2430 | - return $p; |
|
| 2430 | + return $p; |
|
| 2431 | 2431 | } |
| 2432 | 2432 | |
| 2433 | 2433 | |
@@ -2451,15 +2451,15 @@ discard block |
||
| 2451 | 2451 | * Pile complétée par le code à générer |
| 2452 | 2452 | **/ |
| 2453 | 2453 | function balise_PLUGIN_dist($p) { |
| 2454 | - $plugin = interprete_argument_balise(1, $p); |
|
| 2455 | - $plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""'; |
|
| 2456 | - $type_info = interprete_argument_balise(2, $p); |
|
| 2457 | - $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
|
| 2454 | + $plugin = interprete_argument_balise(1, $p); |
|
| 2455 | + $plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""'; |
|
| 2456 | + $type_info = interprete_argument_balise(2, $p); |
|
| 2457 | + $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
|
| 2458 | 2458 | |
| 2459 | - $f = chercher_filtre('info_plugin'); |
|
| 2460 | - $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2459 | + $f = chercher_filtre('info_plugin'); |
|
| 2460 | + $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2461 | 2461 | |
| 2462 | - return $p; |
|
| 2462 | + return $p; |
|
| 2463 | 2463 | } |
| 2464 | 2464 | |
| 2465 | 2465 | /** |
@@ -2480,9 +2480,9 @@ discard block |
||
| 2480 | 2480 | * Pile complétée par le code à générer |
| 2481 | 2481 | **/ |
| 2482 | 2482 | function balise_AIDER_dist($p) { |
| 2483 | - $_motif = interprete_argument_balise(1, $p); |
|
| 2484 | - $p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif):'')"; |
|
| 2485 | - return $p; |
|
| 2483 | + $_motif = interprete_argument_balise(1, $p); |
|
| 2484 | + $p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif):'')"; |
|
| 2485 | + return $p; |
|
| 2486 | 2486 | } |
| 2487 | 2487 | |
| 2488 | 2488 | /** |
@@ -2508,16 +2508,16 @@ discard block |
||
| 2508 | 2508 | * Pile complétée par le code à générer |
| 2509 | 2509 | **/ |
| 2510 | 2510 | function balise_ACTION_FORMULAIRE($p) { |
| 2511 | - if (!$_url = interprete_argument_balise(1, $p)) { |
|
| 2512 | - $_url = "(\$Pile[0]['action'] ?? '')"; |
|
| 2513 | - } |
|
| 2514 | - if (!$_form = interprete_argument_balise(2, $p)) { |
|
| 2515 | - $_form = "(\$Pile[0]['form'] ?? '')"; |
|
| 2516 | - } |
|
| 2517 | - |
|
| 2518 | - // envoyer le nom du formulaire que l'on traite |
|
| 2519 | - // transmettre les eventuels args de la balise formulaire |
|
| 2520 | - $p->code = " '<span class=\"form-hidden\">' . |
|
| 2511 | + if (!$_url = interprete_argument_balise(1, $p)) { |
|
| 2512 | + $_url = "(\$Pile[0]['action'] ?? '')"; |
|
| 2513 | + } |
|
| 2514 | + if (!$_form = interprete_argument_balise(2, $p)) { |
|
| 2515 | + $_form = "(\$Pile[0]['form'] ?? '')"; |
|
| 2516 | + } |
|
| 2517 | + |
|
| 2518 | + // envoyer le nom du formulaire que l'on traite |
|
| 2519 | + // transmettre les eventuels args de la balise formulaire |
|
| 2520 | + $p->code = " '<span class=\"form-hidden\">' . |
|
| 2521 | 2521 | form_hidden($_url) . |
| 2522 | 2522 | '<input name=\'formulaire_action\' type=\'hidden\' |
| 2523 | 2523 | value=\'' . $_form . '\' />' . |
@@ -2528,9 +2528,9 @@ discard block |
||
| 2528 | 2528 | (\$Pile[0]['_hidden'] ?? '') . |
| 2529 | 2529 | '</span>'"; |
| 2530 | 2530 | |
| 2531 | - $p->interdire_scripts = false; |
|
| 2531 | + $p->interdire_scripts = false; |
|
| 2532 | 2532 | |
| 2533 | - return $p; |
|
| 2533 | + return $p; |
|
| 2534 | 2534 | } |
| 2535 | 2535 | |
| 2536 | 2536 | |
@@ -2571,25 +2571,25 @@ discard block |
||
| 2571 | 2571 | */ |
| 2572 | 2572 | function balise_BOUTON_ACTION_dist($p) { |
| 2573 | 2573 | |
| 2574 | - $args = []; |
|
| 2575 | - for ($k = 1; $k <= 6; $k++) { |
|
| 2576 | - $_a = interprete_argument_balise($k, $p); |
|
| 2577 | - if (!$_a) { |
|
| 2578 | - $_a = "''"; |
|
| 2579 | - } |
|
| 2580 | - $args[] = $_a; |
|
| 2581 | - } |
|
| 2582 | - // supprimer les args vides |
|
| 2583 | - while (end($args) == "''" and count($args) > 2) { |
|
| 2584 | - array_pop($args); |
|
| 2585 | - } |
|
| 2586 | - $args = implode(',', $args); |
|
| 2574 | + $args = []; |
|
| 2575 | + for ($k = 1; $k <= 6; $k++) { |
|
| 2576 | + $_a = interprete_argument_balise($k, $p); |
|
| 2577 | + if (!$_a) { |
|
| 2578 | + $_a = "''"; |
|
| 2579 | + } |
|
| 2580 | + $args[] = $_a; |
|
| 2581 | + } |
|
| 2582 | + // supprimer les args vides |
|
| 2583 | + while (end($args) == "''" and count($args) > 2) { |
|
| 2584 | + array_pop($args); |
|
| 2585 | + } |
|
| 2586 | + $args = implode(',', $args); |
|
| 2587 | 2587 | |
| 2588 | - $bouton_action = chercher_filtre('bouton_action'); |
|
| 2589 | - $p->code = "$bouton_action($args)"; |
|
| 2590 | - $p->interdire_scripts = false; |
|
| 2588 | + $bouton_action = chercher_filtre('bouton_action'); |
|
| 2589 | + $p->code = "$bouton_action($args)"; |
|
| 2590 | + $p->interdire_scripts = false; |
|
| 2591 | 2591 | |
| 2592 | - return $p; |
|
| 2592 | + return $p; |
|
| 2593 | 2593 | } |
| 2594 | 2594 | |
| 2595 | 2595 | |
@@ -2608,10 +2608,10 @@ discard block |
||
| 2608 | 2608 | * Pile complétée par le code à générer |
| 2609 | 2609 | */ |
| 2610 | 2610 | function balise_SLOGAN_SITE_SPIP_dist($p) { |
| 2611 | - $p->code = "\$GLOBALS['meta']['slogan_site']"; |
|
| 2611 | + $p->code = "\$GLOBALS['meta']['slogan_site']"; |
|
| 2612 | 2612 | |
| 2613 | - #$p->interdire_scripts = true; |
|
| 2614 | - return $p; |
|
| 2613 | + #$p->interdire_scripts = true; |
|
| 2614 | + return $p; |
|
| 2615 | 2615 | } |
| 2616 | 2616 | |
| 2617 | 2617 | |
@@ -2635,10 +2635,10 @@ discard block |
||
| 2635 | 2635 | * Pile complétée par le code à générer |
| 2636 | 2636 | */ |
| 2637 | 2637 | function balise_HTML5_dist($p) { |
| 2638 | - $p->code = html5_permis() ? "' '" : "''"; |
|
| 2639 | - $p->interdire_scripts = false; |
|
| 2638 | + $p->code = html5_permis() ? "' '" : "''"; |
|
| 2639 | + $p->interdire_scripts = false; |
|
| 2640 | 2640 | |
| 2641 | - return $p; |
|
| 2641 | + return $p; |
|
| 2642 | 2642 | } |
| 2643 | 2643 | |
| 2644 | 2644 | |
@@ -2664,61 +2664,61 @@ discard block |
||
| 2664 | 2664 | * Pile complétée par le code à générer |
| 2665 | 2665 | */ |
| 2666 | 2666 | function balise_TRI_dist($p, $liste = 'true') { |
| 2667 | - $b = index_boucle_mere($p); |
|
| 2668 | - // s'il n'y a pas de nom de boucle, on ne peut pas trier |
|
| 2669 | - if ($b === '') { |
|
| 2670 | - $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 2671 | - erreur_squelette($msg, $p); |
|
| 2672 | - $p->code = "''"; |
|
| 2667 | + $b = index_boucle_mere($p); |
|
| 2668 | + // s'il n'y a pas de nom de boucle, on ne peut pas trier |
|
| 2669 | + if ($b === '') { |
|
| 2670 | + $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 2671 | + erreur_squelette($msg, $p); |
|
| 2672 | + $p->code = "''"; |
|
| 2673 | 2673 | |
| 2674 | - return $p; |
|
| 2675 | - } |
|
| 2676 | - $boucle = $p->boucles[$b]; |
|
| 2674 | + return $p; |
|
| 2675 | + } |
|
| 2676 | + $boucle = $p->boucles[$b]; |
|
| 2677 | 2677 | |
| 2678 | - // s'il n'y a pas de tri_champ, c'est qu'on se trouve |
|
| 2679 | - // dans un boucle recursive ou qu'on a oublie le critere {tri} |
|
| 2680 | - if (!isset($boucle->modificateur['tri_champ'])) { |
|
| 2681 | - $msg = ['zbug_champ_hors_critere', [ |
|
| 2682 | - 'champ' => zbug_presenter_champ($p), |
|
| 2683 | - 'critere' => 'tri' |
|
| 2684 | - ]]; |
|
| 2685 | - erreur_squelette($msg, $p); |
|
| 2686 | - $p->code = "''"; |
|
| 2678 | + // s'il n'y a pas de tri_champ, c'est qu'on se trouve |
|
| 2679 | + // dans un boucle recursive ou qu'on a oublie le critere {tri} |
|
| 2680 | + if (!isset($boucle->modificateur['tri_champ'])) { |
|
| 2681 | + $msg = ['zbug_champ_hors_critere', [ |
|
| 2682 | + 'champ' => zbug_presenter_champ($p), |
|
| 2683 | + 'critere' => 'tri' |
|
| 2684 | + ]]; |
|
| 2685 | + erreur_squelette($msg, $p); |
|
| 2686 | + $p->code = "''"; |
|
| 2687 | 2687 | |
| 2688 | - return $p; |
|
| 2689 | - } |
|
| 2688 | + return $p; |
|
| 2689 | + } |
|
| 2690 | 2690 | |
| 2691 | - $_champ = interprete_argument_balise(1, $p); |
|
| 2692 | - // si pas de champ, renvoyer le critere de tri utilise |
|
| 2693 | - if (!$_champ) { |
|
| 2694 | - $p->code = $boucle->modificateur['tri_champ']; |
|
| 2691 | + $_champ = interprete_argument_balise(1, $p); |
|
| 2692 | + // si pas de champ, renvoyer le critere de tri utilise |
|
| 2693 | + if (!$_champ) { |
|
| 2694 | + $p->code = $boucle->modificateur['tri_champ']; |
|
| 2695 | 2695 | |
| 2696 | - return $p; |
|
| 2697 | - } |
|
| 2698 | - // forcer la jointure si besoin, et si le champ est statique |
|
| 2699 | - if (preg_match(",^'([\w.]+)'$,i", $_champ, $m)) { |
|
| 2700 | - index_pile($b, $m[1], $p->boucles, '', null, true, false); |
|
| 2701 | - } |
|
| 2696 | + return $p; |
|
| 2697 | + } |
|
| 2698 | + // forcer la jointure si besoin, et si le champ est statique |
|
| 2699 | + if (preg_match(",^'([\w.]+)'$,i", $_champ, $m)) { |
|
| 2700 | + index_pile($b, $m[1], $p->boucles, '', null, true, false); |
|
| 2701 | + } |
|
| 2702 | 2702 | |
| 2703 | - $_libelle = interprete_argument_balise(2, $p); |
|
| 2704 | - $_libelle = $_libelle ?: $_champ; |
|
| 2703 | + $_libelle = interprete_argument_balise(2, $p); |
|
| 2704 | + $_libelle = $_libelle ?: $_champ; |
|
| 2705 | 2705 | |
| 2706 | - $_class = interprete_argument_balise(3, $p); |
|
| 2707 | - // si champ = ">" c'est un lien vers le tri croissant : de gauche a droite ==> 1 |
|
| 2708 | - // si champ = "<" c'est un lien vers le tri decroissant : (sens inverse) == -1 |
|
| 2709 | - $_issens = "in_array($_champ,array('>','<'))"; |
|
| 2710 | - $_sens = "(strpos('< >',$_champ)-1)"; |
|
| 2706 | + $_class = interprete_argument_balise(3, $p); |
|
| 2707 | + // si champ = ">" c'est un lien vers le tri croissant : de gauche a droite ==> 1 |
|
| 2708 | + // si champ = "<" c'est un lien vers le tri decroissant : (sens inverse) == -1 |
|
| 2709 | + $_issens = "in_array($_champ,array('>','<'))"; |
|
| 2710 | + $_sens = "(strpos('< >',$_champ)-1)"; |
|
| 2711 | 2711 | |
| 2712 | - $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2713 | - $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
|
| 2714 | - $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2715 | - $_on = '$s?(' . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2712 | + $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2713 | + $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
|
| 2714 | + $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2715 | + $_on = '$s?(' . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2716 | 2716 | |
| 2717 | - $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : '') . ')'; |
|
| 2718 | - //$p->code = "''"; |
|
| 2719 | - $p->interdire_scripts = false; |
|
| 2717 | + $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : '') . ')'; |
|
| 2718 | + //$p->code = "''"; |
|
| 2719 | + $p->interdire_scripts = false; |
|
| 2720 | 2720 | |
| 2721 | - return $p; |
|
| 2721 | + return $p; |
|
| 2722 | 2722 | } |
| 2723 | 2723 | |
| 2724 | 2724 | |
@@ -2739,21 +2739,21 @@ discard block |
||
| 2739 | 2739 | * Pile complétée par le code à générer |
| 2740 | 2740 | */ |
| 2741 | 2741 | function balise_SAUTER_dist($p) { |
| 2742 | - $id_boucle = $p->id_boucle; |
|
| 2742 | + $id_boucle = $p->id_boucle; |
|
| 2743 | 2743 | |
| 2744 | - if (empty($p->boucles[$id_boucle])) { |
|
| 2745 | - $msg = ['zbug_champ_hors_boucle', ['champ' => '#SAUTER']]; |
|
| 2746 | - erreur_squelette($msg, $p); |
|
| 2747 | - } else { |
|
| 2748 | - $_saut = interprete_argument_balise(1, $p); |
|
| 2749 | - $_compteur = "\$Numrows['$id_boucle']['compteur_boucle']"; |
|
| 2750 | - $_total = "(\$Numrows['$id_boucle']['total'] ?? null)"; |
|
| 2744 | + if (empty($p->boucles[$id_boucle])) { |
|
| 2745 | + $msg = ['zbug_champ_hors_boucle', ['champ' => '#SAUTER']]; |
|
| 2746 | + erreur_squelette($msg, $p); |
|
| 2747 | + } else { |
|
| 2748 | + $_saut = interprete_argument_balise(1, $p); |
|
| 2749 | + $_compteur = "\$Numrows['$id_boucle']['compteur_boucle']"; |
|
| 2750 | + $_total = "(\$Numrows['$id_boucle']['total'] ?? null)"; |
|
| 2751 | 2751 | |
| 2752 | - $p->code = "vide($_compteur=\$iter->skip($_saut,$_total))"; |
|
| 2753 | - } |
|
| 2754 | - $p->interdire_scripts = false; |
|
| 2752 | + $p->code = "vide($_compteur=\$iter->skip($_saut,$_total))"; |
|
| 2753 | + } |
|
| 2754 | + $p->interdire_scripts = false; |
|
| 2755 | 2755 | |
| 2756 | - return $p; |
|
| 2756 | + return $p; |
|
| 2757 | 2757 | } |
| 2758 | 2758 | |
| 2759 | 2759 | |
@@ -2775,22 +2775,22 @@ discard block |
||
| 2775 | 2775 | * Pile complétée par le code à générer |
| 2776 | 2776 | */ |
| 2777 | 2777 | function balise_PUBLIE_dist($p) { |
| 2778 | - if (!$_type = interprete_argument_balise(1, $p)) { |
|
| 2779 | - $_type = _q($p->type_requete); |
|
| 2780 | - $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p); |
|
| 2781 | - } else { |
|
| 2782 | - $_id = interprete_argument_balise(2, $p); |
|
| 2783 | - } |
|
| 2778 | + if (!$_type = interprete_argument_balise(1, $p)) { |
|
| 2779 | + $_type = _q($p->type_requete); |
|
| 2780 | + $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p); |
|
| 2781 | + } else { |
|
| 2782 | + $_id = interprete_argument_balise(2, $p); |
|
| 2783 | + } |
|
| 2784 | 2784 | |
| 2785 | - $connect = ''; |
|
| 2786 | - if (isset($p->boucles[$p->id_boucle])) { |
|
| 2787 | - $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2788 | - } |
|
| 2785 | + $connect = ''; |
|
| 2786 | + if (isset($p->boucles[$p->id_boucle])) { |
|
| 2787 | + $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2788 | + } |
|
| 2789 | 2789 | |
| 2790 | - $p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')"; |
|
| 2791 | - $p->interdire_scripts = false; |
|
| 2790 | + $p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')"; |
|
| 2791 | + $p->interdire_scripts = false; |
|
| 2792 | 2792 | |
| 2793 | - return $p; |
|
| 2793 | + return $p; |
|
| 2794 | 2794 | } |
| 2795 | 2795 | |
| 2796 | 2796 | /** |
@@ -2819,12 +2819,12 @@ discard block |
||
| 2819 | 2819 | * Pile complétée par le code à générer |
| 2820 | 2820 | */ |
| 2821 | 2821 | function balise_PRODUIRE_dist($p) { |
| 2822 | - $balise_inclure = charger_fonction('INCLURE', 'balise'); |
|
| 2823 | - $p = $balise_inclure($p); |
|
| 2822 | + $balise_inclure = charger_fonction('INCLURE', 'balise'); |
|
| 2823 | + $p = $balise_inclure($p); |
|
| 2824 | 2824 | |
| 2825 | - $p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code); |
|
| 2825 | + $p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code); |
|
| 2826 | 2826 | |
| 2827 | - return $p; |
|
| 2827 | + return $p; |
|
| 2828 | 2828 | } |
| 2829 | 2829 | |
| 2830 | 2830 | /** |
@@ -2843,13 +2843,13 @@ discard block |
||
| 2843 | 2843 | * Pile complétée par le code à générer |
| 2844 | 2844 | */ |
| 2845 | 2845 | function balise_LARGEUR_ECRAN_dist($p) { |
| 2846 | - $_class = interprete_argument_balise(1, $p); |
|
| 2847 | - if (!$_class) { |
|
| 2848 | - $_class = 'null'; |
|
| 2849 | - } |
|
| 2850 | - $p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))"; |
|
| 2846 | + $_class = interprete_argument_balise(1, $p); |
|
| 2847 | + if (!$_class) { |
|
| 2848 | + $_class = 'null'; |
|
| 2849 | + } |
|
| 2850 | + $p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))"; |
|
| 2851 | 2851 | |
| 2852 | - return $p; |
|
| 2852 | + return $p; |
|
| 2853 | 2853 | } |
| 2854 | 2854 | |
| 2855 | 2855 | |
@@ -2865,14 +2865,14 @@ discard block |
||
| 2865 | 2865 | * Pile complétée par le code à générer |
| 2866 | 2866 | **/ |
| 2867 | 2867 | function balise_CONST_dist($p) { |
| 2868 | - $_const = interprete_argument_balise(1, $p); |
|
| 2869 | - if (!strlen($_const)) { |
|
| 2870 | - $p->code = "''"; |
|
| 2871 | - } |
|
| 2872 | - else { |
|
| 2873 | - $p->code = "(defined($_const)?constant($_const):'')"; |
|
| 2874 | - } |
|
| 2875 | - $p->interdire_scripts = false; |
|
| 2876 | - |
|
| 2877 | - return $p; |
|
| 2868 | + $_const = interprete_argument_balise(1, $p); |
|
| 2869 | + if (!strlen($_const)) { |
|
| 2870 | + $p->code = "''"; |
|
| 2871 | + } |
|
| 2872 | + else { |
|
| 2873 | + $p->code = "(defined($_const)?constant($_const):'')"; |
|
| 2874 | + } |
|
| 2875 | + $p->interdire_scripts = false; |
|
| 2876 | + |
|
| 2877 | + return $p; |
|
| 2878 | 2878 | } |
@@ -37,11 +37,11 @@ |
||
| 37 | 37 | include_spip('inc/filtres'); |
| 38 | 38 | |
| 39 | 39 | // Inserer le css d'admin |
| 40 | - $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 40 | + $css = "<link rel='stylesheet' href='".url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | 41 | . "' type='text/css' />\n"; |
| 42 | 42 | if ($f = find_in_path('spip_admin_perso.css')) { |
| 43 | 43 | $css .= "<link rel='stylesheet' href='" |
| 44 | - . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 44 | + . url_absolue(direction_css($f))."' type='text/css' />\n"; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | ($pos = stripos($contenu, '</head>')) |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -34,33 +34,33 @@ discard block |
||
| 34 | 34 | * Contenu HTML, avec boutons d'administrations et sa CSS |
| 35 | 35 | **/ |
| 36 | 36 | function affiche_boutons_admin($contenu) { |
| 37 | - include_spip('inc/filtres'); |
|
| 37 | + include_spip('inc/filtres'); |
|
| 38 | 38 | |
| 39 | - // Inserer le css d'admin |
|
| 40 | - $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | - . "' type='text/css' />\n"; |
|
| 42 | - if ($f = find_in_path('spip_admin_perso.css')) { |
|
| 43 | - $css .= "<link rel='stylesheet' href='" |
|
| 44 | - . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 45 | - } |
|
| 39 | + // Inserer le css d'admin |
|
| 40 | + $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | + . "' type='text/css' />\n"; |
|
| 42 | + if ($f = find_in_path('spip_admin_perso.css')) { |
|
| 43 | + $css .= "<link rel='stylesheet' href='" |
|
| 44 | + . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - ($pos = stripos($contenu, '</head>')) |
|
| 48 | - || ($pos = stripos($contenu, '<body>')) |
|
| 49 | - || ($pos = 0); |
|
| 50 | - $contenu = substr_replace($contenu, $css, $pos, 0); |
|
| 47 | + ($pos = stripos($contenu, '</head>')) |
|
| 48 | + || ($pos = stripos($contenu, '<body>')) |
|
| 49 | + || ($pos = 0); |
|
| 50 | + $contenu = substr_replace($contenu, $css, $pos, 0); |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | - // Inserer la balise #FORMULAIRE_ADMIN, en float |
|
| 54 | - $boutons_admin = inclure_balise_dynamique( |
|
| 55 | - balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'), |
|
| 56 | - false |
|
| 57 | - ); |
|
| 53 | + // Inserer la balise #FORMULAIRE_ADMIN, en float |
|
| 54 | + $boutons_admin = inclure_balise_dynamique( |
|
| 55 | + balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'), |
|
| 56 | + false |
|
| 57 | + ); |
|
| 58 | 58 | |
| 59 | - ($pos = strripos($contenu, '</body>')) |
|
| 60 | - || ($pos = strripos($contenu, '</html>')) |
|
| 61 | - || ($pos = strlen($contenu)); |
|
| 62 | - $contenu = substr_replace($contenu, $boutons_admin, $pos, 0); |
|
| 59 | + ($pos = strripos($contenu, '</body>')) |
|
| 60 | + || ($pos = strripos($contenu, '</html>')) |
|
| 61 | + || ($pos = strlen($contenu)); |
|
| 62 | + $contenu = substr_replace($contenu, $boutons_admin, $pos, 0); |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | - return $contenu; |
|
| 65 | + return $contenu; |
|
| 66 | 66 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/actions'); |
@@ -29,20 +29,20 @@ discard block |
||
| 29 | 29 | * @uses ajax_retour() |
| 30 | 30 | **/ |
| 31 | 31 | function exec_informer_dist() { |
| 32 | - $id = intval(_request('id')); |
|
| 33 | - $col = intval(_request('col')); |
|
| 34 | - $exclus = intval(_request('exclus')); |
|
| 35 | - $do = _request('do'); |
|
| 32 | + $id = intval(_request('id')); |
|
| 33 | + $col = intval(_request('col')); |
|
| 34 | + $exclus = intval(_request('exclus')); |
|
| 35 | + $do = _request('do'); |
|
| 36 | 36 | |
| 37 | - if (preg_match('/^\w*$/', $do)) { |
|
| 38 | - if (!$do) { |
|
| 39 | - $do = 'aff'; |
|
| 40 | - } |
|
| 37 | + if (preg_match('/^\w*$/', $do)) { |
|
| 38 | + if (!$do) { |
|
| 39 | + $do = 'aff'; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $informer = charger_fonction('informer', 'inc'); |
|
| 43 | - $res = $informer($id, $col, $exclus, _request('rac'), _request('type'), $do); |
|
| 44 | - } else { |
|
| 45 | - $res = ''; |
|
| 46 | - } |
|
| 47 | - ajax_retour($res); |
|
| 42 | + $informer = charger_fonction('informer', 'inc'); |
|
| 43 | + $res = $informer($id, $col, $exclus, _request('rac'), _request('type'), $do); |
|
| 44 | + } else { |
|
| 45 | + $res = ''; |
|
| 46 | + } |
|
| 47 | + ajax_retour($res); |
|
| 48 | 48 | } |
@@ -298,9 +298,9 @@ |
||
| 298 | 298 | and ($e = $flux['args']['contexte']['_etape']) > 1 |
| 299 | 299 | and $ext = $flux['args']['ext'] |
| 300 | 300 | and $f = $flux['data'] |
| 301 | - and file_exists($f . "_$e.$ext") |
|
| 301 | + and file_exists($f."_$e.$ext") |
|
| 302 | 302 | ) { |
| 303 | - $flux['data'] = $f . "_$e"; |
|
| 303 | + $flux['data'] = $f."_$e"; |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | return $flux; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | |
| 68 | 68 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 69 | - return; |
|
| 69 | + return; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -77,46 +77,46 @@ discard block |
||
| 77 | 77 | * @return array |
| 78 | 78 | */ |
| 79 | 79 | function cvtmulti_recuperer_post_precedents($form) { |
| 80 | - include_spip('inc/filtres'); |
|
| 81 | - if ( |
|
| 82 | - $form |
|
| 83 | - and $c = _request('cvtm_prev_post') |
|
| 84 | - and $c = decoder_contexte_ajax($c, $form) |
|
| 85 | - ) { |
|
| 86 | - #var_dump($c); |
|
| 80 | + include_spip('inc/filtres'); |
|
| 81 | + if ( |
|
| 82 | + $form |
|
| 83 | + and $c = _request('cvtm_prev_post') |
|
| 84 | + and $c = decoder_contexte_ajax($c, $form) |
|
| 85 | + ) { |
|
| 86 | + #var_dump($c); |
|
| 87 | 87 | |
| 88 | - # reinjecter dans la bonne variable pour permettre de retrouver |
|
| 89 | - # toutes les saisies dans un seul tableau |
|
| 90 | - if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 91 | - $store = &$_POST; |
|
| 92 | - } else { |
|
| 93 | - $store = &$_GET; |
|
| 94 | - } |
|
| 88 | + # reinjecter dans la bonne variable pour permettre de retrouver |
|
| 89 | + # toutes les saisies dans un seul tableau |
|
| 90 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 91 | + $store = &$_POST; |
|
| 92 | + } else { |
|
| 93 | + $store = &$_GET; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - foreach ($c as $k => $v) { // on ecrase pas si saisi a nouveau ! |
|
| 97 | - if (!isset($store[$k])) { |
|
| 98 | - $_REQUEST[$k] = $store[$k] = $v; |
|
| 99 | - } // mais si tableau des deux cotes, on merge avec priorite a la derniere saisie |
|
| 100 | - elseif ( |
|
| 101 | - is_array($store[$k]) |
|
| 102 | - and is_array($v) |
|
| 103 | - and $z = array_keys($v) |
|
| 104 | - and !is_numeric(reset($z)) |
|
| 105 | - and $z = array_keys($store[$k]) |
|
| 106 | - and !is_numeric(reset($z)) |
|
| 107 | - ) { |
|
| 108 | - $_REQUEST[$k] = $store[$k] = array_merge($v, $store[$k]); |
|
| 109 | - } |
|
| 110 | - } |
|
| 96 | + foreach ($c as $k => $v) { // on ecrase pas si saisi a nouveau ! |
|
| 97 | + if (!isset($store[$k])) { |
|
| 98 | + $_REQUEST[$k] = $store[$k] = $v; |
|
| 99 | + } // mais si tableau des deux cotes, on merge avec priorite a la derniere saisie |
|
| 100 | + elseif ( |
|
| 101 | + is_array($store[$k]) |
|
| 102 | + and is_array($v) |
|
| 103 | + and $z = array_keys($v) |
|
| 104 | + and !is_numeric(reset($z)) |
|
| 105 | + and $z = array_keys($store[$k]) |
|
| 106 | + and !is_numeric(reset($z)) |
|
| 107 | + ) { |
|
| 108 | + $_REQUEST[$k] = $store[$k] = array_merge($v, $store[$k]); |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - // vider pour eviter un second appel a verifier_n |
|
| 113 | - // en cas de double implementation (unipotence) |
|
| 114 | - set_request('cvtm_prev_post'); |
|
| 112 | + // vider pour eviter un second appel a verifier_n |
|
| 113 | + // en cas de double implementation (unipotence) |
|
| 114 | + set_request('cvtm_prev_post'); |
|
| 115 | 115 | |
| 116 | - return [$c['_etape'], $c['_etapes']]; |
|
| 117 | - } |
|
| 116 | + return [$c['_etape'], $c['_etapes']]; |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - return false; |
|
| 119 | + return false; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -129,28 +129,28 @@ discard block |
||
| 129 | 129 | * @return array |
| 130 | 130 | */ |
| 131 | 131 | function cvtmulti_sauver_post($form, $je_suis_poste, &$valeurs) { |
| 132 | - if (!isset($valeurs['_cvtm_prev_post'])) { |
|
| 133 | - $post = ['_etape' => $valeurs['_etape'], '_etapes' => $valeurs['_etapes']]; |
|
| 134 | - foreach (array_keys($valeurs) as $champ) { |
|
| 135 | - if (substr($champ, 0, 1) !== '_') { |
|
| 136 | - if ($je_suis_poste || (isset($valeurs['_forcer_request']) && $valeurs['_forcer_request'])) { |
|
| 137 | - if (($v = _request($champ)) !== null) { |
|
| 138 | - $post[$champ] = $v; |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - } |
|
| 142 | - } |
|
| 143 | - include_spip('inc/filtres'); |
|
| 144 | - $c = encoder_contexte_ajax($post, $form); |
|
| 145 | - if (!isset($valeurs['_hidden'])) { |
|
| 146 | - $valeurs['_hidden'] = ''; |
|
| 147 | - } |
|
| 148 | - $valeurs['_hidden'] .= "<input type='hidden' name='cvtm_prev_post' value='$c' />"; |
|
| 149 | - // marquer comme fait, pour eviter double encodage (unipotence) |
|
| 150 | - $valeurs['_cvtm_prev_post'] = true; |
|
| 151 | - } |
|
| 132 | + if (!isset($valeurs['_cvtm_prev_post'])) { |
|
| 133 | + $post = ['_etape' => $valeurs['_etape'], '_etapes' => $valeurs['_etapes']]; |
|
| 134 | + foreach (array_keys($valeurs) as $champ) { |
|
| 135 | + if (substr($champ, 0, 1) !== '_') { |
|
| 136 | + if ($je_suis_poste || (isset($valeurs['_forcer_request']) && $valeurs['_forcer_request'])) { |
|
| 137 | + if (($v = _request($champ)) !== null) { |
|
| 138 | + $post[$champ] = $v; |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + include_spip('inc/filtres'); |
|
| 144 | + $c = encoder_contexte_ajax($post, $form); |
|
| 145 | + if (!isset($valeurs['_hidden'])) { |
|
| 146 | + $valeurs['_hidden'] = ''; |
|
| 147 | + } |
|
| 148 | + $valeurs['_hidden'] .= "<input type='hidden' name='cvtm_prev_post' value='$c' />"; |
|
| 149 | + // marquer comme fait, pour eviter double encodage (unipotence) |
|
| 150 | + $valeurs['_cvtm_prev_post'] = true; |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - return $valeurs; |
|
| 153 | + return $valeurs; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
@@ -164,14 +164,14 @@ discard block |
||
| 164 | 164 | * @return array |
| 165 | 165 | */ |
| 166 | 166 | function cvtmulti_formulaire_charger($flux) { |
| 167 | - if ( |
|
| 168 | - is_array($flux['data']) |
|
| 169 | - and isset($flux['data']['_etapes']) |
|
| 170 | - ) { |
|
| 171 | - $flux['data'] = cvtmulti_formulaire_charger_etapes($flux['args'], $flux['data']); |
|
| 172 | - } |
|
| 167 | + if ( |
|
| 168 | + is_array($flux['data']) |
|
| 169 | + and isset($flux['data']['_etapes']) |
|
| 170 | + ) { |
|
| 171 | + $flux['data'] = cvtmulti_formulaire_charger_etapes($flux['args'], $flux['data']); |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | - return $flux; |
|
| 174 | + return $flux; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -181,19 +181,19 @@ discard block |
||
| 181 | 181 | * @return array |
| 182 | 182 | */ |
| 183 | 183 | function cvtmulti_formulaire_charger_etapes($args, $valeurs) { |
| 184 | - if (!isset($valeurs['_etape'])) { |
|
| 185 | - $form = $args['form']; |
|
| 186 | - $je_suis_poste = $args['je_suis_poste']; |
|
| 187 | - $nb_etapes = $valeurs['_etapes']; |
|
| 188 | - $etape = _request('_etape'); |
|
| 189 | - $etape = min(max($etape, 1), $nb_etapes); |
|
| 190 | - set_request('_etape', $etape); |
|
| 191 | - $valeurs['_etape'] = $etape; |
|
| 184 | + if (!isset($valeurs['_etape'])) { |
|
| 185 | + $form = $args['form']; |
|
| 186 | + $je_suis_poste = $args['je_suis_poste']; |
|
| 187 | + $nb_etapes = $valeurs['_etapes']; |
|
| 188 | + $etape = _request('_etape'); |
|
| 189 | + $etape = min(max($etape, 1), $nb_etapes); |
|
| 190 | + set_request('_etape', $etape); |
|
| 191 | + $valeurs['_etape'] = $etape; |
|
| 192 | 192 | |
| 193 | - // sauver les posts de cette etape pour les avoir a la prochaine etape |
|
| 194 | - $valeurs = cvtmulti_sauver_post($form, $je_suis_poste, $valeurs); |
|
| 195 | - } |
|
| 196 | - return $valeurs; |
|
| 193 | + // sauver les posts de cette etape pour les avoir a la prochaine etape |
|
| 194 | + $valeurs = cvtmulti_sauver_post($form, $je_suis_poste, $valeurs); |
|
| 195 | + } |
|
| 196 | + return $valeurs; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | * @return array |
| 207 | 207 | */ |
| 208 | 208 | function cvtmulti_formulaire_verifier($flux) { |
| 209 | - $flux['data'] = cvtmulti_formulaire_verifier_etapes($flux['args'], $flux['data']); |
|
| 210 | - return $flux; |
|
| 209 | + $flux['data'] = cvtmulti_formulaire_verifier_etapes($flux['args'], $flux['data']); |
|
| 210 | + return $flux; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -218,87 +218,87 @@ discard block |
||
| 218 | 218 | * @return array |
| 219 | 219 | */ |
| 220 | 220 | function cvtmulti_formulaire_verifier_etapes($args, $erreurs) { |
| 221 | - #var_dump('Pipe verifier'); |
|
| 221 | + #var_dump('Pipe verifier'); |
|
| 222 | 222 | |
| 223 | - if ( |
|
| 224 | - $form = $args['form'] |
|
| 225 | - and ($e = cvtmulti_recuperer_post_precedents($form)) !== false |
|
| 226 | - ) { |
|
| 227 | - // recuperer l'etape saisie et le nombre d'etapes total |
|
| 228 | - [$etape, $etapes] = $e; |
|
| 229 | - $etape_demandee = intval(_request('aller_a_etape')); // possibilite de poster un entier dans aller_a_etape |
|
| 223 | + if ( |
|
| 224 | + $form = $args['form'] |
|
| 225 | + and ($e = cvtmulti_recuperer_post_precedents($form)) !== false |
|
| 226 | + ) { |
|
| 227 | + // recuperer l'etape saisie et le nombre d'etapes total |
|
| 228 | + [$etape, $etapes] = $e; |
|
| 229 | + $etape_demandee = intval(_request('aller_a_etape')); // possibilite de poster un entier dans aller_a_etape |
|
| 230 | 230 | |
| 231 | - $args['etape_saisie'] = $etape; |
|
| 232 | - $args['etapes'] = $etapes; |
|
| 233 | - // lancer les verifs pour chaque etape deja saisie de 1 a $etape |
|
| 234 | - $erreurs_etapes = []; |
|
| 235 | - $derniere_etape_ok = 0; |
|
| 236 | - $e = 0; |
|
| 237 | - while ($e < max($etape, $etape_demandee - 1) and $e < $etapes) { |
|
| 238 | - $e++; |
|
| 239 | - $erreurs_etapes[$e] = []; |
|
| 240 | - if ($verifier = charger_fonction("verifier_$e", "formulaires/$form/", true)) { |
|
| 241 | - $erreurs_etapes[$e] = call_user_func_array($verifier, $args['args']); |
|
| 242 | - } elseif ($verifier = charger_fonction('verifier_etape', "formulaires/$form/", true)) { |
|
| 243 | - $a = $args['args']; |
|
| 244 | - array_unshift($a, $e); |
|
| 245 | - $erreurs_etapes[$e] = call_user_func_array($verifier, $a); |
|
| 246 | - } |
|
| 247 | - // et on appelle un pipeline dedie aux etapes, plus easy |
|
| 248 | - $args['etape'] = $e; |
|
| 249 | - $args['etape_demandee'] = $etape_demandee; |
|
| 250 | - $erreurs_etapes[$e] = pipeline( |
|
| 251 | - 'formulaire_verifier_etape', |
|
| 252 | - [ |
|
| 253 | - 'args' => $args, |
|
| 254 | - 'data' => $erreurs_etapes[$e] |
|
| 255 | - ] |
|
| 256 | - ); |
|
| 231 | + $args['etape_saisie'] = $etape; |
|
| 232 | + $args['etapes'] = $etapes; |
|
| 233 | + // lancer les verifs pour chaque etape deja saisie de 1 a $etape |
|
| 234 | + $erreurs_etapes = []; |
|
| 235 | + $derniere_etape_ok = 0; |
|
| 236 | + $e = 0; |
|
| 237 | + while ($e < max($etape, $etape_demandee - 1) and $e < $etapes) { |
|
| 238 | + $e++; |
|
| 239 | + $erreurs_etapes[$e] = []; |
|
| 240 | + if ($verifier = charger_fonction("verifier_$e", "formulaires/$form/", true)) { |
|
| 241 | + $erreurs_etapes[$e] = call_user_func_array($verifier, $args['args']); |
|
| 242 | + } elseif ($verifier = charger_fonction('verifier_etape', "formulaires/$form/", true)) { |
|
| 243 | + $a = $args['args']; |
|
| 244 | + array_unshift($a, $e); |
|
| 245 | + $erreurs_etapes[$e] = call_user_func_array($verifier, $a); |
|
| 246 | + } |
|
| 247 | + // et on appelle un pipeline dedie aux etapes, plus easy |
|
| 248 | + $args['etape'] = $e; |
|
| 249 | + $args['etape_demandee'] = $etape_demandee; |
|
| 250 | + $erreurs_etapes[$e] = pipeline( |
|
| 251 | + 'formulaire_verifier_etape', |
|
| 252 | + [ |
|
| 253 | + 'args' => $args, |
|
| 254 | + 'data' => $erreurs_etapes[$e] |
|
| 255 | + ] |
|
| 256 | + ); |
|
| 257 | 257 | |
| 258 | - if ($derniere_etape_ok == $e - 1 and !(is_countable($erreurs_etapes[$e]) ? count($erreurs_etapes[$e]) : 0)) { |
|
| 259 | - $derniere_etape_ok = $e; |
|
| 260 | - } |
|
| 261 | - // possibilite de poster dans _retour_etape_x ou aller_a_etape |
|
| 262 | - if (!is_null(_request("_retour_etape_$e"))) { |
|
| 263 | - $etape_demandee = $e; |
|
| 264 | - } |
|
| 265 | - // Il se peut que les verifications ait décidé de faire sauter des étapes |
|
| 266 | - if ($aller_a_etape = intval(_request('aller_a_etape'))) { |
|
| 267 | - $etape_demandee = $aller_a_etape; // possibilite de poster un entier dans aller_a_etape |
|
| 268 | - } |
|
| 269 | - } |
|
| 258 | + if ($derniere_etape_ok == $e - 1 and !(is_countable($erreurs_etapes[$e]) ? count($erreurs_etapes[$e]) : 0)) { |
|
| 259 | + $derniere_etape_ok = $e; |
|
| 260 | + } |
|
| 261 | + // possibilite de poster dans _retour_etape_x ou aller_a_etape |
|
| 262 | + if (!is_null(_request("_retour_etape_$e"))) { |
|
| 263 | + $etape_demandee = $e; |
|
| 264 | + } |
|
| 265 | + // Il se peut que les verifications ait décidé de faire sauter des étapes |
|
| 266 | + if ($aller_a_etape = intval(_request('aller_a_etape'))) { |
|
| 267 | + $etape_demandee = $aller_a_etape; // possibilite de poster un entier dans aller_a_etape |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | 271 | |
| 272 | - // si la derniere etape OK etait la derniere |
|
| 273 | - // on renvoie le flux inchange et ca declenche traiter |
|
| 274 | - if ( |
|
| 275 | - $derniere_etape_ok == $etapes |
|
| 276 | - and (!$etape_demandee or $etape_demandee >= $etapes) |
|
| 277 | - ) { |
|
| 278 | - return $erreurs; |
|
| 279 | - } else { |
|
| 280 | - $etape = $derniere_etape_ok + 1; |
|
| 281 | - if ($etape_demandee > 0 and $etape_demandee < $etape) { |
|
| 282 | - $etape = $etape_demandee; |
|
| 283 | - } |
|
| 284 | - $etape = min($etape, $etapes); |
|
| 285 | - #var_dump("prochaine etape $etape"); |
|
| 286 | - // retourner les erreurs de l'etape ciblee |
|
| 287 | - $erreurs = $erreurs_etapes[$etape] ?? []; |
|
| 288 | - // Ne pas se tromper dans le texte du message d'erreur : la clé '_etapes' n'est pas une erreur ! |
|
| 289 | - if ($erreurs) { |
|
| 290 | - if (!isset($erreurs['message_erreur'])) { |
|
| 291 | - $erreurs['message_erreur'] = singulier_ou_pluriel(is_countable($erreurs) ? count($erreurs) : 0, 'avis_1_erreur_saisie', 'avis_nb_erreurs_saisie'); |
|
| 292 | - } |
|
| 293 | - } else { |
|
| 294 | - $erreurs['message_erreur'] = ''; |
|
| 295 | - } |
|
| 296 | - $erreurs['_etapes'] = "etape suivante $etape"; |
|
| 297 | - set_request('_etape', $etape); |
|
| 298 | - } |
|
| 299 | - } |
|
| 272 | + // si la derniere etape OK etait la derniere |
|
| 273 | + // on renvoie le flux inchange et ca declenche traiter |
|
| 274 | + if ( |
|
| 275 | + $derniere_etape_ok == $etapes |
|
| 276 | + and (!$etape_demandee or $etape_demandee >= $etapes) |
|
| 277 | + ) { |
|
| 278 | + return $erreurs; |
|
| 279 | + } else { |
|
| 280 | + $etape = $derniere_etape_ok + 1; |
|
| 281 | + if ($etape_demandee > 0 and $etape_demandee < $etape) { |
|
| 282 | + $etape = $etape_demandee; |
|
| 283 | + } |
|
| 284 | + $etape = min($etape, $etapes); |
|
| 285 | + #var_dump("prochaine etape $etape"); |
|
| 286 | + // retourner les erreurs de l'etape ciblee |
|
| 287 | + $erreurs = $erreurs_etapes[$etape] ?? []; |
|
| 288 | + // Ne pas se tromper dans le texte du message d'erreur : la clé '_etapes' n'est pas une erreur ! |
|
| 289 | + if ($erreurs) { |
|
| 290 | + if (!isset($erreurs['message_erreur'])) { |
|
| 291 | + $erreurs['message_erreur'] = singulier_ou_pluriel(is_countable($erreurs) ? count($erreurs) : 0, 'avis_1_erreur_saisie', 'avis_nb_erreurs_saisie'); |
|
| 292 | + } |
|
| 293 | + } else { |
|
| 294 | + $erreurs['message_erreur'] = ''; |
|
| 295 | + } |
|
| 296 | + $erreurs['_etapes'] = "etape suivante $etape"; |
|
| 297 | + set_request('_etape', $etape); |
|
| 298 | + } |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | - return $erreurs; |
|
| 301 | + return $erreurs; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -310,17 +310,17 @@ discard block |
||
| 310 | 310 | * @return array |
| 311 | 311 | */ |
| 312 | 312 | function cvtmulti_styliser($flux) { |
| 313 | - if ( |
|
| 314 | - strncmp($flux['args']['fond'], 'formulaires/', 12) == 0 |
|
| 315 | - and isset($flux['args']['contexte']['_etapes']) |
|
| 316 | - and isset($flux['args']['contexte']['_etape']) |
|
| 317 | - and ($e = $flux['args']['contexte']['_etape']) > 1 |
|
| 318 | - and $ext = $flux['args']['ext'] |
|
| 319 | - and $f = $flux['data'] |
|
| 320 | - and file_exists($f . "_$e.$ext") |
|
| 321 | - ) { |
|
| 322 | - $flux['data'] = $f . "_$e"; |
|
| 323 | - } |
|
| 313 | + if ( |
|
| 314 | + strncmp($flux['args']['fond'], 'formulaires/', 12) == 0 |
|
| 315 | + and isset($flux['args']['contexte']['_etapes']) |
|
| 316 | + and isset($flux['args']['contexte']['_etape']) |
|
| 317 | + and ($e = $flux['args']['contexte']['_etape']) > 1 |
|
| 318 | + and $ext = $flux['args']['ext'] |
|
| 319 | + and $f = $flux['data'] |
|
| 320 | + and file_exists($f . "_$e.$ext") |
|
| 321 | + ) { |
|
| 322 | + $flux['data'] = $f . "_$e"; |
|
| 323 | + } |
|
| 324 | 324 | |
| 325 | - return $flux; |
|
| 325 | + return $flux; |
|
| 326 | 326 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | 30 | if ($opt) { |
| 31 | - $phrase .= ' :: ' . str_replace("\n", ' ', join(', ', $opt)); |
|
| 31 | + $phrase .= ' :: '.str_replace("\n", ' ', join(', ', $opt)); |
|
| 32 | 32 | } |
| 33 | 33 | spip_log($phrase, 'journal'); |
| 34 | 34 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | * @param array $opt |
| 25 | 25 | */ |
| 26 | 26 | function inc_journal_dist($phrase, $opt = []) { |
| 27 | - if (!strlen($phrase)) { |
|
| 28 | - return; |
|
| 29 | - } |
|
| 30 | - if ($opt) { |
|
| 31 | - $phrase .= ' :: ' . str_replace("\n", ' ', join(', ', $opt)); |
|
| 32 | - } |
|
| 33 | - spip_log($phrase, 'journal'); |
|
| 27 | + if (!strlen($phrase)) { |
|
| 28 | + return; |
|
| 29 | + } |
|
| 30 | + if ($opt) { |
|
| 31 | + $phrase .= ' :: ' . str_replace("\n", ' ', join(', ', $opt)); |
|
| 32 | + } |
|
| 33 | + spip_log($phrase, 'journal'); |
|
| 34 | 34 | } |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | case is_null($var): |
| 32 | 32 | return 'null'; |
| 33 | 33 | case is_string($var): |
| 34 | - return '"' . addcslashes($var, "\"\\\n\r/") . '"'; |
|
| 34 | + return '"'.addcslashes($var, "\"\\\n\r/").'"'; |
|
| 35 | 35 | case is_bool($var): |
| 36 | 36 | return $var ? 'true' : 'false'; |
| 37 | 37 | case is_scalar($var): |
| 38 | - return (string)$var; |
|
| 38 | + return (string) $var; |
|
| 39 | 39 | case is_object($var):// blam |
| 40 | 40 | $var = get_object_vars($var); |
| 41 | 41 | $asso = true; |
@@ -50,19 +50,19 @@ discard block |
||
| 50 | 50 | if ($asso) { |
| 51 | 51 | $ret = '{'; |
| 52 | 52 | foreach ($var as $key => $elt) { |
| 53 | - $ret .= $sep . '"' . $key . '":' . var2js($elt); |
|
| 53 | + $ret .= $sep.'"'.$key.'":'.var2js($elt); |
|
| 54 | 54 | $sep = ','; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - return $ret . '}'; |
|
| 57 | + return $ret.'}'; |
|
| 58 | 58 | } else { |
| 59 | 59 | $ret = '['; |
| 60 | 60 | foreach ($var as $elt) { |
| 61 | - $ret .= $sep . var2js($elt); |
|
| 61 | + $ret .= $sep.var2js($elt); |
|
| 62 | 62 | $sep = ','; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - return $ret . ']'; |
|
| 65 | + return $ret.']'; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | // flag indiquant qu'on est en iframe et qu'il faut proteger nos |
| 83 | 83 | // donnees dans un <textarea> ; attention $_FILES a ete vide par array_pop |
| 84 | 84 | if (defined('FILE_UPLOAD')) { |
| 85 | - return '<textarea>' . spip_htmlspecialchars($var) . '</textarea>'; |
|
| 85 | + return '<textarea>'.spip_htmlspecialchars($var).'</textarea>'; |
|
| 86 | 86 | } else { |
| 87 | 87 | return $var; |
| 88 | 88 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Les fonctions de toggg pour faire du JSON |
@@ -25,63 +25,63 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | function var2js($var) { |
| 28 | - $asso = false; |
|
| 29 | - switch (true) { |
|
| 30 | - case is_null($var): |
|
| 31 | - return 'null'; |
|
| 32 | - case is_string($var): |
|
| 33 | - return '"' . addcslashes($var, "\"\\\n\r/") . '"'; |
|
| 34 | - case is_bool($var): |
|
| 35 | - return $var ? 'true' : 'false'; |
|
| 36 | - case is_scalar($var): |
|
| 37 | - return (string)$var; |
|
| 38 | - case is_object($var):// blam |
|
| 39 | - $var = get_object_vars($var); |
|
| 40 | - $asso = true; |
|
| 41 | - // $var devient un array, on continue |
|
| 42 | - case is_array($var): |
|
| 43 | - $keys = array_keys($var); |
|
| 44 | - $ikey = count($keys); |
|
| 45 | - while (!$asso && $ikey--) { |
|
| 46 | - $asso = $ikey !== $keys[$ikey]; |
|
| 47 | - } |
|
| 48 | - $sep = ''; |
|
| 49 | - if ($asso) { |
|
| 50 | - $ret = '{'; |
|
| 51 | - foreach ($var as $key => $elt) { |
|
| 52 | - $ret .= $sep . '"' . $key . '":' . var2js($elt); |
|
| 53 | - $sep = ','; |
|
| 54 | - } |
|
| 28 | + $asso = false; |
|
| 29 | + switch (true) { |
|
| 30 | + case is_null($var): |
|
| 31 | + return 'null'; |
|
| 32 | + case is_string($var): |
|
| 33 | + return '"' . addcslashes($var, "\"\\\n\r/") . '"'; |
|
| 34 | + case is_bool($var): |
|
| 35 | + return $var ? 'true' : 'false'; |
|
| 36 | + case is_scalar($var): |
|
| 37 | + return (string)$var; |
|
| 38 | + case is_object($var):// blam |
|
| 39 | + $var = get_object_vars($var); |
|
| 40 | + $asso = true; |
|
| 41 | + // $var devient un array, on continue |
|
| 42 | + case is_array($var): |
|
| 43 | + $keys = array_keys($var); |
|
| 44 | + $ikey = count($keys); |
|
| 45 | + while (!$asso && $ikey--) { |
|
| 46 | + $asso = $ikey !== $keys[$ikey]; |
|
| 47 | + } |
|
| 48 | + $sep = ''; |
|
| 49 | + if ($asso) { |
|
| 50 | + $ret = '{'; |
|
| 51 | + foreach ($var as $key => $elt) { |
|
| 52 | + $ret .= $sep . '"' . $key . '":' . var2js($elt); |
|
| 53 | + $sep = ','; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - return $ret . '}'; |
|
| 57 | - } else { |
|
| 58 | - $ret = '['; |
|
| 59 | - foreach ($var as $elt) { |
|
| 60 | - $ret .= $sep . var2js($elt); |
|
| 61 | - $sep = ','; |
|
| 62 | - } |
|
| 56 | + return $ret . '}'; |
|
| 57 | + } else { |
|
| 58 | + $ret = '['; |
|
| 59 | + foreach ($var as $elt) { |
|
| 60 | + $ret .= $sep . var2js($elt); |
|
| 61 | + $sep = ','; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - return $ret . ']'; |
|
| 65 | - } |
|
| 66 | - } |
|
| 64 | + return $ret . ']'; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - return false; |
|
| 68 | + return false; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | if (!function_exists('json_encode')) { |
| 72 | - function json_encode($v) { |
|
| 73 | - return var2js($v); |
|
| 74 | - } |
|
| 72 | + function json_encode($v) { |
|
| 73 | + return var2js($v); |
|
| 74 | + } |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | function json_export($var) { |
| 78 | - $var = json_encode($var, JSON_THROW_ON_ERROR); |
|
| 78 | + $var = json_encode($var, JSON_THROW_ON_ERROR); |
|
| 79 | 79 | |
| 80 | - // flag indiquant qu'on est en iframe et qu'il faut proteger nos |
|
| 81 | - // donnees dans un <textarea> ; attention $_FILES a ete vide par array_pop |
|
| 82 | - if (defined('FILE_UPLOAD')) { |
|
| 83 | - return '<textarea>' . spip_htmlspecialchars($var) . '</textarea>'; |
|
| 84 | - } else { |
|
| 85 | - return $var; |
|
| 86 | - } |
|
| 80 | + // flag indiquant qu'on est en iframe et qu'il faut proteger nos |
|
| 81 | + // donnees dans un <textarea> ; attention $_FILES a ete vide par array_pop |
|
| 82 | + if (defined('FILE_UPLOAD')) { |
|
| 83 | + return '<textarea>' . spip_htmlspecialchars($var) . '</textarea>'; |
|
| 84 | + } else { |
|
| 85 | + return $var; |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /* |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | * http://zoumzamzouilam/truc/chose/machin..." |
| 23 | 23 | */ |
| 24 | 24 | function inc_lien_court($url) { |
| 25 | - $long_url = defined('_MAX_LONG_URL') ? _MAX_LONG_URL : 40; |
|
| 26 | - $coupe_url = defined('_MAX_COUPE_URL') ? _MAX_COUPE_URL : 35; |
|
| 25 | + $long_url = defined('_MAX_LONG_URL') ? _MAX_LONG_URL : 40; |
|
| 26 | + $coupe_url = defined('_MAX_COUPE_URL') ? _MAX_COUPE_URL : 35; |
|
| 27 | 27 | |
| 28 | - if (strlen($url) > $long_url) { |
|
| 29 | - $url = substr($url, 0, $coupe_url) . '...'; |
|
| 30 | - } |
|
| 28 | + if (strlen($url) > $long_url) { |
|
| 29 | + $url = substr($url, 0, $coupe_url) . '...'; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - return $url; |
|
| 32 | + return $url; |
|
| 33 | 33 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | $coupe_url = defined('_MAX_COUPE_URL') ? _MAX_COUPE_URL : 35; |
| 27 | 27 | |
| 28 | 28 | if (strlen($url) > $long_url) { |
| 29 | - $url = substr($url, 0, $coupe_url) . '...'; |
|
| 29 | + $url = substr($url, 0, $coupe_url).'...'; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | return $url; |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | $namespace[null] = null; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $name = strtolower((string)$obj->getName()); |
|
| 61 | - $text = trim((string)$obj); |
|
| 60 | + $name = strtolower((string) $obj->getName()); |
|
| 61 | + $text = trim((string) $obj); |
|
| 62 | 62 | if (strlen($text) <= 0) { |
| 63 | 63 | $text = null; |
| 64 | 64 | } |
@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | // attributes |
| 72 | 72 | $objAttributes = $obj->attributes($ns, true); |
| 73 | 73 | foreach ($objAttributes as $attributeName => $attributeValue) { |
| 74 | - $attribName = strtolower(trim((string)$attributeName)); |
|
| 75 | - $attribVal = trim((string)$attributeValue); |
|
| 74 | + $attribName = strtolower(trim((string) $attributeName)); |
|
| 75 | + $attribVal = trim((string) $attributeValue); |
|
| 76 | 76 | if (!empty($ns)) { |
| 77 | - $attribName = $ns . ':' . $attribName; |
|
| 77 | + $attribName = $ns.':'.$attribName; |
|
| 78 | 78 | } |
| 79 | 79 | $attributes[$attribName] = $attribVal; |
| 80 | 80 | } |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | // children |
| 83 | 83 | $objChildren = $obj->children($ns, true); |
| 84 | 84 | foreach ($objChildren as $childName => $child) { |
| 85 | - $childName = strtolower((string)$childName); |
|
| 85 | + $childName = strtolower((string) $childName); |
|
| 86 | 86 | if (!empty($ns)) { |
| 87 | - $childName = $ns . ':' . $childName; |
|
| 87 | + $childName = $ns.':'.$childName; |
|
| 88 | 88 | } |
| 89 | 89 | $children[$childName][] = xmlObjToArr($child, $namespace); |
| 90 | 90 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | * @return array |
| 24 | 24 | */ |
| 25 | 25 | function inc_simplexml_to_array_dist($u, $utiliser_namespace = false) { |
| 26 | - // decoder la chaine en SimpleXML si pas deja fait |
|
| 27 | - if (is_string($u)) { |
|
| 28 | - $u = simplexml_load_string($u); |
|
| 29 | - } |
|
| 26 | + // decoder la chaine en SimpleXML si pas deja fait |
|
| 27 | + if (is_string($u)) { |
|
| 28 | + $u = simplexml_load_string($u); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - return ['root' => @xmlObjToArr($u, $utiliser_namespace)]; |
|
| 31 | + return ['root' => @xmlObjToArr($u, $utiliser_namespace)]; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
@@ -43,67 +43,67 @@ discard block |
||
| 43 | 43 | **/ |
| 44 | 44 | function xmlObjToArr($obj, $utiliser_namespace = false) { |
| 45 | 45 | |
| 46 | - $namespace = []; |
|
| 47 | - $tableau = []; |
|
| 46 | + $namespace = []; |
|
| 47 | + $tableau = []; |
|
| 48 | 48 | |
| 49 | - // Cette fonction getDocNamespaces() est longue sur de gros xml. On permet donc |
|
| 50 | - // de l'activer ou pas suivant le contenu supposé du XML |
|
| 51 | - if (is_object($obj)) { |
|
| 52 | - if (is_array($utiliser_namespace)) { |
|
| 53 | - $namespace = $utiliser_namespace; |
|
| 54 | - } else { |
|
| 55 | - if ($utiliser_namespace) { |
|
| 56 | - $namespace = $obj->getDocNamespaces(true); |
|
| 57 | - } |
|
| 58 | - $namespace[null] = null; |
|
| 59 | - } |
|
| 49 | + // Cette fonction getDocNamespaces() est longue sur de gros xml. On permet donc |
|
| 50 | + // de l'activer ou pas suivant le contenu supposé du XML |
|
| 51 | + if (is_object($obj)) { |
|
| 52 | + if (is_array($utiliser_namespace)) { |
|
| 53 | + $namespace = $utiliser_namespace; |
|
| 54 | + } else { |
|
| 55 | + if ($utiliser_namespace) { |
|
| 56 | + $namespace = $obj->getDocNamespaces(true); |
|
| 57 | + } |
|
| 58 | + $namespace[null] = null; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - $name = strtolower((string)$obj->getName()); |
|
| 62 | - $text = trim((string)$obj); |
|
| 63 | - if (strlen($text) <= 0) { |
|
| 64 | - $text = null; |
|
| 65 | - } |
|
| 61 | + $name = strtolower((string)$obj->getName()); |
|
| 62 | + $text = trim((string)$obj); |
|
| 63 | + if (strlen($text) <= 0) { |
|
| 64 | + $text = null; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - $children = []; |
|
| 68 | - $attributes = []; |
|
| 67 | + $children = []; |
|
| 68 | + $attributes = []; |
|
| 69 | 69 | |
| 70 | - // get info for all namespaces |
|
| 71 | - foreach ($namespace as $ns => $nsUrl) { |
|
| 72 | - // attributes |
|
| 73 | - $objAttributes = $obj->attributes($ns, true); |
|
| 74 | - foreach ($objAttributes as $attributeName => $attributeValue) { |
|
| 75 | - $attribName = strtolower(trim((string)$attributeName)); |
|
| 76 | - $attribVal = trim((string)$attributeValue); |
|
| 77 | - if (!empty($ns)) { |
|
| 78 | - $attribName = $ns . ':' . $attribName; |
|
| 79 | - } |
|
| 80 | - $attributes[$attribName] = $attribVal; |
|
| 81 | - } |
|
| 70 | + // get info for all namespaces |
|
| 71 | + foreach ($namespace as $ns => $nsUrl) { |
|
| 72 | + // attributes |
|
| 73 | + $objAttributes = $obj->attributes($ns, true); |
|
| 74 | + foreach ($objAttributes as $attributeName => $attributeValue) { |
|
| 75 | + $attribName = strtolower(trim((string)$attributeName)); |
|
| 76 | + $attribVal = trim((string)$attributeValue); |
|
| 77 | + if (!empty($ns)) { |
|
| 78 | + $attribName = $ns . ':' . $attribName; |
|
| 79 | + } |
|
| 80 | + $attributes[$attribName] = $attribVal; |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - // children |
|
| 84 | - $objChildren = $obj->children($ns, true); |
|
| 85 | - foreach ($objChildren as $childName => $child) { |
|
| 86 | - $childName = strtolower((string)$childName); |
|
| 87 | - if (!empty($ns)) { |
|
| 88 | - $childName = $ns . ':' . $childName; |
|
| 89 | - } |
|
| 90 | - $children[$childName][] = xmlObjToArr($child, $namespace); |
|
| 91 | - } |
|
| 92 | - } |
|
| 83 | + // children |
|
| 84 | + $objChildren = $obj->children($ns, true); |
|
| 85 | + foreach ($objChildren as $childName => $child) { |
|
| 86 | + $childName = strtolower((string)$childName); |
|
| 87 | + if (!empty($ns)) { |
|
| 88 | + $childName = $ns . ':' . $childName; |
|
| 89 | + } |
|
| 90 | + $children[$childName][] = xmlObjToArr($child, $namespace); |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - $tableau = [ |
|
| 95 | - 'name' => $name, |
|
| 96 | - ]; |
|
| 97 | - if ($text) { |
|
| 98 | - $tableau['text'] = $text; |
|
| 99 | - } |
|
| 100 | - if ($attributes) { |
|
| 101 | - $tableau['attributes'] = $attributes; |
|
| 102 | - } |
|
| 103 | - if ($children) { |
|
| 104 | - $tableau['children'] = $children; |
|
| 105 | - } |
|
| 106 | - } |
|
| 94 | + $tableau = [ |
|
| 95 | + 'name' => $name, |
|
| 96 | + ]; |
|
| 97 | + if ($text) { |
|
| 98 | + $tableau['text'] = $text; |
|
| 99 | + } |
|
| 100 | + if ($attributes) { |
|
| 101 | + $tableau['attributes'] = $attributes; |
|
| 102 | + } |
|
| 103 | + if ($children) { |
|
| 104 | + $tableau['children'] = $children; |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - return $tableau; |
|
| 108 | + return $tableau; |
|
| 109 | 109 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/precharger_objet'); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * Couples clés / valeurs des champs du formulaire à charger. |
| 40 | 40 | **/ |
| 41 | 41 | function inc_precharger_article_dist($id_article, $id_rubrique = 0, $lier_trad = 0) { |
| 42 | - return precharger_objet('article', $id_article, $id_rubrique, $lier_trad, 'titre'); |
|
| 42 | + return precharger_objet('article', $id_article, $id_rubrique, $lier_trad, 'titre'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -60,5 +60,5 @@ discard block |
||
| 60 | 60 | * Couples clés / valeurs des champs du formulaire à charger |
| 61 | 61 | **/ |
| 62 | 62 | function inc_precharger_traduction_article_dist($id_article, $id_rubrique = 0, $lier_trad = 0) { |
| 63 | - return precharger_traduction_objet('article', $id_article, $id_rubrique, $lier_trad, 'titre'); |
|
| 63 | + return precharger_traduction_objet('article', $id_article, $id_rubrique, $lier_trad, 'titre'); |
|
| 64 | 64 | } |