~maj v3.0.19-->v3.0.21
[ptitvelo/web/www.git] / www / ecrire / public / compiler.php
index eac227b..3741856 100644 (file)
@@ -72,10 +72,11 @@ function argumenter_inclure($params, $rejet_filtres, $p, &$boucles, $id_boucle,
                                $erreur_p_i_i = array('zbug_parametres_inclus_incorrects',
                                         array('param' => $var->nom_champ));
                                erreur_squelette($erreur_p_i_i, $p);
-                         } else $l[1] = calculer_liste($val, $p->descr, $boucles, $id_boucle);
-                         break;
+                                 break;
+                         }
+                         else $l[1] = calculer_liste($val, $p->descr, $boucles, $id_boucle);
                        } else {
-                               preg_match(",^([^=]*)(=?)(.*)$,", $var->texte,$m);
+                               preg_match(",^([^=]*)(=?)(.*)$,m", $var->texte,$m);
                                $var = $m[1];
                                $auto = false;;
                                if ($m[2]) {
@@ -184,7 +185,7 @@ function calculer_inclure($p, &$boucles, $id_boucle) {
 
        // s'il y a une extension .php, ce n'est pas un squelette
        if (preg_match('/^.+[.]php$/s', $fichier)) {
-               $code = sandbox_composer_inclure_php($fichier, $p);
+               $code = sandbox_composer_inclure_php($fichier, $p, $contexte);
        } else  {
                $_options[] = "\"compil\"=>array($compil)";
                if ($ajax)
@@ -396,7 +397,7 @@ define('CODE_CORPS_BOUCLE', '%s
        }%s
        if (defined("_BOUCLE_PROFILER")
        AND 1000*($timer = (time()+microtime())-$timer) > _BOUCLE_PROFILER)
-               spip_log(intval(1000*$timer)."ms %s","profiler");
+               spip_log(intval(1000*$timer)."ms %s","profiler"._LOG_AVERTISSEMENT);
        return $t0;'
 );
 
@@ -445,6 +446,7 @@ function calculer_boucle_nonrec($id_boucle, &$boucles, $trace) {
                // afin que le corps de boucle affecte la globale directement
                $init_lang = "lang_select(\$GLOBALS['spip_lang']);\n\t";
                $fin_lang = "lang_select();\n\t";
+               $fin_lang_select_public = "\n\t\tlang_select();";
 
                $corps .= 
                        "\n\t\tlang_select_public("
@@ -458,6 +460,7 @@ function calculer_boucle_nonrec($id_boucle, &$boucles, $trace) {
        else {
                $init_lang = '';
                $fin_lang = '';
+               $fin_lang_select_public = '';
                // sortir les appels au traducteur (invariants de boucle)
                if (strpos($return, '?php') === false
                AND preg_match_all("/\W(_T[(]'[^']*'[)])/", $return, $r)) {
@@ -502,6 +505,9 @@ function calculer_boucle_nonrec($id_boucle, &$boucles, $trace) {
                . $boucle->partie 
                . $corps;
 
+       // depiler la lang de la boucle si besoin
+       $corps .= $fin_lang_select_public;
+
        // si le corps est une constante, ne pas appeler le serveur N fois!
 
        if (preg_match(CODE_MONOTONE,str_replace("\\'",'',$corps), $r)) {