@@ -111,13 +111,13 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | function chrono_requete($temps) { |
| 113 | 113 | $total = 0; |
| 114 | - $hors = '<i>' . _T('zbug_hors_compilation') . '</i>'; |
|
| 114 | + $hors = '<i>'._T('zbug_hors_compilation').'</i>'; |
|
| 115 | 115 | $t = $q = $n = $d = []; |
| 116 | 116 | // Totaliser les temps et completer le Explain |
| 117 | 117 | foreach ($temps as $key => $v) { |
| 118 | 118 | list($dt, $nb, $boucle, $query, $explain, $res, $contexte) = $v; |
| 119 | 119 | if (is_array($contexte)) { |
| 120 | - $k = ($contexte[0] . " $boucle"); |
|
| 120 | + $k = ($contexte[0]." $boucle"); |
|
| 121 | 121 | include_spip('public/compiler'); |
| 122 | 122 | $env = reconstruire_contexte_compil($contexte); |
| 123 | 123 | } else { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | // Fabriquer les liens de navigations dans le tableau des temps |
| 163 | 163 | foreach ($temps as $k => $v) { |
| 164 | 164 | $titre = strip_tags($v[2]); |
| 165 | - $href = quote_amp($GLOBALS['REQUEST_URI']) . "#req$i"; |
|
| 165 | + $href = quote_amp($GLOBALS['REQUEST_URI'])."#req$i"; |
|
| 166 | 166 | $href = str_replace("\\'", ''', $href); |
| 167 | 167 | |
| 168 | 168 | if (!isset($t[$v[2]])) { |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | unset($d['']); |
| 184 | 184 | // Fabriquer le tableau des liens de navigation dans le grand tableau |
| 185 | 185 | foreach ($d as $k => $v) { |
| 186 | - $d[$k] = $n[$k] . "</td><td>$k</td><td class='time'>$v</td><td class='liste-reqs'>" |
|
| 186 | + $d[$k] = $n[$k]."</td><td>$k</td><td class='time'>$v</td><td class='liste-reqs'>" |
|
| 187 | 187 | . join('', $t[$k]); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | . join("</td></tr>\n<tr><td>", $d) |
| 194 | 194 | . "</td></tr>\n" |
| 195 | 195 | . (# _request('var_mode_objet') ? '' : |
| 196 | - ('<tr><td>' . count($temps) . '</td><td>' . _T('info_total') . '</td><td class="time">' . $total . '</td><td></td></tr>')) |
|
| 196 | + ('<tr><td>'.count($temps).'</td><td>'._T('info_total').'</td><td class="time">'.$total.'</td><td></td></tr>')) |
|
| 197 | 197 | ]; |
| 198 | 198 | |
| 199 | 199 | return [$temps, $navigation]; |
@@ -177,14 +177,14 @@ discard block |
||
| 177 | 177 | // sache qu'il peut enlever ce where si il enleve la jointure |
| 178 | 178 | $boucle->where["JOIN-L$n"] = |
| 179 | 179 | $echap ? |
| 180 | - ["'='","'$obj'","sql_quote('$type')"] |
|
| 180 | + ["'='", "'$obj'", "sql_quote('$type')"] |
|
| 181 | 181 | : |
| 182 | - ['=',"$obj",sql_quote($type)]; |
|
| 182 | + ['=', "$obj", sql_quote($type)]; |
|
| 183 | 183 | $boucle->join["L$n"] = |
| 184 | 184 | $echap ? |
| 185 | 185 | ["'$id_table'", "'$j2'", "'$j1'", "'$obj='.sql_quote('$type')"] |
| 186 | 186 | : |
| 187 | - [$id_table, $j2, $j1, "$obj=" . sql_quote($type)]; |
|
| 187 | + [$id_table, $j2, $j1, "$obj=".sql_quote($type)]; |
|
| 188 | 188 | } else { |
| 189 | 189 | $boucle->join["L$n"] = $echap ? ["'$id_table'", "'$j'"] : [$id_table, $j]; |
| 190 | 190 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $groups = liste_champs_jointures($nom, $desc, true); |
| 219 | 219 | if (!$pk) { |
| 220 | 220 | foreach ($groups as $id_prim) { |
| 221 | - $id_field = $nom . '.' . $id_prim; |
|
| 221 | + $id_field = $nom.'.'.$id_prim; |
|
| 222 | 222 | if (!in_array($id_field, $boucle->group)) { |
| 223 | 223 | $boucle->group[] = $id_field; |
| 224 | 224 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | ) { |
| 29 | 29 | // si l'url est une url du site, on la laisse passer sans rien faire |
| 30 | 30 | // c'est encore le plus simple |
| 31 | - $base = $GLOBALS['meta']['adresse_site'] . '/'; |
|
| 31 | + $base = $GLOBALS['meta']['adresse_site'].'/'; |
|
| 32 | 32 | if (strlen($base) and strncmp($redirect, $base, strlen($base)) == 0) { |
| 33 | 33 | return $redirect; |
| 34 | 34 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | if ($ancre = _request('var_ajax_ancre')) { |
| 157 | 157 | // pas n'importe quoi quand meme dans la variable ! |
| 158 | 158 | $ancre = str_replace(['<', '"', "'"], ['<', '"', ''], $ancre); |
| 159 | - $texte = "<a href='#$ancre' name='ajax_ancre' style='display:none;'>anchor</a>" . $texte; |
|
| 159 | + $texte = "<a href='#$ancre' name='ajax_ancre' style='display:none;'>anchor</a>".$texte; |
|
| 160 | 160 | } |
| 161 | 161 | } else { |
| 162 | 162 | include_spip('inc/headers'); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | // on ajoute un br en display none en tete du retour ajax pour regler un bug dans IE6/7 |
| 315 | 315 | // sans cela le formulaire n'est pas actif apres le hit ajax |
| 316 | 316 | // la classe ajax-form-is-ok sert a s'assurer que le retour ajax s'est bien passe |
| 317 | - $retour = "<br class='bugajaxie ajax-form-is-ok' style='display:none;'/>" . $retour; |
|
| 317 | + $retour = "<br class='bugajaxie ajax-form-is-ok' style='display:none;'/>".$retour; |
|
| 318 | 318 | ajax_retour($retour, false); |
| 319 | 319 | |
| 320 | 320 | return true; // on a fini le hit |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if (!$fonc) { |
| 149 | 149 | $fonc = $GLOBALS['debug_objets']['principal']; |
| 150 | 150 | } |
| 151 | - $titre = !$mode ? $fonc : ($mode . (isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? ' ' . $GLOBALS['debug_objets']['sourcefile'][$fonc] : '')); |
|
| 151 | + $titre = !$mode ? $fonc : ($mode.(isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? ' '.$GLOBALS['debug_objets']['sourcefile'][$fonc] : '')); |
|
| 152 | 152 | } |
| 153 | 153 | if ($message === false) { |
| 154 | 154 | lang_select(); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $fond = isset($GLOBALS['fond']) ? $GLOBALS['fond'] : ''; |
| 178 | 178 | // une erreur critique sort $message en array |
| 179 | 179 | $debug = is_array($msg) ? $msg[1] : $msg; |
| 180 | - spip_log('Debug: ' . $debug . ' (' . $fond . ')'); |
|
| 180 | + spip_log('Debug: '.$debug.' ('.$fond.')'); |
|
| 181 | 181 | |
| 182 | 182 | return $msg; |
| 183 | 183 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | function debusquer_bandeau($erreurs) { |
| 186 | 186 | |
| 187 | 187 | if (!empty($erreurs)) { |
| 188 | - $n = [count($erreurs) . ' ' . _T('zbug_erreur_squelette')]; |
|
| 188 | + $n = [count($erreurs).' '._T('zbug_erreur_squelette')]; |
|
| 189 | 189 | |
| 190 | 190 | return debusquer_navigation($erreurs, $n); |
| 191 | 191 | } elseif (!empty($GLOBALS['tableau_des_temps'])) { |
@@ -218,25 +218,25 @@ discard block |
||
| 218 | 218 | $valeur_simple = []; |
| 219 | 219 | foreach ($valeur as $v) { |
| 220 | 220 | if (is_array($v)) { |
| 221 | - $valeur_simple[] = 'array:' . count($v); |
|
| 221 | + $valeur_simple[] = 'array:'.count($v); |
|
| 222 | 222 | } elseif (is_object($v)) { |
| 223 | 223 | $valeur_simple[] = get_class($v); |
| 224 | 224 | } elseif (is_string($v)) { |
| 225 | - $valeur_simple[] = "'" . $v . "'"; |
|
| 225 | + $valeur_simple[] = "'".$v."'"; |
|
| 226 | 226 | } else { |
| 227 | 227 | $valeur_simple[] = $v; |
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | $n = count($valeur); |
| 231 | - $valeur = (($n > 3) ? 'array:' . $n . ' ' : ''); |
|
| 232 | - $valeur .= '[' . join(', ', $valeur_simple) . ']'; |
|
| 231 | + $valeur = (($n > 3) ? 'array:'.$n.' ' : ''); |
|
| 232 | + $valeur .= '['.join(', ', $valeur_simple).']'; |
|
| 233 | 233 | } elseif (is_object($valeur)) { |
| 234 | 234 | $valeur = get_class($valeur); |
| 235 | 235 | } elseif (is_string($valeur)) { |
| 236 | - $valeur = "'" . $valeur . "'"; |
|
| 236 | + $valeur = "'".$valeur."'"; |
|
| 237 | 237 | } |
| 238 | - $res .= "\n<tr><td><strong>" . nl2br(entites_html($nom)) |
|
| 239 | - . '</strong></td><td>: ' . nl2br(entites_html($valeur)) |
|
| 238 | + $res .= "\n<tr><td><strong>".nl2br(entites_html($nom)) |
|
| 239 | + . '</strong></td><td>: '.nl2br(entites_html($valeur)) |
|
| 240 | 240 | . "</td></tr>\n"; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | $nom_code = $lieu->descr['nom']; |
| 265 | 265 | $skel = $lieu->descr['sourcefile']; |
| 266 | 266 | $h2 = parametre_url($href, 'var_mode_objet', $nom_code); |
| 267 | - $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette') . '#L' . $ligne; |
|
| 267 | + $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette').'#L'.$ligne; |
|
| 268 | 268 | $skel = "<a href='$h3'><b>$skel</b></a>"; |
| 269 | 269 | if ($boucle) { |
| 270 | - $h3 = parametre_url($h2 . $boucle, 'var_mode_affiche', 'boucle'); |
|
| 270 | + $h3 = parametre_url($h2.$boucle, 'var_mode_affiche', 'boucle'); |
|
| 271 | 271 | $boucle = "<a href='$h3'><b>$boucle</b></a>"; |
| 272 | 272 | } |
| 273 | 273 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | // Requete erronee |
| 359 | - $err = '<b>' . _T('avis_erreur_mysql') . " $errno</b><br /><tt>\n" |
|
| 359 | + $err = '<b>'._T('avis_erreur_mysql')." $errno</b><br /><tt>\n" |
|
| 360 | 360 | . spip_htmlspecialchars($msg) |
| 361 | 361 | . "\n<br /><span style='color: red'><b>" |
| 362 | 362 | . spip_htmlspecialchars($query) |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | // https://code.spip.net/@trouve_boucle_debug |
| 372 | 372 | function trouve_boucle_debug($n, $nom, $debut = 0, $boucle = '') { |
| 373 | 373 | |
| 374 | - $id = $nom . $boucle; |
|
| 374 | + $id = $nom.$boucle; |
|
| 375 | 375 | if (is_array($GLOBALS['debug_objets']['sequence'][$id])) { |
| 376 | 376 | foreach ($GLOBALS['debug_objets']['sequence'][$id] as $v) { |
| 377 | 377 | if (!preg_match('/^(.*)(<\?.*\?>)(.*)$/s', $v[0], $r)) { |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | - $incl = ',' . $reg[1] . '[.]\w$,'; |
|
| 421 | + $incl = ','.$reg[1].'[.]\w$,'; |
|
| 422 | 422 | |
| 423 | 423 | foreach ($GLOBALS['debug_objets']['sourcefile'] as $k => $v) { |
| 424 | 424 | if (preg_match($incl, $v)) { |
@@ -434,16 +434,13 @@ discard block |
||
| 434 | 434 | list($skel, $boucle, $ligne) = trouve_boucle_debug($n, $nom); |
| 435 | 435 | |
| 436 | 436 | if (!$boucle) { |
| 437 | - return !$ligne ? '' : |
|
| 438 | - (' (' . |
|
| 439 | - (($nom != $skel) ? _T('squelette_inclus_ligne') : |
|
| 440 | - _T('squelette_ligne')) . |
|
| 437 | + return !$ligne ? '' : (' ('. |
|
| 438 | + (($nom != $skel) ? _T('squelette_inclus_ligne') : _T('squelette_ligne')). |
|
| 441 | 439 | " <a href='$self&var_mode_objet=$skel&var_mode_affiche=squelette&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"); |
| 442 | 440 | } else { |
| 443 | 441 | $self .= "&var_mode_objet=$skel$boucle&var_mode_affiche=boucle"; |
| 444 | 442 | |
| 445 | - return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : |
|
| 446 | - " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 443 | + return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 447 | 444 | } |
| 448 | 445 | } |
| 449 | 446 | |
@@ -466,14 +463,14 @@ discard block |
||
| 466 | 463 | |
| 467 | 464 | $s = preg_replace( |
| 468 | 465 | ',<(\w[^<>]*)>([^<]*)<br />([^<]*)</\1>,', |
| 469 | - '<\1>\2</\1><br />' . "\n" . '<\1>\3</\1>', |
|
| 466 | + '<\1>\2</\1><br />'."\n".'<\1>\3</\1>', |
|
| 470 | 467 | $s |
| 471 | 468 | ); |
| 472 | 469 | |
| 473 | 470 | |
| 474 | 471 | $tableau = explode('<br />', $s); |
| 475 | 472 | |
| 476 | - $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: " . ($nocpt ? 'hidden' : 'visible') . ";%s' href='#T%s' title=\"%s\">%0" . strval(@strlen(count($tableau))) . "d</a></span> %s<br />\n"; |
|
| 473 | + $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: ".($nocpt ? 'hidden' : 'visible').";%s' href='#T%s' title=\"%s\">%0".strval(@strlen(count($tableau)))."d</a></span> %s<br />\n"; |
|
| 477 | 474 | |
| 478 | 475 | $format10 = str_replace('white', 'lightgrey', $format); |
| 479 | 476 | $formaterr = 'color: red;'; |
@@ -517,7 +514,7 @@ discard block |
||
| 517 | 514 | . '" style="cursor: pointer;">' |
| 518 | 515 | . ($nocpt ? '' : _T('info_numero_abbreviation')) |
| 519 | 516 | . '</div> |
| 520 | - ' . $res . "</div>\n"; |
|
| 517 | + ' . $res."</div>\n"; |
|
| 521 | 518 | } |
| 522 | 519 | |
| 523 | 520 | // l'environnement graphique du debuggueur |
@@ -538,14 +535,14 @@ discard block |
||
| 538 | 535 | if (!empty($GLOBALS['debug_objets'][$mode][$fonc])) { |
| 539 | 536 | list($legend, $texte, $res2) = debusquer_source($fonc, $mode); |
| 540 | 537 | $texte .= $res2; |
| 541 | - } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc . 'tout'])) { |
|
| 542 | - $legend = _T('zbug_' . $mode); |
|
| 543 | - $texte = $GLOBALS['debug_objets'][$mode][$fonc . 'tout']; |
|
| 538 | + } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc.'tout'])) { |
|
| 539 | + $legend = _T('zbug_'.$mode); |
|
| 540 | + $texte = $GLOBALS['debug_objets'][$mode][$fonc.'tout']; |
|
| 544 | 541 | $texte = ancre_texte($texte, ['', '']); |
| 545 | 542 | } |
| 546 | 543 | } else { |
| 547 | 544 | if (strlen(trim($res))) { |
| 548 | - return "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 545 | + return "<img src='".chemin_image('debug-xx.svg')."' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 549 | 546 | } else { |
| 550 | 547 | // cas de l'appel sur erreur: montre la page |
| 551 | 548 | return isset($GLOBALS['debug_objets']['resultat']['tout']) |
@@ -555,7 +552,7 @@ discard block |
||
| 555 | 552 | } |
| 556 | 553 | } else { |
| 557 | 554 | $valider = charger_fonction('valider', 'xml'); |
| 558 | - $val = $valider($GLOBALS['debug_objets']['validation'][$fonc . 'tout']); |
|
| 555 | + $val = $valider($GLOBALS['debug_objets']['validation'][$fonc.'tout']); |
|
| 559 | 556 | // Si erreur, signaler leur nombre dans le formulaire admin |
| 560 | 557 | $GLOBALS['debug_objets']['validation'] = $val->err ? count($val->err) : ''; |
| 561 | 558 | list($texte, $err) = emboite_texte($val, $fonc, $self); |
@@ -566,14 +563,14 @@ discard block |
||
| 566 | 563 | } else { |
| 567 | 564 | $err = ": $err"; |
| 568 | 565 | } |
| 569 | - $legend = _T('validation') . ' ' . $err; |
|
| 566 | + $legend = _T('validation').' '.$err; |
|
| 570 | 567 | $res = $id = ''; |
| 571 | 568 | } |
| 572 | 569 | |
| 573 | 570 | return !trim($texte) ? '' : ( |
| 574 | - "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 571 | + "<img src='".chemin_image('debug-xx.svg')."' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 575 | 572 | . "<div id='debug_boucle'><fieldset$id><legend>" |
| 576 | - . "<a href='" . $self . '#f_' . substr($fonc, 0, 37) . "'> ↑ " |
|
| 573 | + . "<a href='".$self.'#f_'.substr($fonc, 0, 37)."'> ↑ " |
|
| 577 | 574 | . ($legend ? $legend : $mode) |
| 578 | 575 | . '</a></legend>' |
| 579 | 576 | . $texte |
@@ -585,7 +582,7 @@ discard block |
||
| 585 | 582 | // https://code.spip.net/@emboite_texte |
| 586 | 583 | function emboite_texte($res, $fonc = '', $self = '') { |
| 587 | 584 | $errs = $res->err; |
| 588 | - $texte = $res->entete . ($errs ? '' : $res->page); |
|
| 585 | + $texte = $res->entete.($errs ? '' : $res->page); |
|
| 589 | 586 | |
| 590 | 587 | if (!$texte and !$errs) { |
| 591 | 588 | return [ancre_texte('', ['', '']), false]; |
@@ -641,7 +638,7 @@ discard block |
||
| 641 | 638 | $err = "<h2 style='text-align: center'>" |
| 642 | 639 | . $i |
| 643 | 640 | . "<a href='#fin_err'>" |
| 644 | - . ' ' . _T('erreur_texte') |
|
| 641 | + . ' '._T('erreur_texte') |
|
| 645 | 642 | . "</a></h2><table id='debut_err' style='width: 100%'>" |
| 646 | 643 | . $err |
| 647 | 644 | . " </table><a id='fin_err'></a>"; |
@@ -651,9 +648,9 @@ discard block |
||
| 651 | 648 | list($msg, $fermant, $ouvrant) = $errs[0]; |
| 652 | 649 | $rf = reference_boucle_debug($fermant, $fonc, $self); |
| 653 | 650 | $ro = reference_boucle_debug($ouvrant, $fonc, $self); |
| 654 | - $err = $msg . |
|
| 655 | - "<a href='#L" . $fermant . "'>$fermant</a>$rf<br />" . |
|
| 656 | - "<a href='#L" . $ouvrant . "'>$ouvrant</a>$ro"; |
|
| 651 | + $err = $msg. |
|
| 652 | + "<a href='#L".$fermant."'>$fermant</a>$rf<br />". |
|
| 653 | + "<a href='#L".$ouvrant."'>$ouvrant</a>$ro"; |
|
| 657 | 654 | |
| 658 | 655 | return [ancre_texte($texte, [[$ouvrant], [$fermant]]), $err]; |
| 659 | 656 | } |
@@ -687,7 +684,7 @@ discard block |
||
| 687 | 684 | ['time' => $GLOBALS['debug_objets']['profile'][$sourcefile]] |
| 688 | 685 | ); |
| 689 | 686 | |
| 690 | - $res .= "<fieldset id='f_" . $nom . "'><legend>" |
|
| 687 | + $res .= "<fieldset id='f_".$nom."'><legend>" |
|
| 691 | 688 | . $t_skel |
| 692 | 689 | . ' ' |
| 693 | 690 | . $sourcefile |
@@ -702,7 +699,7 @@ discard block |
||
| 702 | 699 | . "'>" |
| 703 | 700 | . _T('zbug_calcul') |
| 704 | 701 | . '</a></legend>' |
| 705 | - . (!$temps ? '' : ("\n<span style='display:block;float:" . $GLOBALS['spip_lang_right'] . "'>$temps</span><br />")) |
|
| 702 | + . (!$temps ? '' : ("\n<span style='display:block;float:".$GLOBALS['spip_lang_right']."'>$temps</span><br />")) |
|
| 706 | 703 | . debusquer_contexte($contexte[$sourcefile]) |
| 707 | 704 | . (!$nav ? '' : ("<table width='100%'>\n$nav</table>\n")) |
| 708 | 705 | . "</fieldset>\n"; |
@@ -723,33 +720,33 @@ discard block |
||
| 723 | 720 | $nom = $boucle->id_boucle; |
| 724 | 721 | $req = $boucle->type_requete; |
| 725 | 722 | $crit = public_decompiler($boucle, $gram, 0, 'criteres'); |
| 726 | - $self2 = $self . '&var_mode_objet=' . $objet; |
|
| 727 | - |
|
| 728 | - $res .= "\n<tr style='background-color: " . |
|
| 729 | - ($i % 2 ? '#e0e0f0' : '#f8f8ff') . |
|
| 730 | - "'><td align='right'>$i</td><td>\n" . |
|
| 731 | - "<a class='debug_link_boucle' href='" . |
|
| 732 | - $self2 . |
|
| 733 | - "&var_mode_affiche=boucle#f_$nom_skel'>" . |
|
| 734 | - _T('zbug_boucle') . |
|
| 735 | - "</a></td><td>\n<a class='debug_link_boucle' href='" . |
|
| 736 | - $self2 . |
|
| 737 | - "&var_mode_affiche=resultat#f_$nom_skel'>" . |
|
| 738 | - _T('zbug_resultat') . |
|
| 739 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 740 | - $self2 . |
|
| 741 | - "&var_mode_affiche=code#f_$nom_skel'>" . |
|
| 742 | - _T('zbug_code') . |
|
| 743 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 744 | - str_replace('var_mode=', 'var_profile=', $self2) . |
|
| 745 | - "'>" . |
|
| 746 | - _T('zbug_calcul') . |
|
| 747 | - "</a></td><td>\n" . |
|
| 748 | - (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom) . |
|
| 749 | - "</td><td>\n" . |
|
| 750 | - $req . |
|
| 751 | - "</td><td>\n" . |
|
| 752 | - spip_htmlspecialchars($crit) . |
|
| 723 | + $self2 = $self.'&var_mode_objet='.$objet; |
|
| 724 | + |
|
| 725 | + $res .= "\n<tr style='background-color: ". |
|
| 726 | + ($i % 2 ? '#e0e0f0' : '#f8f8ff'). |
|
| 727 | + "'><td align='right'>$i</td><td>\n". |
|
| 728 | + "<a class='debug_link_boucle' href='". |
|
| 729 | + $self2. |
|
| 730 | + "&var_mode_affiche=boucle#f_$nom_skel'>". |
|
| 731 | + _T('zbug_boucle'). |
|
| 732 | + "</a></td><td>\n<a class='debug_link_boucle' href='". |
|
| 733 | + $self2. |
|
| 734 | + "&var_mode_affiche=resultat#f_$nom_skel'>". |
|
| 735 | + _T('zbug_resultat'). |
|
| 736 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 737 | + $self2. |
|
| 738 | + "&var_mode_affiche=code#f_$nom_skel'>". |
|
| 739 | + _T('zbug_code'). |
|
| 740 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 741 | + str_replace('var_mode=', 'var_profile=', $self2). |
|
| 742 | + "'>". |
|
| 743 | + _T('zbug_calcul'). |
|
| 744 | + "</a></td><td>\n". |
|
| 745 | + (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom). |
|
| 746 | + "</td><td>\n". |
|
| 747 | + $req. |
|
| 748 | + "</td><td>\n". |
|
| 749 | + spip_htmlspecialchars($crit). |
|
| 753 | 750 | '</td></tr>'; |
| 754 | 751 | } |
| 755 | 752 | } |
@@ -776,7 +773,7 @@ discard block |
||
| 776 | 773 | } |
| 777 | 774 | // permettre le copier/coller facile |
| 778 | 775 | // $res = ancre_texte($req, array(), true); |
| 779 | - $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n"; |
|
| 776 | + $res = "<div id='T".md5($req)."'>\n<pre>\n".$req."</pre>\n</div>\n"; |
|
| 780 | 777 | // formatage et affichage des resultats bruts de la requete |
| 781 | 778 | $ress_req = spip_query($req); |
| 782 | 779 | $brut_sql = ''; |
@@ -786,10 +783,10 @@ discard block |
||
| 786 | 783 | $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50; |
| 787 | 784 | while ($retours_sql = sql_fetch($ress_req)) { |
| 788 | 785 | if ($num <= $max_aff) { |
| 789 | - $brut_sql .= '<h3>' . ($num == 1 ? $num . ' sur ' . sql_count($ress_req) : $num) . '</h3>'; |
|
| 786 | + $brut_sql .= '<h3>'.($num == 1 ? $num.' sur '.sql_count($ress_req) : $num).'</h3>'; |
|
| 790 | 787 | $brut_sql .= '<p>'; |
| 791 | 788 | foreach ($retours_sql as $key => $val) { |
| 792 | - $brut_sql .= '<strong>' . $key . '</strong> => ' . spip_htmlspecialchars(couper($val, 150)) . "<br />\n"; |
|
| 789 | + $brut_sql .= '<strong>'.$key.'</strong> => '.spip_htmlspecialchars(couper($val, 150))."<br />\n"; |
|
| 793 | 790 | } |
| 794 | 791 | $brut_sql .= '</p>'; |
| 795 | 792 | } |
@@ -800,14 +797,14 @@ discard block |
||
| 800 | 797 | // ne pas afficher les $contexte_inclus |
| 801 | 798 | $view = preg_replace(',<\?php.+\?[>],Uims', '', $view); |
| 802 | 799 | if ($view) { |
| 803 | - $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . '</fieldset>'; |
|
| 800 | + $res2 .= "\n<br /><fieldset>".interdire_scripts($view).'</fieldset>'; |
|
| 804 | 801 | } |
| 805 | 802 | } |
| 806 | 803 | } elseif ($affiche == 'code') { |
| 807 | 804 | $legend = $nom; |
| 808 | - $res = ancre_texte('<' . "?php\n" . $quoi . "\n?" . '>'); |
|
| 805 | + $res = ancre_texte('<'."?php\n".$quoi."\n?".'>'); |
|
| 809 | 806 | } elseif ($affiche == 'boucle') { |
| 810 | - $legend = _T('zbug_boucle') . ' ' . $nom; |
|
| 807 | + $legend = _T('zbug_boucle').' '.$nom; |
|
| 811 | 808 | // Le compilateur prefixe le nom des boucles par l'extension du fichier source. |
| 812 | 809 | $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : ''; |
| 813 | 810 | $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle')); |
@@ -826,23 +823,23 @@ discard block |
||
| 826 | 823 | include_spip('public/assembler'); // pour inclure_balise_dynamique |
| 827 | 824 | include_spip('inc/texte'); // pour corriger_typo |
| 828 | 825 | |
| 829 | - return _DOCTYPE_ECRIRE . |
|
| 830 | - html_lang_attributes() . |
|
| 831 | - "<head>\n<title>" . |
|
| 832 | - ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . |
|
| 833 | - _T('admin_debug') . ' ' . $titre . ' (' . |
|
| 834 | - supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . |
|
| 835 | - ")</title>\n" . |
|
| 836 | - "<meta http-equiv='Content-Type' content='text/html" . |
|
| 837 | - (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . |
|
| 838 | - "' />\n" . |
|
| 826 | + return _DOCTYPE_ECRIRE. |
|
| 827 | + html_lang_attributes(). |
|
| 828 | + "<head>\n<title>". |
|
| 829 | + ('SPIP '.$GLOBALS['spip_version_affichee'].' '. |
|
| 830 | + _T('admin_debug').' '.$titre.' ('. |
|
| 831 | + supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))). |
|
| 832 | + ")</title>\n". |
|
| 833 | + "<meta http-equiv='Content-Type' content='text/html". |
|
| 834 | + (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : ''). |
|
| 835 | + "' />\n". |
|
| 839 | 836 | http_script('', 'jquery.js') |
| 840 | - . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) |
|
| 841 | - . "' type='text/css' />" . |
|
| 842 | - "</head>\n" . |
|
| 843 | - "<body style='margin:0 10px;'>\n" . |
|
| 844 | - "<div id='spip-debug-header'>" . |
|
| 845 | - $corps . |
|
| 846 | - inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false) . |
|
| 837 | + . "<link rel='stylesheet' href='".url_absolue(find_in_path('spip_admin.css')) |
|
| 838 | + . "' type='text/css' />". |
|
| 839 | + "</head>\n". |
|
| 840 | + "<body style='margin:0 10px;'>\n". |
|
| 841 | + "<div id='spip-debug-header'>". |
|
| 842 | + $corps. |
|
| 843 | + inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false). |
|
| 847 | 844 | '</div></body></html>'; |
| 848 | 845 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } else { |
| 81 | 81 | // Preparer l'appel de la fonction principale du squelette |
| 82 | 82 | |
| 83 | - spip_timer($a = 'calcul page ' . rand(0, 1000)); |
|
| 83 | + spip_timer($a = 'calcul page '.rand(0, 1000)); |
|
| 84 | 84 | |
| 85 | 85 | // On cree un marqueur de notes unique lie a cette composition |
| 86 | 86 | // et on enregistre l'etat courant des globales de notes... |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | try { |
| 113 | 113 | $page = $fonc(['cache' => $cache], [$contexte]); |
| 114 | 114 | } catch (Throwable $e) { |
| 115 | - $msg = _T('zbug_erreur_execution_page') . " $sourcefile"; |
|
| 116 | - $full_msg = $msg . ' | File ' . $e->getFile() . ' Line ' . $e->getLine() . ' : ' . $e->getMessage(); |
|
| 115 | + $msg = _T('zbug_erreur_execution_page')." $sourcefile"; |
|
| 116 | + $full_msg = $msg.' | File '.$e->getFile().' Line '.$e->getLine().' : '.$e->getMessage(); |
|
| 117 | 117 | $full_msg = str_replace(_ROOT_RACINE, '[…]/', $full_msg); |
| 118 | 118 | $corps = "<pre>$msg</pre>"; |
| 119 | 119 | $page = analyse_resultat_skel($fond, ['cache' => $cache], $corps, $sourcefile); |
@@ -144,17 +144,17 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $profile = spip_timer($a); |
| 146 | 146 | spip_log("calcul ($profile) [$skel] $infos" |
| 147 | - . ' (' . strlen($page['texte']) . ' octets)'); |
|
| 147 | + . ' ('.strlen($page['texte']).' octets)'); |
|
| 148 | 148 | |
| 149 | 149 | if (defined('_CALCUL_PROFILER') and intval($profile) > _CALCUL_PROFILER) { |
| 150 | 150 | spip_log("calcul ($profile) [$skel] $infos" |
| 151 | - . ' (' . strlen($page['texte']) . ' octets) | ' . $_SERVER['REQUEST_URI'], 'profiler' . _LOG_AVERTISSEMENT); |
|
| 151 | + . ' ('.strlen($page['texte']).' octets) | '.$_SERVER['REQUEST_URI'], 'profiler'._LOG_AVERTISSEMENT); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if ($debug) { |
| 155 | 155 | // si c'est ce que demande le debusqueur, lui passer la main |
| 156 | 156 | $t = strlen($page['texte']) ? $page['texte'] : ' '; |
| 157 | - $GLOBALS['debug_objets']['resultat'][$fonc . 'tout'] = $t; |
|
| 157 | + $GLOBALS['debug_objets']['resultat'][$fonc.'tout'] = $t; |
|
| 158 | 158 | $GLOBALS['debug_objets']['courant'] = $courant; |
| 159 | 159 | $GLOBALS['debug_objets']['profile'][$sourcefile] = $profile; |
| 160 | 160 | if ( |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | if (defined('_VAR_INCLURE') and _VAR_INCLURE) { |
| 186 | 186 | $page['sourcefile'] = $sourcefile; |
| 187 | 187 | $page['texte'] = |
| 188 | - "<div class='inclure_blocs'><h6>" . $page['sourcefile'] . '</h6>' . $page['texte'] . '</div>' |
|
| 188 | + "<div class='inclure_blocs'><h6>".$page['sourcefile'].'</h6>'.$page['texte'].'</div>' |
|
| 189 | 189 | . ($js_inclus ? '' : "<script type='text/javascript'>jQuery(function(){jQuery('.inclure_blocs > h6:first-child').hover(function(){jQuery(this).parent().addClass('hover')},function(){jQuery(this).parent().removeClass('hover')})});</script>"); |
| 190 | 190 | $js_inclus = true; |
| 191 | 191 | } |
@@ -220,21 +220,21 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | if (is_array($val)) { |
| 222 | 222 | if ($profondeur_max > 0) { |
| 223 | - $val = 'array:' . count($val) . '(' . presenter_contexte($val, $profondeur_max - 1, 3) . ')'; |
|
| 223 | + $val = 'array:'.count($val).'('.presenter_contexte($val, $profondeur_max - 1, 3).')'; |
|
| 224 | 224 | } else { |
| 225 | - $val = 'array:' . count($val); |
|
| 225 | + $val = 'array:'.count($val); |
|
| 226 | 226 | } |
| 227 | 227 | } elseif (is_object($val)) { |
| 228 | 228 | $val = get_class($val); |
| 229 | 229 | } elseif (strlen("$val") > 30) { |
| 230 | - $val = substr("$val", 0, 29) . '…'; |
|
| 230 | + $val = substr("$val", 0, 29).'…'; |
|
| 231 | 231 | if (strstr($val, ' ')) { |
| 232 | 232 | $val = "'$val'"; |
| 233 | 233 | } |
| 234 | 234 | } elseif (strstr($val, ' ')) { |
| 235 | 235 | $val = "'$val'"; |
| 236 | 236 | } |
| 237 | - $infos[] = $var . '=' . $val; |
|
| 237 | + $infos[] = $var.'='.$val; |
|
| 238 | 238 | } |
| 239 | 239 | return join(', ', $infos); |
| 240 | 240 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | . "?php include_spip('inc/headers');redirige_par_entete('" |
| 303 | 303 | . texte_script($url) |
| 304 | 304 | . "','',$status);" |
| 305 | - . '?' . '>', |
|
| 305 | + . '?'.'>', |
|
| 306 | 306 | 'process_ins' => 'php', |
| 307 | 307 | 'status' => $status |
| 308 | 308 | ]; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | : calculer_liste($val, $p->descr, $boucles, $id_boucle); |
| 122 | 122 | if ($var !== 1) { |
| 123 | 123 | $val = ($echap ? "\'$var\' => ' . argumenter_squelette(" : "'$var' => ") |
| 124 | - . $val . ($echap ? ") . '" : ' '); |
|
| 124 | + . $val.($echap ? ") . '" : ' '); |
|
| 125 | 125 | } else { |
| 126 | 126 | $val = $echap ? "'.$val.'" : $val; |
| 127 | 127 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | if (!$lang) { |
| 143 | 143 | $lang = '$GLOBALS["spip_lang"]'; |
| 144 | 144 | } |
| 145 | - $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ") . $lang . ($echap ? ") . '" : ' '); |
|
| 145 | + $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ").$lang.($echap ? ") . '" : ' '); |
|
| 146 | 146 | |
| 147 | 147 | return $l; |
| 148 | 148 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $_contexte = argumenter_inclure($p->param, false, $p, $boucles, $id_boucle, true, '', true); |
| 172 | 172 | if (is_string($p->texte)) { |
| 173 | 173 | $fichier = $p->texte; |
| 174 | - $code = '"' . str_replace('"', '\"', $fichier) . '"'; |
|
| 174 | + $code = '"'.str_replace('"', '\"', $fichier).'"'; |
|
| 175 | 175 | } else { |
| 176 | 176 | $code = calculer_liste($p->texte, $p->descr, $boucles, $id_boucle); |
| 177 | 177 | if ($code and preg_match("/^'([^']*)'/s", $code, $r)) { |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | return false; |
| 221 | 221 | } // j'aurais voulu toucher le fond ... |
| 222 | 222 | |
| 223 | - $contexte = 'array(' . $_contexte . ')'; |
|
| 223 | + $contexte = 'array('.$_contexte.')'; |
|
| 224 | 224 | |
| 225 | 225 | if ($env) { |
| 226 | 226 | $contexte = "array_merge('.var_export(\$Pile[0],1).',$contexte)"; |
@@ -235,16 +235,16 @@ discard block |
||
| 235 | 235 | $_options[] = $ajax; |
| 236 | 236 | } |
| 237 | 237 | $code = " ' . argumenter_squelette($code) . '"; |
| 238 | - $code = 'echo ' . sprintf( |
|
| 238 | + $code = 'echo '.sprintf( |
|
| 239 | 239 | CODE_RECUPERER_FOND, |
| 240 | 240 | $code, |
| 241 | 241 | $contexte, |
| 242 | 242 | implode(',', $_options), |
| 243 | 243 | '_request("connect")' |
| 244 | - ) . ';'; |
|
| 244 | + ).';'; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - return "\n'<'.'" . '?php ' . $code . "\n?'." . "'>'"; |
|
| 247 | + return "\n'<'.'".'?php '.$code."\n?'."."'>'"; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $id = $id_table; |
| 325 | 325 | $statut = preg_replace(',\W,', '', $s['champ']); // securite |
| 326 | 326 | } |
| 327 | - $mstatut = $id . '.' . $statut; |
|
| 327 | + $mstatut = $id.'.'.$statut; |
|
| 328 | 328 | |
| 329 | 329 | $arg_ignore_previsu = ($ignore_previsu ? ',true' : ''); |
| 330 | 330 | include_spip('public/quete'); |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | isset($s['post_date']) and $s['post_date'] |
| 333 | 333 | and $GLOBALS['meta']['post_dates'] == 'non' |
| 334 | 334 | ) { |
| 335 | - $date = $id . '.' . preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 335 | + $date = $id.'.'.preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 336 | 336 | array_unshift( |
| 337 | 337 | $boucle->where, |
| 338 | 338 | $echapper ? |
| 339 | - "\nquete_condition_postdates('$date'," . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 339 | + "\nquete_condition_postdates('$date',"._q($boucle->sql_serveur)."$arg_ignore_previsu)" |
|
| 340 | 340 | : |
| 341 | 341 | quete_condition_postdates($date, $boucle->sql_serveur, $ignore_previsu) |
| 342 | 342 | ); |
@@ -345,9 +345,9 @@ discard block |
||
| 345 | 345 | $boucle->where, |
| 346 | 346 | $echapper ? |
| 347 | 347 | "\nquete_condition_statut('$mstatut'," |
| 348 | - . _q($s['previsu']) . ',' |
|
| 349 | - . _q($s['publie']) . ',' |
|
| 350 | - . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 348 | + . _q($s['previsu']).',' |
|
| 349 | + . _q($s['publie']).',' |
|
| 350 | + . _q($boucle->sql_serveur)."$arg_ignore_previsu)" |
|
| 351 | 351 | : |
| 352 | 352 | quete_condition_statut($mstatut, $s['previsu'], $s['publie'], $boucle->sql_serveur, $ignore_previsu) |
| 353 | 353 | ); |
@@ -381,14 +381,14 @@ discard block |
||
| 381 | 381 | if (_request('var_mode_affiche') != 'resultat') { |
| 382 | 382 | $trace = ''; |
| 383 | 383 | } else { |
| 384 | - $_trace = $boucles[$id_boucle]->descr['nom'] . $id_boucle; |
|
| 384 | + $_trace = $boucles[$id_boucle]->descr['nom'].$id_boucle; |
|
| 385 | 385 | $_trace = "\$GLOBALS['debug_objets']['resultat']['$_trace']"; |
| 386 | 386 | $trace = " |
| 387 | 387 | if (empty($_trace)) { |
| 388 | 388 | $_trace = []; |
| 389 | 389 | } |
| 390 | 390 | if (count($_trace) < 3) { |
| 391 | - $_trace" . '[] = $t0; |
|
| 391 | + $_trace".'[] = $t0; |
|
| 392 | 392 | }'; |
| 393 | 393 | } |
| 394 | 394 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | return |
| 423 | 423 | // Numrows[$nom] peut ne pas être encore defini |
| 424 | 424 | "\n\t\$save_numrows = (isset(\$Numrows['$nom']) ? \$Numrows['$nom'] : array());" |
| 425 | - . "\n\t\$t0 = " . $boucles[$id_boucle]->return . ';' |
|
| 425 | + . "\n\t\$t0 = ".$boucles[$id_boucle]->return.';' |
|
| 426 | 426 | . "\n\t\$Numrows['$nom'] = (\$save_numrows);" |
| 427 | 427 | . $trace |
| 428 | 428 | . "\n\treturn \$t0;"; |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | // faudrait expanser le foreach a la compil, car y en a souvent qu'un |
| 490 | 490 | // et puis faire un [] plutot qu'un "','." |
| 491 | 491 | if ($boucle->doublons) { |
| 492 | - $corps .= "\n\t\t\tforeach(" . $boucle->doublons . ' as $k) $doublons[$k] .= "," . ' . |
|
| 492 | + $corps .= "\n\t\t\tforeach(".$boucle->doublons.' as $k) $doublons[$k] .= "," . '. |
|
| 493 | 493 | index_pile($id_boucle, $primary, $boucles) |
| 494 | 494 | . "; // doublons\n"; |
| 495 | 495 | } |
@@ -517,13 +517,13 @@ discard block |
||
| 517 | 517 | $corps .= |
| 518 | 518 | "\n\t\tlang_select_public(" |
| 519 | 519 | . index_pile($id_boucle, 'lang', $boucles) |
| 520 | - . ", '" . $boucle->lang_select . "'" |
|
| 520 | + . ", '".$boucle->lang_select."'" |
|
| 521 | 521 | . (in_array($type_boucle, [ |
| 522 | 522 | 'articles', |
| 523 | 523 | 'rubriques', |
| 524 | 524 | 'hierarchie', |
| 525 | 525 | 'breves' |
| 526 | - ]) ? ', ' . index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 526 | + ]) ? ', '.index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 527 | 527 | . ');'; |
| 528 | 528 | } else { |
| 529 | 529 | $init_lang = ''; |
@@ -545,20 +545,16 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | // gestion optimale des separateurs et des boucles constantes |
| 547 | 547 | if (count($boucle->separateur)) { |
| 548 | - $code_sep = ("'" . str_replace("'", "\'", join('', $boucle->separateur)) . "'"); |
|
| 548 | + $code_sep = ("'".str_replace("'", "\'", join('', $boucle->separateur))."'"); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | $corps .= |
| 552 | 552 | ((!$boucle->separateur) ? |
| 553 | - (($constant && !$corps && !$flag_cpt) ? $return : |
|
| 554 | - (($return === "''") ? '' : |
|
| 555 | - ("\n\t\t" . '$t0 .= ' . $return . ';'))) : |
|
| 556 | - ("\n\t\t\$t1 " . |
|
| 553 | + (($constant && !$corps && !$flag_cpt) ? $return : (($return === "''") ? '' : ("\n\t\t".'$t0 .= '.$return.';'))) : ("\n\t\t\$t1 ". |
|
| 557 | 554 | ((strpos($return, '$t1.') === 0) ? |
| 558 | - ('.=' . substr($return, 4)) : |
|
| 559 | - ('= ' . $return)) . |
|
| 560 | - ";\n\t\t" . |
|
| 561 | - '$t0 .= ((strlen($t1) && strlen($t0)) ? ' . $code_sep . " : '') . \$t1;")); |
|
| 555 | + ('.='.substr($return, 4)) : ('= '.$return)). |
|
| 556 | + ";\n\t\t". |
|
| 557 | + '$t0 .= ((strlen($t1) && strlen($t0)) ? '.$code_sep." : '') . \$t1;")); |
|
| 562 | 558 | |
| 563 | 559 | // Calculer les invalideurs si c'est une boucle non constante et si on |
| 564 | 560 | // souhaite invalider ces elements |
@@ -640,7 +636,7 @@ discard block |
||
| 640 | 636 | $corps, |
| 641 | 637 | $fin_lang, |
| 642 | 638 | $trace, |
| 643 | - 'BOUCLE' . $id_boucle . ' @ ' . ($boucle->descr['sourcefile']) |
|
| 639 | + 'BOUCLE'.$id_boucle.' @ '.($boucle->descr['sourcefile']) |
|
| 644 | 640 | ); |
| 645 | 641 | |
| 646 | 642 | # var_dump($a);exit; |
@@ -661,23 +657,23 @@ discard block |
||
| 661 | 657 | **/ |
| 662 | 658 | function calculer_requete_sql($boucle) { |
| 663 | 659 | $init = []; |
| 664 | - $init[] = calculer_dec('table', "'" . $boucle->id_table . "'"); |
|
| 665 | - $init[] = calculer_dec('id', "'" . $boucle->id_boucle . "'"); |
|
| 660 | + $init[] = calculer_dec('table', "'".$boucle->id_table."'"); |
|
| 661 | + $init[] = calculer_dec('id', "'".$boucle->id_boucle."'"); |
|
| 666 | 662 | # En absence de champ c'est un decompte : |
| 667 | 663 | $init[] = calculer_dec('from', calculer_from($boucle)); |
| 668 | 664 | $init[] = calculer_dec('type', calculer_from_type($boucle)); |
| 669 | 665 | $init[] = calculer_dec( |
| 670 | 666 | 'groupby', |
| 671 | - 'array(' . (($g = join("\",\n\t\t\"", $boucle->group)) ? '"' . $g . '"' : '') . ')' |
|
| 667 | + 'array('.(($g = join("\",\n\t\t\"", $boucle->group)) ? '"'.$g.'"' : '').')' |
|
| 672 | 668 | ); |
| 673 | - $init[] = calculer_dec('select', 'array("' . join("\",\n\t\t\"", $boucle->select) . '")'); |
|
| 674 | - $init[] = calculer_dec('orderby', 'array(' . calculer_order($boucle) . ')'); |
|
| 669 | + $init[] = calculer_dec('select', 'array("'.join("\",\n\t\t\"", $boucle->select).'")'); |
|
| 670 | + $init[] = calculer_dec('orderby', 'array('.calculer_order($boucle).')'); |
|
| 675 | 671 | $init[] = calculer_dec('where', calculer_dump_array($boucle->where)); |
| 676 | 672 | $init[] = calculer_dec('join', calculer_dump_join($boucle->join)); |
| 677 | 673 | $init[] = calculer_dec( |
| 678 | 674 | 'limit', |
| 679 | 675 | (strpos($boucle->limit, 'intval') === false ? |
| 680 | - "'" . $boucle->limit . "'" |
|
| 676 | + "'".$boucle->limit."'" |
|
| 681 | 677 | : |
| 682 | 678 | $boucle->limit) |
| 683 | 679 | ); |
@@ -687,17 +683,17 @@ discard block |
||
| 687 | 683 | // ou recalculée à chaque passage (vide) |
| 688 | 684 | foreach ($init as $i) { |
| 689 | 685 | if (reset($i)) { |
| 690 | - $s .= "\n\t\t" . end($i); |
|
| 686 | + $s .= "\n\t\t".end($i); |
|
| 691 | 687 | } # statique |
| 692 | 688 | else { |
| 693 | - $d .= "\n\t" . end($i); |
|
| 689 | + $d .= "\n\t".end($i); |
|
| 694 | 690 | } # dynamique |
| 695 | 691 | } |
| 696 | 692 | |
| 697 | 693 | return ($boucle->hierarchie ? "\n\t$boucle->hierarchie" : '') |
| 698 | 694 | . $boucle->in |
| 699 | 695 | . $boucle->hash |
| 700 | - . "\n\t" . 'if (!isset($command[\'table\'])) {' |
|
| 696 | + . "\n\t".'if (!isset($command[\'table\'])) {' |
|
| 701 | 697 | . $s |
| 702 | 698 | . "\n\t}" |
| 703 | 699 | . $d; |
@@ -780,7 +776,7 @@ discard block |
||
| 780 | 776 | * - index 1 : Code de l'affectation |
| 781 | 777 | **/ |
| 782 | 778 | function calculer_dec($nom, $val) { |
| 783 | - $static = 'if (!isset($command[\'' . $nom . '\'])) '; |
|
| 779 | + $static = 'if (!isset($command[\''.$nom.'\'])) '; |
|
| 784 | 780 | // si une variable apparait dans le calcul de la clause |
| 785 | 781 | // il faut la re-evaluer a chaque passage |
| 786 | 782 | if ( |
@@ -797,7 +793,7 @@ discard block |
||
| 797 | 793 | $static = ''; |
| 798 | 794 | } |
| 799 | 795 | |
| 800 | - return [$static, '$command[\'' . $nom . '\'] = ' . $val . ';']; |
|
| 796 | + return [$static, '$command[\''.$nom.'\'] = '.$val.';']; |
|
| 801 | 797 | } |
| 802 | 798 | |
| 803 | 799 | /** |
@@ -822,17 +818,17 @@ discard block |
||
| 822 | 818 | } |
| 823 | 819 | $res = ''; |
| 824 | 820 | if ($a and $a[0] == "'?'") { |
| 825 | - return ('(' . calculer_dump_array($a[1]) . |
|
| 826 | - ' ? ' . calculer_dump_array($a[2]) . |
|
| 827 | - ' : ' . calculer_dump_array($a[3]) . |
|
| 821 | + return ('('.calculer_dump_array($a[1]). |
|
| 822 | + ' ? '.calculer_dump_array($a[2]). |
|
| 823 | + ' : '.calculer_dump_array($a[3]). |
|
| 828 | 824 | ')'); |
| 829 | 825 | } else { |
| 830 | 826 | foreach ($a as $k => $v) { |
| 831 | - $showk = (is_numeric($k) ? '' : sql_quote($k) . ' => '); |
|
| 832 | - $res .= ', ' . $showk . calculer_dump_array($v); |
|
| 827 | + $showk = (is_numeric($k) ? '' : sql_quote($k).' => '); |
|
| 828 | + $res .= ', '.$showk.calculer_dump_array($v); |
|
| 833 | 829 | } |
| 834 | 830 | |
| 835 | - return "\n\t\t\tarray(" . substr($res, 2) . ')'; |
|
| 831 | + return "\n\t\t\tarray(".substr($res, 2).')'; |
|
| 836 | 832 | } |
| 837 | 833 | } |
| 838 | 834 | |
@@ -840,10 +836,10 @@ discard block |
||
| 840 | 836 | function calculer_dump_join($a) { |
| 841 | 837 | $res = ''; |
| 842 | 838 | foreach ($a as $k => $v) { |
| 843 | - $res .= ", '$k' => array(" . implode(',', $v) . ')'; |
|
| 839 | + $res .= ", '$k' => array(".implode(',', $v).')'; |
|
| 844 | 840 | } |
| 845 | 841 | |
| 846 | - return 'array(' . substr($res, 2) . ')'; |
|
| 842 | + return 'array('.substr($res, 2).')'; |
|
| 847 | 843 | } |
| 848 | 844 | |
| 849 | 845 | /** |
@@ -860,7 +856,7 @@ discard block |
||
| 860 | 856 | $res .= ",'$k' => '$v'"; |
| 861 | 857 | } |
| 862 | 858 | |
| 863 | - return 'array(' . substr($res, 1) . ')'; |
|
| 859 | + return 'array('.substr($res, 1).')'; |
|
| 864 | 860 | } |
| 865 | 861 | |
| 866 | 862 | /** |
@@ -878,7 +874,7 @@ discard block |
||
| 878 | 874 | $res .= ",'$k' => '$v'"; |
| 879 | 875 | } |
| 880 | 876 | |
| 881 | - return 'array(' . substr($res, 1) . ')'; |
|
| 877 | + return 'array('.substr($res, 1).')'; |
|
| 882 | 878 | } |
| 883 | 879 | |
| 884 | 880 | // https://code.spip.net/@calculer_order |
@@ -949,19 +945,19 @@ discard block |
||
| 949 | 945 | ) { |
| 950 | 946 | $res .= " .\n$tab$code"; |
| 951 | 947 | } else { |
| 952 | - $res = substr($res, 0, -1) . substr($code, 1); |
|
| 948 | + $res = substr($res, 0, -1).substr($code, 1); |
|
| 953 | 949 | } |
| 954 | 950 | } |
| 955 | 951 | |
| 956 | - return '(' . substr($res, 2 + $descr['niv']) . ')'; |
|
| 952 | + return '('.substr($res, 2 + $descr['niv']).')'; |
|
| 957 | 953 | } |
| 958 | 954 | } else { |
| 959 | - $nom = $descr['nom'] . $id_boucle . ($descr['niv'] ? $descr['niv'] : ''); |
|
| 955 | + $nom = $descr['nom'].$id_boucle.($descr['niv'] ? $descr['niv'] : ''); |
|
| 960 | 956 | |
| 961 | - return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(" . join( |
|
| 957 | + return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(".join( |
|
| 962 | 958 | " ,\n$tab", |
| 963 | 959 | $codes |
| 964 | - ) . ')))'; |
|
| 960 | + ).')))'; |
|
| 965 | 961 | } |
| 966 | 962 | } |
| 967 | 963 | |
@@ -989,7 +985,7 @@ discard block |
||
| 989 | 985 | // texte seul |
| 990 | 986 | case 'texte': |
| 991 | 987 | $code = sandbox_composer_texte($p->texte, $p); |
| 992 | - $commentaire = strlen($p->texte) . ' signes'; |
|
| 988 | + $commentaire = strlen($p->texte).' signes'; |
|
| 993 | 989 | $avant = ''; |
| 994 | 990 | $apres = ''; |
| 995 | 991 | $altern = "''"; |
@@ -998,14 +994,14 @@ discard block |
||
| 998 | 994 | case 'polyglotte': |
| 999 | 995 | $code = ''; |
| 1000 | 996 | foreach ($p->traductions as $k => $v) { |
| 1001 | - $code .= ",'" . |
|
| 1002 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $k) . |
|
| 1003 | - "' => '" . |
|
| 1004 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $v) . |
|
| 997 | + $code .= ",'". |
|
| 998 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $k). |
|
| 999 | + "' => '". |
|
| 1000 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $v). |
|
| 1005 | 1001 | "'"; |
| 1006 | 1002 | } |
| 1007 | - $code = 'choisir_traduction(array(' . |
|
| 1008 | - substr($code, 1) . |
|
| 1003 | + $code = 'choisir_traduction(array('. |
|
| 1004 | + substr($code, 1). |
|
| 1009 | 1005 | '))'; |
| 1010 | 1006 | $commentaire = '&'; |
| 1011 | 1007 | $avant = ''; |
@@ -1021,7 +1017,7 @@ discard block |
||
| 1021 | 1017 | $err_e_c = true; |
| 1022 | 1018 | $code = "''"; |
| 1023 | 1019 | } else { |
| 1024 | - $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 1020 | + $commentaire = '<INCLURE '.addslashes(str_replace("\n", ' ', $code)).'>'; |
|
| 1025 | 1021 | $avant = ''; |
| 1026 | 1022 | $apres = ''; |
| 1027 | 1023 | $altern = "''"; |
@@ -1050,8 +1046,8 @@ discard block |
||
| 1050 | 1046 | $err_e_c = true; |
| 1051 | 1047 | $code = "''"; |
| 1052 | 1048 | } else { |
| 1053 | - $code = 'BOUCLE' . |
|
| 1054 | - str_replace('-', '_', $nom) . $descr['nom'] . |
|
| 1049 | + $code = 'BOUCLE'. |
|
| 1050 | + str_replace('-', '_', $nom).$descr['nom']. |
|
| 1055 | 1051 | '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
| 1056 | 1052 | $commentaire = "?$nom"; |
| 1057 | 1053 | if ( |
@@ -1093,24 +1089,22 @@ discard block |
||
| 1093 | 1089 | foreach ($p->arg as $k => $v) { |
| 1094 | 1090 | $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
| 1095 | 1091 | if ($k) { |
| 1096 | - $l[] = _q($k) . ' => ' . $_v; |
|
| 1092 | + $l[] = _q($k).' => '.$_v; |
|
| 1097 | 1093 | } else { |
| 1098 | 1094 | $code = $_v; |
| 1099 | 1095 | } |
| 1100 | 1096 | } |
| 1101 | 1097 | // Si le module n'est pas fourni, l'expliciter sauf si calculé |
| 1102 | 1098 | if ($p->module) { |
| 1103 | - $m = $p->module . ':' . $p->nom_champ; |
|
| 1099 | + $m = $p->module.':'.$p->nom_champ; |
|
| 1104 | 1100 | } elseif ($p->nom_champ) { |
| 1105 | - $m = MODULES_IDIOMES . ':' . $p->nom_champ; |
|
| 1101 | + $m = MODULES_IDIOMES.':'.$p->nom_champ; |
|
| 1106 | 1102 | } else { |
| 1107 | 1103 | $m = ''; |
| 1108 | 1104 | } |
| 1109 | 1105 | |
| 1110 | - $code = (!$code ? "'$m'" : |
|
| 1111 | - ($m ? "'$m' . $code" : |
|
| 1112 | - ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 1113 | - . (!$l ? '' : (', array(' . implode(",\n", $l) . ')')); |
|
| 1106 | + $code = (!$code ? "'$m'" : ($m ? "'$m' . $code" : ("(strpos(\$x=$code, ':') ? \$x : ('".MODULES_IDIOMES.":' . \$x))"))) |
|
| 1107 | + . (!$l ? '' : (', array('.implode(",\n", $l).')')); |
|
| 1114 | 1108 | $code = "_T($code)"; |
| 1115 | 1109 | if ($p->param) { |
| 1116 | 1110 | $p->id_boucle = $id_boucle; |
@@ -1132,7 +1126,7 @@ discard block |
||
| 1132 | 1126 | $p->type_requete = $type; |
| 1133 | 1127 | |
| 1134 | 1128 | $code = calculer_champ($p); |
| 1135 | - $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 1129 | + $commentaire = '#'.$p->nom_champ.$p->etoile; |
|
| 1136 | 1130 | $avant = calculer_liste( |
| 1137 | 1131 | $p->avant, |
| 1138 | 1132 | $descr, |
@@ -1172,10 +1166,9 @@ discard block |
||
| 1172 | 1166 | if ($code != "''") { |
| 1173 | 1167 | $code = compile_retour($code, $avant, $apres, $altern, $tab, $descr['niv']); |
| 1174 | 1168 | $codes[] = (($mode == 'validation') ? |
| 1175 | - "array($code, '$commentaire', " . $p->ligne . ')' |
|
| 1169 | + "array($code, '$commentaire', ".$p->ligne.')' |
|
| 1176 | 1170 | : (($mode == 'code') ? |
| 1177 | - "\n// $commentaire\n$code" : |
|
| 1178 | - $code)); |
|
| 1171 | + "\n// $commentaire\n$code" : $code)); |
|
| 1179 | 1172 | } |
| 1180 | 1173 | } // foreach |
| 1181 | 1174 | |
@@ -1232,19 +1225,19 @@ discard block |
||
| 1232 | 1225 | $cond = ''; |
| 1233 | 1226 | } elseif (preg_match(_REGEXP_COND_VIDE_NONVIDE, $code, $r)) { |
| 1234 | 1227 | $t = $r[2]; |
| 1235 | - $cond = '!' . $r[1]; |
|
| 1228 | + $cond = '!'.$r[1]; |
|
| 1236 | 1229 | } else { |
| 1237 | 1230 | if (preg_match(_REGEXP_COND_NONVIDE_VIDE, $code, $r)) { |
| 1238 | 1231 | $t = $r[2]; |
| 1239 | 1232 | $cond = $r[1]; |
| 1240 | 1233 | } else { |
| 1241 | - $t = '$t' . $n; |
|
| 1234 | + $t = '$t'.$n; |
|
| 1242 | 1235 | $cond = "($t = $code)!==''"; |
| 1243 | 1236 | } |
| 1244 | 1237 | } |
| 1245 | 1238 | |
| 1246 | - $res = (!$avant ? '' : "$avant . ") . |
|
| 1247 | - $t . |
|
| 1239 | + $res = (!$avant ? '' : "$avant . "). |
|
| 1240 | + $t. |
|
| 1248 | 1241 | (!$apres ? '' : " . $apres"); |
| 1249 | 1242 | |
| 1250 | 1243 | if ($res !== $t) { |
@@ -1296,13 +1289,13 @@ discard block |
||
| 1296 | 1289 | |
| 1297 | 1290 | // rendre inertes les echappements de #[](){}<> |
| 1298 | 1291 | $i = 0; |
| 1299 | - while (false !== strpos($squelette, $inerte = '-INERTE' . $i)) { |
|
| 1292 | + while (false !== strpos($squelette, $inerte = '-INERTE'.$i)) { |
|
| 1300 | 1293 | $i++; |
| 1301 | 1294 | } |
| 1302 | 1295 | $squelette = preg_replace_callback( |
| 1303 | 1296 | ',\\\\([#[()\]{}<>]),', |
| 1304 | - function ($a) use ($inerte) { |
|
| 1305 | - return "$inerte-" . ord($a[1]) . '-'; |
|
| 1297 | + function($a) use ($inerte) { |
|
| 1298 | + return "$inerte-".ord($a[1]).'-'; |
|
| 1306 | 1299 | }, |
| 1307 | 1300 | $squelette, |
| 1308 | 1301 | -1, |
@@ -1319,7 +1312,7 @@ discard block |
||
| 1319 | 1312 | // Phraser le squelette, selon sa grammaire |
| 1320 | 1313 | |
| 1321 | 1314 | $boucles = []; |
| 1322 | - $f = charger_fonction('phraser_' . $gram, 'public'); |
|
| 1315 | + $f = charger_fonction('phraser_'.$gram, 'public'); |
|
| 1323 | 1316 | |
| 1324 | 1317 | $squelette = $f($squelette, '', $boucles, $descr); |
| 1325 | 1318 | |
@@ -1330,15 +1323,15 @@ discard block |
||
| 1330 | 1323 | foreach ($boucles as $i => $boucle) { |
| 1331 | 1324 | $boucles[$i]->return = preg_replace_callback( |
| 1332 | 1325 | ",$inerte-(\d+)-,", |
| 1333 | - function ($a) { |
|
| 1326 | + function($a) { |
|
| 1334 | 1327 | return chr($a[1]); |
| 1335 | 1328 | }, |
| 1336 | 1329 | $boucle->return |
| 1337 | 1330 | ); |
| 1338 | 1331 | $boucles[$i]->descr['squelette'] = preg_replace_callback( |
| 1339 | 1332 | ",$inerte-(\d+)-,", |
| 1340 | - function ($a) { |
|
| 1341 | - return '\\\\' . chr($a[1]); |
|
| 1333 | + function($a) { |
|
| 1334 | + return '\\\\'.chr($a[1]); |
|
| 1342 | 1335 | }, |
| 1343 | 1336 | $boucle->descr['squelette'] |
| 1344 | 1337 | ); |
@@ -1350,19 +1343,19 @@ discard block |
||
| 1350 | 1343 | include_spip('public/decompiler'); |
| 1351 | 1344 | foreach ($boucles as $id => $boucle) { |
| 1352 | 1345 | if ($id) { |
| 1353 | - $decomp = "\n/* BOUCLE " . |
|
| 1354 | - $boucle->type_requete . |
|
| 1355 | - ' ' . |
|
| 1356 | - str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')) . |
|
| 1357 | - ($boucle->debug ? "\n *\n * " . implode("\n * ", $boucle->debug) . "\n" : '') . |
|
| 1346 | + $decomp = "\n/* BOUCLE ". |
|
| 1347 | + $boucle->type_requete. |
|
| 1348 | + ' '. |
|
| 1349 | + str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')). |
|
| 1350 | + ($boucle->debug ? "\n *\n * ".implode("\n * ", $boucle->debug)."\n" : ''). |
|
| 1358 | 1351 | " */\n"; |
| 1359 | 1352 | } else { |
| 1360 | - $decomp = ("\n/*\n" . |
|
| 1353 | + $decomp = ("\n/*\n". |
|
| 1361 | 1354 | str_replace('*/', '* /', public_decompiler($squelette, $gram)) |
| 1362 | 1355 | . "\n*/"); |
| 1363 | 1356 | } |
| 1364 | - $boucles[$id]->return = $decomp . $boucle->return; |
|
| 1365 | - $GLOBALS['debug_objets']['code'][$nom . $id] = $boucle->return; |
|
| 1357 | + $boucles[$id]->return = $decomp.$boucle->return; |
|
| 1358 | + $GLOBALS['debug_objets']['code'][$nom.$id] = $boucle->return; |
|
| 1366 | 1359 | } |
| 1367 | 1360 | } |
| 1368 | 1361 | |
@@ -1385,7 +1378,7 @@ discard block |
||
| 1385 | 1378 | } |
| 1386 | 1379 | } |
| 1387 | 1380 | foreach ($boucles as $id => $boucle) { |
| 1388 | - $GLOBALS['debug_objets']['boucle'][$nom . $id] = $boucle; |
|
| 1381 | + $GLOBALS['debug_objets']['boucle'][$nom.$id] = $boucle; |
|
| 1389 | 1382 | } |
| 1390 | 1383 | $descr['documents'] = compile_inclure_doublons($squelette); |
| 1391 | 1384 | |
@@ -1476,8 +1469,7 @@ discard block |
||
| 1476 | 1469 | } else { |
| 1477 | 1470 | $boucles[$id]->type_requete = false; |
| 1478 | 1471 | $boucle = $boucles[$id]; |
| 1479 | - $x = (!$boucle->sql_serveur ? '' : |
|
| 1480 | - ($boucle->sql_serveur . ':')) . |
|
| 1472 | + $x = (!$boucle->sql_serveur ? '' : ($boucle->sql_serveur.':')). |
|
| 1481 | 1473 | $type; |
| 1482 | 1474 | $msg = [ |
| 1483 | 1475 | 'zbug_table_inconnue', |
@@ -1567,13 +1559,13 @@ discard block |
||
| 1567 | 1559 | if ( |
| 1568 | 1560 | // fonction de boucle avec serveur & table |
| 1569 | 1561 | (!$serveur or |
| 1570 | - ((!function_exists($f = 'boucle_' . $serveur . '_' . $table)) |
|
| 1571 | - and (!function_exists($f = $f . '_dist')) |
|
| 1562 | + ((!function_exists($f = 'boucle_'.$serveur.'_'.$table)) |
|
| 1563 | + and (!function_exists($f = $f.'_dist')) |
|
| 1572 | 1564 | ) |
| 1573 | 1565 | ) |
| 1574 | 1566 | // fonction de boucle avec table |
| 1575 | - and (!function_exists($f = 'boucle_' . $table)) |
|
| 1576 | - and (!function_exists($f = $f . '_dist')) |
|
| 1567 | + and (!function_exists($f = 'boucle_'.$table)) |
|
| 1568 | + and (!function_exists($f = $f.'_dist')) |
|
| 1577 | 1569 | ) { |
| 1578 | 1570 | // fonction de boucle standard |
| 1579 | 1571 | if (!function_exists($f = 'boucle_DEFAUT')) { |
@@ -1581,20 +1573,20 @@ discard block |
||
| 1581 | 1573 | } |
| 1582 | 1574 | } |
| 1583 | 1575 | |
| 1584 | - $req = "\n\n\tstatic \$command = array();\n\t" . |
|
| 1585 | - "static \$connect;\n\t" . |
|
| 1586 | - "\$command['connect'] = \$connect = " . |
|
| 1587 | - _q($boucle->sql_serveur) . |
|
| 1588 | - ';' . |
|
| 1576 | + $req = "\n\n\tstatic \$command = array();\n\t". |
|
| 1577 | + "static \$connect;\n\t". |
|
| 1578 | + "\$command['connect'] = \$connect = ". |
|
| 1579 | + _q($boucle->sql_serveur). |
|
| 1580 | + ';'. |
|
| 1589 | 1581 | $f($id, $boucles); |
| 1590 | 1582 | } else { |
| 1591 | 1583 | $req = ("\n\treturn '';"); |
| 1592 | 1584 | } |
| 1593 | 1585 | |
| 1594 | 1586 | $boucles[$id]->return = |
| 1595 | - "\n\nfunction BOUCLE" . strtr($id, '-', '_') . $nom . |
|
| 1596 | - '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {' . |
|
| 1597 | - $req . |
|
| 1587 | + "\n\nfunction BOUCLE".strtr($id, '-', '_').$nom. |
|
| 1588 | + '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {'. |
|
| 1589 | + $req. |
|
| 1598 | 1590 | "\n}\n"; |
| 1599 | 1591 | } |
| 1600 | 1592 | |
@@ -1604,7 +1596,7 @@ discard block |
||
| 1604 | 1596 | return false; |
| 1605 | 1597 | } |
| 1606 | 1598 | |
| 1607 | - $principal = "\nfunction " . $nom . '($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1599 | + $principal = "\nfunction ".$nom.'($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1608 | 1600 | ' |
| 1609 | 1601 | // reporter de maniere securisee les doublons inclus |
| 1610 | 1602 | . ' |
@@ -1612,15 +1604,15 @@ discard block |
||
| 1612 | 1604 | $doublons = nettoyer_env_doublons($Pile[0]["doublons"]); |
| 1613 | 1605 | |
| 1614 | 1606 | $connect = ' . |
| 1615 | - _q($connect) . '; |
|
| 1607 | + _q($connect).'; |
|
| 1616 | 1608 | $page = ' . |
| 1617 | 1609 | // ATTENTION, le calcul de l'expression $corps affectera $Cache |
| 1618 | 1610 | // c'est pourquoi on l'affecte a la variable auxiliaire $page. |
| 1619 | 1611 | // avant de referencer $Cache |
| 1620 | - $corps . '; |
|
| 1612 | + $corps.'; |
|
| 1621 | 1613 | |
| 1622 | 1614 | return analyse_resultat_skel(' . var_export($nom, true) |
| 1623 | - . ', $Cache, $page, ' . var_export($sourcefile, true) . '); |
|
| 1615 | + . ', $Cache, $page, '.var_export($sourcefile, true).'); |
|
| 1624 | 1616 | }'; |
| 1625 | 1617 | |
| 1626 | 1618 | $secondes = spip_timer('calcul_skel'); |
@@ -1634,10 +1626,10 @@ discard block |
||
| 1634 | 1626 | $code->return = ' |
| 1635 | 1627 | // |
| 1636 | 1628 | // Fonction principale du squelette ' . |
| 1637 | - $sourcefile . |
|
| 1638 | - ($connect ? " pour $connect" : '') . |
|
| 1639 | - (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes") . |
|
| 1640 | - "\n//\n" . |
|
| 1629 | + $sourcefile. |
|
| 1630 | + ($connect ? " pour $connect" : ''). |
|
| 1631 | + (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes"). |
|
| 1632 | + "\n//\n". |
|
| 1641 | 1633 | $principal; |
| 1642 | 1634 | |
| 1643 | 1635 | $boucles[''] = $code; |
@@ -1689,7 +1681,7 @@ discard block |
||
| 1689 | 1681 | **/ |
| 1690 | 1682 | function requeteur_data_dist(&$boucles, &$boucle, &$id) { |
| 1691 | 1683 | include_spip('iterateur/data'); |
| 1692 | - if ($h = charger_fonction($boucle->type_requete . '_to_array', 'inc', true)) { |
|
| 1684 | + if ($h = charger_fonction($boucle->type_requete.'_to_array', 'inc', true)) { |
|
| 1693 | 1685 | $g = charger_fonction('data', 'iterateur'); |
| 1694 | 1686 | $boucles[$id] = $g($boucle); |
| 1695 | 1687 | // from[0] stocke le type de data (rss, yql, ...) |
@@ -48,19 +48,19 @@ discard block |
||
| 48 | 48 | * Nom d'une balise #TOTO |
| 49 | 49 | * |
| 50 | 50 | * Écriture alambiquée pour rester compatible avec les hexadecimaux des vieux squelettes */ |
| 51 | -define('NOM_DE_CHAMP', '#((' . NOM_DE_BOUCLE . "):)?(([A-F]*[G-Z_][A-Z_0-9]*)|[A-Z_]+)\b(\*{0,2})"); |
|
| 51 | +define('NOM_DE_CHAMP', '#(('.NOM_DE_BOUCLE."):)?(([A-F]*[G-Z_][A-Z_0-9]*)|[A-Z_]+)\b(\*{0,2})"); |
|
| 52 | 52 | /** Balise complète [...(#TOTO) ... ] */ |
| 53 | -define('CHAMP_ETENDU', '/\[([^]\[]*)\(' . NOM_DE_CHAMP . '([^[)]*\)[^]\[]*)\]/S'); |
|
| 53 | +define('CHAMP_ETENDU', '/\[([^]\[]*)\('.NOM_DE_CHAMP.'([^[)]*\)[^]\[]*)\]/S'); |
|
| 54 | 54 | |
| 55 | 55 | define('BALISE_INCLURE', '/<INCLU[DR]E[[:space:]]*(\(([^)]*)\))?/S'); |
| 56 | 56 | define('BALISE_POLYGLOTTE', ',<multi>(.*)</multi>,Uims'); |
| 57 | 57 | define('BALISE_IDIOMES', ',<:(([a-z0-9_]+):)?([a-z0-9_]*)({([^\|=>]*=[^\|>]*)})?((\|[^>]*)?:/?>),iS'); |
| 58 | -define('BALISE_IDIOMES_ARGS', '@^\s*([^= ]*)\s*=\s*((' . NOM_DE_CHAMP . '[{][^}]*})?[^,]*)\s*,?\s*@s'); |
|
| 58 | +define('BALISE_IDIOMES_ARGS', '@^\s*([^= ]*)\s*=\s*(('.NOM_DE_CHAMP.'[{][^}]*})?[^,]*)\s*,?\s*@s'); |
|
| 59 | 59 | |
| 60 | 60 | /** Champ sql dans parenthèse ex: (id_article) */ |
| 61 | 61 | define('SQL_ARGS', '(\([^)]*\))'); |
| 62 | 62 | /** Fonction SQL sur un champ ex: SUM(visites) */ |
| 63 | -define('CHAMP_SQL_PLUS_FONC', '`?([A-Z_\/][A-Z_\/0-9.]*)' . SQL_ARGS . '?`?'); |
|
| 63 | +define('CHAMP_SQL_PLUS_FONC', '`?([A-Z_\/][A-Z_\/0-9.]*)'.SQL_ARGS.'?`?'); |
|
| 64 | 64 | |
| 65 | 65 | // https://code.spip.net/@phraser_inclure |
| 66 | 66 | function phraser_inclure($texte, $ligne, $result) { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * @return array |
| 218 | 218 | **/ |
| 219 | 219 | function phraser_champs($texte, $ligne, $result) { |
| 220 | - while (preg_match('/' . NOM_DE_CHAMP . '/S', $texte, $match)) { |
|
| 220 | + while (preg_match('/'.NOM_DE_CHAMP.'/S', $texte, $match)) { |
|
| 221 | 221 | $p = strpos($texte, $match[0]); |
| 222 | 222 | // texte après la balise |
| 223 | 223 | $suite = substr($texte, $p + strlen($match[0])); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $collecte[] = $champ; |
| 370 | 370 | $args = ltrim($regs[count($regs) - 1]); |
| 371 | 371 | } else { |
| 372 | - if (!preg_match('/' . NOM_DE_CHAMP . '([{|])/', $arg, $r)) { |
|
| 372 | + if (!preg_match('/'.NOM_DE_CHAMP.'([{|])/', $arg, $r)) { |
|
| 373 | 373 | // 0 est un aveu d'impuissance. A completer |
| 374 | 374 | $arg = phraser_champs_exterieurs($arg, 0, $sep, $result); |
| 375 | 375 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | function phraser_champs_exterieurs($texte, $ligne, $sep, $nested) { |
| 455 | 455 | $res = []; |
| 456 | 456 | while (($p = strpos($texte, "%$sep")) !== false) { |
| 457 | - if (!preg_match(',^%' . preg_quote($sep) . '([0-9]+)@,', substr($texte, $p), $m)) { |
|
| 457 | + if (!preg_match(',^%'.preg_quote($sep).'([0-9]+)@,', substr($texte, $p), $m)) { |
|
| 458 | 458 | break; |
| 459 | 459 | } |
| 460 | 460 | $debut = substr($texte, 0, $p); |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $pos_apres = 0; |
| 496 | 496 | $result = phraser_args($match[7], ')', $sep, $result, $champ, $pos_apres); |
| 497 | 497 | phraser_vieux($champ); |
| 498 | - $champ->avant = phraser_champs_exterieurs($match[1], $n, $sep, $result); |
|
| 498 | + $champ->avant = phraser_champs_exterieurs($match[1], $n, $sep, $result); |
|
| 499 | 499 | $debut = substr($match[7], $pos_apres + 1); |
| 500 | 500 | if (!empty($debut)) { |
| 501 | 501 | $n += substr_count(substr($texte, 0, strpos($texte, $debut)), "\n"); |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | // une maniere tres sale de supprimer les "' autour de {critere "xxx","yyy"} |
| 627 | 627 | if (preg_match(',^(["\'])(.*)\1$,', $m[4])) { |
| 628 | 628 | $c = null; |
| 629 | - eval('$c = ' . $m[4] . ';'); |
|
| 629 | + eval('$c = '.$m[4].';'); |
|
| 630 | 630 | if (isset($c)) { |
| 631 | 631 | $m[4] = $c; |
| 632 | 632 | } |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | if (preg_match(',^ *([0-9-]+) *(/) *(.+) *$,', $param, $m)) { |
| 707 | 707 | $crit = phraser_critere_infixe($m[1], $m[3], $v, '/', '', ''); |
| 708 | 708 | } elseif ( |
| 709 | - preg_match(',^([!]?)(' . CHAMP_SQL_PLUS_FONC . |
|
| 709 | + preg_match(',^([!]?)('.CHAMP_SQL_PLUS_FONC. |
|
| 710 | 710 | ')[[:space:]]*(\??)(!?)(<=?|>=?|==?|\b(?:IN|LIKE)\b)(.*)$,is', $param, $m) |
| 711 | 711 | ) { |
| 712 | 712 | $a2 = trim($m[8]); |
@@ -723,8 +723,8 @@ discard block |
||
| 723 | 723 | ); |
| 724 | 724 | $crit->exclus = $m[1]; |
| 725 | 725 | } elseif ( |
| 726 | - preg_match('/^([!]?)\s*(' . |
|
| 727 | - CHAMP_SQL_PLUS_FONC . |
|
| 726 | + preg_match('/^([!]?)\s*('. |
|
| 727 | + CHAMP_SQL_PLUS_FONC. |
|
| 728 | 728 | ')\s*(\??)(.*)$/is', $param, $m) |
| 729 | 729 | ) { |
| 730 | 730 | // contient aussi les comparaisons implicites ! |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | // trouver sa position de depart reelle : au <Bxx> ou au <BBxx> |
| 873 | - $precond_boucle = BALISE_PRECOND_BOUCLE . $id_boucle . '>'; |
|
| 873 | + $precond_boucle = BALISE_PRECOND_BOUCLE.$id_boucle.'>'; |
|
| 874 | 874 | $pos_precond = strpos($texte, $precond_boucle, $id_boucle ? $pos_debut_texte : $pos_derniere_boucle_anonyme); |
| 875 | 875 | if ( |
| 876 | 876 | $pos_precond !== false |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | $boucle['pos_precond_inside'] = $pos_precond + strlen($precond_boucle); |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | - $preaff_boucle = BALISE_PREAFF_BOUCLE . $id_boucle . '>'; |
|
| 884 | + $preaff_boucle = BALISE_PREAFF_BOUCLE.$id_boucle.'>'; |
|
| 885 | 885 | $pos_preaff = strpos($texte, $preaff_boucle, $id_boucle ? $pos_debut_texte : $pos_derniere_boucle_anonyme); |
| 886 | 886 | if ( |
| 887 | 887 | $pos_preaff !== false |
@@ -929,13 +929,13 @@ discard block |
||
| 929 | 929 | $pos_anonyme_next = null; |
| 930 | 930 | // si c'est une boucle anonyme, chercher la position de la prochaine boucle anonyme |
| 931 | 931 | if (!strlen($id_boucle)) { |
| 932 | - $pos_anonyme_next = strpos($texte, BALISE_BOUCLE . '(', $pos_courante); |
|
| 932 | + $pos_anonyme_next = strpos($texte, BALISE_BOUCLE.'(', $pos_courante); |
|
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | // |
| 936 | 936 | // 1. Recuperer la partie conditionnelle apres |
| 937 | 937 | // |
| 938 | - $apres_boucle = BALISE_POSTCOND_BOUCLE . $id_boucle . '>'; |
|
| 938 | + $apres_boucle = BALISE_POSTCOND_BOUCLE.$id_boucle.'>'; |
|
| 939 | 939 | $pos_apres = strpos($texte, $apres_boucle, $pos_courante); |
| 940 | 940 | if ( |
| 941 | 941 | $pos_apres !== false |
@@ -944,13 +944,13 @@ discard block |
||
| 944 | 944 | $boucle['pos_postcond'] = $pos_apres; |
| 945 | 945 | $pos_apres += strlen($apres_boucle); |
| 946 | 946 | $boucle['pos_postcond_inside'] = $pos_apres; |
| 947 | - $pos_courante = $pos_apres ; |
|
| 947 | + $pos_courante = $pos_apres; |
|
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | // |
| 951 | 951 | // 2. Récuperer la partie alternative apres |
| 952 | 952 | // |
| 953 | - $altern_boucle = BALISE_ALT_BOUCLE . $id_boucle . '>'; |
|
| 953 | + $altern_boucle = BALISE_ALT_BOUCLE.$id_boucle.'>'; |
|
| 954 | 954 | $pos_altern = strpos($texte, $altern_boucle, $pos_courante); |
| 955 | 955 | if ( |
| 956 | 956 | $pos_altern !== false |
@@ -965,7 +965,7 @@ discard block |
||
| 965 | 965 | // |
| 966 | 966 | // 3. Recuperer la partie footer non alternative |
| 967 | 967 | // |
| 968 | - $postaff_boucle = BALISE_POSTAFF_BOUCLE . $id_boucle . '>'; |
|
| 968 | + $postaff_boucle = BALISE_POSTAFF_BOUCLE.$id_boucle.'>'; |
|
| 969 | 969 | $pos_postaff = strpos($texte, $postaff_boucle, $pos_courante); |
| 970 | 970 | if ( |
| 971 | 971 | $pos_postaff !== false |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | $boucle['pos_postaff'] = $pos_postaff; |
| 975 | 975 | $pos_postaff += strlen($postaff_boucle); |
| 976 | 976 | $boucle['pos_postaff_inside'] = $pos_postaff; |
| 977 | - $pos_courante = $pos_postaff ; |
|
| 977 | + $pos_courante = $pos_postaff; |
|
| 978 | 978 | } |
| 979 | 979 | |
| 980 | 980 | return $boucle; |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | * @return string |
| 1015 | 1015 | */ |
| 1016 | 1016 | function public_generer_boucle_placeholder($id_boucle, &$boucle, $boucle_placeholder, $nb_lignes) { |
| 1017 | - $placeholder = "[(#{$boucle_placeholder}{" . $id_boucle . '})' . str_pad('', $nb_lignes, "\n") . ']'; |
|
| 1017 | + $placeholder = "[(#{$boucle_placeholder}{".$id_boucle.'})'.str_pad('', $nb_lignes, "\n").']'; |
|
| 1018 | 1018 | //memoriser la boucle a reinjecter |
| 1019 | 1019 | $id_boucle = "$id_boucle"; |
| 1020 | 1020 | phraser_boucle_placeholder($id_boucle, $boucle_placeholder, $boucle); |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | // definir un placholder pour les boucles dont on est sur d'avoir aucune occurence dans le squelette |
| 1028 | 1028 | if (is_null($boucle_placeholder)) { |
| 1029 | 1029 | do { |
| 1030 | - $boucle_placeholder = 'BOUCLE_PLACEHOLDER_' . strtoupper(md5(uniqid())); |
|
| 1030 | + $boucle_placeholder = 'BOUCLE_PLACEHOLDER_'.strtoupper(md5(uniqid())); |
|
| 1031 | 1031 | } while (strpos($texte, $boucle_placeholder) !== false); |
| 1032 | 1032 | } |
| 1033 | 1033 | |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | |
| 1048 | 1048 | // boucle anonyme ? |
| 1049 | 1049 | if (!strlen($id_boucle)) { |
| 1050 | - $id_boucle = '_anon_L' . $ligne_milieu . '_' . substr(md5('anonyme:' . $id_parent . ':' . json_encode($boucle)), 0, 8); |
|
| 1050 | + $id_boucle = '_anon_L'.$ligne_milieu.'_'.substr(md5('anonyme:'.$id_parent.':'.json_encode($boucle)), 0, 8); |
|
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | $pos_debut_boucle = $pos_courante; |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | |
| 1061 | 1061 | $pos_avant = $boucle['pos_precond_inside']; |
| 1062 | 1062 | $result->avant = substr($texte, $pos_avant, $pos_courante - $pos_avant); |
| 1063 | - $ligne_avant = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_avant); |
|
| 1063 | + $ligne_avant = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_avant); |
|
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | // Regarder si on a une partie inconditionnelle avant <BB_xxx> |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | |
| 1070 | 1070 | $pos_preaff = $boucle['pos_preaff_inside']; |
| 1071 | 1071 | $result->preaff = substr($texte, $pos_preaff, $end_preaff - $pos_preaff); |
| 1072 | - $ligne_preaff = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_preaff); |
|
| 1072 | + $ligne_preaff = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_preaff); |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | $result->id_boucle = $id_boucle; |
@@ -1126,7 +1126,7 @@ discard block |
||
| 1126 | 1126 | } else { |
| 1127 | 1127 | $pos_milieu += 1; |
| 1128 | 1128 | |
| 1129 | - $fin_boucle = BALISE_FIN_BOUCLE . $id_boucle_search . '>'; |
|
| 1129 | + $fin_boucle = BALISE_FIN_BOUCLE.$id_boucle_search.'>'; |
|
| 1130 | 1130 | $pos_fin = strpos($texte, $fin_boucle, $pos_milieu); |
| 1131 | 1131 | if ($pos_fin === false) { |
| 1132 | 1132 | $err_b = [ |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | else { |
| 1140 | 1140 | // verifier une eventuelle imbrication d'une boucle homonyme |
| 1141 | 1141 | // (interdite, generera une erreur plus loin, mais permet de signaler la bonne erreur) |
| 1142 | - $search_debut_boucle = BALISE_BOUCLE . $id_boucle_search . '('; |
|
| 1142 | + $search_debut_boucle = BALISE_BOUCLE.$id_boucle_search.'('; |
|
| 1143 | 1143 | $search_from = $pos_milieu; |
| 1144 | 1144 | $nb_open = 1; |
| 1145 | 1145 | $nb_close = 1; |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | if ($boucle['pos_postcond']) { |
| 1180 | 1180 | $result->apres = substr($texte, $pos_courante, $boucle['pos_postcond'] - $pos_courante); |
| 1181 | 1181 | $ligne_suite += public_compte_ligne($texte, $pos_courante, $boucle['pos_postcond_inside']); |
| 1182 | - $pos_courante = $boucle['pos_postcond_inside'] ; |
|
| 1182 | + $pos_courante = $boucle['pos_postcond_inside']; |
|
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | 1185 | |
@@ -46,10 +46,9 @@ discard block |
||
| 46 | 46 | $not = $crit->not; |
| 47 | 47 | $boucle = &$boucles[$idb]; |
| 48 | 48 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 49 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 50 | - 'id_parent'; |
|
| 49 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 51 | 50 | |
| 52 | - $c = ["'='", "'$boucle->id_table." . "$id_parent'", 0]; |
|
| 51 | + $c = ["'='", "'$boucle->id_table."."$id_parent'", 0]; |
|
| 53 | 52 | $boucle->where[] = ($crit->not ? ["'NOT'", $c] : $c); |
| 54 | 53 | } |
| 55 | 54 | |
@@ -72,10 +71,10 @@ discard block |
||
| 72 | 71 | $id = $boucle->primary; |
| 73 | 72 | |
| 74 | 73 | if ($not or !$id) { |
| 75 | - return (['zbug_critere_inconnu', ['critere' => $not . $crit->op]]); |
|
| 74 | + return (['zbug_critere_inconnu', ['critere' => $not.$crit->op]]); |
|
| 76 | 75 | } |
| 77 | 76 | $arg = kwote(calculer_argument_precedent($idb, $id, $boucles)); |
| 78 | - $boucle->where[] = ["'!='", "'$boucle->id_table." . "$id'", $arg]; |
|
| 77 | + $boucle->where[] = ["'!='", "'$boucle->id_table."."$id'", $arg]; |
|
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | |
@@ -106,12 +105,12 @@ discard block |
||
| 106 | 105 | $not = ($crit->not ? '' : 'NOT'); |
| 107 | 106 | |
| 108 | 107 | // le doublon s'applique sur un type de boucle (article) |
| 109 | - $nom = "'" . $boucle->type_requete . "'"; |
|
| 108 | + $nom = "'".$boucle->type_requete."'"; |
|
| 110 | 109 | |
| 111 | 110 | // compléter le nom avec un nom précisé {doublons nom} |
| 112 | 111 | // on obtient $nom = "'article' . 'nom'" |
| 113 | 112 | if (isset($crit->param[0])) { |
| 114 | - $nom .= '.' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent); |
|
| 113 | + $nom .= '.'.calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent); |
|
| 115 | 114 | } |
| 116 | 115 | |
| 117 | 116 | // code qui déclarera l'index du stockage de nos doublons (pour éviter une notice PHP) |
@@ -123,13 +122,13 @@ discard block |
||
| 123 | 122 | // $doublons et son index, ici $nom |
| 124 | 123 | |
| 125 | 124 | // debut du code "sql_in('articles.id_article', " |
| 126 | - $debut_in = "sql_in('" . $boucle->id_table . '.' . $primary . "', "; |
|
| 125 | + $debut_in = "sql_in('".$boucle->id_table.'.'.$primary."', "; |
|
| 127 | 126 | // lecture des données du doublon "$doublons[$doublon_index[] = " |
| 128 | 127 | // Attention : boucle->doublons désigne une variable qu'on affecte |
| 129 | - $debut_doub = '$doublons[' . (!$not ? '' : ($boucle->doublons . '[]= ')); |
|
| 128 | + $debut_doub = '$doublons['.(!$not ? '' : ($boucle->doublons.'[]= ')); |
|
| 130 | 129 | |
| 131 | 130 | // le debut complet du code des doublons |
| 132 | - $debut_doub = $debut_in . $debut_doub; |
|
| 131 | + $debut_doub = $debut_in.$debut_doub; |
|
| 133 | 132 | |
| 134 | 133 | // nom du doublon "('article' . 'nom')]" |
| 135 | 134 | $fin_doub = "($nom)]"; |
@@ -139,22 +138,22 @@ discard block |
||
| 139 | 138 | foreach ($boucle->where as $k => $w) { |
| 140 | 139 | if (strpos($w[0], $debut_doub) === 0) { |
| 141 | 140 | // fusionner le sql_in (du where) |
| 142 | - $boucle->where[$k][0] = $debut_doub . $fin_doub . ' . ' . substr($w[0], strlen($debut_in)); |
|
| 141 | + $boucle->where[$k][0] = $debut_doub.$fin_doub.' . '.substr($w[0], strlen($debut_in)); |
|
| 143 | 142 | // fusionner l'initialisation (du hash) pour faire plus joli |
| 144 | 143 | $x = strpos($boucle->hash, $init_comment); |
| 145 | 144 | $len = strlen($init_comment); |
| 146 | 145 | $boucle->hash = |
| 147 | - substr($boucle->hash, 0, $x + $len) . $init_code . substr($boucle->hash, $x + $len); |
|
| 146 | + substr($boucle->hash, 0, $x + $len).$init_code.substr($boucle->hash, $x + $len); |
|
| 148 | 147 | |
| 149 | 148 | return; |
| 150 | 149 | } |
| 151 | 150 | } |
| 152 | 151 | |
| 153 | 152 | // mettre l'ensemble dans un tableau pour que ce ne soit pas vu comme une constante |
| 154 | - $boucle->where[] = [$debut_doub . $fin_doub . ", '" . $not . "')"]; |
|
| 153 | + $boucle->where[] = [$debut_doub.$fin_doub.", '".$not."')"]; |
|
| 155 | 154 | |
| 156 | 155 | // déclarer le doublon s'il n'existe pas encore |
| 157 | - $boucle->hash .= $init_comment . $init_code; |
|
| 156 | + $boucle->hash .= $init_comment.$init_code; |
|
| 158 | 157 | |
| 159 | 158 | |
| 160 | 159 | # la ligne suivante avait l'intention d'eviter une collecte deja faite |
@@ -215,10 +214,10 @@ discard block |
||
| 215 | 214 | $un = $un[0]->texte; |
| 216 | 215 | $deux = $deux[0]->texte; |
| 217 | 216 | if ($deux) { |
| 218 | - $boucles[$idb]->limit = 'intval($Pile[0]["debut' . |
|
| 219 | - $un . |
|
| 220 | - '"]) . ",' . |
|
| 221 | - $deux . |
|
| 217 | + $boucles[$idb]->limit = 'intval($Pile[0]["debut'. |
|
| 218 | + $un. |
|
| 219 | + '"]) . ",'. |
|
| 220 | + $deux. |
|
| 222 | 221 | '"'; |
| 223 | 222 | } else { |
| 224 | 223 | calculer_critere_DEFAUT_dist($idb, $boucles, $crit); |
@@ -281,26 +280,26 @@ discard block |
||
| 281 | 280 | $type = calculer_liste([$crit->param[1][0]], $idb, $boucles, $boucle->id_parent); |
| 282 | 281 | } |
| 283 | 282 | |
| 284 | - $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut" . substr($type, 1)); |
|
| 283 | + $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut".substr($type, 1)); |
|
| 285 | 284 | $boucle->modificateur['debut_nom'] = $type; |
| 286 | 285 | $partie = |
| 287 | 286 | // tester si le numero de page demande est de la forme '@yyy' |
| 288 | - 'isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : _request(' . $debut . ");\n" |
|
| 287 | + 'isset($Pile[0]['.$debut.']) ? $Pile[0]['.$debut.'] : _request('.$debut.");\n" |
|
| 289 | 288 | . "\tif(substr(\$debut_boucle,0,1)=='@'){\n" |
| 290 | - . "\t\t" . '$debut_boucle = $Pile[0][' . $debut . '] = quete_debut_pagination(\'' . $boucle->primary . '\',$Pile[0][\'@' . $boucle->primary . '\'] = substr($debut_boucle,1),' . $pas . ',$iter);' . "\n" |
|
| 291 | - . "\t\t" . '$iter->seek(0);' . "\n" |
|
| 289 | + . "\t\t".'$debut_boucle = $Pile[0]['.$debut.'] = quete_debut_pagination(\''.$boucle->primary.'\',$Pile[0][\'@'.$boucle->primary.'\'] = substr($debut_boucle,1),'.$pas.',$iter);'."\n" |
|
| 290 | + . "\t\t".'$iter->seek(0);'."\n" |
|
| 292 | 291 | . "\t}\n" |
| 293 | - . "\t" . '$debut_boucle = intval($debut_boucle)'; |
|
| 292 | + . "\t".'$debut_boucle = intval($debut_boucle)'; |
|
| 294 | 293 | |
| 295 | 294 | $boucle->hash .= ' |
| 296 | - $command[\'pagination\'] = array((isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : null), ' . $pas . ');'; |
|
| 295 | + $command[\'pagination\'] = array((isset($Pile[0][' . $debut.']) ? $Pile[0]['.$debut.'] : null), '.$pas.');'; |
|
| 297 | 296 | |
| 298 | 297 | $boucle->total_parties = $pas; |
| 299 | 298 | calculer_parties($boucles, $idb, $partie, 'p+'); |
| 300 | 299 | // ajouter la cle primaire dans le select pour pouvoir gerer la pagination referencee par @id |
| 301 | 300 | // sauf si pas de primaire, ou si primaire composee |
| 302 | 301 | // dans ce cas, on ne sait pas gerer une pagination indirecte |
| 303 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 302 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 304 | 303 | if ( |
| 305 | 304 | $boucle->primary |
| 306 | 305 | and !preg_match('/[,\s]/', $boucle->primary) |
@@ -347,24 +346,24 @@ discard block |
||
| 347 | 346 | $boucle->hash .= ' |
| 348 | 347 | // RECHERCHE' |
| 349 | 348 | . ($crit->cond ? ' |
| 350 | - if (!strlen(' . $quoi . ')){ |
|
| 349 | + if (!strlen(' . $quoi.')){ |
|
| 351 | 350 | list($rech_select, $rech_where) = array("0 as points",""); |
| 352 | - } else' : '') . ' |
|
| 351 | + } else' : '').' |
|
| 353 | 352 | { |
| 354 | 353 | $prepare_recherche = charger_fonction(\'prepare_recherche\', \'inc\'); |
| 355 | - list($rech_select, $rech_where) = $prepare_recherche(' . $quoi . ', "' . $boucle->id_table . '", "' . $crit->cond . '","' . $boucle->sql_serveur . '",' . $_modificateur . ',"' . $boucle->primary . '"); |
|
| 354 | + list($rech_select, $rech_where) = $prepare_recherche(' . $quoi.', "'.$boucle->id_table.'", "'.$crit->cond.'","'.$boucle->sql_serveur.'",'.$_modificateur.',"'.$boucle->primary.'"); |
|
| 356 | 355 | } |
| 357 | 356 | '; |
| 358 | 357 | |
| 359 | 358 | |
| 360 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 359 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 361 | 360 | if (!in_array($t, $boucles[$idb]->select)) { |
| 362 | 361 | $boucle->select[] = $t; |
| 363 | 362 | } # pour postgres, neuneu ici |
| 364 | 363 | // jointure uniquement sur le serveur principal |
| 365 | 364 | // (on ne peut joindre une table d'un serveur distant avec la table des resultats du serveur principal) |
| 366 | 365 | if (!$boucle->sql_serveur) { |
| 367 | - $boucle->join['resultats'] = ["'" . $boucle->id_table . "'", "'id'", "'" . $boucle->primary . "'"]; |
|
| 366 | + $boucle->join['resultats'] = ["'".$boucle->id_table."'", "'id'", "'".$boucle->primary."'"]; |
|
| 368 | 367 | $boucle->from['resultats'] = 'spip_resultats'; |
| 369 | 368 | } |
| 370 | 369 | $boucle->select[] = '$rech_select'; |
@@ -431,7 +430,7 @@ discard block |
||
| 431 | 430 | $c = |
| 432 | 431 | [ |
| 433 | 432 | "'OR'", |
| 434 | - ["'='", "'$table." . "id_trad'", "'$table.$prim'"], |
|
| 433 | + ["'='", "'$table."."id_trad'", "'$table.$prim'"], |
|
| 435 | 434 | ["'='", "'$table.id_trad'", "'0'"] |
| 436 | 435 | ]; |
| 437 | 436 | $boucle->where[] = ($crit->not ? ["'NOT'", $c] : $c); |
@@ -454,15 +453,14 @@ discard block |
||
| 454 | 453 | $boucle = &$boucles[$idb]; |
| 455 | 454 | $arg = kwote(calculer_argument_precedent($idb, 'id_parent', $boucles)); |
| 456 | 455 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 457 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 458 | - 'id_parent'; |
|
| 459 | - $mparent = $boucle->id_table . '.' . $id_parent; |
|
| 456 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 457 | + $mparent = $boucle->id_table.'.'.$id_parent; |
|
| 460 | 458 | |
| 461 | 459 | if ($boucle->type_requete == 'rubriques' or isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'])) { |
| 462 | 460 | $boucle->where[] = ["'='", "'$mparent'", $arg]; |
| 463 | 461 | } // le cas FORUMS est gere dans le plugin forum, dans la fonction critere_FORUMS_meme_parent_dist() |
| 464 | 462 | else { |
| 465 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ' . $boucle->type_requete]]); |
|
| 463 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' '.$boucle->type_requete]]); |
|
| 466 | 464 | } |
| 467 | 465 | } |
| 468 | 466 | |
@@ -515,16 +513,15 @@ discard block |
||
| 515 | 513 | if (count(trouver_champs_decomposes($champ, $desc)) > 1) { |
| 516 | 514 | $decompose = decompose_champ_id_objet($champ); |
| 517 | 515 | $champ = array_shift($decompose); |
| 518 | - $boucle->where[] = ["'='", _q($cle . '.' . reset($decompose)), '"' . sql_quote(end($decompose)) . '"']; |
|
| 516 | + $boucle->where[] = ["'='", _q($cle.'.'.reset($decompose)), '"'.sql_quote(end($decompose)).'"']; |
|
| 519 | 517 | } |
| 520 | 518 | } else { |
| 521 | 519 | $cle = $boucle->id_table; |
| 522 | 520 | } |
| 523 | 521 | |
| 524 | - $c = "sql_in('$cle" . ".$champ', calcul_branche_in($arg)" |
|
| 525 | - . ($not ? ", 'NOT'" : '') . ')'; |
|
| 526 | - $boucle->where[] = !$crit->cond ? $c : |
|
| 527 | - ("($arg ? $c : " . ($not ? "'0=1'" : "'1=1'") . ')'); |
|
| 522 | + $c = "sql_in('$cle".".$champ', calcul_branche_in($arg)" |
|
| 523 | + . ($not ? ", 'NOT'" : '').')'; |
|
| 524 | + $boucle->where[] = !$crit->cond ? $c : ("($arg ? $c : ".($not ? "'0=1'" : "'1=1'").')'); |
|
| 528 | 525 | } |
| 529 | 526 | |
| 530 | 527 | /** |
@@ -544,9 +541,9 @@ discard block |
||
| 544 | 541 | $not = ($crit->not ? 'NOT' : ''); |
| 545 | 542 | $serveur = $boucle->sql_serveur; |
| 546 | 543 | |
| 547 | - $c = "sql_in('" . |
|
| 548 | - $boucle->id_table . '.' . $boucle->primary |
|
| 549 | - . "', lister_objets_avec_logos('" . $boucle->primary . "'), '$not', '$serveur')"; |
|
| 544 | + $c = "sql_in('". |
|
| 545 | + $boucle->id_table.'.'.$boucle->primary |
|
| 546 | + . "', lister_objets_avec_logos('".$boucle->primary."'), '$not', '$serveur')"; |
|
| 550 | 547 | |
| 551 | 548 | $boucle->where[] = $c; |
| 552 | 549 | } |
@@ -578,7 +575,7 @@ discard block |
||
| 578 | 575 | $t = table_objet_sql($r[1]); |
| 579 | 576 | $t = array_search($t, $boucles[$idb]->from); |
| 580 | 577 | if ($t) { |
| 581 | - $t .= '.' . $r[2]; |
|
| 578 | + $t .= '.'.$r[2]; |
|
| 582 | 579 | } |
| 583 | 580 | } |
| 584 | 581 | } else { |
@@ -593,7 +590,7 @@ discard block |
||
| 593 | 590 | $boucles[$idb]->select[] = $t; |
| 594 | 591 | } |
| 595 | 592 | } else { |
| 596 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]); |
|
| 593 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]); |
|
| 597 | 594 | } |
| 598 | 595 | } |
| 599 | 596 | |
@@ -663,26 +660,26 @@ discard block |
||
| 663 | 660 | (false !== $i = strpos($boucle->order[$n - 1], 'ASC')) |
| 664 | 661 | or (false !== $i = strpos($boucle->order[$n - 1], 'DESC')) |
| 665 | 662 | ) { |
| 666 | - $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . " . $boucle->modificateur['collate'] . " . ' ", $i, 0); |
|
| 663 | + $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . ".$boucle->modificateur['collate']." . ' ", $i, 0); |
|
| 667 | 664 | } else { |
| 668 | - $boucle->order[$n - 1] .= ' . ' . $boucle->modificateur['collate']; |
|
| 665 | + $boucle->order[$n - 1] .= ' . '.$boucle->modificateur['collate']; |
|
| 669 | 666 | } |
| 670 | 667 | } |
| 671 | 668 | } else { |
| 672 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ' . count($boucles[$idb]->order)]]); |
|
| 669 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' '.count($boucles[$idb]->order)]]); |
|
| 673 | 670 | } |
| 674 | 671 | } |
| 675 | 672 | |
| 676 | 673 | // https://code.spip.net/@calculer_critere_arg_dynamique |
| 677 | 674 | function calculer_critere_arg_dynamique($idb, &$boucles, $crit, $suffix = '') { |
| 678 | 675 | $boucle = $boucles[$idb]; |
| 679 | - $alt = "('" . $boucle->id_table . '.\' . $x' . $suffix . ')'; |
|
| 680 | - $var = '$champs_' . $idb; |
|
| 676 | + $alt = "('".$boucle->id_table.'.\' . $x'.$suffix.')'; |
|
| 677 | + $var = '$champs_'.$idb; |
|
| 681 | 678 | $desc = (strpos($boucle->in, "static $var =") !== false); |
| 682 | 679 | if (!$desc) { |
| 683 | 680 | $desc = $boucle->show['field']; |
| 684 | 681 | $desc = implode(',', array_map('_q', array_keys($desc))); |
| 685 | - $boucles[$idb]->in .= "\n\tstatic $var = array(" . $desc . ');'; |
|
| 682 | + $boucles[$idb]->in .= "\n\tstatic $var = array(".$desc.');'; |
|
| 686 | 683 | } |
| 687 | 684 | if ($desc) { |
| 688 | 685 | $alt = "(in_array(\$x, $var) ? $alt :(\$x$suffix))"; |
@@ -757,7 +754,7 @@ discard block |
||
| 757 | 754 | $sens = " . ' DESC'"; |
| 758 | 755 | } |
| 759 | 756 | if (isset($boucle->modificateur['collate'])) { |
| 760 | - $collecte = ' . ' . $boucle->modificateur['collate']; |
|
| 757 | + $collecte = ' . '.$boucle->modificateur['collate']; |
|
| 761 | 758 | } |
| 762 | 759 | |
| 763 | 760 | // Pour chaque paramètre du critère |
@@ -779,14 +776,14 @@ discard block |
||
| 779 | 776 | if (preg_match(',^(\w+)[\s]+(.*)$,', $par, $m)) { |
| 780 | 777 | $expression = trim($m[1]); |
| 781 | 778 | $champ = trim($m[2]); |
| 782 | - if (function_exists($f = 'calculer_critere_par_expression_' . $expression)) { |
|
| 779 | + if (function_exists($f = 'calculer_critere_par_expression_'.$expression)) { |
|
| 783 | 780 | $order = $f($idb, $boucles, $crit, $tri, $champ); |
| 784 | 781 | } else { |
| 785 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " $par"]]; |
|
| 782 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." $par"]]; |
|
| 786 | 783 | } |
| 787 | 784 | |
| 788 | 785 | // tris de la forme {par champ} ou {par FONCTION(champ)} |
| 789 | - } elseif (preg_match(',^' . CHAMP_SQL_PLUS_FONC . '$,is', $par, $match)) { |
|
| 786 | + } elseif (preg_match(',^'.CHAMP_SQL_PLUS_FONC.'$,is', $par, $match)) { |
|
| 790 | 787 | // {par FONCTION(champ)} |
| 791 | 788 | if (count($match) > 2) { |
| 792 | 789 | $par = substr($match[2], 1, -1); |
@@ -796,7 +793,7 @@ discard block |
||
| 796 | 793 | if ($par == 'hasard') { |
| 797 | 794 | $order = calculer_critere_par_hasard($idb, $boucles, $crit); |
| 798 | 795 | } elseif ($par == 'date' and !empty($boucle->show['date'])) { |
| 799 | - $order = "'" . $boucle->id_table . '.' . $boucle->show['date'] . "'"; |
|
| 796 | + $order = "'".$boucle->id_table.'.'.$boucle->show['date']."'"; |
|
| 800 | 797 | } else { |
| 801 | 798 | // cas général {par champ}, {par table.champ}, ... |
| 802 | 799 | $order = calculer_critere_par_champ($idb, $boucles, $crit, $par); |
@@ -805,7 +802,7 @@ discard block |
||
| 805 | 802 | |
| 806 | 803 | // on ne sait pas traiter… |
| 807 | 804 | else { |
| 808 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " $par"]]; |
|
| 805 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." $par"]]; |
|
| 809 | 806 | } |
| 810 | 807 | |
| 811 | 808 | // En cas d'erreur de squelette retournée par une fonction |
@@ -825,14 +822,14 @@ discard block |
||
| 825 | 822 | |
| 826 | 823 | if ($fct) { |
| 827 | 824 | if (preg_match("/^\s*'(.*)'\s*$/", $order, $r)) { |
| 828 | - $order = "'$fct(" . $r[1] . ")'"; |
|
| 825 | + $order = "'$fct(".$r[1].")'"; |
|
| 829 | 826 | } else { |
| 830 | 827 | $order = "'$fct(' . $order . ')'"; |
| 831 | 828 | } |
| 832 | 829 | } |
| 833 | - $t = $order . $collecte . $sens; |
|
| 830 | + $t = $order.$collecte.$sens; |
|
| 834 | 831 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 835 | - $t = $r[1] . $r[2]; |
|
| 832 | + $t = $r[1].$r[2]; |
|
| 836 | 833 | } |
| 837 | 834 | |
| 838 | 835 | $boucle->order[] = $t; |
@@ -882,16 +879,16 @@ discard block |
||
| 882 | 879 | function calculer_critere_par_expression_num($idb, &$boucles, $crit, $tri, $champ) { |
| 883 | 880 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 884 | 881 | if (is_array($_champ)) { |
| 885 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " num $champ"]]; |
|
| 882 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." num $champ"]]; |
|
| 886 | 883 | } |
| 887 | 884 | $boucle = &$boucles[$idb]; |
| 888 | - $texte = '0+' . $_champ; |
|
| 885 | + $texte = '0+'.$_champ; |
|
| 889 | 886 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 890 | 887 | if ($suite !== "''") { |
| 891 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . ' . "'; |
|
| 888 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')".' . "'; |
|
| 892 | 889 | } |
| 893 | - $asnum = 'num' . ($boucle->order ? count($boucle->order) : ''); |
|
| 894 | - $boucle->select[] = $texte . " AS $asnum"; |
|
| 890 | + $asnum = 'num'.($boucle->order ? count($boucle->order) : ''); |
|
| 891 | + $boucle->select[] = $texte." AS $asnum"; |
|
| 895 | 892 | |
| 896 | 893 | $orderassinum = calculer_critere_par_expression_sinum($idb, $boucles, $crit, $tri, $champ); |
| 897 | 894 | $orderassinum = trim($orderassinum, "'"); |
@@ -920,13 +917,13 @@ discard block |
||
| 920 | 917 | function calculer_critere_par_expression_sinum($idb, &$boucles, $crit, $tri, $champ) { |
| 921 | 918 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 922 | 919 | if (is_array($_champ)) { |
| 923 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " sinum $champ"]]; |
|
| 920 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." sinum $champ"]]; |
|
| 924 | 921 | } |
| 925 | 922 | $boucle = &$boucles[$idb]; |
| 926 | - $texte = '0+' . $_champ; |
|
| 923 | + $texte = '0+'.$_champ; |
|
| 927 | 924 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 928 | 925 | if ($suite !== "''") { |
| 929 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . ' . "'; |
|
| 926 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')".' . "'; |
|
| 930 | 927 | } |
| 931 | 928 | |
| 932 | 929 | $as = false; |
@@ -942,8 +939,8 @@ discard block |
||
| 942 | 939 | } |
| 943 | 940 | |
| 944 | 941 | if (!$as) { |
| 945 | - $as = 'sinum' . ($boucle->order ? count($boucle->order) : ''); |
|
| 946 | - $boucle->select[] = $select . $as; |
|
| 942 | + $as = 'sinum'.($boucle->order ? count($boucle->order) : ''); |
|
| 943 | + $boucle->select[] = $select.$as; |
|
| 947 | 944 | } |
| 948 | 945 | $order = "'$as'"; |
| 949 | 946 | return $order; |
@@ -968,10 +965,10 @@ discard block |
||
| 968 | 965 | function calculer_critere_par_expression_multi($idb, &$boucles, $crit, $tri, $champ) { |
| 969 | 966 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 970 | 967 | if (is_array($_champ)) { |
| 971 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " multi $champ"]]; |
|
| 968 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." multi $champ"]]; |
|
| 972 | 969 | } |
| 973 | 970 | $boucle = &$boucles[$idb]; |
| 974 | - $boucle->select[] = "\".sql_multi('" . $_champ . "', \$GLOBALS['spip_lang']).\""; |
|
| 971 | + $boucle->select[] = "\".sql_multi('".$_champ."', \$GLOBALS['spip_lang']).\""; |
|
| 975 | 972 | $order = "'multi'"; |
| 976 | 973 | return $order; |
| 977 | 974 | } |
@@ -997,7 +994,7 @@ discard block |
||
| 997 | 994 | |
| 998 | 995 | // le champ existe dans la table, pas de souci (le plus commun) |
| 999 | 996 | if (isset($desc['field'][$par])) { |
| 1000 | - $par = $boucle->id_table . '.' . $par; |
|
| 997 | + $par = $boucle->id_table.'.'.$par; |
|
| 1001 | 998 | } |
| 1002 | 999 | // le champ est peut être une jointure |
| 1003 | 1000 | else { |
@@ -1018,24 +1015,24 @@ discard block |
||
| 1018 | 1015 | // Sinon on cherche le champ dans les tables possibles de jointures |
| 1019 | 1016 | // Si la table est déjà dans le from, on la réutilise. |
| 1020 | 1017 | if ($infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $table)) { |
| 1021 | - $par = $infos['alias'] . '.' . $champ; |
|
| 1018 | + $par = $infos['alias'].'.'.$champ; |
|
| 1022 | 1019 | } elseif ( |
| 1023 | 1020 | $boucle->jointures_explicites |
| 1024 | 1021 | and $alias = trouver_jointure_champ($champ, $boucle, explode(' ', $boucle->jointures_explicites), false, $table) |
| 1025 | 1022 | ) { |
| 1026 | - $par = $alias . '.' . $champ; |
|
| 1023 | + $par = $alias.'.'.$champ; |
|
| 1027 | 1024 | } elseif ($alias = trouver_jointure_champ($champ, $boucle, $boucle->jointures, false, $table)) { |
| 1028 | - $par = $alias . '.' . $champ; |
|
| 1025 | + $par = $alias.'.'.$champ; |
|
| 1029 | 1026 | // en spécifiant directement l'alias {par L2.titre} (situation hasardeuse tout de même) |
| 1030 | 1027 | } elseif ( |
| 1031 | 1028 | $table_alias |
| 1032 | 1029 | and isset($boucle->from[$table_alias]) |
| 1033 | 1030 | and $infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $boucle->from[$table_alias]) |
| 1034 | 1031 | ) { |
| 1035 | - $par = $infos['alias'] . '.' . $champ; |
|
| 1032 | + $par = $infos['alias'].'.'.$champ; |
|
| 1036 | 1033 | } elseif ($table) { |
| 1037 | 1034 | // On avait table + champ, mais on ne les a pas trouvés |
| 1038 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " $par"]]; |
|
| 1035 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." $par"]]; |
|
| 1039 | 1036 | } else { |
| 1040 | 1037 | // Sinon tant pis, ca doit etre un champ synthetise (cf points) |
| 1041 | 1038 | } |
@@ -1059,7 +1056,7 @@ discard block |
||
| 1059 | 1056 | if (!$t) { |
| 1060 | 1057 | $t = trouver_jointure_champ($champ, $boucle); |
| 1061 | 1058 | } |
| 1062 | - return !$t ? '' : ("'" . $t . '.' . $champ . "'"); |
|
| 1059 | + return !$t ? '' : ("'".$t.'.'.$champ."'"); |
|
| 1063 | 1060 | } |
| 1064 | 1061 | |
| 1065 | 1062 | /** |
@@ -1104,9 +1101,9 @@ discard block |
||
| 1104 | 1101 | $boucle->default_order[] = ' DESC'; |
| 1105 | 1102 | } |
| 1106 | 1103 | } else { |
| 1107 | - $t = $boucle->order[$n - 1] . " . $order"; |
|
| 1104 | + $t = $boucle->order[$n - 1]." . $order"; |
|
| 1108 | 1105 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 1109 | - $t = $r[1] . $r[2]; |
|
| 1106 | + $t = $r[1].$r[2]; |
|
| 1110 | 1107 | } |
| 1111 | 1108 | $boucle->order[$n - 1] = $t; |
| 1112 | 1109 | } |
@@ -1141,7 +1138,7 @@ discard block |
||
| 1141 | 1138 | $_order = array_pop($boucle->order); |
| 1142 | 1139 | |
| 1143 | 1140 | $_liste = calculer_liste($crit->param[1], [], $boucles, $boucles[$idb]->id_parent); |
| 1144 | - $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'" . $boucle->sql_serveur . "')) ? \$zl : '0').')'$sens"; |
|
| 1141 | + $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'".$boucle->sql_serveur."')) ? \$zl : '0').')'$sens"; |
|
| 1145 | 1142 | } |
| 1146 | 1143 | |
| 1147 | 1144 | |
@@ -1150,7 +1147,7 @@ discard block |
||
| 1150 | 1147 | $params = $crit->param; |
| 1151 | 1148 | |
| 1152 | 1149 | if (count($params) < 1) { |
| 1153 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]; |
|
| 1150 | + return ['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]; |
|
| 1154 | 1151 | } |
| 1155 | 1152 | |
| 1156 | 1153 | $boucle = &$boucles[$idb]; |
@@ -1171,7 +1168,7 @@ discard block |
||
| 1171 | 1168 | if ((count($date) == 1) and ($date[0]->type == 'texte')) { |
| 1172 | 1169 | $date = $date[0]->texte; |
| 1173 | 1170 | if (!isset($fields[$date])) { |
| 1174 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . ' ' . $date]]; |
|
| 1171 | + return ['zbug_critere_inconnu', ['critere' => $crit->op.' '.$date]]; |
|
| 1175 | 1172 | } |
| 1176 | 1173 | } else { |
| 1177 | 1174 | $a = calculer_liste($date, $idb, $boucles, $parent); |
@@ -1183,38 +1180,38 @@ discard block |
||
| 1183 | 1180 | $date = "'.(($cond)\n?\$a:\"$defaut\").'"; |
| 1184 | 1181 | } |
| 1185 | 1182 | $annee = $params ? array_shift($params) : ''; |
| 1186 | - $annee = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1187 | - calculer_liste($annee, $idb, $boucles, $parent) . |
|
| 1183 | + $annee = "\n".'sprintf("%04d", ($x = '. |
|
| 1184 | + calculer_liste($annee, $idb, $boucles, $parent). |
|
| 1188 | 1185 | ') ? $x : date("Y"))'; |
| 1189 | 1186 | |
| 1190 | 1187 | $mois = $params ? array_shift($params) : ''; |
| 1191 | - $mois = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1192 | - calculer_liste($mois, $idb, $boucles, $parent) . |
|
| 1188 | + $mois = "\n".'sprintf("%02d", ($x = '. |
|
| 1189 | + calculer_liste($mois, $idb, $boucles, $parent). |
|
| 1193 | 1190 | ') ? $x : date("m"))'; |
| 1194 | 1191 | |
| 1195 | 1192 | $jour = $params ? array_shift($params) : ''; |
| 1196 | - $jour = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1197 | - calculer_liste($jour, $idb, $boucles, $parent) . |
|
| 1193 | + $jour = "\n".'sprintf("%02d", ($x = '. |
|
| 1194 | + calculer_liste($jour, $idb, $boucles, $parent). |
|
| 1198 | 1195 | ') ? $x : date("d"))'; |
| 1199 | 1196 | |
| 1200 | 1197 | $annee2 = $params ? array_shift($params) : ''; |
| 1201 | - $annee2 = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1202 | - calculer_liste($annee2, $idb, $boucles, $parent) . |
|
| 1198 | + $annee2 = "\n".'sprintf("%04d", ($x = '. |
|
| 1199 | + calculer_liste($annee2, $idb, $boucles, $parent). |
|
| 1203 | 1200 | ') ? $x : date("Y"))'; |
| 1204 | 1201 | |
| 1205 | 1202 | $mois2 = $params ? array_shift($params) : ''; |
| 1206 | - $mois2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1207 | - calculer_liste($mois2, $idb, $boucles, $parent) . |
|
| 1203 | + $mois2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1204 | + calculer_liste($mois2, $idb, $boucles, $parent). |
|
| 1208 | 1205 | ') ? $x : date("m"))'; |
| 1209 | 1206 | |
| 1210 | 1207 | $jour2 = $params ? array_shift($params) : ''; |
| 1211 | - $jour2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1212 | - calculer_liste($jour2, $idb, $boucles, $parent) . |
|
| 1208 | + $jour2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1209 | + calculer_liste($jour2, $idb, $boucles, $parent). |
|
| 1213 | 1210 | ') ? $x : date("d"))'; |
| 1214 | 1211 | |
| 1215 | - $date = $boucle->id_table . ".$date"; |
|
| 1212 | + $date = $boucle->id_table.".$date"; |
|
| 1216 | 1213 | |
| 1217 | - $quote_end = ",'" . $boucle->sql_serveur . "','text'"; |
|
| 1214 | + $quote_end = ",'".$boucle->sql_serveur."','text'"; |
|
| 1218 | 1215 | if ($type == 'jour') { |
| 1219 | 1216 | $boucle->where[] = [ |
| 1220 | 1217 | "'='", |
@@ -1286,14 +1283,13 @@ discard block |
||
| 1286 | 1283 | list($a21, $a22) = calculer_critere_parties_aux($idb, $boucles, $a2); |
| 1287 | 1284 | |
| 1288 | 1285 | if (($op == ',') && (is_numeric($a11) && (is_numeric($a21)))) { |
| 1289 | - $boucle->limit = $a11 . ',' . $a21; |
|
| 1286 | + $boucle->limit = $a11.','.$a21; |
|
| 1290 | 1287 | } else { |
| 1291 | 1288 | // 3 dans {1/3}, {2,3} ou {1,n-3} |
| 1292 | 1289 | $boucle->total_parties = ($a21 != 'n') ? $a21 : $a22; |
| 1293 | 1290 | // 2 dans {2/3}, {2,5}, {n-2,1} |
| 1294 | 1291 | $partie = ($a11 != 'n') ? $a11 : $a12; |
| 1295 | - $mode = (($op == '/') ? '/' : |
|
| 1296 | - (($a11 == 'n') ? '-' : '+') . (($a21 == 'n') ? '-' : '+')); |
|
| 1292 | + $mode = (($op == '/') ? '/' : (($a11 == 'n') ? '-' : '+').(($a21 == 'n') ? '-' : '+')); |
|
| 1297 | 1293 | // cas simple {0,#ENV{truc}} compilons le en LIMIT : |
| 1298 | 1294 | if ($a11 !== 'n' and $a21 !== 'n' and $mode == '++' and $op == ',') { |
| 1299 | 1295 | $boucle->limit = |
@@ -1339,8 +1335,7 @@ discard block |
||
| 1339 | 1335 | // {1/3} |
| 1340 | 1336 | if ($op1 == '/') { |
| 1341 | 1337 | $pmoins1 = is_numeric($debut) ? ($debut - 1) : "($debut-1)"; |
| 1342 | - $totpos = is_numeric($total_parties) ? ($total_parties) : |
|
| 1343 | - "($total_parties ? $total_parties : 1)"; |
|
| 1338 | + $totpos = is_numeric($total_parties) ? ($total_parties) : "($total_parties ? $total_parties : 1)"; |
|
| 1344 | 1339 | $fin = "ceil(($nombre_boucle * $debut )/$totpos) - 1"; |
| 1345 | 1340 | $debut = !$pmoins1 ? 0 : "ceil(($nombre_boucle * $pmoins1)/$totpos);"; |
| 1346 | 1341 | } else { |
@@ -1351,15 +1346,13 @@ discard block |
||
| 1351 | 1346 | |
| 1352 | 1347 | // cas {x,n-1} |
| 1353 | 1348 | if ($op2 == '-') { |
| 1354 | - $fin = '$debut_boucle + ' . $nombre_boucle . ' - ' |
|
| 1355 | - . (is_numeric($total_parties) ? ($total_parties + 1) : |
|
| 1356 | - ($total_parties . ' - 1')); |
|
| 1349 | + $fin = '$debut_boucle + '.$nombre_boucle.' - ' |
|
| 1350 | + . (is_numeric($total_parties) ? ($total_parties + 1) : ($total_parties.' - 1')); |
|
| 1357 | 1351 | } else { |
| 1358 | 1352 | // {x,1} ou {pagination} |
| 1359 | 1353 | $fin = '$debut_boucle' |
| 1360 | 1354 | . (is_numeric($total_parties) ? |
| 1361 | - (($total_parties == 1) ? '' : (' + ' . ($total_parties - 1))) : |
|
| 1362 | - ('+' . $total_parties . ' - 1')); |
|
| 1355 | + (($total_parties == 1) ? '' : (' + '.($total_parties - 1))) : ('+'.$total_parties.' - 1')); |
|
| 1363 | 1356 | } |
| 1364 | 1357 | |
| 1365 | 1358 | // {pagination}, gerer le debut_xx=-1 pour tout voir |
@@ -1377,11 +1370,11 @@ discard block |
||
| 1377 | 1370 | // Utiliser min pour rabattre $fin_boucle sur total_boucle. |
| 1378 | 1371 | |
| 1379 | 1372 | $boucles[$id_boucle]->mode_partie = "\n\t" |
| 1380 | - . '$debut_boucle = ' . $debut . ";\n " |
|
| 1373 | + . '$debut_boucle = '.$debut.";\n " |
|
| 1381 | 1374 | . "\$debut_boucle = intval(\$debut_boucle);\n " |
| 1382 | - . '$fin_boucle = min(' . $fin . ", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1383 | - . '$Numrows[\'' . $id_boucle . "']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1384 | - . '$Numrows[\'' . $id_boucle . '\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1375 | + . '$fin_boucle = min('.$fin.", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1376 | + . '$Numrows[\''.$id_boucle."']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1377 | + . '$Numrows[\''.$id_boucle.'\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1385 | 1378 | . "\n\tif (\$debut_boucle>0" |
| 1386 | 1379 | . " AND \$debut_boucle < \$Numrows['$id_boucle']['grand_total']" |
| 1387 | 1380 | . " AND \$iter->seek(\$debut_boucle,'continue'))" |
@@ -1466,16 +1459,16 @@ discard block |
||
| 1466 | 1459 | // critere personnalise ? |
| 1467 | 1460 | if ( |
| 1468 | 1461 | (!$serveur or |
| 1469 | - ((!function_exists($f = 'critere_' . $serveur . '_' . $table . '_' . $critere)) |
|
| 1470 | - and (!function_exists($f = $f . '_dist')) |
|
| 1471 | - and (!function_exists($f = 'critere_' . $serveur . '_' . $critere)) |
|
| 1472 | - and (!function_exists($f = $f . '_dist')) |
|
| 1462 | + ((!function_exists($f = 'critere_'.$serveur.'_'.$table.'_'.$critere)) |
|
| 1463 | + and (!function_exists($f = $f.'_dist')) |
|
| 1464 | + and (!function_exists($f = 'critere_'.$serveur.'_'.$critere)) |
|
| 1465 | + and (!function_exists($f = $f.'_dist')) |
|
| 1473 | 1466 | ) |
| 1474 | 1467 | ) |
| 1475 | - and (!function_exists($f = 'critere_' . $table . '_' . $critere)) |
|
| 1476 | - and (!function_exists($f = $f . '_dist')) |
|
| 1477 | - and (!function_exists($f = 'critere_' . $critere)) |
|
| 1478 | - and (!function_exists($f = $f . '_dist')) |
|
| 1468 | + and (!function_exists($f = 'critere_'.$table.'_'.$critere)) |
|
| 1469 | + and (!function_exists($f = $f.'_dist')) |
|
| 1470 | + and (!function_exists($f = 'critere_'.$critere)) |
|
| 1471 | + and (!function_exists($f = $f.'_dist')) |
|
| 1479 | 1472 | ) { |
| 1480 | 1473 | // fonction critere standard |
| 1481 | 1474 | $f = $defaut; |
@@ -1508,9 +1501,9 @@ discard block |
||
| 1508 | 1501 | */ |
| 1509 | 1502 | function kwote($lisp, $serveur = '', $type = '') { |
| 1510 | 1503 | if (preg_match(_CODE_QUOTE, $lisp, $r)) { |
| 1511 | - return $r[1] . '"' . sql_quote(str_replace(["\\'", '\\\\'], ["'", '\\'], $r[2]), $serveur, $type) . '"'; |
|
| 1504 | + return $r[1].'"'.sql_quote(str_replace(["\\'", '\\\\'], ["'", '\\'], $r[2]), $serveur, $type).'"'; |
|
| 1512 | 1505 | } else { |
| 1513 | - return "sql_quote($lisp, '$serveur', '" . str_replace("'", "\\'", $type) . "')"; |
|
| 1506 | + return "sql_quote($lisp, '$serveur', '".str_replace("'", "\\'", $type)."')"; |
|
| 1514 | 1507 | } |
| 1515 | 1508 | } |
| 1516 | 1509 | |
@@ -1532,7 +1525,7 @@ discard block |
||
| 1532 | 1525 | function critere_IN_dist($idb, &$boucles, $crit) { |
| 1533 | 1526 | $r = calculer_critere_infixe($idb, $boucles, $crit); |
| 1534 | 1527 | if (!$r) { |
| 1535 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]); |
|
| 1528 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]); |
|
| 1536 | 1529 | } |
| 1537 | 1530 | list($arg, $op, $val, $col, $where_complement) = $r; |
| 1538 | 1531 | |
@@ -1557,8 +1550,8 @@ discard block |
||
| 1557 | 1550 | "'NOT'", |
| 1558 | 1551 | [ |
| 1559 | 1552 | "'IN'", |
| 1560 | - "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", |
|
| 1561 | - ["'SELF'", "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", $where] |
|
| 1553 | + "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", |
|
| 1554 | + ["'SELF'", "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", $where] |
|
| 1562 | 1555 | ] |
| 1563 | 1556 | ]; |
| 1564 | 1557 | } |
@@ -1576,22 +1569,22 @@ discard block |
||
| 1576 | 1569 | $descr = $boucles[$idb]->descr; |
| 1577 | 1570 | $cpt = &$num[$descr['nom']][$descr['gram']][$idb]; |
| 1578 | 1571 | |
| 1579 | - $var = '$in' . $cpt++; |
|
| 1572 | + $var = '$in'.$cpt++; |
|
| 1580 | 1573 | $x = "\n\t$var = array();"; |
| 1581 | 1574 | foreach ($val as $k => $v) { |
| 1582 | 1575 | if (preg_match(",^(\n//.*\n)?'(.*)'$,", $v, $r)) { |
| 1583 | 1576 | // optimiser le traitement des constantes |
| 1584 | 1577 | if (is_numeric($r[2])) { |
| 1585 | - $x .= "\n\t$var" . "[]= $r[2];"; |
|
| 1578 | + $x .= "\n\t$var"."[]= $r[2];"; |
|
| 1586 | 1579 | } else { |
| 1587 | - $x .= "\n\t$var" . '[]= ' . sql_quote($r[2]) . ';'; |
|
| 1580 | + $x .= "\n\t$var".'[]= '.sql_quote($r[2]).';'; |
|
| 1588 | 1581 | } |
| 1589 | 1582 | } else { |
| 1590 | 1583 | // Pour permettre de passer des tableaux de valeurs |
| 1591 | 1584 | // on repere l'utilisation brute de #ENV**{X}, |
| 1592 | 1585 | // c'est-a-dire sa traduction en ($PILE[0][X]). |
| 1593 | 1586 | // et on deballe mais en rajoutant l'anti XSS |
| 1594 | - $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var" . "[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1587 | + $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var"."[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1595 | 1588 | } |
| 1596 | 1589 | } |
| 1597 | 1590 | |
@@ -1605,7 +1598,7 @@ discard block |
||
| 1605 | 1598 | $boucles[$idb]->default_order[] = "((!\$zqv=sql_quote($var) OR \$zqv===\"''\") ? 0 : ('FIELD($arg,' . \$zqv . ')'))"; |
| 1606 | 1599 | } |
| 1607 | 1600 | |
| 1608 | - return "sql_in('$arg', $var" . ($crit2 == 'NOT' ? ",'NOT'" : '') . ')'; |
|
| 1601 | + return "sql_in('$arg', $var".($crit2 == 'NOT' ? ",'NOT'" : '').')'; |
|
| 1609 | 1602 | } |
| 1610 | 1603 | |
| 1611 | 1604 | /** |
@@ -1678,7 +1671,7 @@ discard block |
||
| 1678 | 1671 | $champs = array_diff($champs, array_keys($boucle->modificateur['criteres'])); |
| 1679 | 1672 | } |
| 1680 | 1673 | // nous aider en mode debug. |
| 1681 | - $boucle->debug[] = 'id_ : ' . implode(', ', $champs); |
|
| 1674 | + $boucle->debug[] = 'id_ : '.implode(', ', $champs); |
|
| 1682 | 1675 | $boucle->modificateur['id_'] = $champs; |
| 1683 | 1676 | |
| 1684 | 1677 | // créer un critère {id_xxx?} de chaque champ retenu |
@@ -1719,7 +1712,7 @@ discard block |
||
| 1719 | 1712 | // Les champs id_xx de la table demandée |
| 1720 | 1713 | $champs = array_filter( |
| 1721 | 1714 | array_keys($desc['field']), |
| 1722 | - function ($champ) { |
|
| 1715 | + function($champ) { |
|
| 1723 | 1716 | return |
| 1724 | 1717 | strpos($champ, 'id_') === 0 |
| 1725 | 1718 | or (in_array($champ, ['objet'])); |
@@ -1933,8 +1926,8 @@ discard block |
||
| 1933 | 1926 | "'NOT'", |
| 1934 | 1927 | [ |
| 1935 | 1928 | "'IN'", |
| 1936 | - "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", |
|
| 1937 | - ["'SELF'", "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", $where] |
|
| 1929 | + "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", |
|
| 1930 | + ["'SELF'", "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", $where] |
|
| 1938 | 1931 | ] |
| 1939 | 1932 | ]; |
| 1940 | 1933 | } |
@@ -1945,7 +1938,7 @@ discard block |
||
| 1945 | 1938 | if ($crit->cond) { |
| 1946 | 1939 | $pred = calculer_argument_precedent($idb, $col, $boucles); |
| 1947 | 1940 | if ($col == 'date' or $col == 'date_redac') { |
| 1948 | - if ($pred == "\$Pile[0]['" . $col . "']") { |
|
| 1941 | + if ($pred == "\$Pile[0]['".$col."']") { |
|
| 1949 | 1942 | $pred = "(\$Pile[0]['{$col}_default']?'':$pred)"; |
| 1950 | 1943 | } |
| 1951 | 1944 | } |
@@ -2106,7 +2099,7 @@ discard block |
||
| 2106 | 2099 | // defaire le quote des int et les passer dans sql_quote avec le bon type de champ si on le connait, int sinon |
| 2107 | 2100 | // prendre en compte le debug ou la valeur arrive avec un commentaire PHP en debut |
| 2108 | 2101 | if (preg_match(",^\\A(\s*//.*?$\s*)?\"'(-?\d+)'\"\\z,ms", $val[0], $r)) { |
| 2109 | - $val[0] = $r[1] . '"' . sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote) . '"'; |
|
| 2102 | + $val[0] = $r[1].'"'.sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote).'"'; |
|
| 2110 | 2103 | } |
| 2111 | 2104 | // sinon expliciter les |
| 2112 | 2105 | // sql_quote(truc) en sql_quote(truc,'',type) |
@@ -2122,14 +2115,14 @@ discard block |
||
| 2122 | 2115 | ) { |
| 2123 | 2116 | $r = $r[1] |
| 2124 | 2117 | . ((isset($r[2]) and $r[2]) ? $r[2] : ",''") |
| 2125 | - . ",'" . addslashes($type_cast_quote) . "'"; |
|
| 2118 | + . ",'".addslashes($type_cast_quote)."'"; |
|
| 2126 | 2119 | $val[0] = "sql_quote($r)"; |
| 2127 | 2120 | } |
| 2128 | 2121 | elseif ( |
| 2129 | 2122 | strpos($val[0], '@@defaultcast@@') !== false |
| 2130 | 2123 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r) |
| 2131 | 2124 | ) { |
| 2132 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'" . addslashes($type_cast_quote) . "')"; |
|
| 2125 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'".addslashes($type_cast_quote)."')"; |
|
| 2133 | 2126 | } |
| 2134 | 2127 | } |
| 2135 | 2128 | |
@@ -2137,7 +2130,7 @@ discard block |
||
| 2137 | 2130 | strpos($val[0], '@@defaultcast@@') !== false |
| 2138 | 2131 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r) |
| 2139 | 2132 | ) { |
| 2140 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'char')"; |
|
| 2133 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'char')"; |
|
| 2141 | 2134 | } |
| 2142 | 2135 | |
| 2143 | 2136 | // Indicateur pour permettre aux fonctionx boucle_X de modifier |
@@ -2153,7 +2146,7 @@ discard block |
||
| 2153 | 2146 | // inserer le nom de la table SQL devant le nom du champ |
| 2154 | 2147 | if ($table) { |
| 2155 | 2148 | if ($col[0] == '`') { |
| 2156 | - $arg = "$table." . substr($col, 1, -1); |
|
| 2149 | + $arg = "$table.".substr($col, 1, -1); |
|
| 2157 | 2150 | } else { |
| 2158 | 2151 | $arg = "$table.$col"; |
| 2159 | 2152 | } |
@@ -2288,9 +2281,9 @@ discard block |
||
| 2288 | 2281 | **/ |
| 2289 | 2282 | function primary_doublee($decompose, $table) { |
| 2290 | 2283 | $e1 = reset($decompose); |
| 2291 | - $e2 = "sql_quote('" . end($decompose) . "')"; |
|
| 2284 | + $e2 = "sql_quote('".end($decompose)."')"; |
|
| 2292 | 2285 | |
| 2293 | - return ["'='", "'$table." . $e1 . "'", $e2]; |
|
| 2286 | + return ["'='", "'$table.".$e1."'", $e2]; |
|
| 2294 | 2287 | } |
| 2295 | 2288 | |
| 2296 | 2289 | /** |
@@ -2329,7 +2322,7 @@ discard block |
||
| 2329 | 2322 | $checkarrivee |
| 2330 | 2323 | and is_string($checkarrivee) |
| 2331 | 2324 | and $a = table_objet($checkarrivee) |
| 2332 | - and in_array($a . '_liens', $joints) |
|
| 2325 | + and in_array($a.'_liens', $joints) |
|
| 2333 | 2326 | ) { |
| 2334 | 2327 | if ($res = calculer_lien_externe_init($boucle, $joints, $col, $desc, $cond, $checkarrivee)) { |
| 2335 | 2328 | return $res; |
@@ -2349,12 +2342,12 @@ discard block |
||
| 2349 | 2342 | // la table est déjà dans le FROM, on vérifie si le champ est utilisé. |
| 2350 | 2343 | $joindre = false; |
| 2351 | 2344 | foreach ($cols as $col) { |
| 2352 | - $c = '/\b' . $t . ".$col" . '\b/'; |
|
| 2345 | + $c = '/\b'.$t.".$col".'\b/'; |
|
| 2353 | 2346 | if (trouver_champ($c, $boucle->where)) { |
| 2354 | 2347 | $joindre = true; |
| 2355 | 2348 | } else { |
| 2356 | 2349 | // mais ca peut etre dans le FIELD pour le Having |
| 2357 | - $c = "/FIELD.$t" . ".$col,/"; |
|
| 2350 | + $c = "/FIELD.$t".".$col,/"; |
|
| 2358 | 2351 | if (trouver_champ($c, $boucle->select)) { |
| 2359 | 2352 | $joindre = true; |
| 2360 | 2353 | } |
@@ -2400,7 +2393,7 @@ discard block |
||
| 2400 | 2393 | $primary_arrivee = id_table_objet($checkarrivee); |
| 2401 | 2394 | |
| 2402 | 2395 | // [FIXME] $checkarrivee peut-il arriver avec false ???? |
| 2403 | - $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee . '_liens'); |
|
| 2396 | + $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee.'_liens'); |
|
| 2404 | 2397 | $arrivee = trouver_champ_exterieur($col, $joints, $boucle, $checkarrivee); |
| 2405 | 2398 | |
| 2406 | 2399 | if (!$intermediaire or !$arrivee) { |
@@ -2504,7 +2497,7 @@ discard block |
||
| 2504 | 2497 | } elseif ($crit->cond and ($col == 'date' or $col == 'date_redac')) { |
| 2505 | 2498 | // un critere conditionnel sur date est traite a part |
| 2506 | 2499 | // car la date est mise d'office par SPIP, |
| 2507 | - $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['" . $col . "'])"; |
|
| 2500 | + $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['".$col."'])"; |
|
| 2508 | 2501 | } |
| 2509 | 2502 | |
| 2510 | 2503 | $val = calculer_argument_precedent($idb, $val, $boucles, $defaut); |
@@ -2536,7 +2529,7 @@ discard block |
||
| 2536 | 2529 | and (($p == "'") or ($p == '"')) |
| 2537 | 2530 | and $params[0][1]->type == 'champ' |
| 2538 | 2531 | ) { |
| 2539 | - $val[] = "$p\\$p#" . $params[0][1]->nom_champ . "\\$p$p"; |
|
| 2532 | + $val[] = "$p\\$p#".$params[0][1]->nom_champ."\\$p$p"; |
|
| 2540 | 2533 | } else { |
| 2541 | 2534 | foreach ((($op != 'IN') ? $params : calculer_vieux_in($params)) as $p) { |
| 2542 | 2535 | $a = calculer_liste($p, $idb, $boucles, $parent); |
@@ -2552,7 +2545,7 @@ discard block |
||
| 2552 | 2545 | $fct = $args_sql = ''; |
| 2553 | 2546 | // fonction SQL ? |
| 2554 | 2547 | // chercher FONCTION(champ) tel que CONCAT(titre,descriptif) |
| 2555 | - if (preg_match('/^(.*)' . SQL_ARGS . '$/', $col, $m)) { |
|
| 2548 | + if (preg_match('/^(.*)'.SQL_ARGS.'$/', $col, $m)) { |
|
| 2556 | 2549 | $fct = $m[1]; |
| 2557 | 2550 | preg_match('/^\(([^,]*)(.*)\)$/', $m[2], $a); |
| 2558 | 2551 | $col = $a[1]; |
@@ -2643,7 +2636,7 @@ discard block |
||
| 2643 | 2636 | # si oui choisir ce champ, sinon choisir xxxx |
| 2644 | 2637 | |
| 2645 | 2638 | if (isset($table['field']["date$suite"])) { |
| 2646 | - $date_orig = 'date' . $suite; |
|
| 2639 | + $date_orig = 'date'.$suite; |
|
| 2647 | 2640 | } else { |
| 2648 | 2641 | $date_orig = substr($suite, 1); |
| 2649 | 2642 | } |
@@ -2654,12 +2647,12 @@ discard block |
||
| 2654 | 2647 | } |
| 2655 | 2648 | } |
| 2656 | 2649 | |
| 2657 | - $date_compare = "\"' . normaliser_date(" . |
|
| 2658 | - calculer_argument_precedent($idb, $pred, $boucles) . |
|
| 2650 | + $date_compare = "\"' . normaliser_date(". |
|
| 2651 | + calculer_argument_precedent($idb, $pred, $boucles). |
|
| 2659 | 2652 | ") . '\""; |
| 2660 | 2653 | |
| 2661 | 2654 | $col_vraie = $date_orig; |
| 2662 | - $date_orig = $boucle->id_table . '.' . $date_orig; |
|
| 2655 | + $date_orig = $boucle->id_table.'.'.$date_orig; |
|
| 2663 | 2656 | |
| 2664 | 2657 | switch ($col) { |
| 2665 | 2658 | case 'date': |
@@ -2679,26 +2672,26 @@ discard block |
||
| 2679 | 2672 | break; |
| 2680 | 2673 | case 'age': |
| 2681 | 2674 | $col = calculer_param_date("\'' . date('Y-m-d H:i:00') . '\'", $date_orig); |
| 2682 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2675 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2683 | 2676 | break; |
| 2684 | 2677 | case 'age_relatif': |
| 2685 | 2678 | $col = calculer_param_date($date_compare, $date_orig); |
| 2686 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2679 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2687 | 2680 | break; |
| 2688 | 2681 | case 'jour_relatif': |
| 2689 | - $col = '(TO_DAYS(' . $date_compare . ')-TO_DAYS(' . $date_orig . '))'; |
|
| 2690 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2682 | + $col = '(TO_DAYS('.$date_compare.')-TO_DAYS('.$date_orig.'))'; |
|
| 2683 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2691 | 2684 | break; |
| 2692 | 2685 | case 'mois_relatif': |
| 2693 | - $col = 'MONTH(' . $date_compare . ')-MONTH(' . |
|
| 2694 | - $date_orig . ')+12*(YEAR(' . $date_compare . |
|
| 2695 | - ')-YEAR(' . $date_orig . '))'; |
|
| 2696 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2686 | + $col = 'MONTH('.$date_compare.')-MONTH('. |
|
| 2687 | + $date_orig.')+12*(YEAR('.$date_compare. |
|
| 2688 | + ')-YEAR('.$date_orig.'))'; |
|
| 2689 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2697 | 2690 | break; |
| 2698 | 2691 | case 'annee_relatif': |
| 2699 | - $col = 'YEAR(' . $date_compare . ')-YEAR(' . |
|
| 2700 | - $date_orig . ')'; |
|
| 2701 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2692 | + $col = 'YEAR('.$date_compare.')-YEAR('. |
|
| 2693 | + $date_orig.')'; |
|
| 2694 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2702 | 2695 | break; |
| 2703 | 2696 | } |
| 2704 | 2697 | |
@@ -2759,10 +2752,10 @@ discard block |
||
| 2759 | 2752 | } |
| 2760 | 2753 | |
| 2761 | 2754 | $boucle->hash .= ' |
| 2762 | - $command[\'sourcemode\'] = ' . array_shift($args) . ";\n"; |
|
| 2755 | + $command[\'sourcemode\'] = ' . array_shift($args).";\n"; |
|
| 2763 | 2756 | |
| 2764 | 2757 | $boucle->hash .= ' |
| 2765 | - $command[\'source\'] = array(' . join(', ', $args) . ");\n"; |
|
| 2758 | + $command[\'source\'] = array(' . join(', ', $args).");\n"; |
|
| 2766 | 2759 | } |
| 2767 | 2760 | |
| 2768 | 2761 | /** |
@@ -2781,7 +2774,7 @@ discard block |
||
| 2781 | 2774 | function critere_DATA_datacache_dist($idb, &$boucles, $crit) { |
| 2782 | 2775 | $boucle = &$boucles[$idb]; |
| 2783 | 2776 | $boucle->hash .= ' |
| 2784 | - $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2777 | + $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2785 | 2778 | } |
| 2786 | 2779 | |
| 2787 | 2780 | |
@@ -2800,7 +2793,7 @@ discard block |
||
| 2800 | 2793 | $boucle->hash .= '$command[\'args\']=array();'; |
| 2801 | 2794 | foreach ($crit->param as $param) { |
| 2802 | 2795 | $boucle->hash .= ' |
| 2803 | - $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2796 | + $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2804 | 2797 | } |
| 2805 | 2798 | } |
| 2806 | 2799 | |
@@ -2819,14 +2812,14 @@ discard block |
||
| 2819 | 2812 | */ |
| 2820 | 2813 | function critere_DATA_liste_dist($idb, &$boucles, $crit) { |
| 2821 | 2814 | $boucle = &$boucles[$idb]; |
| 2822 | - $boucle->hash .= "\n\t" . '$command[\'liste\'] = array();' . "\n"; |
|
| 2815 | + $boucle->hash .= "\n\t".'$command[\'liste\'] = array();'."\n"; |
|
| 2823 | 2816 | foreach ($crit->param as $param) { |
| 2824 | - $boucle->hash .= "\t" . '$command[\'liste\'][] = ' . calculer_liste( |
|
| 2817 | + $boucle->hash .= "\t".'$command[\'liste\'][] = '.calculer_liste( |
|
| 2825 | 2818 | $param, |
| 2826 | 2819 | $idb, |
| 2827 | 2820 | $boucles, |
| 2828 | 2821 | $boucles[$idb]->id_parent |
| 2829 | - ) . ";\n"; |
|
| 2822 | + ).";\n"; |
|
| 2830 | 2823 | } |
| 2831 | 2824 | } |
| 2832 | 2825 | |
@@ -2853,14 +2846,14 @@ discard block |
||
| 2853 | 2846 | */ |
| 2854 | 2847 | function critere_DATA_enum_dist($idb, &$boucles, $crit) { |
| 2855 | 2848 | $boucle = &$boucles[$idb]; |
| 2856 | - $boucle->hash .= "\n\t" . '$command[\'enum\'] = array();' . "\n"; |
|
| 2849 | + $boucle->hash .= "\n\t".'$command[\'enum\'] = array();'."\n"; |
|
| 2857 | 2850 | foreach ($crit->param as $param) { |
| 2858 | - $boucle->hash .= "\t" . '$command[\'enum\'][] = ' . calculer_liste( |
|
| 2851 | + $boucle->hash .= "\t".'$command[\'enum\'][] = '.calculer_liste( |
|
| 2859 | 2852 | $param, |
| 2860 | 2853 | $idb, |
| 2861 | 2854 | $boucles, |
| 2862 | 2855 | $boucles[$idb]->id_parent |
| 2863 | - ) . ";\n"; |
|
| 2856 | + ).";\n"; |
|
| 2864 | 2857 | } |
| 2865 | 2858 | } |
| 2866 | 2859 | |
@@ -2879,7 +2872,7 @@ discard block |
||
| 2879 | 2872 | $boucle = &$boucles[$idb]; |
| 2880 | 2873 | foreach ($crit->param as $param) { |
| 2881 | 2874 | $boucle->hash .= ' |
| 2882 | - $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2875 | + $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2883 | 2876 | } |
| 2884 | 2877 | } |
| 2885 | 2878 | |
@@ -2920,7 +2913,7 @@ discard block |
||
| 2920 | 2913 | if ($crit->param) { |
| 2921 | 2914 | foreach ($crit->param as $param) { |
| 2922 | 2915 | $boucle->hash .= "\t\$command['si'][] = " |
| 2923 | - . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ";\n"; |
|
| 2916 | + . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).";\n"; |
|
| 2924 | 2917 | } |
| 2925 | 2918 | // interdire {si 0} aussi ! |
| 2926 | 2919 | } else { |
@@ -2944,7 +2937,7 @@ discard block |
||
| 2944 | 2937 | function critere_POUR_tableau_dist($idb, &$boucles, $crit) { |
| 2945 | 2938 | $boucle = &$boucles[$idb]; |
| 2946 | 2939 | $boucle->hash .= ' |
| 2947 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2940 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).'); |
|
| 2948 | 2941 | $command[\'sourcemode\'] = \'table\';'; |
| 2949 | 2942 | } |
| 2950 | 2943 | |
@@ -2977,11 +2970,10 @@ discard block |
||
| 2977 | 2970 | $table_sql = table_objet_sql(objet_type($table)); |
| 2978 | 2971 | |
| 2979 | 2972 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 2980 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 2981 | - 'id_parent'; |
|
| 2973 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 2982 | 2974 | |
| 2983 | 2975 | $in = 'IN'; |
| 2984 | - $where = ["'IN'", "'$boucle->id_table." . "$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"]; |
|
| 2976 | + $where = ["'IN'", "'$boucle->id_table."."$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"]; |
|
| 2985 | 2977 | if ($not) { |
| 2986 | 2978 | $where = ["'NOT'", $where]; |
| 2987 | 2979 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | array_shift($p->param); |
| 53 | 53 | $p->etoile = '*'; |
| 54 | 54 | spip_log("filtre de logo obsolete $nom", 'vieilles_defs'); |
| 55 | - } elseif (preg_match('/^' . NOM_DE_CHAMP . '(.*)$/sS', $nom, $m)) { |
|
| 55 | + } elseif (preg_match('/^'.NOM_DE_CHAMP.'(.*)$/sS', $nom, $m)) { |
|
| 56 | 56 | $champ = new Champ(); |
| 57 | 57 | $champ->nom_boucle = $m[2]; |
| 58 | 58 | $champ->nom_champ = $m[3]; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $p->param[0][1] = [$c]; |
| 129 | 129 | $p->param[0][0] = ''; |
| 130 | 130 | $p->fonctions = []; |
| 131 | - spip_log('FORMULAIRE_RECHERCHE avec filtre ' . $c->texte, 'vieilles_defs'); |
|
| 131 | + spip_log('FORMULAIRE_RECHERCHE avec filtre '.$c->texte, 'vieilles_defs'); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |