@@ -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 = array("'='", "'$boucle->id_table." . "$id_parent'", 0); |
|
| 51 | + $c = array("'='", "'$boucle->id_table."."$id_parent'", 0); |
|
| 53 | 52 | $boucle->where[] = ($crit->not ? array("'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 (array('zbug_critere_inconnu', array('critere' => $not . $crit->op))); |
|
| 74 | + return (array('zbug_critere_inconnu', array('critere' => $not.$crit->op))); |
|
| 76 | 75 | } |
| 77 | 76 | $arg = kwote(calculer_argument_precedent($idb, $id, $boucles)); |
| 78 | - $boucle->where[] = array("'!='", "'$boucle->id_table." . "$id'", $arg); |
|
| 77 | + $boucle->where[] = array("'!='", "'$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[] = array($debut_doub . $fin_doub . ", '" . $not . "')"); |
|
| 153 | + $boucle->where[] = array($debut_doub.$fin_doub.", '".$not."')"); |
|
| 155 | 154 | |
| 156 | 155 | // déclarer le doublon s'il n'existe pas encore |
| 157 | - $boucle->hash .= $init_comment . $init_code; |
|
| 156 | + $boucle->hash .= $init_comment.$init_code; |
|
| 158 | 157 | |
| 159 | 158 | |
| 160 | 159 | # la ligne suivante avait l'intention d'eviter une collecte deja faite |
@@ -215,10 +214,10 @@ discard block |
||
| 215 | 214 | $un = $un[0]->texte; |
| 216 | 215 | $deux = $deux[0]->texte; |
| 217 | 216 | if ($deux) { |
| 218 | - $boucles[$idb]->limit = 'intval($Pile[0]["debut' . |
|
| 219 | - $un . |
|
| 220 | - '"]) . ",' . |
|
| 221 | - $deux . |
|
| 217 | + $boucles[$idb]->limit = 'intval($Pile[0]["debut'. |
|
| 218 | + $un. |
|
| 219 | + '"]) . ",'. |
|
| 220 | + $deux. |
|
| 222 | 221 | '"'; |
| 223 | 222 | } else { |
| 224 | 223 | calculer_critere_DEFAUT_dist($idb, $boucles, $crit); |
@@ -281,26 +280,26 @@ discard block |
||
| 281 | 280 | $type = calculer_liste(array($crit->param[1][0]), $idb, $boucles, $boucle->id_parent); |
| 282 | 281 | } |
| 283 | 282 | |
| 284 | - $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut" . substr($type, 1)); |
|
| 283 | + $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut".substr($type, 1)); |
|
| 285 | 284 | $boucle->modificateur['debut_nom'] = $type; |
| 286 | 285 | $partie = |
| 287 | 286 | // tester si le numero de page demande est de la forme '@yyy' |
| 288 | - 'isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : _request(' . $debut . ");\n" |
|
| 287 | + 'isset($Pile[0]['.$debut.']) ? $Pile[0]['.$debut.'] : _request('.$debut.");\n" |
|
| 289 | 288 | . "\tif(substr(\$debut_boucle,0,1)=='@'){\n" |
| 290 | - . "\t\t" . '$debut_boucle = $Pile[0][' . $debut . '] = quete_debut_pagination(\'' . $boucle->primary . '\',$Pile[0][\'@' . $boucle->primary . '\'] = substr($debut_boucle,1),' . $pas . ',$iter);' . "\n" |
|
| 291 | - . "\t\t" . '$iter->seek(0);' . "\n" |
|
| 289 | + . "\t\t".'$debut_boucle = $Pile[0]['.$debut.'] = quete_debut_pagination(\''.$boucle->primary.'\',$Pile[0][\'@'.$boucle->primary.'\'] = substr($debut_boucle,1),'.$pas.',$iter);'."\n" |
|
| 290 | + . "\t\t".'$iter->seek(0);'."\n" |
|
| 292 | 291 | . "\t}\n" |
| 293 | - . "\t" . '$debut_boucle = intval($debut_boucle)'; |
|
| 292 | + . "\t".'$debut_boucle = intval($debut_boucle)'; |
|
| 294 | 293 | |
| 295 | 294 | $boucle->hash .= ' |
| 296 | - $command[\'pagination\'] = array((isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : null), ' . $pas . ');'; |
|
| 295 | + $command[\'pagination\'] = array((isset($Pile[0][' . $debut.']) ? $Pile[0]['.$debut.'] : null), '.$pas.');'; |
|
| 297 | 296 | |
| 298 | 297 | $boucle->total_parties = $pas; |
| 299 | 298 | calculer_parties($boucles, $idb, $partie, 'p+'); |
| 300 | 299 | // ajouter la cle primaire dans le select pour pouvoir gerer la pagination referencee par @id |
| 301 | 300 | // sauf si pas de primaire, ou si primaire composee |
| 302 | 301 | // dans ce cas, on ne sait pas gerer une pagination indirecte |
| 303 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 302 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 304 | 303 | if ($boucle->primary |
| 305 | 304 | and !preg_match('/[,\s]/', $boucle->primary) |
| 306 | 305 | and !in_array($t, $boucle->select) |
@@ -346,24 +345,24 @@ discard block |
||
| 346 | 345 | $boucle->hash .= ' |
| 347 | 346 | // RECHERCHE' |
| 348 | 347 | . ($crit->cond ? ' |
| 349 | - if (!strlen(' . $quoi . ')){ |
|
| 348 | + if (!strlen(' . $quoi.')){ |
|
| 350 | 349 | list($rech_select, $rech_where) = array("0 as points",""); |
| 351 | - } else' : '') . ' |
|
| 350 | + } else' : '').' |
|
| 352 | 351 | { |
| 353 | 352 | $prepare_recherche = charger_fonction(\'prepare_recherche\', \'inc\'); |
| 354 | - list($rech_select, $rech_where) = $prepare_recherche(' . $quoi . ', "' . $boucle->id_table . '", "' . $crit->cond . '","' . $boucle->sql_serveur . '",' . $_modificateur . ',"' . $boucle->primary . '"); |
|
| 353 | + list($rech_select, $rech_where) = $prepare_recherche(' . $quoi.', "'.$boucle->id_table.'", "'.$crit->cond.'","'.$boucle->sql_serveur.'",'.$_modificateur.',"'.$boucle->primary.'"); |
|
| 355 | 354 | } |
| 356 | 355 | '; |
| 357 | 356 | |
| 358 | 357 | |
| 359 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 358 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 360 | 359 | if (!in_array($t, $boucles[$idb]->select)) { |
| 361 | 360 | $boucle->select[] = $t; |
| 362 | 361 | } # pour postgres, neuneu ici |
| 363 | 362 | // jointure uniquement sur le serveur principal |
| 364 | 363 | // (on ne peut joindre une table d'un serveur distant avec la table des resultats du serveur principal) |
| 365 | 364 | if (!$boucle->sql_serveur) { |
| 366 | - $boucle->join['resultats'] = array("'" . $boucle->id_table . "'", "'id'", "'" . $boucle->primary . "'"); |
|
| 365 | + $boucle->join['resultats'] = array("'".$boucle->id_table."'", "'id'", "'".$boucle->primary."'"); |
|
| 367 | 366 | $boucle->from['resultats'] = 'spip_resultats'; |
| 368 | 367 | } |
| 369 | 368 | $boucle->select[] = '$rech_select'; |
@@ -430,7 +429,7 @@ discard block |
||
| 430 | 429 | $c = |
| 431 | 430 | array( |
| 432 | 431 | "'OR'", |
| 433 | - array("'='", "'$table." . "id_trad'", "'$table.$prim'"), |
|
| 432 | + array("'='", "'$table."."id_trad'", "'$table.$prim'"), |
|
| 434 | 433 | array("'='", "'$table.id_trad'", "'0'") |
| 435 | 434 | ); |
| 436 | 435 | $boucle->where[] = ($crit->not ? array("'NOT'", $c) : $c); |
@@ -453,16 +452,15 @@ discard block |
||
| 453 | 452 | $boucle = &$boucles[$idb]; |
| 454 | 453 | $arg = kwote(calculer_argument_precedent($idb, 'id_parent', $boucles)); |
| 455 | 454 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 456 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 457 | - 'id_parent'; |
|
| 458 | - $mparent = $boucle->id_table . '.' . $id_parent; |
|
| 455 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 456 | + $mparent = $boucle->id_table.'.'.$id_parent; |
|
| 459 | 457 | |
| 460 | 458 | if ($boucle->type_requete == 'rubriques' or isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'])) { |
| 461 | 459 | $boucle->where[] = array("'='", "'$mparent'", $arg); |
| 462 | 460 | |
| 463 | 461 | } // le cas FORUMS est gere dans le plugin forum, dans la fonction critere_FORUMS_meme_parent_dist() |
| 464 | 462 | else { |
| 465 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . ' ' . $boucle->type_requete))); |
|
| 463 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op.' '.$boucle->type_requete))); |
|
| 466 | 464 | } |
| 467 | 465 | } |
| 468 | 466 | |
@@ -515,16 +513,15 @@ discard block |
||
| 515 | 513 | if (count(trouver_champs_decomposes($champ, $desc)) > 1) { |
| 516 | 514 | $decompose = decompose_champ_id_objet($champ); |
| 517 | 515 | $champ = array_shift($decompose); |
| 518 | - $boucle->where[] = array("'='", _q($cle . "." . reset($decompose)), '"' . sql_quote(end($decompose)) . '"'); |
|
| 516 | + $boucle->where[] = array("'='", _q($cle.".".reset($decompose)), '"'.sql_quote(end($decompose)).'"'); |
|
| 519 | 517 | } |
| 520 | 518 | } else { |
| 521 | 519 | $cle = $boucle->id_table; |
| 522 | 520 | } |
| 523 | 521 | |
| 524 | - $c = "sql_in('$cle" . ".$champ', calcul_branche_in($arg)" |
|
| 525 | - . ($not ? ", 'NOT'" : '') . ")"; |
|
| 526 | - $boucle->where[] = !$crit->cond ? $c : |
|
| 527 | - ("($arg ? $c : " . ($not ? "'0=1'" : "'1=1'") . ')'); |
|
| 522 | + $c = "sql_in('$cle".".$champ', calcul_branche_in($arg)" |
|
| 523 | + . ($not ? ", 'NOT'" : '').")"; |
|
| 524 | + $boucle->where[] = !$crit->cond ? $c : ("($arg ? $c : ".($not ? "'0=1'" : "'1=1'").')'); |
|
| 528 | 525 | } |
| 529 | 526 | |
| 530 | 527 | /** |
@@ -544,9 +541,9 @@ discard block |
||
| 544 | 541 | $not = ($crit->not ? 'NOT' : ''); |
| 545 | 542 | $serveur = $boucle->sql_serveur; |
| 546 | 543 | |
| 547 | - $c = "sql_in('" . |
|
| 548 | - $boucle->id_table . '.' . $boucle->primary |
|
| 549 | - . "', lister_objets_avec_logos('" . $boucle->primary . "'), '$not', '$serveur')"; |
|
| 544 | + $c = "sql_in('". |
|
| 545 | + $boucle->id_table.'.'.$boucle->primary |
|
| 546 | + . "', lister_objets_avec_logos('".$boucle->primary."'), '$not', '$serveur')"; |
|
| 550 | 547 | |
| 551 | 548 | $boucle->where[] = $c; |
| 552 | 549 | } |
@@ -578,7 +575,7 @@ discard block |
||
| 578 | 575 | $t = table_objet_sql($r[1]); |
| 579 | 576 | $t = array_search($t, $boucles[$idb]->from); |
| 580 | 577 | if ($t) { |
| 581 | - $t .= '.' . $r[2]; |
|
| 578 | + $t .= '.'.$r[2]; |
|
| 582 | 579 | } |
| 583 | 580 | } |
| 584 | 581 | } else { |
@@ -593,7 +590,7 @@ discard block |
||
| 593 | 590 | $boucles[$idb]->select[] = $t; |
| 594 | 591 | } |
| 595 | 592 | } else { |
| 596 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . ' ?'))); |
|
| 593 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op.' ?'))); |
|
| 597 | 594 | } |
| 598 | 595 | } |
| 599 | 596 | |
@@ -613,7 +610,7 @@ discard block |
||
| 613 | 610 | * @param Critere $crit Paramètres du critère dans cette boucle |
| 614 | 611 | * @return void |
| 615 | 612 | **/ |
| 616 | -function critere_fusion_supprimer_dist($idb, &$boucles, $crit){ |
|
| 613 | +function critere_fusion_supprimer_dist($idb, &$boucles, $crit) { |
|
| 617 | 614 | $boucles[$idb]->group = array(); |
| 618 | 615 | } |
| 619 | 616 | |
@@ -663,26 +660,26 @@ discard block |
||
| 663 | 660 | (false !== $i = strpos($boucle->order[$n - 1], 'ASC')) |
| 664 | 661 | OR (false !== $i = strpos($boucle->order[$n - 1], 'DESC')) |
| 665 | 662 | ) { |
| 666 | - $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . " . $boucle->modificateur['collate'] . " . ' ", $i, 0); |
|
| 663 | + $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . ".$boucle->modificateur['collate']." . ' ", $i, 0); |
|
| 667 | 664 | } else { |
| 668 | - $boucle->order[$n - 1] .= " . " . $boucle->modificateur['collate']; |
|
| 665 | + $boucle->order[$n - 1] .= " . ".$boucle->modificateur['collate']; |
|
| 669 | 666 | } |
| 670 | 667 | } |
| 671 | 668 | } else { |
| 672 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . " " . count($boucles[$idb]->order)))); |
|
| 669 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op." ".count($boucles[$idb]->order)))); |
|
| 673 | 670 | } |
| 674 | 671 | } |
| 675 | 672 | |
| 676 | 673 | // https://code.spip.net/@calculer_critere_arg_dynamique |
| 677 | 674 | function calculer_critere_arg_dynamique($idb, &$boucles, $crit, $suffix = '') { |
| 678 | 675 | $boucle = $boucles[$idb]; |
| 679 | - $alt = "('" . $boucle->id_table . '.\' . $x' . $suffix . ')'; |
|
| 680 | - $var = '$champs_' . $idb; |
|
| 676 | + $alt = "('".$boucle->id_table.'.\' . $x'.$suffix.')'; |
|
| 677 | + $var = '$champs_'.$idb; |
|
| 681 | 678 | $desc = (strpos($boucle->in, "static $var =") !== false); |
| 682 | 679 | if (!$desc) { |
| 683 | 680 | $desc = $boucle->show['field']; |
| 684 | 681 | $desc = implode(',', array_map('_q', array_keys($desc))); |
| 685 | - $boucles[$idb]->in .= "\n\tstatic $var = array(" . $desc . ");"; |
|
| 682 | + $boucles[$idb]->in .= "\n\tstatic $var = array(".$desc.");"; |
|
| 686 | 683 | } |
| 687 | 684 | if ($desc) { |
| 688 | 685 | $alt = "(in_array(\$x, $var) ? $alt :(\$x$suffix))"; |
@@ -757,7 +754,7 @@ discard block |
||
| 757 | 754 | $sens = " . ' DESC'"; |
| 758 | 755 | } |
| 759 | 756 | if (isset($boucle->modificateur['collate'])) { |
| 760 | - $collecte = ' . ' . $boucle->modificateur['collate']; |
|
| 757 | + $collecte = ' . '.$boucle->modificateur['collate']; |
|
| 761 | 758 | } |
| 762 | 759 | |
| 763 | 760 | // Pour chaque paramètre du critère |
@@ -779,14 +776,14 @@ discard block |
||
| 779 | 776 | if (preg_match(",^(\w+)[\s]+(.*)$,", $par, $m)) { |
| 780 | 777 | $expression = trim($m[1]); |
| 781 | 778 | $champ = trim($m[2]); |
| 782 | - if (function_exists($f = 'calculer_critere_par_expression_' . $expression)) { |
|
| 779 | + if (function_exists($f = 'calculer_critere_par_expression_'.$expression)) { |
|
| 783 | 780 | $order = $f($idb, $boucles, $crit, $tri, $champ); |
| 784 | 781 | } else { |
| 785 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 782 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 786 | 783 | } |
| 787 | 784 | |
| 788 | 785 | // tris de la forme {par champ} ou {par FONCTION(champ)} |
| 789 | - } elseif (preg_match(",^" . CHAMP_SQL_PLUS_FONC . '$,is', $par, $match)) { |
|
| 786 | + } elseif (preg_match(",^".CHAMP_SQL_PLUS_FONC.'$,is', $par, $match)) { |
|
| 790 | 787 | // {par FONCTION(champ)} |
| 791 | 788 | if (count($match) > 2) { |
| 792 | 789 | $par = substr($match[2], 1, -1); |
@@ -796,7 +793,7 @@ discard block |
||
| 796 | 793 | if ($par == 'hasard') { |
| 797 | 794 | $order = calculer_critere_par_hasard($idb, $boucles, $crit); |
| 798 | 795 | } elseif ($par == 'date' and !empty($boucle->show['date'])) { |
| 799 | - $order = "'" . $boucle->id_table . "." . $boucle->show['date'] . "'"; |
|
| 796 | + $order = "'".$boucle->id_table.".".$boucle->show['date']."'"; |
|
| 800 | 797 | } else { |
| 801 | 798 | // cas général {par champ}, {par table.champ}, ... |
| 802 | 799 | $order = calculer_critere_par_champ($idb, $boucles, $crit, $par); |
@@ -805,7 +802,7 @@ discard block |
||
| 805 | 802 | |
| 806 | 803 | // on ne sait pas traiter… |
| 807 | 804 | else { |
| 808 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 805 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 809 | 806 | } |
| 810 | 807 | |
| 811 | 808 | // En cas d'erreur de squelette retournée par une fonction |
@@ -825,14 +822,14 @@ discard block |
||
| 825 | 822 | |
| 826 | 823 | if ($fct) { |
| 827 | 824 | if (preg_match("/^\s*'(.*)'\s*$/", $order, $r)) { |
| 828 | - $order = "'$fct(" . $r[1] . ")'"; |
|
| 825 | + $order = "'$fct(".$r[1].")'"; |
|
| 829 | 826 | } else { |
| 830 | 827 | $order = "'$fct(' . $order . ')'"; |
| 831 | 828 | } |
| 832 | 829 | } |
| 833 | - $t = $order . $collecte . $sens; |
|
| 830 | + $t = $order.$collecte.$sens; |
|
| 834 | 831 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 835 | - $t = $r[1] . $r[2]; |
|
| 832 | + $t = $r[1].$r[2]; |
|
| 836 | 833 | } |
| 837 | 834 | |
| 838 | 835 | $boucle->order[] = $t; |
@@ -882,16 +879,16 @@ discard block |
||
| 882 | 879 | function calculer_critere_par_expression_num($idb, &$boucles, $crit, $tri, $champ) { |
| 883 | 880 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 884 | 881 | if (is_array($_champ)) { |
| 885 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " num $champ")); |
|
| 882 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." num $champ")); |
|
| 886 | 883 | } |
| 887 | 884 | $boucle = &$boucles[$idb]; |
| 888 | - $texte = '0+' . $_champ; |
|
| 885 | + $texte = '0+'.$_champ; |
|
| 889 | 886 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 890 | 887 | if ($suite !== "''") { |
| 891 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \""; |
|
| 888 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \""; |
|
| 892 | 889 | } |
| 893 | - $asnum = 'num' . ($boucle->order ? count($boucle->order) : ""); |
|
| 894 | - $boucle->select[] = $texte . " AS $asnum"; |
|
| 890 | + $asnum = 'num'.($boucle->order ? count($boucle->order) : ""); |
|
| 891 | + $boucle->select[] = $texte." AS $asnum"; |
|
| 895 | 892 | |
| 896 | 893 | $orderassinum = calculer_critere_par_expression_sinum($idb, $boucles, $crit, $tri, $champ); |
| 897 | 894 | $orderassinum = trim($orderassinum, "'"); |
@@ -920,13 +917,13 @@ discard block |
||
| 920 | 917 | function calculer_critere_par_expression_sinum($idb, &$boucles, $crit, $tri, $champ) { |
| 921 | 918 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 922 | 919 | if (is_array($_champ)) { |
| 923 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " sinum $champ")); |
|
| 920 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." sinum $champ")); |
|
| 924 | 921 | } |
| 925 | 922 | $boucle = &$boucles[$idb]; |
| 926 | - $texte = '0+' . $_champ; |
|
| 923 | + $texte = '0+'.$_champ; |
|
| 927 | 924 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 928 | 925 | if ($suite !== "''") { |
| 929 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \""; |
|
| 926 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \""; |
|
| 930 | 927 | } |
| 931 | 928 | |
| 932 | 929 | $as = false; |
@@ -942,8 +939,8 @@ discard block |
||
| 942 | 939 | } |
| 943 | 940 | |
| 944 | 941 | if (!$as) { |
| 945 | - $as = 'sinum' . ($boucle->order ? count($boucle->order) : ""); |
|
| 946 | - $boucle->select[] = $select . $as; |
|
| 942 | + $as = 'sinum'.($boucle->order ? count($boucle->order) : ""); |
|
| 943 | + $boucle->select[] = $select.$as; |
|
| 947 | 944 | } |
| 948 | 945 | $order = "'$as'"; |
| 949 | 946 | return $order; |
@@ -968,10 +965,10 @@ discard block |
||
| 968 | 965 | function calculer_critere_par_expression_multi($idb, &$boucles, $crit, $tri, $champ) { |
| 969 | 966 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 970 | 967 | if (is_array($_champ)) { |
| 971 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " multi $champ")); |
|
| 968 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." multi $champ")); |
|
| 972 | 969 | } |
| 973 | 970 | $boucle = &$boucles[$idb]; |
| 974 | - $boucle->select[] = "\".sql_multi('" . $_champ . "', \$GLOBALS['spip_lang']).\""; |
|
| 971 | + $boucle->select[] = "\".sql_multi('".$_champ."', \$GLOBALS['spip_lang']).\""; |
|
| 975 | 972 | $order = "'multi'"; |
| 976 | 973 | return $order; |
| 977 | 974 | } |
@@ -991,13 +988,13 @@ discard block |
||
| 991 | 988 | * @param bool $raw Retourne le champ pour le compilateur ("'alias.champ'") ou brut ('alias.champ') |
| 992 | 989 | * @return array|string |
| 993 | 990 | */ |
| 994 | -function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) { |
|
| 991 | +function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) { |
|
| 995 | 992 | $boucle = &$boucles[$idb]; |
| 996 | 993 | $desc = $boucle->show; |
| 997 | 994 | |
| 998 | 995 | // le champ existe dans la table, pas de souci (le plus commun) |
| 999 | 996 | if (isset($desc['field'][$par])) { |
| 1000 | - $par = $boucle->id_table . "." . $par; |
|
| 997 | + $par = $boucle->id_table.".".$par; |
|
| 1001 | 998 | } |
| 1002 | 999 | // le champ est peut être une jointure |
| 1003 | 1000 | else { |
@@ -1018,24 +1015,24 @@ discard block |
||
| 1018 | 1015 | // Sinon on cherche le champ dans les tables possibles de jointures |
| 1019 | 1016 | // Si la table est déjà dans le from, on la réutilise. |
| 1020 | 1017 | if ($infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $table)) { |
| 1021 | - $par = $infos['alias'] . "." . $champ; |
|
| 1018 | + $par = $infos['alias'].".".$champ; |
|
| 1022 | 1019 | } elseif ( |
| 1023 | 1020 | $boucle->jointures_explicites |
| 1024 | 1021 | and $alias = trouver_jointure_champ($champ, $boucle, explode(' ', $boucle->jointures_explicites), false, $table) |
| 1025 | 1022 | ) { |
| 1026 | - $par = $alias . "." . $champ; |
|
| 1023 | + $par = $alias.".".$champ; |
|
| 1027 | 1024 | } elseif ($alias = trouver_jointure_champ($champ, $boucle, $boucle->jointures, false, $table)) { |
| 1028 | - $par = $alias . "." . $champ; |
|
| 1025 | + $par = $alias.".".$champ; |
|
| 1029 | 1026 | // en spécifiant directement l'alias {par L2.titre} (situation hasardeuse tout de même) |
| 1030 | 1027 | } elseif ( |
| 1031 | 1028 | $table_alias |
| 1032 | 1029 | and isset($boucle->from[$table_alias]) |
| 1033 | 1030 | and $infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $boucle->from[$table_alias]) |
| 1034 | 1031 | ) { |
| 1035 | - $par = $infos['alias'] . "." . $champ; |
|
| 1032 | + $par = $infos['alias'].".".$champ; |
|
| 1036 | 1033 | } elseif ($table) { |
| 1037 | 1034 | // On avait table + champ, mais on ne les a pas trouvés |
| 1038 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 1035 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 1039 | 1036 | } else { |
| 1040 | 1037 | // Sinon tant pis, ca doit etre un champ synthetise (cf points) |
| 1041 | 1038 | } |
@@ -1059,7 +1056,7 @@ discard block |
||
| 1059 | 1056 | if (!$t) { |
| 1060 | 1057 | $t = trouver_jointure_champ($champ, $boucle); |
| 1061 | 1058 | } |
| 1062 | - return !$t ? '' : ("'" . $t . '.' . $champ . "'"); |
|
| 1059 | + return !$t ? '' : ("'".$t.'.'.$champ."'"); |
|
| 1063 | 1060 | } |
| 1064 | 1061 | |
| 1065 | 1062 | /** |
@@ -1104,9 +1101,9 @@ discard block |
||
| 1104 | 1101 | $boucle->default_order[] = ' DESC'; |
| 1105 | 1102 | } |
| 1106 | 1103 | } else { |
| 1107 | - $t = $boucle->order[$n - 1] . " . $order"; |
|
| 1104 | + $t = $boucle->order[$n - 1]." . $order"; |
|
| 1108 | 1105 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 1109 | - $t = $r[1] . $r[2]; |
|
| 1106 | + $t = $r[1].$r[2]; |
|
| 1110 | 1107 | } |
| 1111 | 1108 | $boucle->order[$n - 1] = $t; |
| 1112 | 1109 | } |
@@ -1120,11 +1117,11 @@ discard block |
||
| 1120 | 1117 | * @param $crit |
| 1121 | 1118 | * @return array|string |
| 1122 | 1119 | */ |
| 1123 | -function critere_par_ordre_liste_dist($idb, &$boucles, $crit){ |
|
| 1120 | +function critere_par_ordre_liste_dist($idb, &$boucles, $crit) { |
|
| 1124 | 1121 | $boucle = &$boucles[$idb]; |
| 1125 | 1122 | |
| 1126 | 1123 | $sens = $collecte = ''; |
| 1127 | - if ($crit->not){ |
|
| 1124 | + if ($crit->not) { |
|
| 1128 | 1125 | $sens = " . ' DESC'"; |
| 1129 | 1126 | } |
| 1130 | 1127 | |
@@ -1134,14 +1131,14 @@ discard block |
||
| 1134 | 1131 | $res = critere_parinverse($idb, $boucles, $crit2); |
| 1135 | 1132 | |
| 1136 | 1133 | // erreur ? |
| 1137 | - if (is_array($res)){ |
|
| 1134 | + if (is_array($res)) { |
|
| 1138 | 1135 | return $res; |
| 1139 | 1136 | } |
| 1140 | 1137 | |
| 1141 | 1138 | $_order = array_pop($boucle->order); |
| 1142 | 1139 | |
| 1143 | 1140 | $_liste = calculer_liste($crit->param[1], array(), $boucles, $boucles[$idb]->id_parent); |
| 1144 | - $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'" . $boucle->sql_serveur . "')) ? \$zl : '0').')'$sens"; |
|
| 1141 | + $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'".$boucle->sql_serveur."')) ? \$zl : '0').')'$sens"; |
|
| 1145 | 1142 | } |
| 1146 | 1143 | |
| 1147 | 1144 | |
@@ -1150,7 +1147,7 @@ discard block |
||
| 1150 | 1147 | $params = $crit->param; |
| 1151 | 1148 | |
| 1152 | 1149 | if (count($params) < 1) { |
| 1153 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " ?")); |
|
| 1150 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." ?")); |
|
| 1154 | 1151 | } |
| 1155 | 1152 | |
| 1156 | 1153 | $boucle = &$boucles[$idb]; |
@@ -1171,7 +1168,7 @@ discard block |
||
| 1171 | 1168 | if ((count($date) == 1) and ($date[0]->type == 'texte')) { |
| 1172 | 1169 | $date = $date[0]->texte; |
| 1173 | 1170 | if (!isset($fields[$date])) { |
| 1174 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " " . $date)); |
|
| 1171 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." ".$date)); |
|
| 1175 | 1172 | } |
| 1176 | 1173 | } else { |
| 1177 | 1174 | $a = calculer_liste($date, $idb, $boucles, $parent); |
@@ -1183,38 +1180,38 @@ discard block |
||
| 1183 | 1180 | $date = "'.(($cond)\n?\$a:\"$defaut\").'"; |
| 1184 | 1181 | } |
| 1185 | 1182 | $annee = $params ? array_shift($params) : ""; |
| 1186 | - $annee = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1187 | - calculer_liste($annee, $idb, $boucles, $parent) . |
|
| 1183 | + $annee = "\n".'sprintf("%04d", ($x = '. |
|
| 1184 | + calculer_liste($annee, $idb, $boucles, $parent). |
|
| 1188 | 1185 | ') ? $x : date("Y"))'; |
| 1189 | 1186 | |
| 1190 | 1187 | $mois = $params ? array_shift($params) : ""; |
| 1191 | - $mois = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1192 | - calculer_liste($mois, $idb, $boucles, $parent) . |
|
| 1188 | + $mois = "\n".'sprintf("%02d", ($x = '. |
|
| 1189 | + calculer_liste($mois, $idb, $boucles, $parent). |
|
| 1193 | 1190 | ') ? $x : date("m"))'; |
| 1194 | 1191 | |
| 1195 | 1192 | $jour = $params ? array_shift($params) : ""; |
| 1196 | - $jour = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1197 | - calculer_liste($jour, $idb, $boucles, $parent) . |
|
| 1193 | + $jour = "\n".'sprintf("%02d", ($x = '. |
|
| 1194 | + calculer_liste($jour, $idb, $boucles, $parent). |
|
| 1198 | 1195 | ') ? $x : date("d"))'; |
| 1199 | 1196 | |
| 1200 | 1197 | $annee2 = $params ? array_shift($params) : ""; |
| 1201 | - $annee2 = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1202 | - calculer_liste($annee2, $idb, $boucles, $parent) . |
|
| 1198 | + $annee2 = "\n".'sprintf("%04d", ($x = '. |
|
| 1199 | + calculer_liste($annee2, $idb, $boucles, $parent). |
|
| 1203 | 1200 | ') ? $x : date("Y"))'; |
| 1204 | 1201 | |
| 1205 | 1202 | $mois2 = $params ? array_shift($params) : ""; |
| 1206 | - $mois2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1207 | - calculer_liste($mois2, $idb, $boucles, $parent) . |
|
| 1203 | + $mois2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1204 | + calculer_liste($mois2, $idb, $boucles, $parent). |
|
| 1208 | 1205 | ') ? $x : date("m"))'; |
| 1209 | 1206 | |
| 1210 | 1207 | $jour2 = $params ? array_shift($params) : ""; |
| 1211 | - $jour2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1212 | - calculer_liste($jour2, $idb, $boucles, $parent) . |
|
| 1208 | + $jour2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1209 | + calculer_liste($jour2, $idb, $boucles, $parent). |
|
| 1213 | 1210 | ') ? $x : date("d"))'; |
| 1214 | 1211 | |
| 1215 | - $date = $boucle->id_table . ".$date"; |
|
| 1212 | + $date = $boucle->id_table.".$date"; |
|
| 1216 | 1213 | |
| 1217 | - $quote_end = ",'" . $boucle->sql_serveur . "','text'"; |
|
| 1214 | + $quote_end = ",'".$boucle->sql_serveur."','text'"; |
|
| 1218 | 1215 | if ($type == 'jour') { |
| 1219 | 1216 | $boucle->where[] = array( |
| 1220 | 1217 | "'='", |
@@ -1286,14 +1283,13 @@ discard block |
||
| 1286 | 1283 | list($a21, $a22) = calculer_critere_parties_aux($idb, $boucles, $a2); |
| 1287 | 1284 | |
| 1288 | 1285 | if (($op == ',') && (is_numeric($a11) && (is_numeric($a21)))) { |
| 1289 | - $boucle->limit = $a11 . ',' . $a21; |
|
| 1286 | + $boucle->limit = $a11.','.$a21; |
|
| 1290 | 1287 | } else { |
| 1291 | 1288 | // 3 dans {1/3}, {2,3} ou {1,n-3} |
| 1292 | 1289 | $boucle->total_parties = ($a21 != 'n') ? $a21 : $a22; |
| 1293 | 1290 | // 2 dans {2/3}, {2,5}, {n-2,1} |
| 1294 | 1291 | $partie = ($a11 != 'n') ? $a11 : $a12; |
| 1295 | - $mode = (($op == '/') ? '/' : |
|
| 1296 | - (($a11 == 'n') ? '-' : '+') . (($a21 == 'n') ? '-' : '+')); |
|
| 1292 | + $mode = (($op == '/') ? '/' : (($a11 == 'n') ? '-' : '+').(($a21 == 'n') ? '-' : '+')); |
|
| 1297 | 1293 | // cas simple {0,#ENV{truc}} compilons le en LIMIT : |
| 1298 | 1294 | if ($a11 !== 'n' and $a21 !== 'n' and $mode == "++" and $op == ',') { |
| 1299 | 1295 | $boucle->limit = |
@@ -1339,8 +1335,7 @@ discard block |
||
| 1339 | 1335 | // {1/3} |
| 1340 | 1336 | if ($op1 == '/') { |
| 1341 | 1337 | $pmoins1 = is_numeric($debut) ? ($debut - 1) : "($debut-1)"; |
| 1342 | - $totpos = is_numeric($total_parties) ? ($total_parties) : |
|
| 1343 | - "($total_parties ? $total_parties : 1)"; |
|
| 1338 | + $totpos = is_numeric($total_parties) ? ($total_parties) : "($total_parties ? $total_parties : 1)"; |
|
| 1344 | 1339 | $fin = "ceil(($nombre_boucle * $debut )/$totpos) - 1"; |
| 1345 | 1340 | $debut = !$pmoins1 ? 0 : "ceil(($nombre_boucle * $pmoins1)/$totpos);"; |
| 1346 | 1341 | } else { |
@@ -1351,15 +1346,13 @@ discard block |
||
| 1351 | 1346 | |
| 1352 | 1347 | // cas {x,n-1} |
| 1353 | 1348 | if ($op2 == '-') { |
| 1354 | - $fin = '$debut_boucle + ' . $nombre_boucle . ' - ' |
|
| 1355 | - . (is_numeric($total_parties) ? ($total_parties + 1) : |
|
| 1356 | - ($total_parties . ' - 1')); |
|
| 1349 | + $fin = '$debut_boucle + '.$nombre_boucle.' - ' |
|
| 1350 | + . (is_numeric($total_parties) ? ($total_parties + 1) : ($total_parties.' - 1')); |
|
| 1357 | 1351 | } else { |
| 1358 | 1352 | // {x,1} ou {pagination} |
| 1359 | 1353 | $fin = '$debut_boucle' |
| 1360 | 1354 | . (is_numeric($total_parties) ? |
| 1361 | - (($total_parties == 1) ? "" : (' + ' . ($total_parties - 1))) : |
|
| 1362 | - ('+' . $total_parties . ' - 1')); |
|
| 1355 | + (($total_parties == 1) ? "" : (' + '.($total_parties - 1))) : ('+'.$total_parties.' - 1')); |
|
| 1363 | 1356 | } |
| 1364 | 1357 | |
| 1365 | 1358 | // {pagination}, gerer le debut_xx=-1 pour tout voir |
@@ -1377,11 +1370,11 @@ discard block |
||
| 1377 | 1370 | // Utiliser min pour rabattre $fin_boucle sur total_boucle. |
| 1378 | 1371 | |
| 1379 | 1372 | $boucles[$id_boucle]->mode_partie = "\n\t" |
| 1380 | - . '$debut_boucle = ' . $debut . ";\n " |
|
| 1373 | + . '$debut_boucle = '.$debut.";\n " |
|
| 1381 | 1374 | . "\$debut_boucle = intval(\$debut_boucle);\n " |
| 1382 | - . '$fin_boucle = min(' . $fin . ", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1383 | - . '$Numrows[\'' . $id_boucle . "']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1384 | - . '$Numrows[\'' . $id_boucle . '\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1375 | + . '$fin_boucle = min('.$fin.", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1376 | + . '$Numrows[\''.$id_boucle."']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1377 | + . '$Numrows[\''.$id_boucle.'\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1385 | 1378 | . "\n\tif (\$debut_boucle>0" |
| 1386 | 1379 | . " AND \$debut_boucle < \$Numrows['$id_boucle']['grand_total']" |
| 1387 | 1380 | . " AND \$iter->seek(\$debut_boucle,'continue'))" |
@@ -1466,16 +1459,16 @@ discard block |
||
| 1466 | 1459 | // critere personnalise ? |
| 1467 | 1460 | if ( |
| 1468 | 1461 | (!$serveur or |
| 1469 | - ((!function_exists($f = "critere_" . $serveur . "_" . $table . "_" . $critere)) |
|
| 1470 | - and (!function_exists($f = $f . "_dist")) |
|
| 1471 | - and (!function_exists($f = "critere_" . $serveur . "_" . $critere)) |
|
| 1472 | - and (!function_exists($f = $f . "_dist")) |
|
| 1462 | + ((!function_exists($f = "critere_".$serveur."_".$table."_".$critere)) |
|
| 1463 | + and (!function_exists($f = $f."_dist")) |
|
| 1464 | + and (!function_exists($f = "critere_".$serveur."_".$critere)) |
|
| 1465 | + and (!function_exists($f = $f."_dist")) |
|
| 1473 | 1466 | ) |
| 1474 | 1467 | ) |
| 1475 | - and (!function_exists($f = "critere_" . $table . "_" . $critere)) |
|
| 1476 | - and (!function_exists($f = $f . "_dist")) |
|
| 1477 | - and (!function_exists($f = "critere_" . $critere)) |
|
| 1478 | - and (!function_exists($f = $f . "_dist")) |
|
| 1468 | + and (!function_exists($f = "critere_".$table."_".$critere)) |
|
| 1469 | + and (!function_exists($f = $f."_dist")) |
|
| 1470 | + and (!function_exists($f = "critere_".$critere)) |
|
| 1471 | + and (!function_exists($f = $f."_dist")) |
|
| 1479 | 1472 | ) { |
| 1480 | 1473 | // fonction critere standard |
| 1481 | 1474 | $f = $defaut; |
@@ -1508,9 +1501,9 @@ discard block |
||
| 1508 | 1501 | */ |
| 1509 | 1502 | function kwote($lisp, $serveur = '', $type = '') { |
| 1510 | 1503 | if (preg_match(_CODE_QUOTE, $lisp, $r)) { |
| 1511 | - return $r[1] . "\"" . sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type) . "\""; |
|
| 1504 | + return $r[1]."\"".sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type)."\""; |
|
| 1512 | 1505 | } else { |
| 1513 | - return "sql_quote($lisp, '$serveur', '" . str_replace("'", "\\'", $type) . "')"; |
|
| 1506 | + return "sql_quote($lisp, '$serveur', '".str_replace("'", "\\'", $type)."')"; |
|
| 1514 | 1507 | } |
| 1515 | 1508 | } |
| 1516 | 1509 | |
@@ -1532,7 +1525,7 @@ discard block |
||
| 1532 | 1525 | function critere_IN_dist($idb, &$boucles, $crit) { |
| 1533 | 1526 | $r = calculer_critere_infixe($idb, $boucles, $crit); |
| 1534 | 1527 | if (!$r) { |
| 1535 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . " ?"))); |
|
| 1528 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op." ?"))); |
|
| 1536 | 1529 | } |
| 1537 | 1530 | list($arg, $op, $val, $col, $where_complement) = $r; |
| 1538 | 1531 | |
@@ -1559,8 +1552,8 @@ discard block |
||
| 1559 | 1552 | "'NOT'", |
| 1560 | 1553 | array( |
| 1561 | 1554 | "'IN'", |
| 1562 | - "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", |
|
| 1563 | - array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where) |
|
| 1555 | + "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", |
|
| 1556 | + array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where) |
|
| 1564 | 1557 | ) |
| 1565 | 1558 | ); |
| 1566 | 1559 | } |
@@ -1579,22 +1572,22 @@ discard block |
||
| 1579 | 1572 | $descr = $boucles[$idb]->descr; |
| 1580 | 1573 | $cpt = &$num[$descr['nom']][$descr['gram']][$idb]; |
| 1581 | 1574 | |
| 1582 | - $var = '$in' . $cpt++; |
|
| 1575 | + $var = '$in'.$cpt++; |
|
| 1583 | 1576 | $x = "\n\t$var = array();"; |
| 1584 | 1577 | foreach ($val as $k => $v) { |
| 1585 | 1578 | if (preg_match(",^(\n//.*\n)?'(.*)'$,", $v, $r)) { |
| 1586 | 1579 | // optimiser le traitement des constantes |
| 1587 | 1580 | if (is_numeric($r[2])) { |
| 1588 | - $x .= "\n\t$var" . "[]= $r[2];"; |
|
| 1581 | + $x .= "\n\t$var"."[]= $r[2];"; |
|
| 1589 | 1582 | } else { |
| 1590 | - $x .= "\n\t$var" . "[]= " . sql_quote($r[2]) . ";"; |
|
| 1583 | + $x .= "\n\t$var"."[]= ".sql_quote($r[2]).";"; |
|
| 1591 | 1584 | } |
| 1592 | 1585 | } else { |
| 1593 | 1586 | // Pour permettre de passer des tableaux de valeurs |
| 1594 | 1587 | // on repere l'utilisation brute de #ENV**{X}, |
| 1595 | 1588 | // c'est-a-dire sa traduction en ($PILE[0][X]). |
| 1596 | 1589 | // et on deballe mais en rajoutant l'anti XSS |
| 1597 | - $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var" . "[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1590 | + $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var"."[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1598 | 1591 | } |
| 1599 | 1592 | } |
| 1600 | 1593 | |
@@ -1608,7 +1601,7 @@ discard block |
||
| 1608 | 1601 | $boucles[$idb]->default_order[] = "((!\$zqv=sql_quote($var) OR \$zqv===\"''\") ? 0 : ('FIELD($arg,' . \$zqv . ')'))"; |
| 1609 | 1602 | } |
| 1610 | 1603 | |
| 1611 | - return "sql_in('$arg', $var" . ($crit2 == 'NOT' ? ",'NOT'" : "") . ")"; |
|
| 1604 | + return "sql_in('$arg', $var".($crit2 == 'NOT' ? ",'NOT'" : "").")"; |
|
| 1612 | 1605 | } |
| 1613 | 1606 | |
| 1614 | 1607 | /** |
@@ -1681,7 +1674,7 @@ discard block |
||
| 1681 | 1674 | $champs = array_diff($champs, array_keys($boucle->modificateur['criteres'])); |
| 1682 | 1675 | } |
| 1683 | 1676 | // nous aider en mode debug. |
| 1684 | - $boucle->debug[] = "id_ : " . implode(', ', $champs); |
|
| 1677 | + $boucle->debug[] = "id_ : ".implode(', ', $champs); |
|
| 1685 | 1678 | $boucle->modificateur['id_'] = $champs; |
| 1686 | 1679 | |
| 1687 | 1680 | // créer un critère {id_xxx?} de chaque champ retenu |
@@ -1722,7 +1715,7 @@ discard block |
||
| 1722 | 1715 | // Les champs id_xx de la table demandée |
| 1723 | 1716 | $champs = array_filter( |
| 1724 | 1717 | array_keys($desc['field']), |
| 1725 | - function($champ){ |
|
| 1718 | + function($champ) { |
|
| 1726 | 1719 | return |
| 1727 | 1720 | strpos($champ, 'id_') === 0 |
| 1728 | 1721 | or (in_array($champ, array('objet'))); |
@@ -1937,8 +1930,8 @@ discard block |
||
| 1937 | 1930 | "'NOT'", |
| 1938 | 1931 | array( |
| 1939 | 1932 | "'IN'", |
| 1940 | - "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", |
|
| 1941 | - array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where) |
|
| 1933 | + "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", |
|
| 1934 | + array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where) |
|
| 1942 | 1935 | ) |
| 1943 | 1936 | ); |
| 1944 | 1937 | } |
@@ -1949,7 +1942,7 @@ discard block |
||
| 1949 | 1942 | if ($crit->cond) { |
| 1950 | 1943 | $pred = calculer_argument_precedent($idb, $col, $boucles); |
| 1951 | 1944 | if ($col == "date" or $col == "date_redac") { |
| 1952 | - if ($pred == "\$Pile[0]['" . $col . "']") { |
|
| 1945 | + if ($pred == "\$Pile[0]['".$col."']") { |
|
| 1953 | 1946 | $pred = "(\$Pile[0]['{$col}_default']?'':$pred)"; |
| 1954 | 1947 | } |
| 1955 | 1948 | } |
@@ -2110,7 +2103,7 @@ discard block |
||
| 2110 | 2103 | // defaire le quote des int et les passer dans sql_quote avec le bon type de champ si on le connait, int sinon |
| 2111 | 2104 | // prendre en compte le debug ou la valeur arrive avec un commentaire PHP en debut |
| 2112 | 2105 | if (preg_match(",^\\A(\s*//.*?$\s*)?\"'(-?\d+)'\"\\z,ms", $val[0], $r)) { |
| 2113 | - $val[0] = $r[1] . '"' . sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote) . '"'; |
|
| 2106 | + $val[0] = $r[1].'"'.sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote).'"'; |
|
| 2114 | 2107 | } |
| 2115 | 2108 | // sinon expliciter les |
| 2116 | 2109 | // sql_quote(truc) en sql_quote(truc,'',type) |
@@ -2121,22 +2114,22 @@ discard block |
||
| 2121 | 2114 | // sql_quote(truc,'','varchar') |
| 2122 | 2115 | elseif (preg_match('/\Asql_quote[(](.*?)(,[^)]*?)?(,[^)]*(?:\(\d+\)[^)]*)?)?[)]\s*\z/ms', $val[0], $r) |
| 2123 | 2116 | // si pas deja un type |
| 2124 | - and (!isset($r[3]) or !$r[3] or !trim($r[3],", '")) |
|
| 2117 | + and (!isset($r[3]) or !$r[3] or !trim($r[3], ", '")) |
|
| 2125 | 2118 | ) { |
| 2126 | 2119 | $r = $r[1] |
| 2127 | 2120 | . ((isset($r[2]) and $r[2]) ? $r[2] : ",''") |
| 2128 | - . ",'" . addslashes($type_cast_quote) . "'"; |
|
| 2121 | + . ",'".addslashes($type_cast_quote)."'"; |
|
| 2129 | 2122 | $val[0] = "sql_quote($r)"; |
| 2130 | 2123 | } |
| 2131 | - elseif(strpos($val[0], '@@defaultcast@@') !== false |
|
| 2124 | + elseif (strpos($val[0], '@@defaultcast@@') !== false |
|
| 2132 | 2125 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) { |
| 2133 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'" . addslashes($type_cast_quote) . "')"; |
|
| 2126 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'".addslashes($type_cast_quote)."')"; |
|
| 2134 | 2127 | } |
| 2135 | 2128 | } |
| 2136 | 2129 | |
| 2137 | - if(strpos($val[0], '@@defaultcast@@') !== false |
|
| 2130 | + if (strpos($val[0], '@@defaultcast@@') !== false |
|
| 2138 | 2131 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) { |
| 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 | } |
@@ -2286,9 +2279,9 @@ discard block |
||
| 2286 | 2279 | **/ |
| 2287 | 2280 | function primary_doublee($decompose, $table) { |
| 2288 | 2281 | $e1 = reset($decompose); |
| 2289 | - $e2 = "sql_quote('" . end($decompose) . "')"; |
|
| 2282 | + $e2 = "sql_quote('".end($decompose)."')"; |
|
| 2290 | 2283 | |
| 2291 | - return array("'='", "'$table." . $e1 . "'", $e2); |
|
| 2284 | + return array("'='", "'$table.".$e1."'", $e2); |
|
| 2292 | 2285 | } |
| 2293 | 2286 | |
| 2294 | 2287 | /** |
@@ -2326,7 +2319,7 @@ discard block |
||
| 2326 | 2319 | if ($checkarrivee |
| 2327 | 2320 | and is_string($checkarrivee) |
| 2328 | 2321 | and $a = table_objet($checkarrivee) |
| 2329 | - and in_array($a . '_liens', $joints) |
|
| 2322 | + and in_array($a.'_liens', $joints) |
|
| 2330 | 2323 | ) { |
| 2331 | 2324 | if ($res = calculer_lien_externe_init($boucle, $joints, $col, $desc, $cond, $checkarrivee)) { |
| 2332 | 2325 | return $res; |
@@ -2346,12 +2339,12 @@ discard block |
||
| 2346 | 2339 | // la table est déjà dans le FROM, on vérifie si le champ est utilisé. |
| 2347 | 2340 | $joindre = false; |
| 2348 | 2341 | foreach ($cols as $col) { |
| 2349 | - $c = '/\b' . $t . ".$col" . '\b/'; |
|
| 2342 | + $c = '/\b'.$t.".$col".'\b/'; |
|
| 2350 | 2343 | if (trouver_champ($c, $boucle->where)) { |
| 2351 | 2344 | $joindre = true; |
| 2352 | 2345 | } else { |
| 2353 | 2346 | // mais ca peut etre dans le FIELD pour le Having |
| 2354 | - $c = "/FIELD.$t" . ".$col,/"; |
|
| 2347 | + $c = "/FIELD.$t".".$col,/"; |
|
| 2355 | 2348 | if (trouver_champ($c, $boucle->select)) { |
| 2356 | 2349 | $joindre = true; |
| 2357 | 2350 | } |
@@ -2398,7 +2391,7 @@ discard block |
||
| 2398 | 2391 | $primary_arrivee = id_table_objet($checkarrivee); |
| 2399 | 2392 | |
| 2400 | 2393 | // [FIXME] $checkarrivee peut-il arriver avec false ???? |
| 2401 | - $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee . "_liens"); |
|
| 2394 | + $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee."_liens"); |
|
| 2402 | 2395 | $arrivee = trouver_champ_exterieur($col, $joints, $boucle, $checkarrivee); |
| 2403 | 2396 | |
| 2404 | 2397 | if (!$intermediaire or !$arrivee) { |
@@ -2496,7 +2489,7 @@ discard block |
||
| 2496 | 2489 | } elseif ($crit->cond and ($col == "date" or $col == "date_redac")) { |
| 2497 | 2490 | // un critere conditionnel sur date est traite a part |
| 2498 | 2491 | // car la date est mise d'office par SPIP, |
| 2499 | - $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['" . $col . "'])"; |
|
| 2492 | + $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['".$col."'])"; |
|
| 2500 | 2493 | } |
| 2501 | 2494 | |
| 2502 | 2495 | $val = calculer_argument_precedent($idb, $val, $boucles, $defaut); |
@@ -2527,7 +2520,7 @@ discard block |
||
| 2527 | 2520 | and (($p == "'") or ($p == '"')) |
| 2528 | 2521 | and $params[0][1]->type == 'champ' |
| 2529 | 2522 | ) { |
| 2530 | - $val[] = "$p\\$p#" . $params[0][1]->nom_champ . "\\$p$p"; |
|
| 2523 | + $val[] = "$p\\$p#".$params[0][1]->nom_champ."\\$p$p"; |
|
| 2531 | 2524 | } else { |
| 2532 | 2525 | foreach ((($op != 'IN') ? $params : calculer_vieux_in($params)) as $p) { |
| 2533 | 2526 | $a = calculer_liste($p, $idb, $boucles, $parent); |
@@ -2543,7 +2536,7 @@ discard block |
||
| 2543 | 2536 | $fct = $args_sql = ''; |
| 2544 | 2537 | // fonction SQL ? |
| 2545 | 2538 | // chercher FONCTION(champ) tel que CONCAT(titre,descriptif) |
| 2546 | - if (preg_match('/^(.*)' . SQL_ARGS . '$/', $col, $m)) { |
|
| 2539 | + if (preg_match('/^(.*)'.SQL_ARGS.'$/', $col, $m)) { |
|
| 2547 | 2540 | $fct = $m[1]; |
| 2548 | 2541 | preg_match('/^\(([^,]*)(.*)\)$/', $m[2], $a); |
| 2549 | 2542 | $col = $a[1]; |
@@ -2633,7 +2626,7 @@ discard block |
||
| 2633 | 2626 | # si oui choisir ce champ, sinon choisir xxxx |
| 2634 | 2627 | |
| 2635 | 2628 | if (isset($table['field']["date$suite"])) { |
| 2636 | - $date_orig = 'date' . $suite; |
|
| 2629 | + $date_orig = 'date'.$suite; |
|
| 2637 | 2630 | } else { |
| 2638 | 2631 | $date_orig = substr($suite, 1); |
| 2639 | 2632 | } |
@@ -2644,12 +2637,12 @@ discard block |
||
| 2644 | 2637 | } |
| 2645 | 2638 | } |
| 2646 | 2639 | |
| 2647 | - $date_compare = "\"' . normaliser_date(" . |
|
| 2648 | - calculer_argument_precedent($idb, $pred, $boucles) . |
|
| 2640 | + $date_compare = "\"' . normaliser_date(". |
|
| 2641 | + calculer_argument_precedent($idb, $pred, $boucles). |
|
| 2649 | 2642 | ") . '\""; |
| 2650 | 2643 | |
| 2651 | 2644 | $col_vraie = $date_orig; |
| 2652 | - $date_orig = $boucle->id_table . '.' . $date_orig; |
|
| 2645 | + $date_orig = $boucle->id_table.'.'.$date_orig; |
|
| 2653 | 2646 | |
| 2654 | 2647 | switch ($col) { |
| 2655 | 2648 | case 'date': |
@@ -2669,26 +2662,26 @@ discard block |
||
| 2669 | 2662 | break; |
| 2670 | 2663 | case 'age': |
| 2671 | 2664 | $col = calculer_param_date("\'' . date('Y-m-d H:i:00') . '\'", $date_orig); |
| 2672 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2665 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2673 | 2666 | break; |
| 2674 | 2667 | case 'age_relatif': |
| 2675 | 2668 | $col = calculer_param_date($date_compare, $date_orig); |
| 2676 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2669 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2677 | 2670 | break; |
| 2678 | 2671 | case 'jour_relatif': |
| 2679 | - $col = "(TO_DAYS(" . $date_compare . ")-TO_DAYS(" . $date_orig . "))"; |
|
| 2680 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2672 | + $col = "(TO_DAYS(".$date_compare.")-TO_DAYS(".$date_orig."))"; |
|
| 2673 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2681 | 2674 | break; |
| 2682 | 2675 | case 'mois_relatif': |
| 2683 | - $col = "MONTH(" . $date_compare . ")-MONTH(" . |
|
| 2684 | - $date_orig . ")+12*(YEAR(" . $date_compare . |
|
| 2685 | - ")-YEAR(" . $date_orig . "))"; |
|
| 2686 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2676 | + $col = "MONTH(".$date_compare.")-MONTH(". |
|
| 2677 | + $date_orig.")+12*(YEAR(".$date_compare. |
|
| 2678 | + ")-YEAR(".$date_orig."))"; |
|
| 2679 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2687 | 2680 | break; |
| 2688 | 2681 | case 'annee_relatif': |
| 2689 | - $col = "YEAR(" . $date_compare . ")-YEAR(" . |
|
| 2690 | - $date_orig . ")"; |
|
| 2691 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2682 | + $col = "YEAR(".$date_compare.")-YEAR(". |
|
| 2683 | + $date_orig.")"; |
|
| 2684 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2692 | 2685 | break; |
| 2693 | 2686 | } |
| 2694 | 2687 | |
@@ -2747,10 +2740,10 @@ discard block |
||
| 2747 | 2740 | } |
| 2748 | 2741 | |
| 2749 | 2742 | $boucle->hash .= ' |
| 2750 | - $command[\'sourcemode\'] = ' . array_shift($args) . ";\n"; |
|
| 2743 | + $command[\'sourcemode\'] = ' . array_shift($args).";\n"; |
|
| 2751 | 2744 | |
| 2752 | 2745 | $boucle->hash .= ' |
| 2753 | - $command[\'source\'] = array(' . join(', ', $args) . ");\n"; |
|
| 2746 | + $command[\'source\'] = array(' . join(', ', $args).");\n"; |
|
| 2754 | 2747 | } |
| 2755 | 2748 | |
| 2756 | 2749 | /** |
@@ -2769,7 +2762,7 @@ discard block |
||
| 2769 | 2762 | function critere_DATA_datacache_dist($idb, &$boucles, $crit) { |
| 2770 | 2763 | $boucle = &$boucles[$idb]; |
| 2771 | 2764 | $boucle->hash .= ' |
| 2772 | - $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2765 | + $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2773 | 2766 | } |
| 2774 | 2767 | |
| 2775 | 2768 | |
@@ -2788,7 +2781,7 @@ discard block |
||
| 2788 | 2781 | $boucle->hash .= '$command[\'args\']=array();'; |
| 2789 | 2782 | foreach ($crit->param as $param) { |
| 2790 | 2783 | $boucle->hash .= ' |
| 2791 | - $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2784 | + $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2792 | 2785 | } |
| 2793 | 2786 | } |
| 2794 | 2787 | |
@@ -2807,10 +2800,10 @@ discard block |
||
| 2807 | 2800 | */ |
| 2808 | 2801 | function critere_DATA_liste_dist($idb, &$boucles, $crit) { |
| 2809 | 2802 | $boucle = &$boucles[$idb]; |
| 2810 | - $boucle->hash .= "\n\t" . '$command[\'liste\'] = array();' . "\n"; |
|
| 2803 | + $boucle->hash .= "\n\t".'$command[\'liste\'] = array();'."\n"; |
|
| 2811 | 2804 | foreach ($crit->param as $param) { |
| 2812 | - $boucle->hash .= "\t" . '$command[\'liste\'][] = ' . calculer_liste($param, $idb, $boucles, |
|
| 2813 | - $boucles[$idb]->id_parent) . ";\n"; |
|
| 2805 | + $boucle->hash .= "\t".'$command[\'liste\'][] = '.calculer_liste($param, $idb, $boucles, |
|
| 2806 | + $boucles[$idb]->id_parent).";\n"; |
|
| 2814 | 2807 | } |
| 2815 | 2808 | } |
| 2816 | 2809 | |
@@ -2837,10 +2830,10 @@ discard block |
||
| 2837 | 2830 | */ |
| 2838 | 2831 | function critere_DATA_enum_dist($idb, &$boucles, $crit) { |
| 2839 | 2832 | $boucle = &$boucles[$idb]; |
| 2840 | - $boucle->hash .= "\n\t" . '$command[\'enum\'] = array();' . "\n"; |
|
| 2833 | + $boucle->hash .= "\n\t".'$command[\'enum\'] = array();'."\n"; |
|
| 2841 | 2834 | foreach ($crit->param as $param) { |
| 2842 | - $boucle->hash .= "\t" . '$command[\'enum\'][] = ' . calculer_liste($param, $idb, $boucles, |
|
| 2843 | - $boucles[$idb]->id_parent) . ";\n"; |
|
| 2835 | + $boucle->hash .= "\t".'$command[\'enum\'][] = '.calculer_liste($param, $idb, $boucles, |
|
| 2836 | + $boucles[$idb]->id_parent).";\n"; |
|
| 2844 | 2837 | } |
| 2845 | 2838 | } |
| 2846 | 2839 | |
@@ -2859,7 +2852,7 @@ discard block |
||
| 2859 | 2852 | $boucle = &$boucles[$idb]; |
| 2860 | 2853 | foreach ($crit->param as $param) { |
| 2861 | 2854 | $boucle->hash .= ' |
| 2862 | - $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2855 | + $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2863 | 2856 | } |
| 2864 | 2857 | } |
| 2865 | 2858 | |
@@ -2900,7 +2893,7 @@ discard block |
||
| 2900 | 2893 | if ($crit->param) { |
| 2901 | 2894 | foreach ($crit->param as $param) { |
| 2902 | 2895 | $boucle->hash .= "\t\$command['si'][] = " |
| 2903 | - . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ";\n"; |
|
| 2896 | + . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).";\n"; |
|
| 2904 | 2897 | } |
| 2905 | 2898 | // interdire {si 0} aussi ! |
| 2906 | 2899 | } else { |
@@ -2924,7 +2917,7 @@ discard block |
||
| 2924 | 2917 | function critere_POUR_tableau_dist($idb, &$boucles, $crit) { |
| 2925 | 2918 | $boucle = &$boucles[$idb]; |
| 2926 | 2919 | $boucle->hash .= ' |
| 2927 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2920 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).'); |
|
| 2928 | 2921 | $command[\'sourcemode\'] = \'table\';'; |
| 2929 | 2922 | } |
| 2930 | 2923 | |
@@ -2957,11 +2950,10 @@ discard block |
||
| 2957 | 2950 | $table_sql = table_objet_sql(objet_type($table)); |
| 2958 | 2951 | |
| 2959 | 2952 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 2960 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 2961 | - 'id_parent'; |
|
| 2953 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 2962 | 2954 | |
| 2963 | 2955 | $in = "IN"; |
| 2964 | - $where = array("'IN'", "'$boucle->id_table." . "$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"); |
|
| 2956 | + $where = array("'IN'", "'$boucle->id_table."."$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"); |
|
| 2965 | 2957 | if ($not) { |
| 2966 | 2958 | $where = array("'NOT'", $where); |
| 2967 | 2959 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | if (strlen($intro)) { |
| 84 | 84 | $texte = $intro; |
| 85 | 85 | } else { |
| 86 | - if (strpos("\n" . $texte, "\n|") === false |
|
| 86 | + if (strpos("\n".$texte, "\n|") === false |
|
| 87 | 87 | and strlen($texte) > 2.5 * $longueur |
| 88 | 88 | ) { |
| 89 | 89 | if (strpos($texte, "<multi") !== false) { |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | if ($pas < 1) { |
| 169 | 169 | return ''; |
| 170 | 170 | } |
| 171 | - $ancre = 'pagination' . $nom; // #pagination_articles |
|
| 172 | - $debut = 'debut' . $nom; // 'debut_articles' |
|
| 171 | + $ancre = 'pagination'.$nom; // #pagination_articles |
|
| 172 | + $debut = 'debut'.$nom; // 'debut_articles' |
|
| 173 | 173 | |
| 174 | 174 | // n'afficher l'ancre qu'une fois |
| 175 | 175 | if (!isset($ancres[$ancre])) { |
| 176 | - $bloc_ancre = $ancres[$ancre] = "<a id='" . $ancre . "' class='pagination_ancre'></a>"; |
|
| 176 | + $bloc_ancre = $ancres[$ancre] = "<a id='".$ancre."' class='pagination_ancre'></a>"; |
|
| 177 | 177 | } else { |
| 178 | 178 | $bloc_ancre = ''; |
| 179 | 179 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | if ($modele) { |
| 207 | 207 | $pagination['type_pagination'] = $modele; |
| 208 | 208 | if (trouver_fond('pagination_'.$modele, 'modeles')) { |
| 209 | - $modele = '_' . $modele; |
|
| 209 | + $modele = '_'.$modele; |
|
| 210 | 210 | } |
| 211 | 211 | else { |
| 212 | 212 | $modele = ''; |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | * @param $objet_lien |
| 338 | 338 | * @return string |
| 339 | 339 | */ |
| 340 | -function retrouver_rang_lien($objet_source, $ids, $objet_lie, $idl, $objet_lien){ |
|
| 340 | +function retrouver_rang_lien($objet_source, $ids, $objet_lie, $idl, $objet_lien) { |
|
| 341 | 341 | $res = lister_objets_liens($objet_source, $objet_lie, $idl, $objet_lien); |
| 342 | 342 | $res = array_column($res, 'rang_lien', $objet_source); |
| 343 | 343 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | * @param array $from |
| 429 | 429 | * @return string |
| 430 | 430 | */ |
| 431 | -function tri_champ_order($t, $from = null, $senstri='') { |
|
| 431 | +function tri_champ_order($t, $from = null, $senstri = '') { |
|
| 432 | 432 | if (strncmp($t, 'multi ', 6) == 0) { |
| 433 | 433 | return "multi"; |
| 434 | 434 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | case 'sinum ': |
| 464 | 464 | return "CASE( 0+$champ ) WHEN 0 THEN 1 ELSE 0 END{$senstri}"; |
| 465 | 465 | default: |
| 466 | - return $champ . $senstri; |
|
| 466 | + return $champ.$senstri; |
|
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | |
@@ -500,12 +500,12 @@ discard block |
||
| 500 | 500 | * @param string $serveur |
| 501 | 501 | * @return string |
| 502 | 502 | */ |
| 503 | -function formate_liste_critere_par_ordre_liste($valeurs, $serveur = ''){ |
|
| 504 | - if (!is_array($valeurs)){ |
|
| 503 | +function formate_liste_critere_par_ordre_liste($valeurs, $serveur = '') { |
|
| 504 | + if (!is_array($valeurs)) { |
|
| 505 | 505 | return ''; |
| 506 | 506 | } |
| 507 | 507 | $f = sql_serveur('quote', $serveur, true); |
| 508 | - if (!is_string($f) or !$f){ |
|
| 508 | + if (!is_string($f) or !$f) { |
|
| 509 | 509 | return ''; |
| 510 | 510 | } |
| 511 | 511 | $valeurs = implode(',', array_map($f, array_unique($valeurs))); |