Skip to content
Extraits de code Groupes Projets
Valider 92a3af05 rédigé par Fil's avatar Fil
Parcourir les fichiers

revision generale des \{ \} dans les ereg (bug sur certaines plateformes)

parent b066f728
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -875,7 +875,7 @@ function multi_trad ($trads) {
function extraire_trad ($bloc) {
$lang = '';
while (preg_match("/^(.*?)[\{\[]([a-z_]+)[\}\]]/si", $bloc, $regs)) {
while (preg_match("/^(.*?)[{\[]([a-z_]+)[}\]]/si", $bloc, $regs)) {
$texte = trim($regs[1]);
if ($texte OR $lang)
$trads[$lang] = $texte;
......
......@@ -985,13 +985,13 @@ function traiter_raccourcis_generale($letexte) {
/* 1 */ "/\n-- */",
/* 2 */ "/\n- */",
/* 3 */ "/\n_ +/",
/* 4 */ "/\{\{\{/",
/* 5 */ "/\}\}\}/",
/* 4 */ "/[{][{][{]/",
/* 5 */ "/[}][}][}]/",
/* 6 */ "/(( *)\n){2,}(<br[[:space:]]*\/?".">)?/",
/* 7 */ "/\{\{/",
/* 8 */ "/\}\}/",
/* 9 */ "/\{/",
/* 10 */ "/\}/",
/* 7 */ "/[{][{]/",
/* 8 */ "/[}][}]/",
/* 9 */ "/[{]/",
/* 10 */ "/[}]/",
/* 11 */ "/(<br[[:space:]]*\/?".">){2,}/",
/* 12 */ "/<p>([\n]*)(<br[[:space:]]*\/?".">)+/",
/* 13 */ "/<p>/",
......
......@@ -281,7 +281,7 @@ function calcule_logo_document($id_document, $doubdoc, &$doublons, $flag_fichier
}
// taille maximum [(#LOGO_DOCUMENT{300,52})]
list($x,$y) = split(',', ereg_replace("[\{\}]", "", $params));
list($x,$y) = split(',', ereg_replace("[{}]", "", $params));
if ($logo AND @file_exists($logo)) {
......
......@@ -212,7 +212,7 @@ function critere_par_dist($idb, &$boucles, $param, $not) {
while ($param) {
preg_match('/(([^{,]*\{[^}]*\})|([^,]*))[[:space:]]*,?[[:space:]]*(.*)/ims',
preg_match('/(([^{,]*[{][^}]*[}])|([^,]*))[[:space:]]*,?[[:space:]]*(.*)/ims',
$param, $regs);
$param = $regs[4];
$tri = $regs[1];
......@@ -358,7 +358,7 @@ function calculer_critere_DEFAUT($idb, &$boucles, $param, $not) {
$primary = $boucle->primary;
$id_field = $id_table . '.' . $primary;
if (ereg('^([0-9a-zA-Z#_\{\}-]+)([,/])([0-9a-zA-Z#_\{\}-]+)$', $param, $match))
if (ereg('^([0-9a-zA-Z#_{}-]+)([,/])([0-9a-zA-Z#_{}-]+)$', $param, $match))
calculer_critere_parties($idb, $boucles, $param, $not, $match);
// Restriction de valeurs (implicite ou explicite)
......@@ -625,7 +625,7 @@ function calculer_param_date($date_compare, $date_orig) {
// - dans le cas d'un parametre de boucle, la boucle parente
function calculer_param_dynamique($val, &$boucles, $idb) {
# if (ereg('^ *\((.*)) *$', $val, $m)) $val = $m[1]; # si on veut (#...)
if (ereg(NOM_DE_CHAMP . "(\{[^}]*\})?", $val, $regs)) {
if (ereg(NOM_DE_CHAMP . "([{][^}]*[}])?", $val, $regs)) {
#spip_log(serialize($regs)." ($idb)");
$champ = new Champ;
$champ->nom_boucle = $regs[2];
......
......@@ -23,7 +23,7 @@ define("_INC_HTML_SQUEL", "1");
define('NOM_DE_BOUCLE', "[0-9]+|[-_][-_.a-zA-Z0-9]*");
define('NOM_DE_CHAMP', "#((" . NOM_DE_BOUCLE . "):)?([A-Z_]+)(\*?)");
define('CHAMP_ETENDU', '\[([^]\[]*)\(' . NOM_DE_CHAMP . '([^[)]*\)[^]\[]*)\]');
define('PARAM_DE_BOUCLE','[[:space:]]*\{[[:space:]]*([^{}]*(\{[^\}]*\}[^\}]*)*)[[:space:]]*\}');
define('PARAM_DE_BOUCLE','[[:space:]]*[{][[:space:]]*([^{}]*([{][^}]*[}][^}]*)*)[[:space:]]*[}]');
define('TYPE_DE_BOUCLE', "[^)]*");
define('BALISE_DE_BOUCLE',
"^<BOUCLE(" .
......@@ -33,7 +33,7 @@ define('BALISE_DE_BOUCLE',
')\)((' .
PARAM_DE_BOUCLE .
')*)[[:space:]]*>');
define('PARAM_INCLURE','^[[:space:]]*\{[[:space:]]*([_0-9a-zA-Z]+)[[:space:]]*(=)?');
define('PARAM_INCLURE','^[[:space:]]*[{][[:space:]]*([_0-9a-zA-Z]+)[[:space:]]*(=)?');
define('BALISE_INCLURE','<INCLU[DR]E[[:space:]]*\(([^)]*)\)');
define('DEBUT_DE_BOUCLE','/<B('.NOM_DE_BOUCLE.')>.*?<BOUCLE\1[^-_.a-zA-Z0-9]|<BOUCLE('.NOM_DE_BOUCLE.')/ms'); # preg
......@@ -84,7 +84,7 @@ function phraser_polyglotte($texte,$result) {
$lang = '';
$bloc = $match[1];
$texte = substr($texte,$p+strlen($match[0]));
while (preg_match("/^[[:space:]]*([^[{]*)[[:space:]]*[\{\[]([a-z_]+)[\}\]](.*)$/si", $bloc, $regs)) {
while (preg_match("/^[[:space:]]*([^[{]*)[[:space:]]*[{\[]([a-z_]+)[}\]](.*)$/si", $bloc, $regs)) {
$trad = $regs[1];
if ($trad OR $lang)
$champ->traductions[$lang] = $trad;
......@@ -178,7 +178,7 @@ function phraser_args($texte, $fin, $sep, $result, &$pointeur_champ) {
else if ($args[0] == "'")
ereg ("^(')([^']*)(')(.*)$", $args, $regs);
else
ereg("^( *)([^,{}]*({[^{}]*\}[^,{}]*)*[^,}]*)([,}$fin].*)$", $args, $regs);
ereg("^( *)([^,{}]*({[^{}]*[}][^,{}]*)*[^,}]*)([,}$fin].*)$", $args, $regs);
$args = ltrim($regs[count($regs)-1]);
$arg = $regs[2];
......@@ -189,7 +189,7 @@ function phraser_args($texte, $fin, $sep, $result, &$pointeur_champ) {
$collecte[] = $champ;
} else { // valeur = ", ', ou vide
if ((count($regs) > 3) &&
ereg("^(.*)(#[A-Z0-9:_=]+\{.*\})(.*)$",$arg, $r))
ereg("^(.*)(#[A-Z0-9:_=]+[{].*[}])(.*)$",$arg, $r))
{
// champ avec arg, sans les [( )]: on les rajoute
$arg = $r[1] . '[(' . $r[2] . ')' . $r[3] . ']';
......@@ -293,7 +293,7 @@ function phraser_param($params, &$result) {
else {
$params2[] = ($param == 'unique') ? 'doublons' :$param;
/* pour bientot
if (ereg('^([0-9a-zA-Z#_\{\}-]+)([,/])([0-9a-zA-Z#_\{\}-]+)$', $param, $match))
if (ereg('^([0-9a-zA-Z#_{}-]+)([,/])([0-9a-zA-Z#_{}-]+)$', $param, $match))
$args['parties'] = $match;
else if (eregi('^(`?[a-z_]+\(?[a-z_]*\)?`?) *(\??)(!?)(<=?|>=?|==?|IN) *"?([^<>=!"]*)"?$', $param, $match))
$args['comparaison'] = $match;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter