X-Git-Url: http://git.cyclocoop.org/?p=lhc%2Fweb%2Fclavette_www.git;a=blobdiff_plain;f=www%2Fecrire%2Fpublic%2Fcompiler.php;fp=www%2Fecrire%2Fpublic%2Fcompiler.php;h=362000afd29b1b6d4adfb549a513b5b4995f42a4;hp=7341b0a3a398e3d5f1e34c0a778fee3fcc41e484;hb=cc641eb476987612f6d6df1a5417c1c5582a8ab8;hpb=7d84a490677fb716a1fd4df260f8eab35f6a8506 diff --git a/www/ecrire/public/compiler.php b/www/ecrire/public/compiler.php index 7341b0a..362000a 100644 --- a/www/ecrire/public/compiler.php +++ b/www/ecrire/public/compiler.php @@ -3,7 +3,7 @@ /***************************************************************************\ * SPIP, Systeme de publication pour l'internet * * * - * Copyright (c) 2001-2014 * + * Copyright (c) 2001-2016 * * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * * * * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * @@ -140,7 +140,7 @@ function calculer_inclure($p, &$boucles, $id_boucle) { $_contexte = argumenter_inclure($p->param, false, $p, $boucles, $id_boucle, true, '', true); if (is_string($p->texte)) { $fichier = $p->texte; - $code = "\"$fichier\""; + $code = "\"".str_replace('"','\"',$fichier)."\""; } else { $code = calculer_liste($p->texte, $p->descr, $boucles, $id_boucle); @@ -184,7 +184,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)) { + if ($fichier and preg_match('/^.+[.]php$/s', $fichier)) { $code = sandbox_composer_inclure_php($fichier, $p, $contexte); } else { $_options[] = "\"compil\"=>array($compil)"; @@ -446,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(" @@ -459,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)) { @@ -503,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)) {