@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | 108 | // Si l'article est publie, invalider les caches et demander sa reindexation |
| 109 | - $t = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id_article)); |
|
| 109 | + $t = sql_getfetsel('statut', 'spip_articles', 'id_article='.intval($id_article)); |
|
| 110 | 110 | $invalideur = $indexation = false; |
| 111 | 111 | if ($t == 'publie') { |
| 112 | 112 | $invalideur = "id='article/$id_article'"; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $id_article, |
| 120 | 120 | [ |
| 121 | 121 | 'data' => $set, |
| 122 | - 'nonvide' => ['titre' => _T('info_nouvel_article') . ' ' . _T('info_numero_abbreviation') . $id_article], |
|
| 122 | + 'nonvide' => ['titre' => _T('info_nouvel_article').' '._T('info_numero_abbreviation').$id_article], |
|
| 123 | 123 | 'invalideur' => $invalideur, |
| 124 | 124 | 'indexation' => $indexation, |
| 125 | 125 | 'date_modif' => 'date_modif' // champ a mettre a date('Y-m-d H:i:s') s'il y a modif |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } elseif (autoriser('modifier', 'article', $id_article) and $s != 'publie') { |
| 310 | 310 | $statut = $champs['statut'] = $s; |
| 311 | 311 | } else { |
| 312 | - spip_log("editer_article $id_article refus " . join(' ', $c)); |
|
| 312 | + spip_log("editer_article $id_article refus ".join(' ', $c)); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | // En cas de publication, fixer la date a "maintenant" |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | isset($c['id_parent']) |
| 335 | 335 | and $id_parent = $c['id_parent'] |
| 336 | 336 | and $id_parent != $id_rubrique |
| 337 | - and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 337 | + and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique='.intval($id_parent))) |
|
| 338 | 338 | ) { |
| 339 | 339 | $champs['id_rubrique'] = $id_parent; |
| 340 | 340 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | // Si on deplace l'article |
| 436 | 436 | // changer aussi son secteur et sa langue (si heritee) |
| 437 | 437 | if (isset($champs['id_rubrique'])) { |
| 438 | - $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 438 | + $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique='.sql_quote($champs['id_rubrique'])); |
|
| 439 | 439 | |
| 440 | 440 | $langue = $row_rub['lang']; |
| 441 | 441 | $champs['id_secteur'] = $row_rub['id_secteur']; |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | sql_fetsel( |
| 444 | 444 | '1', |
| 445 | 445 | 'spip_articles', |
| 446 | - 'id_article=' . intval($id_article) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 446 | + 'id_article='.intval($id_article)." AND langue_choisie<>'oui' AND lang<>".sql_quote($langue) |
|
| 447 | 447 | ) |
| 448 | 448 | ) { |
| 449 | 449 | $champs['lang'] = $langue; |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | return; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - sql_updateq('spip_articles', $champs, 'id_article=' . intval($id_article)); |
|
| 457 | + sql_updateq('spip_articles', $champs, 'id_article='.intval($id_article)); |
|
| 458 | 458 | |
| 459 | 459 | // Changer le statut des rubriques concernees |
| 460 | 460 | |
@@ -475,6 +475,6 @@ discard block |
||
| 475 | 475 | foreach ($plus as $n => $t) { |
| 476 | 476 | $plus[$n] = preg_replace(",<!--SPIP-->[\n\r]*,", '', $t); |
| 477 | 477 | } |
| 478 | - set_request('texte', join('', $plus) . _request('texte')); |
|
| 478 | + set_request('texte', join('', $plus)._request('texte')); |
|
| 479 | 479 | } |
| 480 | 480 | } |
@@ -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,25 +657,24 @@ 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 | ( |
| 680 | 676 | strpos($boucle->limit, 'intval') === false ? |
| 681 | - "'" . ($boucle->limit) . "'" : |
|
| 682 | - $boucle->limit |
|
| 677 | + "'".($boucle->limit)."'" : $boucle->limit |
|
| 683 | 678 | ) |
| 684 | 679 | ); |
| 685 | 680 | $init[] = calculer_dec('having', calculer_dump_array($boucle->having)); |
@@ -688,17 +683,17 @@ discard block |
||
| 688 | 683 | // ou recalculée à chaque passage (vide) |
| 689 | 684 | foreach ($init as $i) { |
| 690 | 685 | if (reset($i)) { |
| 691 | - $s .= "\n\t\t" . end($i); |
|
| 686 | + $s .= "\n\t\t".end($i); |
|
| 692 | 687 | } # statique |
| 693 | 688 | else { |
| 694 | - $d .= "\n\t" . end($i); |
|
| 689 | + $d .= "\n\t".end($i); |
|
| 695 | 690 | } # dynamique |
| 696 | 691 | } |
| 697 | 692 | |
| 698 | 693 | return ($boucle->hierarchie ? "\n\t$boucle->hierarchie" : '') |
| 699 | 694 | . $boucle->in |
| 700 | 695 | . $boucle->hash |
| 701 | - . "\n\t" . 'if (!isset($command[\'table\'])) {' |
|
| 696 | + . "\n\t".'if (!isset($command[\'table\'])) {' |
|
| 702 | 697 | . $s |
| 703 | 698 | . "\n\t}" |
| 704 | 699 | . $d; |
@@ -781,7 +776,7 @@ discard block |
||
| 781 | 776 | * - index 1 : Code de l'affectation |
| 782 | 777 | **/ |
| 783 | 778 | function calculer_dec($nom, $val) { |
| 784 | - $static = 'if (!isset($command[\'' . $nom . '\'])) '; |
|
| 779 | + $static = 'if (!isset($command[\''.$nom.'\'])) '; |
|
| 785 | 780 | // si une variable apparait dans le calcul de la clause |
| 786 | 781 | // il faut la re-evaluer a chaque passage |
| 787 | 782 | if ( |
@@ -798,7 +793,7 @@ discard block |
||
| 798 | 793 | $static = ''; |
| 799 | 794 | } |
| 800 | 795 | |
| 801 | - return [$static, '$command[\'' . $nom . '\'] = ' . $val . ';']; |
|
| 796 | + return [$static, '$command[\''.$nom.'\'] = '.$val.';']; |
|
| 802 | 797 | } |
| 803 | 798 | |
| 804 | 799 | /** |
@@ -823,17 +818,17 @@ discard block |
||
| 823 | 818 | } |
| 824 | 819 | $res = ''; |
| 825 | 820 | if ($a and $a[0] == "'?'") { |
| 826 | - return ('(' . calculer_dump_array($a[1]) . |
|
| 827 | - ' ? ' . calculer_dump_array($a[2]) . |
|
| 828 | - ' : ' . calculer_dump_array($a[3]) . |
|
| 821 | + return ('('.calculer_dump_array($a[1]). |
|
| 822 | + ' ? '.calculer_dump_array($a[2]). |
|
| 823 | + ' : '.calculer_dump_array($a[3]). |
|
| 829 | 824 | ')'); |
| 830 | 825 | } else { |
| 831 | 826 | foreach ($a as $k => $v) { |
| 832 | - $showk = (is_numeric($k) ? '' : sql_quote($k) . ' => '); |
|
| 833 | - $res .= ', ' . $showk . calculer_dump_array($v); |
|
| 827 | + $showk = (is_numeric($k) ? '' : sql_quote($k).' => '); |
|
| 828 | + $res .= ', '.$showk.calculer_dump_array($v); |
|
| 834 | 829 | } |
| 835 | 830 | |
| 836 | - return "\n\t\t\tarray(" . substr($res, 2) . ')'; |
|
| 831 | + return "\n\t\t\tarray(".substr($res, 2).')'; |
|
| 837 | 832 | } |
| 838 | 833 | } |
| 839 | 834 | |
@@ -841,10 +836,10 @@ discard block |
||
| 841 | 836 | function calculer_dump_join($a) { |
| 842 | 837 | $res = ''; |
| 843 | 838 | foreach ($a as $k => $v) { |
| 844 | - $res .= ", '$k' => array(" . implode(',', $v) . ')'; |
|
| 839 | + $res .= ", '$k' => array(".implode(',', $v).')'; |
|
| 845 | 840 | } |
| 846 | 841 | |
| 847 | - return 'array(' . substr($res, 2) . ')'; |
|
| 842 | + return 'array('.substr($res, 2).')'; |
|
| 848 | 843 | } |
| 849 | 844 | |
| 850 | 845 | /** |
@@ -861,7 +856,7 @@ discard block |
||
| 861 | 856 | $res .= ",'$k' => '$v'"; |
| 862 | 857 | } |
| 863 | 858 | |
| 864 | - return 'array(' . substr($res, 1) . ')'; |
|
| 859 | + return 'array('.substr($res, 1).')'; |
|
| 865 | 860 | } |
| 866 | 861 | |
| 867 | 862 | /** |
@@ -879,7 +874,7 @@ discard block |
||
| 879 | 874 | $res .= ",'$k' => '$v'"; |
| 880 | 875 | } |
| 881 | 876 | |
| 882 | - return 'array(' . substr($res, 1) . ')'; |
|
| 877 | + return 'array('.substr($res, 1).')'; |
|
| 883 | 878 | } |
| 884 | 879 | |
| 885 | 880 | // https://code.spip.net/@calculer_order |
@@ -950,19 +945,19 @@ discard block |
||
| 950 | 945 | ) { |
| 951 | 946 | $res .= " .\n$tab$code"; |
| 952 | 947 | } else { |
| 953 | - $res = substr($res, 0, -1) . substr($code, 1); |
|
| 948 | + $res = substr($res, 0, -1).substr($code, 1); |
|
| 954 | 949 | } |
| 955 | 950 | } |
| 956 | 951 | |
| 957 | - return '(' . substr($res, 2 + $descr['niv']) . ')'; |
|
| 952 | + return '('.substr($res, 2 + $descr['niv']).')'; |
|
| 958 | 953 | } |
| 959 | 954 | } else { |
| 960 | - $nom = $descr['nom'] . $id_boucle . ($descr['niv'] ? $descr['niv'] : ''); |
|
| 955 | + $nom = $descr['nom'].$id_boucle.($descr['niv'] ? $descr['niv'] : ''); |
|
| 961 | 956 | |
| 962 | - 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( |
|
| 963 | 958 | " ,\n$tab", |
| 964 | 959 | $codes |
| 965 | - ) . ')))'; |
|
| 960 | + ).')))'; |
|
| 966 | 961 | } |
| 967 | 962 | } |
| 968 | 963 | |
@@ -990,7 +985,7 @@ discard block |
||
| 990 | 985 | // texte seul |
| 991 | 986 | case 'texte': |
| 992 | 987 | $code = sandbox_composer_texte($p->texte, $p); |
| 993 | - $commentaire = strlen($p->texte) . ' signes'; |
|
| 988 | + $commentaire = strlen($p->texte).' signes'; |
|
| 994 | 989 | $avant = ''; |
| 995 | 990 | $apres = ''; |
| 996 | 991 | $altern = "''"; |
@@ -999,14 +994,14 @@ discard block |
||
| 999 | 994 | case 'polyglotte': |
| 1000 | 995 | $code = ''; |
| 1001 | 996 | foreach ($p->traductions as $k => $v) { |
| 1002 | - $code .= ",'" . |
|
| 1003 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $k) . |
|
| 1004 | - "' => '" . |
|
| 1005 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $v) . |
|
| 997 | + $code .= ",'". |
|
| 998 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $k). |
|
| 999 | + "' => '". |
|
| 1000 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $v). |
|
| 1006 | 1001 | "'"; |
| 1007 | 1002 | } |
| 1008 | - $code = 'choisir_traduction(array(' . |
|
| 1009 | - substr($code, 1) . |
|
| 1003 | + $code = 'choisir_traduction(array('. |
|
| 1004 | + substr($code, 1). |
|
| 1010 | 1005 | '))'; |
| 1011 | 1006 | $commentaire = '&'; |
| 1012 | 1007 | $avant = ''; |
@@ -1022,7 +1017,7 @@ discard block |
||
| 1022 | 1017 | $err_e_c = true; |
| 1023 | 1018 | $code = "''"; |
| 1024 | 1019 | } else { |
| 1025 | - $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 1020 | + $commentaire = '<INCLURE '.addslashes(str_replace("\n", ' ', $code)).'>'; |
|
| 1026 | 1021 | $avant = ''; |
| 1027 | 1022 | $apres = ''; |
| 1028 | 1023 | $altern = "''"; |
@@ -1051,8 +1046,8 @@ discard block |
||
| 1051 | 1046 | $err_e_c = true; |
| 1052 | 1047 | $code = "''"; |
| 1053 | 1048 | } else { |
| 1054 | - $code = 'BOUCLE' . |
|
| 1055 | - str_replace('-', '_', $nom) . $descr['nom'] . |
|
| 1049 | + $code = 'BOUCLE'. |
|
| 1050 | + str_replace('-', '_', $nom).$descr['nom']. |
|
| 1056 | 1051 | '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
| 1057 | 1052 | $commentaire = "?$nom"; |
| 1058 | 1053 | if ( |
@@ -1094,24 +1089,22 @@ discard block |
||
| 1094 | 1089 | foreach ($p->arg as $k => $v) { |
| 1095 | 1090 | $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
| 1096 | 1091 | if ($k) { |
| 1097 | - $l[] = _q($k) . ' => ' . $_v; |
|
| 1092 | + $l[] = _q($k).' => '.$_v; |
|
| 1098 | 1093 | } else { |
| 1099 | 1094 | $code = $_v; |
| 1100 | 1095 | } |
| 1101 | 1096 | } |
| 1102 | 1097 | // Si le module n'est pas fourni, l'expliciter sauf si calculé |
| 1103 | 1098 | if ($p->module) { |
| 1104 | - $m = $p->module . ':' . $p->nom_champ; |
|
| 1099 | + $m = $p->module.':'.$p->nom_champ; |
|
| 1105 | 1100 | } elseif ($p->nom_champ) { |
| 1106 | - $m = MODULES_IDIOMES . ':' . $p->nom_champ; |
|
| 1101 | + $m = MODULES_IDIOMES.':'.$p->nom_champ; |
|
| 1107 | 1102 | } else { |
| 1108 | 1103 | $m = ''; |
| 1109 | 1104 | } |
| 1110 | 1105 | |
| 1111 | - $code = (!$code ? "'$m'" : |
|
| 1112 | - ($m ? "'$m' . $code" : |
|
| 1113 | - ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 1114 | - . (!$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).')')); |
|
| 1115 | 1108 | $code = "_T($code)"; |
| 1116 | 1109 | if ($p->param) { |
| 1117 | 1110 | $p->id_boucle = $id_boucle; |
@@ -1133,7 +1126,7 @@ discard block |
||
| 1133 | 1126 | $p->type_requete = $type; |
| 1134 | 1127 | |
| 1135 | 1128 | $code = calculer_champ($p); |
| 1136 | - $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 1129 | + $commentaire = '#'.$p->nom_champ.$p->etoile; |
|
| 1137 | 1130 | $avant = calculer_liste( |
| 1138 | 1131 | $p->avant, |
| 1139 | 1132 | $descr, |
@@ -1173,10 +1166,9 @@ discard block |
||
| 1173 | 1166 | if ($code != "''") { |
| 1174 | 1167 | $code = compile_retour($code, $avant, $apres, $altern, $tab, $descr['niv']); |
| 1175 | 1168 | $codes[] = (($mode == 'validation') ? |
| 1176 | - "array($code, '$commentaire', " . $p->ligne . ')' |
|
| 1169 | + "array($code, '$commentaire', ".$p->ligne.')' |
|
| 1177 | 1170 | : (($mode == 'code') ? |
| 1178 | - "\n// $commentaire\n$code" : |
|
| 1179 | - $code)); |
|
| 1171 | + "\n// $commentaire\n$code" : $code)); |
|
| 1180 | 1172 | } |
| 1181 | 1173 | } // foreach |
| 1182 | 1174 | |
@@ -1233,19 +1225,19 @@ discard block |
||
| 1233 | 1225 | $cond = ''; |
| 1234 | 1226 | } elseif (preg_match(_REGEXP_COND_VIDE_NONVIDE, $code, $r)) { |
| 1235 | 1227 | $t = $r[2]; |
| 1236 | - $cond = '!' . $r[1]; |
|
| 1228 | + $cond = '!'.$r[1]; |
|
| 1237 | 1229 | } else { |
| 1238 | 1230 | if (preg_match(_REGEXP_COND_NONVIDE_VIDE, $code, $r)) { |
| 1239 | 1231 | $t = $r[2]; |
| 1240 | 1232 | $cond = $r[1]; |
| 1241 | 1233 | } else { |
| 1242 | - $t = '$t' . $n; |
|
| 1234 | + $t = '$t'.$n; |
|
| 1243 | 1235 | $cond = "($t = $code)!==''"; |
| 1244 | 1236 | } |
| 1245 | 1237 | } |
| 1246 | 1238 | |
| 1247 | - $res = (!$avant ? '' : "$avant . ") . |
|
| 1248 | - $t . |
|
| 1239 | + $res = (!$avant ? '' : "$avant . "). |
|
| 1240 | + $t. |
|
| 1249 | 1241 | (!$apres ? '' : " . $apres"); |
| 1250 | 1242 | |
| 1251 | 1243 | if ($res !== $t) { |
@@ -1297,13 +1289,13 @@ discard block |
||
| 1297 | 1289 | |
| 1298 | 1290 | // rendre inertes les echappements de #[](){}<> |
| 1299 | 1291 | $i = 0; |
| 1300 | - while (false !== strpos($squelette, $inerte = '-INERTE' . $i)) { |
|
| 1292 | + while (false !== strpos($squelette, $inerte = '-INERTE'.$i)) { |
|
| 1301 | 1293 | $i++; |
| 1302 | 1294 | } |
| 1303 | 1295 | $squelette = preg_replace_callback( |
| 1304 | 1296 | ',\\\\([#[()\]{}<>]),', |
| 1305 | - function ($a) use ($inerte) { |
|
| 1306 | - return "$inerte-" . ord($a[1]) . '-'; |
|
| 1297 | + function($a) use ($inerte) { |
|
| 1298 | + return "$inerte-".ord($a[1]).'-'; |
|
| 1307 | 1299 | }, |
| 1308 | 1300 | $squelette, |
| 1309 | 1301 | -1, |
@@ -1320,7 +1312,7 @@ discard block |
||
| 1320 | 1312 | // Phraser le squelette, selon sa grammaire |
| 1321 | 1313 | |
| 1322 | 1314 | $boucles = []; |
| 1323 | - $f = charger_fonction('phraser_' . $gram, 'public'); |
|
| 1315 | + $f = charger_fonction('phraser_'.$gram, 'public'); |
|
| 1324 | 1316 | |
| 1325 | 1317 | $squelette = $f($squelette, '', $boucles, $descr); |
| 1326 | 1318 | |
@@ -1331,15 +1323,15 @@ discard block |
||
| 1331 | 1323 | foreach ($boucles as $i => $boucle) { |
| 1332 | 1324 | $boucles[$i]->return = preg_replace_callback( |
| 1333 | 1325 | ",$inerte-(\d+)-,", |
| 1334 | - function ($a) { |
|
| 1326 | + function($a) { |
|
| 1335 | 1327 | return chr($a[1]); |
| 1336 | 1328 | }, |
| 1337 | 1329 | $boucle->return |
| 1338 | 1330 | ); |
| 1339 | 1331 | $boucles[$i]->descr['squelette'] = preg_replace_callback( |
| 1340 | 1332 | ",$inerte-(\d+)-,", |
| 1341 | - function ($a) { |
|
| 1342 | - return '\\\\' . chr($a[1]); |
|
| 1333 | + function($a) { |
|
| 1334 | + return '\\\\'.chr($a[1]); |
|
| 1343 | 1335 | }, |
| 1344 | 1336 | $boucle->descr['squelette'] |
| 1345 | 1337 | ); |
@@ -1351,19 +1343,19 @@ discard block |
||
| 1351 | 1343 | include_spip('public/decompiler'); |
| 1352 | 1344 | foreach ($boucles as $id => $boucle) { |
| 1353 | 1345 | if ($id) { |
| 1354 | - $decomp = "\n/* BOUCLE " . |
|
| 1355 | - $boucle->type_requete . |
|
| 1356 | - ' ' . |
|
| 1357 | - str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')) . |
|
| 1358 | - ($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" : ''). |
|
| 1359 | 1351 | " */\n"; |
| 1360 | 1352 | } else { |
| 1361 | - $decomp = ("\n/*\n" . |
|
| 1353 | + $decomp = ("\n/*\n". |
|
| 1362 | 1354 | str_replace('*/', '* /', public_decompiler($squelette, $gram)) |
| 1363 | 1355 | . "\n*/"); |
| 1364 | 1356 | } |
| 1365 | - $boucles[$id]->return = $decomp . $boucle->return; |
|
| 1366 | - $GLOBALS['debug_objets']['code'][$nom . $id] = $boucle->return; |
|
| 1357 | + $boucles[$id]->return = $decomp.$boucle->return; |
|
| 1358 | + $GLOBALS['debug_objets']['code'][$nom.$id] = $boucle->return; |
|
| 1367 | 1359 | } |
| 1368 | 1360 | } |
| 1369 | 1361 | |
@@ -1386,7 +1378,7 @@ discard block |
||
| 1386 | 1378 | } |
| 1387 | 1379 | } |
| 1388 | 1380 | foreach ($boucles as $id => $boucle) { |
| 1389 | - $GLOBALS['debug_objets']['boucle'][$nom . $id] = $boucle; |
|
| 1381 | + $GLOBALS['debug_objets']['boucle'][$nom.$id] = $boucle; |
|
| 1390 | 1382 | } |
| 1391 | 1383 | $descr['documents'] = compile_inclure_doublons($squelette); |
| 1392 | 1384 | |
@@ -1477,8 +1469,7 @@ discard block |
||
| 1477 | 1469 | } else { |
| 1478 | 1470 | $boucles[$id]->type_requete = false; |
| 1479 | 1471 | $boucle = $boucles[$id]; |
| 1480 | - $x = (!$boucle->sql_serveur ? '' : |
|
| 1481 | - ($boucle->sql_serveur . ':')) . |
|
| 1472 | + $x = (!$boucle->sql_serveur ? '' : ($boucle->sql_serveur.':')). |
|
| 1482 | 1473 | $type; |
| 1483 | 1474 | $msg = [ |
| 1484 | 1475 | 'zbug_table_inconnue', |
@@ -1568,13 +1559,13 @@ discard block |
||
| 1568 | 1559 | if ( |
| 1569 | 1560 | // fonction de boucle avec serveur & table |
| 1570 | 1561 | (!$serveur or |
| 1571 | - ((!function_exists($f = 'boucle_' . $serveur . '_' . $table)) |
|
| 1572 | - and (!function_exists($f = $f . '_dist')) |
|
| 1562 | + ((!function_exists($f = 'boucle_'.$serveur.'_'.$table)) |
|
| 1563 | + and (!function_exists($f = $f.'_dist')) |
|
| 1573 | 1564 | ) |
| 1574 | 1565 | ) |
| 1575 | 1566 | // fonction de boucle avec table |
| 1576 | - and (!function_exists($f = 'boucle_' . $table)) |
|
| 1577 | - and (!function_exists($f = $f . '_dist')) |
|
| 1567 | + and (!function_exists($f = 'boucle_'.$table)) |
|
| 1568 | + and (!function_exists($f = $f.'_dist')) |
|
| 1578 | 1569 | ) { |
| 1579 | 1570 | // fonction de boucle standard |
| 1580 | 1571 | if (!function_exists($f = 'boucle_DEFAUT')) { |
@@ -1582,20 +1573,20 @@ discard block |
||
| 1582 | 1573 | } |
| 1583 | 1574 | } |
| 1584 | 1575 | |
| 1585 | - $req = "\n\n\tstatic \$command = array();\n\t" . |
|
| 1586 | - "static \$connect;\n\t" . |
|
| 1587 | - "\$command['connect'] = \$connect = " . |
|
| 1588 | - _q($boucle->sql_serveur) . |
|
| 1589 | - ';' . |
|
| 1576 | + $req = "\n\n\tstatic \$command = array();\n\t". |
|
| 1577 | + "static \$connect;\n\t". |
|
| 1578 | + "\$command['connect'] = \$connect = ". |
|
| 1579 | + _q($boucle->sql_serveur). |
|
| 1580 | + ';'. |
|
| 1590 | 1581 | $f($id, $boucles); |
| 1591 | 1582 | } else { |
| 1592 | 1583 | $req = ("\n\treturn '';"); |
| 1593 | 1584 | } |
| 1594 | 1585 | |
| 1595 | 1586 | $boucles[$id]->return = |
| 1596 | - "\n\nfunction BOUCLE" . strtr($id, '-', '_') . $nom . |
|
| 1597 | - '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {' . |
|
| 1598 | - $req . |
|
| 1587 | + "\n\nfunction BOUCLE".strtr($id, '-', '_').$nom. |
|
| 1588 | + '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {'. |
|
| 1589 | + $req. |
|
| 1599 | 1590 | "\n}\n"; |
| 1600 | 1591 | } |
| 1601 | 1592 | |
@@ -1605,7 +1596,7 @@ discard block |
||
| 1605 | 1596 | return false; |
| 1606 | 1597 | } |
| 1607 | 1598 | |
| 1608 | - $principal = "\nfunction " . $nom . '($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1599 | + $principal = "\nfunction ".$nom.'($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1609 | 1600 | ' |
| 1610 | 1601 | // reporter de maniere securisee les doublons inclus |
| 1611 | 1602 | . ' |
@@ -1613,15 +1604,15 @@ discard block |
||
| 1613 | 1604 | $doublons = nettoyer_env_doublons($Pile[0]["doublons"]); |
| 1614 | 1605 | |
| 1615 | 1606 | $connect = ' . |
| 1616 | - _q($connect) . '; |
|
| 1607 | + _q($connect).'; |
|
| 1617 | 1608 | $page = ' . |
| 1618 | 1609 | // ATTENTION, le calcul de l'expression $corps affectera $Cache |
| 1619 | 1610 | // c'est pourquoi on l'affecte a la variable auxiliaire $page. |
| 1620 | 1611 | // avant de referencer $Cache |
| 1621 | - $corps . '; |
|
| 1612 | + $corps.'; |
|
| 1622 | 1613 | |
| 1623 | 1614 | return analyse_resultat_skel(' . var_export($nom, true) |
| 1624 | - . ', $Cache, $page, ' . var_export($sourcefile, true) . '); |
|
| 1615 | + . ', $Cache, $page, '.var_export($sourcefile, true).'); |
|
| 1625 | 1616 | }'; |
| 1626 | 1617 | |
| 1627 | 1618 | $secondes = spip_timer('calcul_skel'); |
@@ -1635,10 +1626,10 @@ discard block |
||
| 1635 | 1626 | $code->return = ' |
| 1636 | 1627 | // |
| 1637 | 1628 | // Fonction principale du squelette ' . |
| 1638 | - $sourcefile . |
|
| 1639 | - ($connect ? " pour $connect" : '') . |
|
| 1640 | - (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes") . |
|
| 1641 | - "\n//\n" . |
|
| 1629 | + $sourcefile. |
|
| 1630 | + ($connect ? " pour $connect" : ''). |
|
| 1631 | + (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes"). |
|
| 1632 | + "\n//\n". |
|
| 1642 | 1633 | $principal; |
| 1643 | 1634 | |
| 1644 | 1635 | $boucles[''] = $code; |
@@ -1690,7 +1681,7 @@ discard block |
||
| 1690 | 1681 | **/ |
| 1691 | 1682 | function requeteur_data_dist(&$boucles, &$boucle, &$id) { |
| 1692 | 1683 | include_spip('iterateur/data'); |
| 1693 | - if ($h = charger_fonction($boucle->type_requete . '_to_array', 'inc', true)) { |
|
| 1684 | + if ($h = charger_fonction($boucle->type_requete.'_to_array', 'inc', true)) { |
|
| 1694 | 1685 | $g = charger_fonction('data', 'iterateur'); |
| 1695 | 1686 | $boucles[$id] = $g($boucle); |
| 1696 | 1687 | // from[0] stocke le type de data (rss, yql, ...) |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $GLOBALS['debug_objets']['courant'] = $nom; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php'; |
|
| 57 | + $phpfile = sous_repertoire(_DIR_SKELS, '', false, true).$nom.'.php'; |
|
| 58 | 58 | |
| 59 | 59 | // si squelette est deja compile et perenne, le charger |
| 60 | 60 | if (!squelette_obsolete($phpfile, $source)) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | #} |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (file_exists($lib = $squelette . '_fonctions' . '.php')) { |
|
| 70 | + if (file_exists($lib = $squelette.'_fonctions'.'.php')) { |
|
| 71 | 71 | include_once $lib; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | eval("return true; $f ;"); |
| 96 | 96 | } catch (\ParseError $e) { |
| 97 | 97 | // Code syntaxiquement faux (critere etc mal programme') |
| 98 | - $msg = _T('zbug_erreur_compilation') . ' | Line ' . $e->getLine() . ' : ' . $e->getMessage(); |
|
| 98 | + $msg = _T('zbug_erreur_compilation').' | Line '.$e->getLine().' : '.$e->getMessage(); |
|
| 99 | 99 | erreur_squelette($msg, $boucle); |
| 100 | 100 | // continuer pour trouver d'autres fautes eventuelles |
| 101 | 101 | // mais prevenir que c'est mort |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
| 125 | 125 | // Tracer ce qui vient d'etre compile |
| 126 | - $GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code; |
|
| 126 | + $GLOBALS['debug_objets']['code'][$nom.'tout'] = $code; |
|
| 127 | 127 | |
| 128 | 128 | // si c'est ce que demande le debusqueur, lui passer la main |
| 129 | 129 | if ( |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | $code = " |
| 147 | 147 | /* |
| 148 | 148 | * Squelette : $sourcefile |
| 149 | - * Date : " . gmdate('D, d M Y H:i:s', @filemtime($sourcefile)) . ' GMT |
|
| 150 | - * Compile : ' . gmdate('D, d M Y H:i:s', time()) . ' GMT |
|
| 151 | - * ' . (!$boucles ? 'Pas de boucle' : ('Boucles : ' . $noms)) . ' |
|
| 149 | + * Date : ".gmdate('D, d M Y H:i:s', @filemtime($sourcefile)).' GMT |
|
| 150 | + * Compile : ' . gmdate('D, d M Y H:i:s', time()).' GMT |
|
| 151 | + * ' . (!$boucles ? 'Pas de boucle' : ('Boucles : '.$noms)).' |
|
| 152 | 152 | */ '; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - $code = '<' . "?php\n" . $code . join('', $boucles) . "\n?" . '>'; |
|
| 155 | + $code = '<'."?php\n".$code.join('', $boucles)."\n?".'>'; |
|
| 156 | 156 | if (!defined('_VAR_NOCACHE') or !_VAR_NOCACHE) { |
| 157 | 157 | ecrire_fichier($phpfile, $code); |
| 158 | 158 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $j = join('-', array_map('ucwords', explode('-', strtolower($r[2])))); |
| 217 | 217 | |
| 218 | 218 | if ($j == 'X-Spip-Filtre' and isset($headers[$j])) { |
| 219 | - $headers[$j] .= '|' . $r[3]; |
|
| 219 | + $headers[$j] .= '|'.$r[3]; |
|
| 220 | 220 | } else { |
| 221 | 221 | $headers[$j] = $r[3]; |
| 222 | 222 | } |
@@ -224,10 +224,10 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | // S'agit-il d'un resultat constant ou contenant du code php |
| 226 | 226 | $process_ins = ( |
| 227 | - strpos($corps, '<' . '?') === false |
|
| 227 | + strpos($corps, '<'.'?') === false |
|
| 228 | 228 | or |
| 229 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 230 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 229 | + (strpos($corps, '<'.'?xml') !== false and |
|
| 230 | + strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false) |
|
| 231 | 231 | ) |
| 232 | 232 | ? 'html' |
| 233 | 233 | : 'php'; |
@@ -256,10 +256,10 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | if ($process_ins == 'html') { |
| 258 | 258 | $skel['process_ins'] = ( |
| 259 | - strpos($corps, '<' . '?') === false |
|
| 259 | + strpos($corps, '<'.'?') === false |
|
| 260 | 260 | or |
| 261 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 262 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 261 | + (strpos($corps, '<'.'?xml') !== false and |
|
| 262 | + strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false) |
|
| 263 | 263 | ) |
| 264 | 264 | ? 'html' |
| 265 | 265 | : 'php'; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | // |
| 278 | 278 | |
| 279 | 279 | /** Code PHP pour inclure une balise dynamique à l'exécution d'une page */ |
| 280 | -define('CODE_INCLURE_BALISE', '<' . '?php |
|
| 280 | +define('CODE_INCLURE_BALISE', '<'.'?php |
|
| 281 | 281 | include_once("%s"); |
| 282 | 282 | if ($lang_select = "%s") $lang_select = lang_select($lang_select); |
| 283 | 283 | inserer_balise_dynamique(balise_%s_dyn(%s), array(%s)); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | // pas de lien symbolique sous Windows |
| 309 | 309 | and !(stristr(PHP_OS, 'WIN') and strpos($file, ':') !== false) |
| 310 | 310 | ) { |
| 311 | - $file = './" . _DIR_RACINE . "' . $file; |
|
| 311 | + $file = './" . _DIR_RACINE . "'.$file; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $lang = $context_compil[4]; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | $args = array_map('argumenter_squelette', $args); |
| 320 | 320 | if (!empty($context_compil['appel_php_depuis_modele'])) { |
| 321 | - $args[0] = 'arguments_balise_dyn_depuis_modele(' . $args[0] . ')'; |
|
| 321 | + $args[0] = 'arguments_balise_dyn_depuis_modele('.$args[0].')'; |
|
| 322 | 322 | } |
| 323 | 323 | $args = join(', ', $args); |
| 324 | 324 | |
@@ -352,14 +352,14 @@ discard block |
||
| 352 | 352 | if (is_object($v)) { |
| 353 | 353 | return var_export($v, true); |
| 354 | 354 | } elseif (!is_array($v)) { |
| 355 | - return "'" . texte_script((string) $v) . "'"; |
|
| 355 | + return "'".texte_script((string) $v)."'"; |
|
| 356 | 356 | } else { |
| 357 | 357 | $out = []; |
| 358 | 358 | foreach ($v as $k => $val) { |
| 359 | - $out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val); |
|
| 359 | + $out [] = argumenter_squelette($k).'=>'.argumenter_squelette($val); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - return 'array(' . join(', ', $out) . ')'; |
|
| 362 | + return 'array('.join(', ', $out).')'; |
|
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | // Y a-t-il une fonction de traitement des arguments ? |
| 440 | - $f = 'balise_' . $nom_balise . '_stat'; |
|
| 440 | + $f = 'balise_'.$nom_balise.'_stat'; |
|
| 441 | 441 | |
| 442 | 442 | $r = !function_exists($f) ? $args : $f($args, $context_compil); |
| 443 | 443 | |
@@ -447,18 +447,18 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | // verifier que la fonction dyn est la, |
| 449 | 449 | // sinon se replier sur la generique si elle existe |
| 450 | - if (!function_exists('balise_' . $nom_balise . '_dyn')) { |
|
| 450 | + if (!function_exists('balise_'.$nom_balise.'_dyn')) { |
|
| 451 | 451 | if ( |
| 452 | 452 | $balise_generique = chercher_balise_generique($nom) |
| 453 | 453 | and $nom_balise_generique = $balise_generique['nom_generique'] |
| 454 | - and $file = include_spip('balise/' . strtolower($nom_balise_generique)) |
|
| 455 | - and function_exists('balise_' . $nom_balise_generique . '_dyn') |
|
| 454 | + and $file = include_spip('balise/'.strtolower($nom_balise_generique)) |
|
| 455 | + and function_exists('balise_'.$nom_balise_generique.'_dyn') |
|
| 456 | 456 | ) { |
| 457 | 457 | // et lui injecter en premier arg le nom de la balise |
| 458 | 458 | array_unshift($r, $nom); |
| 459 | 459 | $nom_balise = $nom_balise_generique; |
| 460 | 460 | if (!_DIR_RESTREINT) { |
| 461 | - $file = _DIR_RESTREINT_ABS . $file; |
|
| 461 | + $file = _DIR_RESTREINT_ABS.$file; |
|
| 462 | 462 | } |
| 463 | 463 | } else { |
| 464 | 464 | $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | $n = ''; |
| 561 | 561 | foreach (explode(',', $liste) as $val) { |
| 562 | 562 | if ($a = intval($val) and $val === strval($a)) { |
| 563 | - $n .= ',' . $val; |
|
| 563 | + $n .= ','.$val; |
|
| 564 | 564 | } |
| 565 | 565 | } |
| 566 | 566 | if (strlen($n)) { |
@@ -739,8 +739,8 @@ discard block |
||
| 739 | 739 | // on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction |
| 740 | 740 | $i = 0; |
| 741 | 741 | do { |
| 742 | - $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 743 | - [$sous[1] . ' AS id'], |
|
| 742 | + $where[$k] = remplace_sous_requete($w, '('.calculer_select( |
|
| 743 | + [$sous[1].' AS id'], |
|
| 744 | 744 | $from, |
| 745 | 745 | $from_type, |
| 746 | 746 | $wheresub, |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | $id, |
| 754 | 754 | $serveur, |
| 755 | 755 | false |
| 756 | - ) . ')'); |
|
| 756 | + ).')'); |
|
| 757 | 757 | if (!$i) { |
| 758 | 758 | $i = 1; |
| 759 | 759 | $wherestring = calculer_where_to_string($where[$k]); |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | if ($sous[0] == 'SUBSELECT') { |
| 774 | 774 | // c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having) |
| 775 | 775 | array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ? |
| 776 | - $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 776 | + $where[$k] = remplace_sous_requete($w, '('.calculer_select( |
|
| 777 | 777 | $sous[1], # select |
| 778 | 778 | $sous[2], #from |
| 779 | 779 | [], #from_type |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | $id, |
| 789 | 789 | $serveur, |
| 790 | 790 | false |
| 791 | - ) . ')'); |
|
| 791 | + ).')'); |
|
| 792 | 792 | } |
| 793 | 793 | array_pop($where_simples); |
| 794 | 794 | } |
@@ -851,15 +851,15 @@ discard block |
||
| 851 | 851 | // sans recours a preg_match |
| 852 | 852 | // un implode(' ',..) est fait dans reinjecte_joint un peu plus bas |
| 853 | 853 | $afrom[$t][$cle] = [ |
| 854 | - "\n" . |
|
| 855 | - (isset($from_type[$cle]) ? $from_type[$cle] : 'INNER') . ' JOIN', |
|
| 854 | + "\n". |
|
| 855 | + (isset($from_type[$cle]) ? $from_type[$cle] : 'INNER').' JOIN', |
|
| 856 | 856 | $from[$cle], |
| 857 | 857 | "AS $cle", |
| 858 | 858 | 'ON (', |
| 859 | 859 | "$cle.$c", |
| 860 | 860 | '=', |
| 861 | 861 | "$t.$carr", |
| 862 | - ($and ? 'AND ' . $and : '') . |
|
| 862 | + ($and ? 'AND '.$and : ''). |
|
| 863 | 863 | ')' |
| 864 | 864 | ]; |
| 865 | 865 | if (isset($afrom[$cle])) { |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | $t = key($from); |
| 898 | 898 | $c = current($from); |
| 899 | 899 | reset($from); |
| 900 | - $e = '/\b(' . "$t\\." . join('|' . $t . '\.', $equiv) . ')\b/'; |
|
| 900 | + $e = '/\b('."$t\\.".join('|'.$t.'\.', $equiv).')\b/'; |
|
| 901 | 901 | if ( |
| 902 | 902 | !(strpos($t, ' ') or // jointure des le depart cf boucle_doc |
| 903 | 903 | calculer_jointnul($t, $select, $e) or |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | unset($afrom[$t][$nt]); |
| 916 | 916 | $afrom[$nt] = $afrom[$t]; |
| 917 | 917 | unset($afrom[$t]); |
| 918 | - $e = '/\b' . preg_quote($nfrom[6]) . '\b/'; |
|
| 918 | + $e = '/\b'.preg_quote($nfrom[6]).'\b/'; |
|
| 919 | 919 | $t = $nfrom[4]; |
| 920 | 920 | $alias = ''; |
| 921 | 921 | // verifier que les deux cles sont homonymes, sinon installer un alias dans le select |
@@ -926,14 +926,14 @@ discard block |
||
| 926 | 926 | if ($newcle != $oldcle) { |
| 927 | 927 | // si l'ancienne cle etait deja dans le select avec un AS |
| 928 | 928 | // reprendre simplement ce AS |
| 929 | - $as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/'; |
|
| 929 | + $as = '/\b'.preg_quote($nfrom[6]).'\s+(AS\s+\w+)\b/'; |
|
| 930 | 930 | if (preg_match($as, implode(',', $select), $m)) { |
| 931 | 931 | $alias = ''; |
| 932 | 932 | } else { |
| 933 | - $alias = ', ' . $nfrom[4] . " AS $oldcle"; |
|
| 933 | + $alias = ', '.$nfrom[4]." AS $oldcle"; |
|
| 934 | 934 | } |
| 935 | 935 | } |
| 936 | - $select = remplacer_jointnul($t . $alias, $select, $e); |
|
| 936 | + $select = remplacer_jointnul($t.$alias, $select, $e); |
|
| 937 | 937 | $join = remplacer_jointnul($t, $join, $e); |
| 938 | 938 | $where = remplacer_jointnul($t, $where, $e); |
| 939 | 939 | $having = remplacer_jointnul($t, $having, $e); |
@@ -983,9 +983,9 @@ discard block |
||
| 983 | 983 | } else { |
| 984 | 984 | $exp = ''; |
| 985 | 985 | if (strtoupper($join) === 'AND') { |
| 986 | - return $exp . join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 986 | + return $exp.join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 987 | 987 | } else { |
| 988 | - return $exp . join($join, $v); |
|
| 988 | + return $exp.join($join, $v); |
|
| 989 | 989 | } |
| 990 | 990 | } |
| 991 | 991 | } |
@@ -1051,6 +1051,6 @@ discard block |
||
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | return $mime_type |
| 1054 | - . (!$connect ? '' : preg_replace('/\W/', '_', $connect)) . '_' |
|
| 1055 | - . md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : '')); |
|
| 1054 | + . (!$connect ? '' : preg_replace('/\W/', '_', $connect)).'_' |
|
| 1055 | + . md5($GLOBALS['spip_version_code'].' * '.$skel.(isset($GLOBALS['marqueur_skel']) ? '*'.$GLOBALS['marqueur_skel'] : '')); |
|
| 1056 | 1056 | } |
@@ -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 |
@@ -216,7 +215,7 @@ discard block |
||
| 216 | 215 | $deux = $deux[0]->texte; |
| 217 | 216 | if ($deux) { |
| 218 | 217 | $boucles[$idb]->limit = |
| 219 | - 'intval($Pile[0]["debut' . $un . '"]) . ",' . $deux . '"'; |
|
| 218 | + 'intval($Pile[0]["debut'.$un.'"]) . ",'.$deux.'"'; |
|
| 220 | 219 | } else { |
| 221 | 220 | calculer_critere_DEFAUT_dist($idb, $boucles, $crit); |
| 222 | 221 | } |
@@ -278,26 +277,26 @@ discard block |
||
| 278 | 277 | $type = calculer_liste([$crit->param[1][0]], $idb, $boucles, $boucle->id_parent); |
| 279 | 278 | } |
| 280 | 279 | |
| 281 | - $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut" . substr($type, 1)); |
|
| 280 | + $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut".substr($type, 1)); |
|
| 282 | 281 | $boucle->modificateur['debut_nom'] = $type; |
| 283 | 282 | $partie = |
| 284 | 283 | // tester si le numero de page demande est de la forme '@yyy' |
| 285 | - 'isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : _request(' . $debut . ");\n" |
|
| 284 | + 'isset($Pile[0]['.$debut.']) ? $Pile[0]['.$debut.'] : _request('.$debut.");\n" |
|
| 286 | 285 | . "\tif (\$debut_boucle && \$debut_boucle[0] === '@') {\n" |
| 287 | - . "\t\t" . '$debut_boucle = $Pile[0][' . $debut . '] = quete_debut_pagination(\'' . $boucle->primary . '\',$Pile[0][\'@' . $boucle->primary . '\'] = substr($debut_boucle,1),' . $pas . ',$iter);' . "\n" |
|
| 288 | - . "\t\t" . '$iter->seek(0);' . "\n" |
|
| 286 | + . "\t\t".'$debut_boucle = $Pile[0]['.$debut.'] = quete_debut_pagination(\''.$boucle->primary.'\',$Pile[0][\'@'.$boucle->primary.'\'] = substr($debut_boucle,1),'.$pas.',$iter);'."\n" |
|
| 287 | + . "\t\t".'$iter->seek(0);'."\n" |
|
| 289 | 288 | . "\t}\n" |
| 290 | - . "\t" . '$debut_boucle = intval($debut_boucle)'; |
|
| 289 | + . "\t".'$debut_boucle = intval($debut_boucle)'; |
|
| 291 | 290 | |
| 292 | 291 | $boucle->hash .= ' |
| 293 | - $command[\'pagination\'] = array((isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : null), ' . $pas . ');'; |
|
| 292 | + $command[\'pagination\'] = array((isset($Pile[0][' . $debut.']) ? $Pile[0]['.$debut.'] : null), '.$pas.');'; |
|
| 294 | 293 | |
| 295 | 294 | $boucle->total_parties = $pas; |
| 296 | 295 | calculer_parties($boucles, $idb, $partie, 'p+'); |
| 297 | 296 | // ajouter la cle primaire dans le select pour pouvoir gerer la pagination referencee par @id |
| 298 | 297 | // sauf si pas de primaire, ou si primaire composee |
| 299 | 298 | // dans ce cas, on ne sait pas gerer une pagination indirecte |
| 300 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 299 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 301 | 300 | if ( |
| 302 | 301 | $boucle->primary |
| 303 | 302 | and !preg_match('/[,\s]/', $boucle->primary) |
@@ -344,24 +343,24 @@ discard block |
||
| 344 | 343 | $boucle->hash .= ' |
| 345 | 344 | // RECHERCHE' |
| 346 | 345 | . ($crit->cond ? ' |
| 347 | - if (!strlen(' . $quoi . ')){ |
|
| 346 | + if (!strlen(' . $quoi.')){ |
|
| 348 | 347 | list($rech_select, $rech_where) = array("0 as points",""); |
| 349 | - } else' : '') . ' |
|
| 348 | + } else' : '').' |
|
| 350 | 349 | { |
| 351 | 350 | $prepare_recherche = charger_fonction(\'prepare_recherche\', \'inc\'); |
| 352 | - list($rech_select, $rech_where) = $prepare_recherche(' . $quoi . ', "' . $boucle->id_table . '", "' . $crit->cond . '","' . $boucle->sql_serveur . '",' . $_modificateur . ',"' . $boucle->primary . '"); |
|
| 351 | + list($rech_select, $rech_where) = $prepare_recherche(' . $quoi.', "'.$boucle->id_table.'", "'.$crit->cond.'","'.$boucle->sql_serveur.'",'.$_modificateur.',"'.$boucle->primary.'"); |
|
| 353 | 352 | } |
| 354 | 353 | '; |
| 355 | 354 | |
| 356 | 355 | |
| 357 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 356 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 358 | 357 | if (!in_array($t, $boucles[$idb]->select)) { |
| 359 | 358 | $boucle->select[] = $t; |
| 360 | 359 | } # pour postgres, neuneu ici |
| 361 | 360 | // jointure uniquement sur le serveur principal |
| 362 | 361 | // (on ne peut joindre une table d'un serveur distant avec la table des resultats du serveur principal) |
| 363 | 362 | if (!$boucle->sql_serveur) { |
| 364 | - $boucle->join['resultats'] = ["'" . $boucle->id_table . "'", "'id'", "'" . $boucle->primary . "'"]; |
|
| 363 | + $boucle->join['resultats'] = ["'".$boucle->id_table."'", "'id'", "'".$boucle->primary."'"]; |
|
| 365 | 364 | $boucle->from['resultats'] = 'spip_resultats'; |
| 366 | 365 | } |
| 367 | 366 | $boucle->select[] = '$rech_select'; |
@@ -428,7 +427,7 @@ discard block |
||
| 428 | 427 | $c = |
| 429 | 428 | [ |
| 430 | 429 | "'OR'", |
| 431 | - ["'='", "'$table." . "id_trad'", "'$table.$prim'"], |
|
| 430 | + ["'='", "'$table."."id_trad'", "'$table.$prim'"], |
|
| 432 | 431 | ["'='", "'$table.id_trad'", "'0'"] |
| 433 | 432 | ]; |
| 434 | 433 | $boucle->where[] = ($crit->not ? ["'NOT'", $c] : $c); |
@@ -451,15 +450,14 @@ discard block |
||
| 451 | 450 | $boucle = &$boucles[$idb]; |
| 452 | 451 | $arg = kwote(calculer_argument_precedent($idb, 'id_parent', $boucles)); |
| 453 | 452 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 454 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 455 | - 'id_parent'; |
|
| 456 | - $mparent = $boucle->id_table . '.' . $id_parent; |
|
| 453 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 454 | + $mparent = $boucle->id_table.'.'.$id_parent; |
|
| 457 | 455 | |
| 458 | 456 | if ($boucle->type_requete == 'rubriques' or isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'])) { |
| 459 | 457 | $boucle->where[] = ["'='", "'$mparent'", $arg]; |
| 460 | 458 | } // le cas FORUMS est gere dans le plugin forum, dans la fonction critere_FORUMS_meme_parent_dist() |
| 461 | 459 | else { |
| 462 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ' . $boucle->type_requete]]); |
|
| 460 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' '.$boucle->type_requete]]); |
|
| 463 | 461 | } |
| 464 | 462 | } |
| 465 | 463 | |
@@ -512,16 +510,15 @@ discard block |
||
| 512 | 510 | if (count(trouver_champs_decomposes($champ, $desc)) > 1) { |
| 513 | 511 | $decompose = decompose_champ_id_objet($champ); |
| 514 | 512 | $champ = array_shift($decompose); |
| 515 | - $boucle->where[] = ["'='", _q($cle . '.' . reset($decompose)), '"' . sql_quote(end($decompose)) . '"']; |
|
| 513 | + $boucle->where[] = ["'='", _q($cle.'.'.reset($decompose)), '"'.sql_quote(end($decompose)).'"']; |
|
| 516 | 514 | } |
| 517 | 515 | } else { |
| 518 | 516 | $cle = $boucle->id_table; |
| 519 | 517 | } |
| 520 | 518 | |
| 521 | - $c = "sql_in('$cle" . ".$champ', calcul_branche_in($arg)" |
|
| 522 | - . ($not ? ", 'NOT'" : '') . ')'; |
|
| 523 | - $boucle->where[] = !$crit->cond ? $c : |
|
| 524 | - ("($arg ? $c : " . ($not ? "'0=1'" : "'1=1'") . ')'); |
|
| 519 | + $c = "sql_in('$cle".".$champ', calcul_branche_in($arg)" |
|
| 520 | + . ($not ? ", 'NOT'" : '').')'; |
|
| 521 | + $boucle->where[] = !$crit->cond ? $c : ("($arg ? $c : ".($not ? "'0=1'" : "'1=1'").')'); |
|
| 525 | 522 | } |
| 526 | 523 | |
| 527 | 524 | /** |
@@ -541,9 +538,9 @@ discard block |
||
| 541 | 538 | $not = ($crit->not ? 'NOT' : ''); |
| 542 | 539 | $serveur = $boucle->sql_serveur; |
| 543 | 540 | |
| 544 | - $c = "sql_in('" . |
|
| 545 | - $boucle->id_table . '.' . $boucle->primary |
|
| 546 | - . "', lister_objets_avec_logos('" . $boucle->primary . "'), '$not', '$serveur')"; |
|
| 541 | + $c = "sql_in('". |
|
| 542 | + $boucle->id_table.'.'.$boucle->primary |
|
| 543 | + . "', lister_objets_avec_logos('".$boucle->primary."'), '$not', '$serveur')"; |
|
| 547 | 544 | |
| 548 | 545 | $boucle->where[] = $c; |
| 549 | 546 | } |
@@ -575,7 +572,7 @@ discard block |
||
| 575 | 572 | $t = table_objet_sql($r[1]); |
| 576 | 573 | $t = array_search($t, $boucles[$idb]->from); |
| 577 | 574 | if ($t) { |
| 578 | - $t .= '.' . $r[2]; |
|
| 575 | + $t .= '.'.$r[2]; |
|
| 579 | 576 | } |
| 580 | 577 | } |
| 581 | 578 | } else { |
@@ -590,7 +587,7 @@ discard block |
||
| 590 | 587 | $boucles[$idb]->select[] = $t; |
| 591 | 588 | } |
| 592 | 589 | } else { |
| 593 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]); |
|
| 590 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]); |
|
| 594 | 591 | } |
| 595 | 592 | } |
| 596 | 593 | |
@@ -660,26 +657,26 @@ discard block |
||
| 660 | 657 | (false !== $i = strpos($boucle->order[$n - 1], 'ASC')) |
| 661 | 658 | or (false !== $i = strpos($boucle->order[$n - 1], 'DESC')) |
| 662 | 659 | ) { |
| 663 | - $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . " . $boucle->modificateur['collate'] . " . ' ", $i, 0); |
|
| 660 | + $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . ".$boucle->modificateur['collate']." . ' ", $i, 0); |
|
| 664 | 661 | } else { |
| 665 | - $boucle->order[$n - 1] .= ' . ' . $boucle->modificateur['collate']; |
|
| 662 | + $boucle->order[$n - 1] .= ' . '.$boucle->modificateur['collate']; |
|
| 666 | 663 | } |
| 667 | 664 | } |
| 668 | 665 | } else { |
| 669 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ' . count($boucles[$idb]->order)]]); |
|
| 666 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' '.count($boucles[$idb]->order)]]); |
|
| 670 | 667 | } |
| 671 | 668 | } |
| 672 | 669 | |
| 673 | 670 | // https://code.spip.net/@calculer_critere_arg_dynamique |
| 674 | 671 | function calculer_critere_arg_dynamique($idb, &$boucles, $crit, $suffix = '') { |
| 675 | 672 | $boucle = $boucles[$idb]; |
| 676 | - $alt = "('" . $boucle->id_table . '.\' . $x' . $suffix . ')'; |
|
| 677 | - $var = '$champs_' . $idb; |
|
| 673 | + $alt = "('".$boucle->id_table.'.\' . $x'.$suffix.')'; |
|
| 674 | + $var = '$champs_'.$idb; |
|
| 678 | 675 | $desc = (strpos($boucle->in, "static $var =") !== false); |
| 679 | 676 | if (!$desc) { |
| 680 | 677 | $desc = $boucle->show['field']; |
| 681 | 678 | $desc = implode(',', array_map('_q', array_keys($desc))); |
| 682 | - $boucles[$idb]->in .= "\n\tstatic $var = array(" . $desc . ');'; |
|
| 679 | + $boucles[$idb]->in .= "\n\tstatic $var = array(".$desc.');'; |
|
| 683 | 680 | } |
| 684 | 681 | if ($desc) { |
| 685 | 682 | $alt = "(in_array(\$x, $var) ? $alt :(\$x$suffix))"; |
@@ -754,7 +751,7 @@ discard block |
||
| 754 | 751 | $sens = " . ' DESC'"; |
| 755 | 752 | } |
| 756 | 753 | if (isset($boucle->modificateur['collate'])) { |
| 757 | - $collecte = ' . ' . $boucle->modificateur['collate']; |
|
| 754 | + $collecte = ' . '.$boucle->modificateur['collate']; |
|
| 758 | 755 | } |
| 759 | 756 | |
| 760 | 757 | // Pour chaque paramètre du critère |
@@ -776,14 +773,14 @@ discard block |
||
| 776 | 773 | if (preg_match(',^(\w+)[\s]+(.*)$,', $par, $m)) { |
| 777 | 774 | $expression = trim($m[1]); |
| 778 | 775 | $champ = trim($m[2]); |
| 779 | - if (function_exists($f = 'calculer_critere_par_expression_' . $expression)) { |
|
| 776 | + if (function_exists($f = 'calculer_critere_par_expression_'.$expression)) { |
|
| 780 | 777 | $order = $f($idb, $boucles, $crit, $tri, $champ); |
| 781 | 778 | } else { |
| 782 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " $par"]]; |
|
| 779 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." $par"]]; |
|
| 783 | 780 | } |
| 784 | 781 | |
| 785 | 782 | // tris de la forme {par champ} ou {par FONCTION(champ)} |
| 786 | - } elseif (preg_match(',^' . CHAMP_SQL_PLUS_FONC . '$,is', $par, $match)) { |
|
| 783 | + } elseif (preg_match(',^'.CHAMP_SQL_PLUS_FONC.'$,is', $par, $match)) { |
|
| 787 | 784 | // {par FONCTION(champ)} |
| 788 | 785 | if (count($match) > 2) { |
| 789 | 786 | $par = substr($match[2], 1, -1); |
@@ -793,7 +790,7 @@ discard block |
||
| 793 | 790 | if ($par == 'hasard') { |
| 794 | 791 | $order = calculer_critere_par_hasard($idb, $boucles, $crit); |
| 795 | 792 | } elseif ($par == 'date' and !empty($boucle->show['date'])) { |
| 796 | - $order = "'" . $boucle->id_table . '.' . $boucle->show['date'] . "'"; |
|
| 793 | + $order = "'".$boucle->id_table.'.'.$boucle->show['date']."'"; |
|
| 797 | 794 | } else { |
| 798 | 795 | // cas général {par champ}, {par table.champ}, ... |
| 799 | 796 | $order = calculer_critere_par_champ($idb, $boucles, $crit, $par); |
@@ -802,7 +799,7 @@ discard block |
||
| 802 | 799 | |
| 803 | 800 | // on ne sait pas traiter… |
| 804 | 801 | else { |
| 805 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " $par"]]; |
|
| 802 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." $par"]]; |
|
| 806 | 803 | } |
| 807 | 804 | |
| 808 | 805 | // En cas d'erreur de squelette retournée par une fonction |
@@ -822,14 +819,14 @@ discard block |
||
| 822 | 819 | |
| 823 | 820 | if ($fct) { |
| 824 | 821 | if (preg_match("/^\s*'(.*)'\s*$/", $order, $r)) { |
| 825 | - $order = "'$fct(" . $r[1] . ")'"; |
|
| 822 | + $order = "'$fct(".$r[1].")'"; |
|
| 826 | 823 | } else { |
| 827 | 824 | $order = "'$fct(' . $order . ')'"; |
| 828 | 825 | } |
| 829 | 826 | } |
| 830 | - $t = $order . $collecte . $sens; |
|
| 827 | + $t = $order.$collecte.$sens; |
|
| 831 | 828 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 832 | - $t = $r[1] . $r[2]; |
|
| 829 | + $t = $r[1].$r[2]; |
|
| 833 | 830 | } |
| 834 | 831 | |
| 835 | 832 | $boucle->order[] = $t; |
@@ -879,16 +876,16 @@ discard block |
||
| 879 | 876 | function calculer_critere_par_expression_num($idb, &$boucles, $crit, $tri, $champ) { |
| 880 | 877 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 881 | 878 | if (is_array($_champ)) { |
| 882 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " num $champ"]]; |
|
| 879 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." num $champ"]]; |
|
| 883 | 880 | } |
| 884 | 881 | $boucle = &$boucles[$idb]; |
| 885 | - $texte = '0+' . $_champ; |
|
| 882 | + $texte = '0+'.$_champ; |
|
| 886 | 883 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 887 | 884 | if ($suite !== "''") { |
| 888 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . ' . "'; |
|
| 885 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')".' . "'; |
|
| 889 | 886 | } |
| 890 | - $asnum = 'num' . ($boucle->order ? count($boucle->order) : ''); |
|
| 891 | - $boucle->select[] = $texte . " AS $asnum"; |
|
| 887 | + $asnum = 'num'.($boucle->order ? count($boucle->order) : ''); |
|
| 888 | + $boucle->select[] = $texte." AS $asnum"; |
|
| 892 | 889 | |
| 893 | 890 | $orderassinum = calculer_critere_par_expression_sinum($idb, $boucles, $crit, $tri, $champ); |
| 894 | 891 | $orderassinum = trim($orderassinum, "'"); |
@@ -917,13 +914,13 @@ discard block |
||
| 917 | 914 | function calculer_critere_par_expression_sinum($idb, &$boucles, $crit, $tri, $champ) { |
| 918 | 915 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 919 | 916 | if (is_array($_champ)) { |
| 920 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " sinum $champ"]]; |
|
| 917 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." sinum $champ"]]; |
|
| 921 | 918 | } |
| 922 | 919 | $boucle = &$boucles[$idb]; |
| 923 | - $texte = '0+' . $_champ; |
|
| 920 | + $texte = '0+'.$_champ; |
|
| 924 | 921 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 925 | 922 | if ($suite !== "''") { |
| 926 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . ' . "'; |
|
| 923 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')".' . "'; |
|
| 927 | 924 | } |
| 928 | 925 | |
| 929 | 926 | $as = false; |
@@ -939,8 +936,8 @@ discard block |
||
| 939 | 936 | } |
| 940 | 937 | |
| 941 | 938 | if (!$as) { |
| 942 | - $as = 'sinum' . ($boucle->order ? count($boucle->order) : ''); |
|
| 943 | - $boucle->select[] = $select . $as; |
|
| 939 | + $as = 'sinum'.($boucle->order ? count($boucle->order) : ''); |
|
| 940 | + $boucle->select[] = $select.$as; |
|
| 944 | 941 | } |
| 945 | 942 | $order = "'$as'"; |
| 946 | 943 | return $order; |
@@ -965,10 +962,10 @@ discard block |
||
| 965 | 962 | function calculer_critere_par_expression_multi($idb, &$boucles, $crit, $tri, $champ) { |
| 966 | 963 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 967 | 964 | if (is_array($_champ)) { |
| 968 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " multi $champ"]]; |
|
| 965 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." multi $champ"]]; |
|
| 969 | 966 | } |
| 970 | 967 | $boucle = &$boucles[$idb]; |
| 971 | - $boucle->select[] = "\".sql_multi('" . $_champ . "', \$GLOBALS['spip_lang']).\""; |
|
| 968 | + $boucle->select[] = "\".sql_multi('".$_champ."', \$GLOBALS['spip_lang']).\""; |
|
| 972 | 969 | $order = "'multi'"; |
| 973 | 970 | return $order; |
| 974 | 971 | } |
@@ -994,7 +991,7 @@ discard block |
||
| 994 | 991 | |
| 995 | 992 | // le champ existe dans la table, pas de souci (le plus commun) |
| 996 | 993 | if (isset($desc['field'][$par])) { |
| 997 | - $par = $boucle->id_table . '.' . $par; |
|
| 994 | + $par = $boucle->id_table.'.'.$par; |
|
| 998 | 995 | } |
| 999 | 996 | // le champ est peut être une jointure |
| 1000 | 997 | else { |
@@ -1015,24 +1012,24 @@ discard block |
||
| 1015 | 1012 | // Sinon on cherche le champ dans les tables possibles de jointures |
| 1016 | 1013 | // Si la table est déjà dans le from, on la réutilise. |
| 1017 | 1014 | if ($infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $table)) { |
| 1018 | - $par = $infos['alias'] . '.' . $champ; |
|
| 1015 | + $par = $infos['alias'].'.'.$champ; |
|
| 1019 | 1016 | } elseif ( |
| 1020 | 1017 | $boucle->jointures_explicites |
| 1021 | 1018 | and $alias = trouver_jointure_champ($champ, $boucle, explode(' ', $boucle->jointures_explicites), false, $table) |
| 1022 | 1019 | ) { |
| 1023 | - $par = $alias . '.' . $champ; |
|
| 1020 | + $par = $alias.'.'.$champ; |
|
| 1024 | 1021 | } elseif ($alias = trouver_jointure_champ($champ, $boucle, $boucle->jointures, false, $table)) { |
| 1025 | - $par = $alias . '.' . $champ; |
|
| 1022 | + $par = $alias.'.'.$champ; |
|
| 1026 | 1023 | // en spécifiant directement l'alias {par L2.titre} (situation hasardeuse tout de même) |
| 1027 | 1024 | } elseif ( |
| 1028 | 1025 | $table_alias |
| 1029 | 1026 | and isset($boucle->from[$table_alias]) |
| 1030 | 1027 | and $infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $boucle->from[$table_alias]) |
| 1031 | 1028 | ) { |
| 1032 | - $par = $infos['alias'] . '.' . $champ; |
|
| 1029 | + $par = $infos['alias'].'.'.$champ; |
|
| 1033 | 1030 | } elseif ($table) { |
| 1034 | 1031 | // On avait table + champ, mais on ne les a pas trouvés |
| 1035 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " $par"]]; |
|
| 1032 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." $par"]]; |
|
| 1036 | 1033 | } else { |
| 1037 | 1034 | // Sinon tant pis, ca doit etre un champ synthetise (cf points) |
| 1038 | 1035 | } |
@@ -1056,7 +1053,7 @@ discard block |
||
| 1056 | 1053 | if (!$t) { |
| 1057 | 1054 | $t = trouver_jointure_champ($champ, $boucle); |
| 1058 | 1055 | } |
| 1059 | - return !$t ? '' : ("'" . $t . '.' . $champ . "'"); |
|
| 1056 | + return !$t ? '' : ("'".$t.'.'.$champ."'"); |
|
| 1060 | 1057 | } |
| 1061 | 1058 | |
| 1062 | 1059 | /** |
@@ -1101,9 +1098,9 @@ discard block |
||
| 1101 | 1098 | $boucle->default_order[] = ' DESC'; |
| 1102 | 1099 | } |
| 1103 | 1100 | } else { |
| 1104 | - $t = $boucle->order[$n - 1] . " . $order"; |
|
| 1101 | + $t = $boucle->order[$n - 1]." . $order"; |
|
| 1105 | 1102 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 1106 | - $t = $r[1] . $r[2]; |
|
| 1103 | + $t = $r[1].$r[2]; |
|
| 1107 | 1104 | } |
| 1108 | 1105 | $boucle->order[$n - 1] = $t; |
| 1109 | 1106 | } |
@@ -1138,7 +1135,7 @@ discard block |
||
| 1138 | 1135 | $_order = array_pop($boucle->order); |
| 1139 | 1136 | |
| 1140 | 1137 | $_liste = calculer_liste($crit->param[1], [], $boucles, $boucles[$idb]->id_parent); |
| 1141 | - $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'" . $boucle->sql_serveur . "')) ? \$zl : '0').')'$sens"; |
|
| 1138 | + $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'".$boucle->sql_serveur."')) ? \$zl : '0').')'$sens"; |
|
| 1142 | 1139 | } |
| 1143 | 1140 | |
| 1144 | 1141 | |
@@ -1147,7 +1144,7 @@ discard block |
||
| 1147 | 1144 | $params = $crit->param; |
| 1148 | 1145 | |
| 1149 | 1146 | if (count($params) < 1) { |
| 1150 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]; |
|
| 1147 | + return ['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]; |
|
| 1151 | 1148 | } |
| 1152 | 1149 | |
| 1153 | 1150 | $boucle = &$boucles[$idb]; |
@@ -1168,7 +1165,7 @@ discard block |
||
| 1168 | 1165 | if ((count($date) == 1) and ($date[0]->type == 'texte')) { |
| 1169 | 1166 | $date = $date[0]->texte; |
| 1170 | 1167 | if (!isset($fields[$date])) { |
| 1171 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . ' ' . $date]]; |
|
| 1168 | + return ['zbug_critere_inconnu', ['critere' => $crit->op.' '.$date]]; |
|
| 1172 | 1169 | } |
| 1173 | 1170 | } else { |
| 1174 | 1171 | $a = calculer_liste($date, $idb, $boucles, $parent); |
@@ -1180,38 +1177,38 @@ discard block |
||
| 1180 | 1177 | $date = "'.(($cond)\n?\$a:\"$defaut\").'"; |
| 1181 | 1178 | } |
| 1182 | 1179 | $annee = $params ? array_shift($params) : ''; |
| 1183 | - $annee = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1184 | - calculer_liste($annee, $idb, $boucles, $parent) . |
|
| 1180 | + $annee = "\n".'sprintf("%04d", ($x = '. |
|
| 1181 | + calculer_liste($annee, $idb, $boucles, $parent). |
|
| 1185 | 1182 | ') ? $x : date("Y"))'; |
| 1186 | 1183 | |
| 1187 | 1184 | $mois = $params ? array_shift($params) : ''; |
| 1188 | - $mois = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1189 | - calculer_liste($mois, $idb, $boucles, $parent) . |
|
| 1185 | + $mois = "\n".'sprintf("%02d", ($x = '. |
|
| 1186 | + calculer_liste($mois, $idb, $boucles, $parent). |
|
| 1190 | 1187 | ') ? $x : date("m"))'; |
| 1191 | 1188 | |
| 1192 | 1189 | $jour = $params ? array_shift($params) : ''; |
| 1193 | - $jour = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1194 | - calculer_liste($jour, $idb, $boucles, $parent) . |
|
| 1190 | + $jour = "\n".'sprintf("%02d", ($x = '. |
|
| 1191 | + calculer_liste($jour, $idb, $boucles, $parent). |
|
| 1195 | 1192 | ') ? $x : date("d"))'; |
| 1196 | 1193 | |
| 1197 | 1194 | $annee2 = $params ? array_shift($params) : ''; |
| 1198 | - $annee2 = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1199 | - calculer_liste($annee2, $idb, $boucles, $parent) . |
|
| 1195 | + $annee2 = "\n".'sprintf("%04d", ($x = '. |
|
| 1196 | + calculer_liste($annee2, $idb, $boucles, $parent). |
|
| 1200 | 1197 | ') ? $x : date("Y"))'; |
| 1201 | 1198 | |
| 1202 | 1199 | $mois2 = $params ? array_shift($params) : ''; |
| 1203 | - $mois2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1204 | - calculer_liste($mois2, $idb, $boucles, $parent) . |
|
| 1200 | + $mois2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1201 | + calculer_liste($mois2, $idb, $boucles, $parent). |
|
| 1205 | 1202 | ') ? $x : date("m"))'; |
| 1206 | 1203 | |
| 1207 | 1204 | $jour2 = $params ? array_shift($params) : ''; |
| 1208 | - $jour2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1209 | - calculer_liste($jour2, $idb, $boucles, $parent) . |
|
| 1205 | + $jour2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1206 | + calculer_liste($jour2, $idb, $boucles, $parent). |
|
| 1210 | 1207 | ') ? $x : date("d"))'; |
| 1211 | 1208 | |
| 1212 | - $date = $boucle->id_table . ".$date"; |
|
| 1209 | + $date = $boucle->id_table.".$date"; |
|
| 1213 | 1210 | |
| 1214 | - $quote_end = ",'" . $boucle->sql_serveur . "','text'"; |
|
| 1211 | + $quote_end = ",'".$boucle->sql_serveur."','text'"; |
|
| 1215 | 1212 | if ($type == 'jour') { |
| 1216 | 1213 | $boucle->where[] = [ |
| 1217 | 1214 | "'='", |
@@ -1283,14 +1280,13 @@ discard block |
||
| 1283 | 1280 | list($a21, $a22) = calculer_critere_parties_aux($idb, $boucles, $a2); |
| 1284 | 1281 | |
| 1285 | 1282 | if (($op == ',') && (is_numeric($a11) && (is_numeric($a21)))) { |
| 1286 | - $boucle->limit = $a11 . ',' . $a21; |
|
| 1283 | + $boucle->limit = $a11.','.$a21; |
|
| 1287 | 1284 | } else { |
| 1288 | 1285 | // 3 dans {1/3}, {2,3} ou {1,n-3} |
| 1289 | 1286 | $boucle->total_parties = ($a21 != 'n') ? $a21 : $a22; |
| 1290 | 1287 | // 2 dans {2/3}, {2,5}, {n-2,1} |
| 1291 | 1288 | $partie = ($a11 != 'n') ? $a11 : $a12; |
| 1292 | - $mode = (($op == '/') ? '/' : |
|
| 1293 | - (($a11 == 'n') ? '-' : '+') . (($a21 == 'n') ? '-' : '+')); |
|
| 1289 | + $mode = (($op == '/') ? '/' : (($a11 == 'n') ? '-' : '+').(($a21 == 'n') ? '-' : '+')); |
|
| 1294 | 1290 | // cas simple {0,#ENV{truc}} compilons le en LIMIT : |
| 1295 | 1291 | if ($a11 !== 'n' and $a21 !== 'n' and $mode == '++' and $op == ',') { |
| 1296 | 1292 | $boucle->limit = |
@@ -1336,8 +1332,7 @@ discard block |
||
| 1336 | 1332 | // {1/3} |
| 1337 | 1333 | if ($op1 == '/') { |
| 1338 | 1334 | $pmoins1 = is_numeric($debut) ? ($debut - 1) : "($debut-1)"; |
| 1339 | - $totpos = is_numeric($total_parties) ? ($total_parties) : |
|
| 1340 | - "($total_parties ? $total_parties : 1)"; |
|
| 1335 | + $totpos = is_numeric($total_parties) ? ($total_parties) : "($total_parties ? $total_parties : 1)"; |
|
| 1341 | 1336 | $fin = "ceil(($nombre_boucle * $debut )/$totpos) - 1"; |
| 1342 | 1337 | $debut = !$pmoins1 ? 0 : "ceil(($nombre_boucle * $pmoins1)/$totpos);"; |
| 1343 | 1338 | } else { |
@@ -1348,15 +1343,13 @@ discard block |
||
| 1348 | 1343 | |
| 1349 | 1344 | // cas {x,n-1} |
| 1350 | 1345 | if ($op2 == '-') { |
| 1351 | - $fin = '$debut_boucle + ' . $nombre_boucle . ' - ' |
|
| 1352 | - . (is_numeric($total_parties) ? ($total_parties + 1) : |
|
| 1353 | - ($total_parties . ' - 1')); |
|
| 1346 | + $fin = '$debut_boucle + '.$nombre_boucle.' - ' |
|
| 1347 | + . (is_numeric($total_parties) ? ($total_parties + 1) : ($total_parties.' - 1')); |
|
| 1354 | 1348 | } else { |
| 1355 | 1349 | // {x,1} ou {pagination} |
| 1356 | 1350 | $fin = '$debut_boucle' |
| 1357 | 1351 | . (is_numeric($total_parties) ? |
| 1358 | - (($total_parties == 1) ? '' : (' + ' . ($total_parties - 1))) : |
|
| 1359 | - ('+' . $total_parties . ' - 1')); |
|
| 1352 | + (($total_parties == 1) ? '' : (' + '.($total_parties - 1))) : ('+'.$total_parties.' - 1')); |
|
| 1360 | 1353 | } |
| 1361 | 1354 | |
| 1362 | 1355 | // {pagination}, gerer le debut_xx=-1 pour tout voir |
@@ -1374,11 +1367,11 @@ discard block |
||
| 1374 | 1367 | // Utiliser min pour rabattre $fin_boucle sur total_boucle. |
| 1375 | 1368 | |
| 1376 | 1369 | $boucles[$id_boucle]->mode_partie = "\n\t" |
| 1377 | - . '$debut_boucle = ' . $debut . ";\n " |
|
| 1370 | + . '$debut_boucle = '.$debut.";\n " |
|
| 1378 | 1371 | . "\$debut_boucle = intval(\$debut_boucle);\n " |
| 1379 | - . '$fin_boucle = min(' . $fin . ", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1380 | - . '$Numrows[\'' . $id_boucle . "']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1381 | - . '$Numrows[\'' . $id_boucle . '\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1372 | + . '$fin_boucle = min('.$fin.", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1373 | + . '$Numrows[\''.$id_boucle."']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1374 | + . '$Numrows[\''.$id_boucle.'\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1382 | 1375 | . "\n\tif (\$debut_boucle>0" |
| 1383 | 1376 | . " AND \$debut_boucle < \$Numrows['$id_boucle']['grand_total']" |
| 1384 | 1377 | . " AND \$iter->seek(\$debut_boucle,'continue'))" |
@@ -1463,16 +1456,16 @@ discard block |
||
| 1463 | 1456 | // critere personnalise ? |
| 1464 | 1457 | if ( |
| 1465 | 1458 | (!$serveur or |
| 1466 | - ((!function_exists($f = 'critere_' . $serveur . '_' . $table . '_' . $critere)) |
|
| 1467 | - and (!function_exists($f = $f . '_dist')) |
|
| 1468 | - and (!function_exists($f = 'critere_' . $serveur . '_' . $critere)) |
|
| 1469 | - and (!function_exists($f = $f . '_dist')) |
|
| 1459 | + ((!function_exists($f = 'critere_'.$serveur.'_'.$table.'_'.$critere)) |
|
| 1460 | + and (!function_exists($f = $f.'_dist')) |
|
| 1461 | + and (!function_exists($f = 'critere_'.$serveur.'_'.$critere)) |
|
| 1462 | + and (!function_exists($f = $f.'_dist')) |
|
| 1470 | 1463 | ) |
| 1471 | 1464 | ) |
| 1472 | - and (!function_exists($f = 'critere_' . $table . '_' . $critere)) |
|
| 1473 | - and (!function_exists($f = $f . '_dist')) |
|
| 1474 | - and (!function_exists($f = 'critere_' . $critere)) |
|
| 1475 | - and (!function_exists($f = $f . '_dist')) |
|
| 1465 | + and (!function_exists($f = 'critere_'.$table.'_'.$critere)) |
|
| 1466 | + and (!function_exists($f = $f.'_dist')) |
|
| 1467 | + and (!function_exists($f = 'critere_'.$critere)) |
|
| 1468 | + and (!function_exists($f = $f.'_dist')) |
|
| 1476 | 1469 | ) { |
| 1477 | 1470 | // fonction critere standard |
| 1478 | 1471 | $f = $defaut; |
@@ -1505,9 +1498,9 @@ discard block |
||
| 1505 | 1498 | */ |
| 1506 | 1499 | function kwote($lisp, $serveur = '', $type = '') { |
| 1507 | 1500 | if (preg_match(_CODE_QUOTE, $lisp, $r)) { |
| 1508 | - return $r[1] . '"' . sql_quote(str_replace(["\\'", '\\\\'], ["'", '\\'], $r[2]), $serveur, $type) . '"'; |
|
| 1501 | + return $r[1].'"'.sql_quote(str_replace(["\\'", '\\\\'], ["'", '\\'], $r[2]), $serveur, $type).'"'; |
|
| 1509 | 1502 | } else { |
| 1510 | - return "sql_quote($lisp, '$serveur', '" . str_replace("'", "\\'", $type) . "')"; |
|
| 1503 | + return "sql_quote($lisp, '$serveur', '".str_replace("'", "\\'", $type)."')"; |
|
| 1511 | 1504 | } |
| 1512 | 1505 | } |
| 1513 | 1506 | |
@@ -1529,7 +1522,7 @@ discard block |
||
| 1529 | 1522 | function critere_IN_dist($idb, &$boucles, $crit) { |
| 1530 | 1523 | $r = calculer_critere_infixe($idb, $boucles, $crit); |
| 1531 | 1524 | if (!$r) { |
| 1532 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]); |
|
| 1525 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]); |
|
| 1533 | 1526 | } |
| 1534 | 1527 | list($arg, $op, $val, $col, $where_complement) = $r; |
| 1535 | 1528 | |
@@ -1554,8 +1547,8 @@ discard block |
||
| 1554 | 1547 | "'NOT'", |
| 1555 | 1548 | [ |
| 1556 | 1549 | "'IN'", |
| 1557 | - "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", |
|
| 1558 | - ["'SELF'", "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", $where] |
|
| 1550 | + "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", |
|
| 1551 | + ["'SELF'", "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", $where] |
|
| 1559 | 1552 | ] |
| 1560 | 1553 | ]; |
| 1561 | 1554 | } |
@@ -1573,22 +1566,22 @@ discard block |
||
| 1573 | 1566 | $descr = $boucles[$idb]->descr; |
| 1574 | 1567 | $cpt = &$num[$descr['nom']][$descr['gram']][$idb]; |
| 1575 | 1568 | |
| 1576 | - $var = '$in' . $cpt++; |
|
| 1569 | + $var = '$in'.$cpt++; |
|
| 1577 | 1570 | $x = "\n\t$var = array();"; |
| 1578 | 1571 | foreach ($val as $k => $v) { |
| 1579 | 1572 | if (preg_match(",^(\n//.*\n)?'(.*)'$,", $v, $r)) { |
| 1580 | 1573 | // optimiser le traitement des constantes |
| 1581 | 1574 | if (is_numeric($r[2])) { |
| 1582 | - $x .= "\n\t$var" . "[]= $r[2];"; |
|
| 1575 | + $x .= "\n\t$var"."[]= $r[2];"; |
|
| 1583 | 1576 | } else { |
| 1584 | - $x .= "\n\t$var" . '[]= ' . sql_quote($r[2]) . ';'; |
|
| 1577 | + $x .= "\n\t$var".'[]= '.sql_quote($r[2]).';'; |
|
| 1585 | 1578 | } |
| 1586 | 1579 | } else { |
| 1587 | 1580 | // Pour permettre de passer des tableaux de valeurs |
| 1588 | 1581 | // on repere l'utilisation brute de #ENV**{X}, |
| 1589 | 1582 | // c'est-a-dire sa traduction en ($PILE[0][X]). |
| 1590 | 1583 | // et on deballe mais en rajoutant l'anti XSS |
| 1591 | - $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var" . "[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1584 | + $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var"."[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1592 | 1585 | } |
| 1593 | 1586 | } |
| 1594 | 1587 | |
@@ -1602,7 +1595,7 @@ discard block |
||
| 1602 | 1595 | $boucles[$idb]->default_order[] = "((!\$zqv=sql_quote($var) OR \$zqv===\"''\") ? 0 : ('FIELD($arg,' . \$zqv . ')'))"; |
| 1603 | 1596 | } |
| 1604 | 1597 | |
| 1605 | - return "sql_in('$arg', $var" . ($crit2 == 'NOT' ? ",'NOT'" : '') . ')'; |
|
| 1598 | + return "sql_in('$arg', $var".($crit2 == 'NOT' ? ",'NOT'" : '').')'; |
|
| 1606 | 1599 | } |
| 1607 | 1600 | |
| 1608 | 1601 | /** |
@@ -1675,7 +1668,7 @@ discard block |
||
| 1675 | 1668 | $champs = array_diff($champs, array_keys($boucle->modificateur['criteres'])); |
| 1676 | 1669 | } |
| 1677 | 1670 | // nous aider en mode debug. |
| 1678 | - $boucle->debug[] = 'id_ : ' . implode(', ', $champs); |
|
| 1671 | + $boucle->debug[] = 'id_ : '.implode(', ', $champs); |
|
| 1679 | 1672 | $boucle->modificateur['id_'] = $champs; |
| 1680 | 1673 | |
| 1681 | 1674 | // créer un critère {id_xxx?} de chaque champ retenu |
@@ -1716,7 +1709,7 @@ discard block |
||
| 1716 | 1709 | // Les champs id_xx de la table demandée |
| 1717 | 1710 | $champs = array_filter( |
| 1718 | 1711 | array_keys($desc['field']), |
| 1719 | - function ($champ) { |
|
| 1712 | + function($champ) { |
|
| 1720 | 1713 | return |
| 1721 | 1714 | strpos($champ, 'id_') === 0 |
| 1722 | 1715 | or (in_array($champ, ['objet'])); |
@@ -1930,8 +1923,8 @@ discard block |
||
| 1930 | 1923 | "'NOT'", |
| 1931 | 1924 | [ |
| 1932 | 1925 | "'IN'", |
| 1933 | - "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", |
|
| 1934 | - ["'SELF'", "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", $where] |
|
| 1926 | + "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", |
|
| 1927 | + ["'SELF'", "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", $where] |
|
| 1935 | 1928 | ] |
| 1936 | 1929 | ]; |
| 1937 | 1930 | } |
@@ -1942,7 +1935,7 @@ discard block |
||
| 1942 | 1935 | if ($crit->cond) { |
| 1943 | 1936 | $pred = calculer_argument_precedent($idb, $col, $boucles); |
| 1944 | 1937 | if ($col === 'date' or $col === 'date_redac') { |
| 1945 | - if ($pred === "\$Pile[0]['" . $col . "']") { |
|
| 1938 | + if ($pred === "\$Pile[0]['".$col."']") { |
|
| 1946 | 1939 | $pred = "(\$Pile[0]['{$col}_default']?'':$pred)"; |
| 1947 | 1940 | } |
| 1948 | 1941 | } |
@@ -2105,7 +2098,7 @@ discard block |
||
| 2105 | 2098 | // defaire le quote des int et les passer dans sql_quote avec le bon type de champ si on le connait, int sinon |
| 2106 | 2099 | // prendre en compte le debug ou la valeur arrive avec un commentaire PHP en debut |
| 2107 | 2100 | if (preg_match(",^\\A(\s*//.*?$\s*)?\"'(-?\d+)'\"\\z,ms", $val[0], $r)) { |
| 2108 | - $val[0] = $r[1] . '"' . sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote) . '"'; |
|
| 2101 | + $val[0] = $r[1].'"'.sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote).'"'; |
|
| 2109 | 2102 | } |
| 2110 | 2103 | // sinon expliciter les |
| 2111 | 2104 | // sql_quote(truc) en sql_quote(truc,'',type) |
@@ -2121,14 +2114,14 @@ discard block |
||
| 2121 | 2114 | ) { |
| 2122 | 2115 | $r = $r[1] |
| 2123 | 2116 | . ((isset($r[2]) and $r[2]) ? $r[2] : ",''") |
| 2124 | - . ",'" . addslashes($type_cast_quote) . "'"; |
|
| 2117 | + . ",'".addslashes($type_cast_quote)."'"; |
|
| 2125 | 2118 | $val[0] = "sql_quote($r)"; |
| 2126 | 2119 | } |
| 2127 | 2120 | elseif ( |
| 2128 | 2121 | strpos($val[0], '@@defaultcast@@') !== false |
| 2129 | 2122 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r) |
| 2130 | 2123 | ) { |
| 2131 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'" . addslashes($type_cast_quote) . "')"; |
|
| 2124 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'".addslashes($type_cast_quote)."')"; |
|
| 2132 | 2125 | } |
| 2133 | 2126 | } |
| 2134 | 2127 | |
@@ -2136,7 +2129,7 @@ discard block |
||
| 2136 | 2129 | strpos($val[0], '@@defaultcast@@') !== false |
| 2137 | 2130 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r) |
| 2138 | 2131 | ) { |
| 2139 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'char')"; |
|
| 2132 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'char')"; |
|
| 2140 | 2133 | } |
| 2141 | 2134 | |
| 2142 | 2135 | // Indicateur pour permettre aux fonctionx boucle_X de modifier |
@@ -2152,7 +2145,7 @@ discard block |
||
| 2152 | 2145 | // inserer le nom de la table SQL devant le nom du champ |
| 2153 | 2146 | if ($table) { |
| 2154 | 2147 | if ($col[0] == '`') { |
| 2155 | - $arg = "$table." . substr($col, 1, -1); |
|
| 2148 | + $arg = "$table.".substr($col, 1, -1); |
|
| 2156 | 2149 | } else { |
| 2157 | 2150 | $arg = "$table.$col"; |
| 2158 | 2151 | } |
@@ -2287,9 +2280,9 @@ discard block |
||
| 2287 | 2280 | **/ |
| 2288 | 2281 | function primary_doublee($decompose, $table) { |
| 2289 | 2282 | $e1 = reset($decompose); |
| 2290 | - $e2 = "sql_quote('" . end($decompose) . "')"; |
|
| 2283 | + $e2 = "sql_quote('".end($decompose)."')"; |
|
| 2291 | 2284 | |
| 2292 | - return ["'='", "'$table." . $e1 . "'", $e2]; |
|
| 2285 | + return ["'='", "'$table.".$e1."'", $e2]; |
|
| 2293 | 2286 | } |
| 2294 | 2287 | |
| 2295 | 2288 | /** |
@@ -2328,7 +2321,7 @@ discard block |
||
| 2328 | 2321 | $checkarrivee |
| 2329 | 2322 | and is_string($checkarrivee) |
| 2330 | 2323 | and $a = table_objet($checkarrivee) |
| 2331 | - and in_array($a . '_liens', $joints) |
|
| 2324 | + and in_array($a.'_liens', $joints) |
|
| 2332 | 2325 | ) { |
| 2333 | 2326 | if ($res = calculer_lien_externe_init($boucle, $joints, $col, $desc, $cond, $checkarrivee)) { |
| 2334 | 2327 | return $res; |
@@ -2348,12 +2341,12 @@ discard block |
||
| 2348 | 2341 | // la table est déjà dans le FROM, on vérifie si le champ est utilisé. |
| 2349 | 2342 | $joindre = false; |
| 2350 | 2343 | foreach ($cols as $col) { |
| 2351 | - $c = '/\b' . $t . ".$col" . '\b/'; |
|
| 2344 | + $c = '/\b'.$t.".$col".'\b/'; |
|
| 2352 | 2345 | if (trouver_champ($c, $boucle->where)) { |
| 2353 | 2346 | $joindre = true; |
| 2354 | 2347 | } else { |
| 2355 | 2348 | // mais ca peut etre dans le FIELD pour le Having |
| 2356 | - $c = "/FIELD.$t" . ".$col,/"; |
|
| 2349 | + $c = "/FIELD.$t".".$col,/"; |
|
| 2357 | 2350 | if (trouver_champ($c, $boucle->select)) { |
| 2358 | 2351 | $joindre = true; |
| 2359 | 2352 | } |
@@ -2399,7 +2392,7 @@ discard block |
||
| 2399 | 2392 | $primary_arrivee = id_table_objet($checkarrivee); |
| 2400 | 2393 | |
| 2401 | 2394 | // [FIXME] $checkarrivee peut-il arriver avec false ???? |
| 2402 | - $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee . '_liens'); |
|
| 2395 | + $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee.'_liens'); |
|
| 2403 | 2396 | $arrivee = trouver_champ_exterieur($col, $joints, $boucle, $checkarrivee); |
| 2404 | 2397 | |
| 2405 | 2398 | if (!$intermediaire or !$arrivee) { |
@@ -2503,7 +2496,7 @@ discard block |
||
| 2503 | 2496 | } elseif ($crit->cond and ($col == 'date' or $col == 'date_redac')) { |
| 2504 | 2497 | // un critere conditionnel sur date est traite a part |
| 2505 | 2498 | // car la date est mise d'office par SPIP, |
| 2506 | - $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['" . $col . "'])"; |
|
| 2499 | + $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['".$col."'])"; |
|
| 2507 | 2500 | } |
| 2508 | 2501 | |
| 2509 | 2502 | $val = calculer_argument_precedent($idb, $val, $boucles, $defaut); |
@@ -2535,7 +2528,7 @@ discard block |
||
| 2535 | 2528 | and (($p == "'") or ($p == '"')) |
| 2536 | 2529 | and $params[0][1]->type == 'champ' |
| 2537 | 2530 | ) { |
| 2538 | - $val[] = "$p\\$p#" . $params[0][1]->nom_champ . "\\$p$p"; |
|
| 2531 | + $val[] = "$p\\$p#".$params[0][1]->nom_champ."\\$p$p"; |
|
| 2539 | 2532 | } else { |
| 2540 | 2533 | foreach ((($op != 'IN') ? $params : calculer_vieux_in($params)) as $p) { |
| 2541 | 2534 | $a = calculer_liste($p, $idb, $boucles, $parent); |
@@ -2551,7 +2544,7 @@ discard block |
||
| 2551 | 2544 | $fct = $args_sql = ''; |
| 2552 | 2545 | // fonction SQL ? |
| 2553 | 2546 | // chercher FONCTION(champ) tel que CONCAT(titre,descriptif) |
| 2554 | - if (preg_match('/^(.*)' . SQL_ARGS . '$/', $col, $m)) { |
|
| 2547 | + if (preg_match('/^(.*)'.SQL_ARGS.'$/', $col, $m)) { |
|
| 2555 | 2548 | $fct = $m[1]; |
| 2556 | 2549 | preg_match('/^\(([^,]*)(.*)\)$/', $m[2], $a); |
| 2557 | 2550 | $col = $a[1]; |
@@ -2642,7 +2635,7 @@ discard block |
||
| 2642 | 2635 | # si oui choisir ce champ, sinon choisir xxxx |
| 2643 | 2636 | |
| 2644 | 2637 | if (isset($table['field']["date$suite"])) { |
| 2645 | - $date_orig = 'date' . $suite; |
|
| 2638 | + $date_orig = 'date'.$suite; |
|
| 2646 | 2639 | } else { |
| 2647 | 2640 | $date_orig = substr($suite, 1); |
| 2648 | 2641 | } |
@@ -2653,12 +2646,12 @@ discard block |
||
| 2653 | 2646 | } |
| 2654 | 2647 | } |
| 2655 | 2648 | |
| 2656 | - $date_compare = "\"' . normaliser_date(" . |
|
| 2657 | - calculer_argument_precedent($idb, $pred, $boucles) . |
|
| 2649 | + $date_compare = "\"' . normaliser_date(". |
|
| 2650 | + calculer_argument_precedent($idb, $pred, $boucles). |
|
| 2658 | 2651 | ") . '\""; |
| 2659 | 2652 | |
| 2660 | 2653 | $col_vraie = $date_orig; |
| 2661 | - $date_orig = $boucle->id_table . '.' . $date_orig; |
|
| 2654 | + $date_orig = $boucle->id_table.'.'.$date_orig; |
|
| 2662 | 2655 | |
| 2663 | 2656 | switch ($col) { |
| 2664 | 2657 | case 'date': |
@@ -2678,26 +2671,26 @@ discard block |
||
| 2678 | 2671 | break; |
| 2679 | 2672 | case 'age': |
| 2680 | 2673 | $col = calculer_param_date("\'' . date('Y-m-d H:i:00') . '\'", $date_orig); |
| 2681 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2674 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2682 | 2675 | break; |
| 2683 | 2676 | case 'age_relatif': |
| 2684 | 2677 | $col = calculer_param_date($date_compare, $date_orig); |
| 2685 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2678 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2686 | 2679 | break; |
| 2687 | 2680 | case 'jour_relatif': |
| 2688 | - $col = '(TO_DAYS(' . $date_compare . ')-TO_DAYS(' . $date_orig . '))'; |
|
| 2689 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2681 | + $col = '(TO_DAYS('.$date_compare.')-TO_DAYS('.$date_orig.'))'; |
|
| 2682 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2690 | 2683 | break; |
| 2691 | 2684 | case 'mois_relatif': |
| 2692 | - $col = 'MONTH(' . $date_compare . ')-MONTH(' . |
|
| 2693 | - $date_orig . ')+12*(YEAR(' . $date_compare . |
|
| 2694 | - ')-YEAR(' . $date_orig . '))'; |
|
| 2695 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2685 | + $col = 'MONTH('.$date_compare.')-MONTH('. |
|
| 2686 | + $date_orig.')+12*(YEAR('.$date_compare. |
|
| 2687 | + ')-YEAR('.$date_orig.'))'; |
|
| 2688 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2696 | 2689 | break; |
| 2697 | 2690 | case 'annee_relatif': |
| 2698 | - $col = 'YEAR(' . $date_compare . ')-YEAR(' . |
|
| 2699 | - $date_orig . ')'; |
|
| 2700 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2691 | + $col = 'YEAR('.$date_compare.')-YEAR('. |
|
| 2692 | + $date_orig.')'; |
|
| 2693 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2701 | 2694 | break; |
| 2702 | 2695 | } |
| 2703 | 2696 | |
@@ -2758,10 +2751,10 @@ discard block |
||
| 2758 | 2751 | } |
| 2759 | 2752 | |
| 2760 | 2753 | $boucle->hash .= ' |
| 2761 | - $command[\'sourcemode\'] = ' . array_shift($args) . ";\n"; |
|
| 2754 | + $command[\'sourcemode\'] = ' . array_shift($args).";\n"; |
|
| 2762 | 2755 | |
| 2763 | 2756 | $boucle->hash .= ' |
| 2764 | - $command[\'source\'] = array(' . join(', ', $args) . ");\n"; |
|
| 2757 | + $command[\'source\'] = array(' . join(', ', $args).");\n"; |
|
| 2765 | 2758 | } |
| 2766 | 2759 | |
| 2767 | 2760 | /** |
@@ -2780,7 +2773,7 @@ discard block |
||
| 2780 | 2773 | function critere_DATA_datacache_dist($idb, &$boucles, $crit) { |
| 2781 | 2774 | $boucle = &$boucles[$idb]; |
| 2782 | 2775 | $boucle->hash .= ' |
| 2783 | - $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2776 | + $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2784 | 2777 | } |
| 2785 | 2778 | |
| 2786 | 2779 | |
@@ -2799,7 +2792,7 @@ discard block |
||
| 2799 | 2792 | $boucle->hash .= '$command[\'args\']=array();'; |
| 2800 | 2793 | foreach ($crit->param as $param) { |
| 2801 | 2794 | $boucle->hash .= ' |
| 2802 | - $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2795 | + $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2803 | 2796 | } |
| 2804 | 2797 | } |
| 2805 | 2798 | |
@@ -2818,14 +2811,14 @@ discard block |
||
| 2818 | 2811 | */ |
| 2819 | 2812 | function critere_DATA_liste_dist($idb, &$boucles, $crit) { |
| 2820 | 2813 | $boucle = &$boucles[$idb]; |
| 2821 | - $boucle->hash .= "\n\t" . '$command[\'liste\'] = array();' . "\n"; |
|
| 2814 | + $boucle->hash .= "\n\t".'$command[\'liste\'] = array();'."\n"; |
|
| 2822 | 2815 | foreach ($crit->param as $param) { |
| 2823 | - $boucle->hash .= "\t" . '$command[\'liste\'][] = ' . calculer_liste( |
|
| 2816 | + $boucle->hash .= "\t".'$command[\'liste\'][] = '.calculer_liste( |
|
| 2824 | 2817 | $param, |
| 2825 | 2818 | $idb, |
| 2826 | 2819 | $boucles, |
| 2827 | 2820 | $boucles[$idb]->id_parent |
| 2828 | - ) . ";\n"; |
|
| 2821 | + ).";\n"; |
|
| 2829 | 2822 | } |
| 2830 | 2823 | } |
| 2831 | 2824 | |
@@ -2852,14 +2845,14 @@ discard block |
||
| 2852 | 2845 | */ |
| 2853 | 2846 | function critere_DATA_enum_dist($idb, &$boucles, $crit) { |
| 2854 | 2847 | $boucle = &$boucles[$idb]; |
| 2855 | - $boucle->hash .= "\n\t" . '$command[\'enum\'] = array();' . "\n"; |
|
| 2848 | + $boucle->hash .= "\n\t".'$command[\'enum\'] = array();'."\n"; |
|
| 2856 | 2849 | foreach ($crit->param as $param) { |
| 2857 | - $boucle->hash .= "\t" . '$command[\'enum\'][] = ' . calculer_liste( |
|
| 2850 | + $boucle->hash .= "\t".'$command[\'enum\'][] = '.calculer_liste( |
|
| 2858 | 2851 | $param, |
| 2859 | 2852 | $idb, |
| 2860 | 2853 | $boucles, |
| 2861 | 2854 | $boucles[$idb]->id_parent |
| 2862 | - ) . ";\n"; |
|
| 2855 | + ).";\n"; |
|
| 2863 | 2856 | } |
| 2864 | 2857 | } |
| 2865 | 2858 | |
@@ -2878,7 +2871,7 @@ discard block |
||
| 2878 | 2871 | $boucle = &$boucles[$idb]; |
| 2879 | 2872 | foreach ($crit->param as $param) { |
| 2880 | 2873 | $boucle->hash .= ' |
| 2881 | - $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2874 | + $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2882 | 2875 | } |
| 2883 | 2876 | } |
| 2884 | 2877 | |
@@ -2919,7 +2912,7 @@ discard block |
||
| 2919 | 2912 | if ($crit->param) { |
| 2920 | 2913 | foreach ($crit->param as $param) { |
| 2921 | 2914 | $boucle->hash .= "\t\$command['si'][] = " |
| 2922 | - . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ";\n"; |
|
| 2915 | + . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).";\n"; |
|
| 2923 | 2916 | } |
| 2924 | 2917 | // interdire {si 0} aussi ! |
| 2925 | 2918 | } else { |
@@ -2943,7 +2936,7 @@ discard block |
||
| 2943 | 2936 | function critere_POUR_tableau_dist($idb, &$boucles, $crit) { |
| 2944 | 2937 | $boucle = &$boucles[$idb]; |
| 2945 | 2938 | $boucle->hash .= ' |
| 2946 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2939 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).'); |
|
| 2947 | 2940 | $command[\'sourcemode\'] = \'table\';'; |
| 2948 | 2941 | } |
| 2949 | 2942 | |
@@ -2976,11 +2969,10 @@ discard block |
||
| 2976 | 2969 | $table_sql = table_objet_sql(objet_type($table)); |
| 2977 | 2970 | |
| 2978 | 2971 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 2979 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 2980 | - 'id_parent'; |
|
| 2972 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 2981 | 2973 | |
| 2982 | 2974 | $in = 'IN'; |
| 2983 | - $where = ["'IN'", "'$boucle->id_table." . "$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"]; |
|
| 2975 | + $where = ["'IN'", "'$boucle->id_table."."$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"]; |
|
| 2984 | 2976 | if ($not) { |
| 2985 | 2977 | $where = ["'NOT'", $where]; |
| 2986 | 2978 | } |
@@ -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 | } |
@@ -222,14 +222,14 @@ discard block |
||
| 222 | 222 | $val = ''; |
| 223 | 223 | } elseif (is_array($val)) { |
| 224 | 224 | if ($profondeur_max > 0) { |
| 225 | - $val = 'array:' . count($val) . '(' . presenter_contexte($val, $profondeur_max - 1, 3) . ')'; |
|
| 225 | + $val = 'array:'.count($val).'('.presenter_contexte($val, $profondeur_max - 1, 3).')'; |
|
| 226 | 226 | } else { |
| 227 | - $val = 'array:' . count($val); |
|
| 227 | + $val = 'array:'.count($val); |
|
| 228 | 228 | } |
| 229 | 229 | } elseif (is_object($val)) { |
| 230 | 230 | $val = get_class($val); |
| 231 | 231 | } elseif (strlen("$val") > 30) { |
| 232 | - $val = substr("$val", 0, 29) . '…'; |
|
| 232 | + $val = substr("$val", 0, 29).'…'; |
|
| 233 | 233 | if (strstr($val, ' ')) { |
| 234 | 234 | $val = "'$val'"; |
| 235 | 235 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | } elseif (!strlen($val)) { |
| 239 | 239 | $val = "''"; |
| 240 | 240 | } |
| 241 | - $infos[] = $var . '=' . $val; |
|
| 241 | + $infos[] = $var.'='.$val; |
|
| 242 | 242 | } |
| 243 | 243 | return join(', ', $infos); |
| 244 | 244 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | . "?php include_spip('inc/headers');redirige_par_entete('" |
| 307 | 307 | . texte_script($url) |
| 308 | 308 | . "','',$status);" |
| 309 | - . '?' . '>', |
|
| 309 | + . '?'.'>', |
|
| 310 | 310 | 'process_ins' => 'php', |
| 311 | 311 | 'status' => $status |
| 312 | 312 | ]; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $credentials_ldap = ['ldap_dn' => $dn, 'ldap_password' => $pass]; |
| 69 | 69 | |
| 70 | 70 | // Si l'utilisateur figure deja dans la base, y recuperer les infos |
| 71 | - $r = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login) . " AND source='ldap'", '', '', '', '', $serveur); |
|
| 71 | + $r = sql_fetsel('*', 'spip_auteurs', 'login='.sql_quote($login)." AND source='ldap'", '', '', '', '', $serveur); |
|
| 72 | 72 | |
| 73 | 73 | if ($r) { |
| 74 | 74 | return array_merge($r, $credentials_ldap); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | if ($r) { |
| 93 | 93 | return array_merge( |
| 94 | 94 | $credentials_ldap, |
| 95 | - sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . intval($r), '', '', '', '', $serveur) |
|
| 95 | + sql_fetsel('*', 'spip_auteurs', 'id_auteur='.intval($r), '', '', '', '', $serveur) |
|
| 96 | 96 | ); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $connexion = spip_connect($serveur); |
| 122 | 122 | if (!is_array($connexion['ldap'])) { |
| 123 | 123 | if ($connexion['authentification']['ldap']) { |
| 124 | - $f = _DIR_CONNECT . $connexion['authentification']['ldap']; |
|
| 124 | + $f = _DIR_CONNECT.$connexion['authentification']['ldap']; |
|
| 125 | 125 | unset($GLOBALS['ldap_link']); |
| 126 | 126 | if (is_readable($f)) { |
| 127 | 127 | include_once($f); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | if (!ldap_bind($link, $dn, session_get('ldap_password'))) { |
| 335 | 335 | return false; |
| 336 | 336 | } |
| 337 | - $encoded_pass = '{MD5}' . base64_encode(pack('H*', md5($new_pass))); |
|
| 337 | + $encoded_pass = '{MD5}'.base64_encode(pack('H*', md5($new_pass))); |
|
| 338 | 338 | $success = ldap_mod_replace($link, $dn, ['userPassword' => $encoded_pass]); |
| 339 | 339 | |
| 340 | 340 | return $success; |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | $link = @mysqli_connect($host, $login, $pass); |
| 59 | 59 | } |
| 60 | 60 | } catch (\mysqli_sql_exception $e) { |
| 61 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 61 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 62 | 62 | $link = false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (!$link) { |
| 66 | - spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS); |
|
| 66 | + spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS); |
|
| 67 | 67 | |
| 68 | 68 | return false; |
| 69 | 69 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | spip_log( |
| 85 | - "Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? 'operationnelle' : 'impossible'), |
|
| 85 | + "Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? 'operationnelle' : 'impossible'), |
|
| 86 | 86 | _LOG_DEBUG |
| 87 | 87 | ); |
| 88 | 88 | |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) { |
| 175 | 175 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 176 | - spip_log('changement de charset sql : ' . 'SET NAMES ' . _q($charset), _LOG_DEBUG); |
|
| 176 | + spip_log('changement de charset sql : '.'SET NAMES '._q($charset), _LOG_DEBUG); |
|
| 177 | 177 | |
| 178 | - return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES ' . _q($charset)); |
|
| 178 | + return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES '._q($charset)); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | function spip_mysql_get_charset($charset = [], $serveur = '', $requeter = true) { |
| 191 | 191 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 192 | 192 | $connexion['last'] = $c = 'SHOW CHARACTER SET' |
| 193 | - . (!$charset ? '' : (' LIKE ' . _q($charset['charset']))); |
|
| 193 | + . (!$charset ? '' : (' LIKE '._q($charset['charset']))); |
|
| 194 | 194 | |
| 195 | 195 | return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur); |
| 196 | 196 | } |
@@ -234,21 +234,21 @@ discard block |
||
| 234 | 234 | $debug = ''; |
| 235 | 235 | if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) { |
| 236 | 236 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 237 | - list(, $id, , $infos) = $GLOBALS['debug']['aucasou']; |
|
| 238 | - $debug .= "BOUCLE$id @ " . (isset($infos[0]) ? $infos[0] : '') . ' | '; |
|
| 237 | + list(, $id,, $infos) = $GLOBALS['debug']['aucasou']; |
|
| 238 | + $debug .= "BOUCLE$id @ ".(isset($infos[0]) ? $infos[0] : '').' | '; |
|
| 239 | 239 | } |
| 240 | 240 | if (isset($_SERVER['REQUEST_URI'])) { |
| 241 | 241 | $debug .= $_SERVER['REQUEST_URI']; |
| 242 | 242 | } |
| 243 | 243 | if (!empty($GLOBALS['ip'])) { |
| 244 | - $debug .= ' + ' . $GLOBALS['ip']; |
|
| 244 | + $debug .= ' + '.$GLOBALS['ip']; |
|
| 245 | 245 | } |
| 246 | - $debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */'; |
|
| 246 | + $debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */'; |
|
| 247 | 247 | } |
| 248 | 248 | try { |
| 249 | - $r = mysqli_query($link, $query . $debug); |
|
| 249 | + $r = mysqli_query($link, $query.$debug); |
|
| 250 | 250 | } catch (\mysqli_sql_exception $e) { |
| 251 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 251 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 252 | 252 | $r = false; |
| 253 | 253 | // Todo: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 254 | 254 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 266 | 266 | $link = $connexion['link']; |
| 267 | 267 | //On retente au cas où |
| 268 | - $r = mysqli_query($link, $query . $debug); |
|
| 268 | + $r = mysqli_query($link, $query.$debug); |
|
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | // d'utiliser ceux-ci, copie-colle de phpmyadmin |
| 294 | 294 | $query = preg_replace(',^TABLE\s*`([^`]*)`,i', "TABLE \\1", $query); |
| 295 | 295 | |
| 296 | - return spip_mysql_query('ALTER ' . $query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 296 | + return spip_mysql_query('ALTER '.$query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * @return bool Toujours true |
| 307 | 307 | */ |
| 308 | 308 | function spip_mysql_optimize($table, $serveur = '', $requeter = true) { |
| 309 | - spip_mysql_query('OPTIMIZE TABLE ' . $table); |
|
| 309 | + spip_mysql_query('OPTIMIZE TABLE '.$table); |
|
| 310 | 310 | |
| 311 | 311 | return true; |
| 312 | 312 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $link = $connexion['link']; |
| 330 | 330 | $db = $connexion['db']; |
| 331 | 331 | |
| 332 | - $query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe); |
|
| 332 | + $query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe); |
|
| 333 | 333 | $r = mysqli_query($link, $query); |
| 334 | 334 | |
| 335 | 335 | return spip_mysql_fetch($r, null, $serveur); |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | . calculer_mysql_expression('WHERE', $where) |
| 381 | 381 | . calculer_mysql_expression('GROUP BY', $groupby, ',') |
| 382 | 382 | . calculer_mysql_expression('HAVING', $having) |
| 383 | - . ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '') |
|
| 383 | + . ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '') |
|
| 384 | 384 | . ($limit ? "\nLIMIT $limit" : ''); |
| 385 | 385 | |
| 386 | 386 | // renvoyer la requete inerte si demandee |
@@ -470,12 +470,12 @@ discard block |
||
| 470 | 470 | $exp = "\n$expression "; |
| 471 | 471 | |
| 472 | 472 | if (!is_array($v)) { |
| 473 | - return $exp . $v; |
|
| 473 | + return $exp.$v; |
|
| 474 | 474 | } else { |
| 475 | 475 | if (strtoupper($join) === 'AND') { |
| 476 | - return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 476 | + return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 477 | 477 | } else { |
| 478 | - return $exp . join($join, $v); |
|
| 478 | + return $exp.join($join, $v); |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | } |
@@ -493,17 +493,17 @@ discard block |
||
| 493 | 493 | if (substr($k, -1) == '@') { |
| 494 | 494 | // c'est une jointure qui se refere au from precedent |
| 495 | 495 | // pas de virgule |
| 496 | - $res .= ' ' . $v; |
|
| 496 | + $res .= ' '.$v; |
|
| 497 | 497 | } else { |
| 498 | 498 | if (!is_numeric($k)) { |
| 499 | 499 | $p = strpos($v, ' '); |
| 500 | 500 | if ($p) { |
| 501 | - $v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p); |
|
| 501 | + $v = substr($v, 0, $p)." AS `$k`".substr($v, $p); |
|
| 502 | 502 | } else { |
| 503 | 503 | $v .= " AS `$k`"; |
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | - $res .= ', ' . $v; |
|
| 506 | + $res .= ', '.$v; |
|
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | |
@@ -533,13 +533,13 @@ discard block |
||
| 533 | 533 | function _mysql_traite_query($query, $db = '', $prefixe = '', $echappe_textes = true) { |
| 534 | 534 | |
| 535 | 535 | if ($GLOBALS['mysql_rappel_nom_base'] and $db) { |
| 536 | - $pref = '`' . $db . '`.'; |
|
| 536 | + $pref = '`'.$db.'`.'; |
|
| 537 | 537 | } else { |
| 538 | 538 | $pref = ''; |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | if ($prefixe) { |
| 542 | - $pref .= $prefixe . '_'; |
|
| 542 | + $pref .= $prefixe.'_'; |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) { |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | $suite_echap = $suite; |
| 559 | 559 | } |
| 560 | 560 | if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite_echap, $r)) { |
| 561 | - $suite_echap = $r[1] . _mysql_traite_query($r[2], $db, $prefixe, false); |
|
| 561 | + $suite_echap = $r[1]._mysql_traite_query($r[2], $db, $prefixe, false); |
|
| 562 | 562 | if ($echappe_textes) { |
| 563 | 563 | $suite = query_reinjecte_textes($suite_echap, $textes); |
| 564 | 564 | } |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | - $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite; |
|
| 571 | + $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite; |
|
| 572 | 572 | |
| 573 | 573 | // en option, remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
| 574 | 574 | // remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | $link = _mysql_link($serveur); |
| 605 | 605 | $ok = mysqli_select_db($link, $db); |
| 606 | 606 | if (!$ok) { |
| 607 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 607 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | return $ok; |
@@ -694,10 +694,10 @@ discard block |
||
| 694 | 694 | |
| 695 | 695 | $character_set = ''; |
| 696 | 696 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 697 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 697 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 698 | 698 | } |
| 699 | 699 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 700 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 700 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | foreach ($champs as $k => $v) { |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | preg_match(',(char|text),i', $defs[1]) |
| 708 | 708 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 709 | 709 | ) { |
| 710 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 710 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | 713 | |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | $s = ','; |
| 720 | 720 | } |
| 721 | 721 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 722 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ')' |
|
| 722 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').')' |
|
| 723 | 723 | . ' ENGINE=MyISAM' |
| 724 | 724 | . ($character_set ? " DEFAULT $character_set" : '') |
| 725 | 725 | . "\n"; |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | return false; |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 802 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 803 | 803 | |
| 804 | 804 | return spip_mysql_query($query, $serveur, $requeter); |
| 805 | 805 | } |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | * Ressource à utiliser avec sql_fetch() |
| 858 | 858 | **/ |
| 859 | 859 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 860 | - return spip_mysql_query('SHOW TABLES LIKE ' . _q($match), $serveur, $requeter); |
|
| 860 | + return spip_mysql_query('SHOW TABLES LIKE '._q($match), $serveur, $requeter); |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | /** |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | * Ressource à utiliser avec sql_fetch() |
| 891 | 891 | **/ |
| 892 | 892 | function spip_mysql_table_exists(string $table, $serveur = '', $requeter = true) { |
| 893 | - $r = spip_mysql_query('SHOW TABLES LIKE ' . _q($table), $serveur, $requeter); |
|
| 893 | + $r = spip_mysql_query('SHOW TABLES LIKE '._q($table), $serveur, $requeter); |
|
| 894 | 894 | if (!$requeter) { |
| 895 | 895 | return $r; |
| 896 | 896 | } |
@@ -972,22 +972,22 @@ discard block |
||
| 972 | 972 | } |
| 973 | 973 | if ($val['Default'] === '0' || $val['Default']) { |
| 974 | 974 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 975 | - $nfields[$val['Field']] .= ' DEFAULT ' . $val['Default']; |
|
| 975 | + $nfields[$val['Field']] .= ' DEFAULT '.$val['Default']; |
|
| 976 | 976 | } else { |
| 977 | - $nfields[$val['Field']] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 977 | + $nfields[$val['Field']] .= " DEFAULT '".$val['Default']."'"; |
|
| 978 | 978 | } |
| 979 | 979 | } |
| 980 | 980 | if ($val['Extra']) { |
| 981 | - $nfields[$val['Field']] .= ' ' . $val['Extra']; |
|
| 981 | + $nfields[$val['Field']] .= ' '.$val['Extra']; |
|
| 982 | 982 | } |
| 983 | 983 | if ($val['Key'] == 'PRI') { |
| 984 | 984 | $nkeys['PRIMARY KEY'] = $val['Field']; |
| 985 | 985 | } else { |
| 986 | 986 | if ($val['Key'] == 'MUL') { |
| 987 | - $nkeys['KEY ' . $val['Field']] = $val['Field']; |
|
| 987 | + $nkeys['KEY '.$val['Field']] = $val['Field']; |
|
| 988 | 988 | } else { |
| 989 | 989 | if ($val['Key'] == 'UNI') { |
| 990 | - $nkeys['UNIQUE KEY ' . $val['Field']] = $val['Field']; |
|
| 990 | + $nkeys['UNIQUE KEY '.$val['Field']] = $val['Field']; |
|
| 991 | 991 | } |
| 992 | 992 | } |
| 993 | 993 | } |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | $serveur = '', |
| 1059 | 1059 | $requeter = true |
| 1060 | 1060 | ) { |
| 1061 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1061 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1062 | 1062 | |
| 1063 | 1063 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1064 | 1064 | if (!$requeter) { |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | if ($s) { |
| 1099 | 1099 | $trace = debug_backtrace(); |
| 1100 | 1100 | if ($trace[0]['function'] != 'spip_mysql_error') { |
| 1101 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1101 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1102 | 1102 | } |
| 1103 | 1103 | } |
| 1104 | 1104 | |
@@ -1269,8 +1269,8 @@ discard block |
||
| 1269 | 1269 | |
| 1270 | 1270 | return spip_mysql_insert( |
| 1271 | 1271 | $table, |
| 1272 | - '(' . join(',', array_keys($couples)) . ')', |
|
| 1273 | - '(' . join(',', $couples) . ')', |
|
| 1272 | + '('.join(',', array_keys($couples)).')', |
|
| 1273 | + '('.join(',', $couples).')', |
|
| 1274 | 1274 | $desc, |
| 1275 | 1275 | $serveur, |
| 1276 | 1276 | $requeter |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | } |
| 1308 | 1308 | $fields = isset($desc['field']) ? $desc['field'] : []; |
| 1309 | 1309 | |
| 1310 | - $cles = '(' . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1310 | + $cles = '('.join(',', array_keys(reset($tab_couples))).')'; |
|
| 1311 | 1311 | $valeurs = []; |
| 1312 | 1312 | $r = false; |
| 1313 | 1313 | |
@@ -1316,7 +1316,7 @@ discard block |
||
| 1316 | 1316 | foreach ($couples as $champ => $val) { |
| 1317 | 1317 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1318 | 1318 | } |
| 1319 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1319 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1320 | 1320 | if (count($valeurs) >= 100) { |
| 1321 | 1321 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1322 | 1322 | $valeurs = []; |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | function spip_mysql_update($table, $champs, $where = '', $desc = [], $serveur = '', $requeter = true) { |
| 1354 | 1354 | $set = []; |
| 1355 | 1355 | foreach ($champs as $champ => $val) { |
| 1356 | - $set[] = $champ . "=$val"; |
|
| 1356 | + $set[] = $champ."=$val"; |
|
| 1357 | 1357 | } |
| 1358 | 1358 | if (!empty($set)) { |
| 1359 | 1359 | return spip_mysql_query( |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | } |
| 1410 | 1410 | $set = []; |
| 1411 | 1411 | foreach ($champs as $champ => $val) { |
| 1412 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1412 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | 1415 | return spip_mysql_query( |
@@ -1478,10 +1478,10 @@ discard block |
||
| 1478 | 1478 | * - False en cas d'erreur. |
| 1479 | 1479 | **/ |
| 1480 | 1480 | function spip_mysql_replace($table, $couples, $desc = [], $serveur = '', $requeter = true) { |
| 1481 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1481 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1482 | 1482 | ',', |
| 1483 | 1483 | array_map('_q', $couples) |
| 1484 | - ) . ')', $serveur, $requeter); |
|
| 1484 | + ).')', $serveur, $requeter); |
|
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | |
@@ -1510,10 +1510,10 @@ discard block |
||
| 1510 | 1510 | * - False en cas d'erreur. |
| 1511 | 1511 | **/ |
| 1512 | 1512 | function spip_mysql_replace_multi($table, $tab_couples, $desc = [], $serveur = '', $requeter = true) { |
| 1513 | - $cles = '(' . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1513 | + $cles = '('.join(',', array_keys($tab_couples[0])).')'; |
|
| 1514 | 1514 | $valeurs = []; |
| 1515 | 1515 | foreach ($tab_couples as $couples) { |
| 1516 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1516 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1517 | 1517 | } |
| 1518 | 1518 | $valeurs = implode(', ', $valeurs); |
| 1519 | 1519 | |
@@ -1533,28 +1533,28 @@ discard block |
||
| 1533 | 1533 | */ |
| 1534 | 1534 | function spip_mysql_multi($objet, $lang) { |
| 1535 | 1535 | $lengthlang = strlen("[$lang]"); |
| 1536 | - $posmulti = 'INSTR(' . $objet . ", '<multi>')"; |
|
| 1537 | - $posfinmulti = 'INSTR(' . $objet . ", '</multi>')"; |
|
| 1538 | - $debutchaine = 'LEFT(' . $objet . ", $posmulti-1)"; |
|
| 1539 | - $finchaine = 'RIGHT(' . $objet . ', CHAR_LENGTH(' . $objet . ") -(7+$posfinmulti))"; |
|
| 1540 | - $chainemulti = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1541 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1536 | + $posmulti = 'INSTR('.$objet.", '<multi>')"; |
|
| 1537 | + $posfinmulti = 'INSTR('.$objet.", '</multi>')"; |
|
| 1538 | + $debutchaine = 'LEFT('.$objet.", $posmulti-1)"; |
|
| 1539 | + $finchaine = 'RIGHT('.$objet.', CHAR_LENGTH('.$objet.") -(7+$posfinmulti))"; |
|
| 1540 | + $chainemulti = 'TRIM(SUBSTRING('.$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1541 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1542 | 1542 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1543 | - $chainelang = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1544 | - $posfinlang = 'INSTR(' . $chainelang . ", '[')"; |
|
| 1543 | + $chainelang = 'TRIM(SUBSTRING('.$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1544 | + $posfinlang = 'INSTR('.$chainelang.", '[')"; |
|
| 1545 | 1545 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1546 | 1546 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1547 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1548 | - ' TRIM(' . $objet . '), ' . |
|
| 1549 | - ' CONCAT( ' . |
|
| 1550 | - " $debutchaine, " . |
|
| 1551 | - ' IF( ' . |
|
| 1552 | - " $poslang = 0, " . |
|
| 1553 | - " $chainemulti, " . |
|
| 1554 | - " $chainelang" . |
|
| 1555 | - ' ), ' . |
|
| 1556 | - " $finchaine" . |
|
| 1557 | - ' ) ' . |
|
| 1547 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1548 | + ' TRIM('.$objet.'), '. |
|
| 1549 | + ' CONCAT( '. |
|
| 1550 | + " $debutchaine, ". |
|
| 1551 | + ' IF( '. |
|
| 1552 | + " $poslang = 0, ". |
|
| 1553 | + " $chainemulti, ". |
|
| 1554 | + " $chainelang". |
|
| 1555 | + ' ), '. |
|
| 1556 | + " $finchaine". |
|
| 1557 | + ' ) '. |
|
| 1558 | 1558 | '))) AS multi'; |
| 1559 | 1559 | |
| 1560 | 1560 | return $retour; |
@@ -1571,7 +1571,7 @@ discard block |
||
| 1571 | 1571 | * Valeur hexadécimale pour MySQL |
| 1572 | 1572 | **/ |
| 1573 | 1573 | function spip_mysql_hex($v) { |
| 1574 | - return '0x' . $v; |
|
| 1574 | + return '0x'.$v; |
|
| 1575 | 1575 | } |
| 1576 | 1576 | |
| 1577 | 1577 | /** |
@@ -1611,7 +1611,7 @@ discard block |
||
| 1611 | 1611 | * Expression SQL |
| 1612 | 1612 | **/ |
| 1613 | 1613 | function spip_mysql_date_proche($champ, $interval, $unite) { |
| 1614 | - $use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false ); |
|
| 1614 | + $use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false); |
|
| 1615 | 1615 | return '(' |
| 1616 | 1616 | . $champ |
| 1617 | 1617 | . (($interval <= 0) ? '>' : '<') |
@@ -1666,7 +1666,7 @@ discard block |
||
| 1666 | 1666 | } elseif ($v === null) { |
| 1667 | 1667 | return "''"; |
| 1668 | 1668 | } |
| 1669 | - return "'" . addslashes($v) . "'"; |
|
| 1669 | + return "'".addslashes($v)."'"; |
|
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | if ($v === null) { |
@@ -1690,7 +1690,7 @@ discard block |
||
| 1690 | 1690 | } |
| 1691 | 1691 | } |
| 1692 | 1692 | |
| 1693 | - return ("'" . addslashes($v) . "'"); |
|
| 1693 | + return ("'".addslashes($v)."'"); |
|
| 1694 | 1694 | } |
| 1695 | 1695 | |
| 1696 | 1696 | /** |
@@ -1724,7 +1724,7 @@ discard block |
||
| 1724 | 1724 | } else { |
| 1725 | 1725 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1726 | 1726 | |
| 1727 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1727 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1728 | 1728 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1729 | 1729 | } |
| 1730 | 1730 | } |
@@ -553,16 +553,14 @@ |
||
| 553 | 553 | if (stripos($suite, 'SELECT') !== false) { |
| 554 | 554 | if ($echappe_textes) { |
| 555 | 555 | list($suite_echap, $textes) = query_echappe_textes($suite); |
| 556 | - } |
|
| 557 | - else { |
|
| 556 | + } else { |
|
| 558 | 557 | $suite_echap = $suite; |
| 559 | 558 | } |
| 560 | 559 | if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite_echap, $r)) { |
| 561 | 560 | $suite_echap = $r[1] . _mysql_traite_query($r[2], $db, $prefixe, false); |
| 562 | 561 | if ($echappe_textes) { |
| 563 | 562 | $suite = query_reinjecte_textes($suite_echap, $textes); |
| 564 | - } |
|
| 565 | - else { |
|
| 563 | + } else { |
|
| 566 | 564 | $suite = $suite_echap; |
| 567 | 565 | } |
| 568 | 566 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $titre = '[' |
| 91 | 91 | . $nom_site_spip |
| 92 | 92 | . ']' |
| 93 | - . ($titre ? ' ' . textebrut(typo($titre)) : ''); |
|
| 93 | + . ($titre ? ' '.textebrut(typo($titre)) : ''); |
|
| 94 | 94 | |
| 95 | 95 | return _DOCTYPE_ECRIRE |
| 96 | 96 | . html_lang_attributes() |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | function init_body($rubrique = 'accueil', $sous_rubrique = 'accueil', $id_rubrique = '', $menu = true) { |
| 134 | 134 | |
| 135 | 135 | $res = pipeline('body_prive', "<body class='" |
| 136 | - . init_body_class() . ' ' . _request('exec') . "'" |
|
| 136 | + . init_body_class().' '._request('exec')."'" |
|
| 137 | 137 | . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '') |
| 138 | 138 | . '>'); |
| 139 | 139 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $couleur = intval($prefs['couleur'] ?? 2); |
| 176 | 176 | |
| 177 | - $classes = $GLOBALS['spip_ecran'] . " spip-theme-colors-$couleur $spip_display_navigation $spip_display_outils " . $display_class[$GLOBALS['spip_display']]; |
|
| 177 | + $classes = $GLOBALS['spip_ecran']." spip-theme-colors-$couleur $spip_display_navigation $spip_display_outils ".$display_class[$GLOBALS['spip_display']]; |
|
| 178 | 178 | return spip_sanitize_classname($classes); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | return $r ? $r : traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | -define('_EXTRAIRE_LIEN', ',^\s*(?:' . _PROTOCOLES_STD . '):?/?/?\s*$,iS'); |
|
| 105 | +define('_EXTRAIRE_LIEN', ',^\s*(?:'._PROTOCOLES_STD.'):?/?/?\s*$,iS'); |
|
| 106 | 106 | |
| 107 | 107 | // https://code.spip.net/@traiter_lien_explicite |
| 108 | 108 | function traiter_lien_explicite($ref, $texte = '', $pour = 'url', string $connect = '', $echappe_typo = true) { |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | $lien_court = charger_fonction('lien_court', 'inc'); |
| 120 | 120 | $texte = $lien_court($texte); |
| 121 | 121 | if ($echappe_typo) { |
| 122 | - $texte = '<html>' . quote_amp($texte) . '</html>'; |
|
| 122 | + $texte = '<html>'.quote_amp($texte).'</html>'; |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // petites corrections d'URL |
| 127 | 127 | if (preg_match('/^www\.[^@]+$/S', $lien)) { |
| 128 | - $lien = 'http://' . $lien; |
|
| 128 | + $lien = 'http://'.$lien; |
|
| 129 | 129 | } else { |
| 130 | 130 | if (strpos($lien, '@') && email_valide($lien)) { |
| 131 | 131 | if (!$texte) { |
| 132 | 132 | $texte = $lien; |
| 133 | 133 | } |
| 134 | - $lien = 'mailto:' . $lien; |
|
| 134 | + $lien = 'mailto:'.$lien; |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | function liens_implicite_glose_dist($texte, $id, $type, $args, $ancre, string $connect = '') { |
| 150 | - if (function_exists($f = 'glossaire_' . $ancre)) { |
|
| 150 | + if (function_exists($f = 'glossaire_'.$ancre)) { |
|
| 151 | 151 | $url = $f($texte, $id); |
| 152 | 152 | } else { |
| 153 | 153 | $url = glossaire_std($texte); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | if (!($match = typer_raccourci($ref))) { |
| 162 | 162 | return false; |
| 163 | 163 | } |
| 164 | - @list($type, , $id, , $args, , $ancre) = $match; |
|
| 164 | + @list($type,, $id,, $args,, $ancre) = $match; |
|
| 165 | 165 | // attention dans le cas des sites le lien doit pointer non pas sur |
| 166 | 166 | // la page locale du site, mais directement sur le site lui-meme |
| 167 | 167 | if ($f = charger_fonction("implicite_$type", 'liens', true)) { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $r['titre'] = $texte; |
| 189 | 189 | } |
| 190 | 190 | if (!@$r['titre']) { |
| 191 | - $r['titre'] = _T($type) . " $id"; |
|
| 191 | + $r['titre'] = _T($type)." $id"; |
|
| 192 | 192 | } |
| 193 | 193 | if ($pour == 'titre') { |
| 194 | 194 | return $r['titre']; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | and $mime = sql_getfetsel( |
| 202 | 202 | 'mime_type', |
| 203 | 203 | 'spip_types_documents', |
| 204 | - 'extension IN (' . sql_get_select('extension', 'spip_documents', 'id_document=' . sql_quote($id)) . ')', |
|
| 204 | + 'extension IN ('.sql_get_select('extension', 'spip_documents', 'id_document='.sql_quote($id)).')', |
|
| 205 | 205 | '', |
| 206 | 206 | '', |
| 207 | 207 | '', |
@@ -304,11 +304,11 @@ discard block |
||
| 304 | 304 | '(<([a-z_-]{3,})' # <modele |
| 305 | 305 | . '\s*([0-9]*)\s*' # id |
| 306 | 306 | . '([|](?:<[^<>]*>|[^>])*?)?' # |arguments (y compris des tags <...>) |
| 307 | - . '\s*/?' . '>)' # fin du modele > |
|
| 307 | + . '\s*/?'.'>)' # fin du modele > |
|
| 308 | 308 | . '\s*(<\/a>)?' # eventuel </a> |
| 309 | 309 | ); |
| 310 | 310 | |
| 311 | -define('_RACCOURCI_MODELE_DEBUT', '@^' . _RACCOURCI_MODELE . '@isS'); |
|
| 311 | +define('_RACCOURCI_MODELE_DEBUT', '@^'._RACCOURCI_MODELE.'@isS'); |
|
| 312 | 312 | |
| 313 | 313 | // https://code.spip.net/@traiter_modeles |
| 314 | 314 | function traiter_modeles($texte, $doublons = false, $echap = '', string $connect = '', $liens = null, $env = []) { |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | if (test_espace_prive()) { |
| 389 | 389 | $modele = entites_html(substr($texte, $a, $cherche)); |
| 390 | 390 | if (!is_null($liens)) { |
| 391 | - $modele = '<pre>' . str_replace($liens[0], $liens[1], $modele) . '</pre>'; |
|
| 391 | + $modele = '<pre>'.str_replace($liens[0], $liens[1], $modele).'</pre>'; |
|
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | } |