@@ -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 | - $as = 'num' . ($boucle->order ? count($boucle->order) : ""); |
|
| 894 | - $boucle->select[] = $texte . " AS $as"; |
|
| 890 | + $as = 'num'.($boucle->order ? count($boucle->order) : ""); |
|
| 891 | + $boucle->select[] = $texte." AS $as"; |
|
| 895 | 892 | $order = "'$as'"; |
| 896 | 893 | return $order; |
| 897 | 894 | } |
@@ -916,16 +913,16 @@ discard block |
||
| 916 | 913 | function calculer_critere_par_expression_sinum($idb, &$boucles, $crit, $tri, $champ) { |
| 917 | 914 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 918 | 915 | if (is_array($_champ)) { |
| 919 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " sinum $champ")); |
|
| 916 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." sinum $champ")); |
|
| 920 | 917 | } |
| 921 | 918 | $boucle = &$boucles[$idb]; |
| 922 | - $texte = '0+' . $_champ; |
|
| 919 | + $texte = '0+'.$_champ; |
|
| 923 | 920 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 924 | 921 | if ($suite !== "''") { |
| 925 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \""; |
|
| 922 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \""; |
|
| 926 | 923 | } |
| 927 | - $as = 'sinum' . ($boucle->order ? count($boucle->order) : ""); |
|
| 928 | - $boucle->select[] = 'CASE (' . $texte . ') WHEN 0 THEN 1 ELSE 0 END AS ' . $as; |
|
| 924 | + $as = 'sinum'.($boucle->order ? count($boucle->order) : ""); |
|
| 925 | + $boucle->select[] = 'CASE ('.$texte.') WHEN 0 THEN 1 ELSE 0 END AS '.$as; |
|
| 929 | 926 | $order = "'$as'"; |
| 930 | 927 | return $order; |
| 931 | 928 | } |
@@ -949,10 +946,10 @@ discard block |
||
| 949 | 946 | function calculer_critere_par_expression_multi($idb, &$boucles, $crit, $tri, $champ) { |
| 950 | 947 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 951 | 948 | if (is_array($_champ)) { |
| 952 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " multi $champ")); |
|
| 949 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." multi $champ")); |
|
| 953 | 950 | } |
| 954 | 951 | $boucle = &$boucles[$idb]; |
| 955 | - $boucle->select[] = "\".sql_multi('" . $_champ . "', \$GLOBALS['spip_lang']).\""; |
|
| 952 | + $boucle->select[] = "\".sql_multi('".$_champ."', \$GLOBALS['spip_lang']).\""; |
|
| 956 | 953 | $order = "'multi'"; |
| 957 | 954 | return $order; |
| 958 | 955 | } |
@@ -972,13 +969,13 @@ discard block |
||
| 972 | 969 | * @param bool $raw Retourne le champ pour le compilateur ("'alias.champ'") ou brut ('alias.champ') |
| 973 | 970 | * @return array|string |
| 974 | 971 | */ |
| 975 | -function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) { |
|
| 972 | +function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) { |
|
| 976 | 973 | $boucle = &$boucles[$idb]; |
| 977 | 974 | $desc = $boucle->show; |
| 978 | 975 | |
| 979 | 976 | // le champ existe dans la table, pas de souci (le plus commun) |
| 980 | 977 | if (isset($desc['field'][$par])) { |
| 981 | - $par = $boucle->id_table . "." . $par; |
|
| 978 | + $par = $boucle->id_table.".".$par; |
|
| 982 | 979 | } |
| 983 | 980 | // le champ est peut être une jointure |
| 984 | 981 | else { |
@@ -999,24 +996,24 @@ discard block |
||
| 999 | 996 | // Sinon on cherche le champ dans les tables possibles de jointures |
| 1000 | 997 | // Si la table est déjà dans le from, on la réutilise. |
| 1001 | 998 | if ($infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $table)) { |
| 1002 | - $par = $infos['alias'] . "." . $champ; |
|
| 999 | + $par = $infos['alias'].".".$champ; |
|
| 1003 | 1000 | } elseif ( |
| 1004 | 1001 | $boucle->jointures_explicites |
| 1005 | 1002 | and $alias = trouver_jointure_champ($champ, $boucle, explode(' ', $boucle->jointures_explicites), false, $table) |
| 1006 | 1003 | ) { |
| 1007 | - $par = $alias . "." . $champ; |
|
| 1004 | + $par = $alias.".".$champ; |
|
| 1008 | 1005 | } elseif ($alias = trouver_jointure_champ($champ, $boucle, $boucle->jointures, false, $table)) { |
| 1009 | - $par = $alias . "." . $champ; |
|
| 1006 | + $par = $alias.".".$champ; |
|
| 1010 | 1007 | // en spécifiant directement l'alias {par L2.titre} (situation hasardeuse tout de même) |
| 1011 | 1008 | } elseif ( |
| 1012 | 1009 | $table_alias |
| 1013 | 1010 | and isset($boucle->from[$table_alias]) |
| 1014 | 1011 | and $infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $boucle->from[$table_alias]) |
| 1015 | 1012 | ) { |
| 1016 | - $par = $infos['alias'] . "." . $champ; |
|
| 1013 | + $par = $infos['alias'].".".$champ; |
|
| 1017 | 1014 | } elseif ($table) { |
| 1018 | 1015 | // On avait table + champ, mais on ne les a pas trouvés |
| 1019 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 1016 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 1020 | 1017 | } else { |
| 1021 | 1018 | // Sinon tant pis, ca doit etre un champ synthetise (cf points) |
| 1022 | 1019 | } |
@@ -1040,7 +1037,7 @@ discard block |
||
| 1040 | 1037 | if (!$t) { |
| 1041 | 1038 | $t = trouver_jointure_champ($champ, $boucle); |
| 1042 | 1039 | } |
| 1043 | - return !$t ? '' : ("'" . $t . '.' . $champ . "'"); |
|
| 1040 | + return !$t ? '' : ("'".$t.'.'.$champ."'"); |
|
| 1044 | 1041 | } |
| 1045 | 1042 | |
| 1046 | 1043 | /** |
@@ -1085,9 +1082,9 @@ discard block |
||
| 1085 | 1082 | $boucle->default_order[] = ' DESC'; |
| 1086 | 1083 | } |
| 1087 | 1084 | } else { |
| 1088 | - $t = $boucle->order[$n - 1] . " . $order"; |
|
| 1085 | + $t = $boucle->order[$n - 1]." . $order"; |
|
| 1089 | 1086 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 1090 | - $t = $r[1] . $r[2]; |
|
| 1087 | + $t = $r[1].$r[2]; |
|
| 1091 | 1088 | } |
| 1092 | 1089 | $boucle->order[$n - 1] = $t; |
| 1093 | 1090 | } |
@@ -1101,11 +1098,11 @@ discard block |
||
| 1101 | 1098 | * @param $crit |
| 1102 | 1099 | * @return array|string |
| 1103 | 1100 | */ |
| 1104 | -function critere_par_ordre_liste_dist($idb, &$boucles, $crit){ |
|
| 1101 | +function critere_par_ordre_liste_dist($idb, &$boucles, $crit) { |
|
| 1105 | 1102 | $boucle = &$boucles[$idb]; |
| 1106 | 1103 | |
| 1107 | 1104 | $sens = $collecte = ''; |
| 1108 | - if ($crit->not){ |
|
| 1105 | + if ($crit->not) { |
|
| 1109 | 1106 | $sens = " . ' DESC'"; |
| 1110 | 1107 | } |
| 1111 | 1108 | |
@@ -1115,14 +1112,14 @@ discard block |
||
| 1115 | 1112 | $res = critere_parinverse($idb, $boucles, $crit2); |
| 1116 | 1113 | |
| 1117 | 1114 | // erreur ? |
| 1118 | - if (is_array($res)){ |
|
| 1115 | + if (is_array($res)) { |
|
| 1119 | 1116 | return $res; |
| 1120 | 1117 | } |
| 1121 | 1118 | |
| 1122 | 1119 | $_order = array_pop($boucle->order); |
| 1123 | 1120 | |
| 1124 | 1121 | $_liste = calculer_liste($crit->param[1], array(), $boucles, $boucles[$idb]->id_parent); |
| 1125 | - $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'" . $boucle->sql_serveur . "')) ? \$zl : '0').')'$sens"; |
|
| 1122 | + $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'".$boucle->sql_serveur."')) ? \$zl : '0').')'$sens"; |
|
| 1126 | 1123 | } |
| 1127 | 1124 | |
| 1128 | 1125 | |
@@ -1131,7 +1128,7 @@ discard block |
||
| 1131 | 1128 | $params = $crit->param; |
| 1132 | 1129 | |
| 1133 | 1130 | if (count($params) < 1) { |
| 1134 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " ?")); |
|
| 1131 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." ?")); |
|
| 1135 | 1132 | } |
| 1136 | 1133 | |
| 1137 | 1134 | $boucle = &$boucles[$idb]; |
@@ -1152,7 +1149,7 @@ discard block |
||
| 1152 | 1149 | if ((count($date) == 1) and ($date[0]->type == 'texte')) { |
| 1153 | 1150 | $date = $date[0]->texte; |
| 1154 | 1151 | if (!isset($fields[$date])) { |
| 1155 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " " . $date)); |
|
| 1152 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." ".$date)); |
|
| 1156 | 1153 | } |
| 1157 | 1154 | } else { |
| 1158 | 1155 | $a = calculer_liste($date, $idb, $boucles, $parent); |
@@ -1164,38 +1161,38 @@ discard block |
||
| 1164 | 1161 | $date = "'.(($cond)\n?\$a:\"$defaut\").'"; |
| 1165 | 1162 | } |
| 1166 | 1163 | $annee = $params ? array_shift($params) : ""; |
| 1167 | - $annee = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1168 | - calculer_liste($annee, $idb, $boucles, $parent) . |
|
| 1164 | + $annee = "\n".'sprintf("%04d", ($x = '. |
|
| 1165 | + calculer_liste($annee, $idb, $boucles, $parent). |
|
| 1169 | 1166 | ') ? $x : date("Y"))'; |
| 1170 | 1167 | |
| 1171 | 1168 | $mois = $params ? array_shift($params) : ""; |
| 1172 | - $mois = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1173 | - calculer_liste($mois, $idb, $boucles, $parent) . |
|
| 1169 | + $mois = "\n".'sprintf("%02d", ($x = '. |
|
| 1170 | + calculer_liste($mois, $idb, $boucles, $parent). |
|
| 1174 | 1171 | ') ? $x : date("m"))'; |
| 1175 | 1172 | |
| 1176 | 1173 | $jour = $params ? array_shift($params) : ""; |
| 1177 | - $jour = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1178 | - calculer_liste($jour, $idb, $boucles, $parent) . |
|
| 1174 | + $jour = "\n".'sprintf("%02d", ($x = '. |
|
| 1175 | + calculer_liste($jour, $idb, $boucles, $parent). |
|
| 1179 | 1176 | ') ? $x : date("d"))'; |
| 1180 | 1177 | |
| 1181 | 1178 | $annee2 = $params ? array_shift($params) : ""; |
| 1182 | - $annee2 = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1183 | - calculer_liste($annee2, $idb, $boucles, $parent) . |
|
| 1179 | + $annee2 = "\n".'sprintf("%04d", ($x = '. |
|
| 1180 | + calculer_liste($annee2, $idb, $boucles, $parent). |
|
| 1184 | 1181 | ') ? $x : date("Y"))'; |
| 1185 | 1182 | |
| 1186 | 1183 | $mois2 = $params ? array_shift($params) : ""; |
| 1187 | - $mois2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1188 | - calculer_liste($mois2, $idb, $boucles, $parent) . |
|
| 1184 | + $mois2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1185 | + calculer_liste($mois2, $idb, $boucles, $parent). |
|
| 1189 | 1186 | ') ? $x : date("m"))'; |
| 1190 | 1187 | |
| 1191 | 1188 | $jour2 = $params ? array_shift($params) : ""; |
| 1192 | - $jour2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1193 | - calculer_liste($jour2, $idb, $boucles, $parent) . |
|
| 1189 | + $jour2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1190 | + calculer_liste($jour2, $idb, $boucles, $parent). |
|
| 1194 | 1191 | ') ? $x : date("d"))'; |
| 1195 | 1192 | |
| 1196 | - $date = $boucle->id_table . ".$date"; |
|
| 1193 | + $date = $boucle->id_table.".$date"; |
|
| 1197 | 1194 | |
| 1198 | - $quote_end = ",'" . $boucle->sql_serveur . "','text'"; |
|
| 1195 | + $quote_end = ",'".$boucle->sql_serveur."','text'"; |
|
| 1199 | 1196 | if ($type == 'jour') { |
| 1200 | 1197 | $boucle->where[] = array( |
| 1201 | 1198 | "'='", |
@@ -1267,14 +1264,13 @@ discard block |
||
| 1267 | 1264 | list($a21, $a22) = calculer_critere_parties_aux($idb, $boucles, $a2); |
| 1268 | 1265 | |
| 1269 | 1266 | if (($op == ',') && (is_numeric($a11) && (is_numeric($a21)))) { |
| 1270 | - $boucle->limit = $a11 . ',' . $a21; |
|
| 1267 | + $boucle->limit = $a11.','.$a21; |
|
| 1271 | 1268 | } else { |
| 1272 | 1269 | // 3 dans {1/3}, {2,3} ou {1,n-3} |
| 1273 | 1270 | $boucle->total_parties = ($a21 != 'n') ? $a21 : $a22; |
| 1274 | 1271 | // 2 dans {2/3}, {2,5}, {n-2,1} |
| 1275 | 1272 | $partie = ($a11 != 'n') ? $a11 : $a12; |
| 1276 | - $mode = (($op == '/') ? '/' : |
|
| 1277 | - (($a11 == 'n') ? '-' : '+') . (($a21 == 'n') ? '-' : '+')); |
|
| 1273 | + $mode = (($op == '/') ? '/' : (($a11 == 'n') ? '-' : '+').(($a21 == 'n') ? '-' : '+')); |
|
| 1278 | 1274 | // cas simple {0,#ENV{truc}} compilons le en LIMIT : |
| 1279 | 1275 | if ($a11 !== 'n' and $a21 !== 'n' and $mode == "++" and $op == ',') { |
| 1280 | 1276 | $boucle->limit = |
@@ -1320,8 +1316,7 @@ discard block |
||
| 1320 | 1316 | // {1/3} |
| 1321 | 1317 | if ($op1 == '/') { |
| 1322 | 1318 | $pmoins1 = is_numeric($debut) ? ($debut - 1) : "($debut-1)"; |
| 1323 | - $totpos = is_numeric($total_parties) ? ($total_parties) : |
|
| 1324 | - "($total_parties ? $total_parties : 1)"; |
|
| 1319 | + $totpos = is_numeric($total_parties) ? ($total_parties) : "($total_parties ? $total_parties : 1)"; |
|
| 1325 | 1320 | $fin = "ceil(($nombre_boucle * $debut )/$totpos) - 1"; |
| 1326 | 1321 | $debut = !$pmoins1 ? 0 : "ceil(($nombre_boucle * $pmoins1)/$totpos);"; |
| 1327 | 1322 | } else { |
@@ -1332,15 +1327,13 @@ discard block |
||
| 1332 | 1327 | |
| 1333 | 1328 | // cas {x,n-1} |
| 1334 | 1329 | if ($op2 == '-') { |
| 1335 | - $fin = '$debut_boucle + ' . $nombre_boucle . ' - ' |
|
| 1336 | - . (is_numeric($total_parties) ? ($total_parties + 1) : |
|
| 1337 | - ($total_parties . ' - 1')); |
|
| 1330 | + $fin = '$debut_boucle + '.$nombre_boucle.' - ' |
|
| 1331 | + . (is_numeric($total_parties) ? ($total_parties + 1) : ($total_parties.' - 1')); |
|
| 1338 | 1332 | } else { |
| 1339 | 1333 | // {x,1} ou {pagination} |
| 1340 | 1334 | $fin = '$debut_boucle' |
| 1341 | 1335 | . (is_numeric($total_parties) ? |
| 1342 | - (($total_parties == 1) ? "" : (' + ' . ($total_parties - 1))) : |
|
| 1343 | - ('+' . $total_parties . ' - 1')); |
|
| 1336 | + (($total_parties == 1) ? "" : (' + '.($total_parties - 1))) : ('+'.$total_parties.' - 1')); |
|
| 1344 | 1337 | } |
| 1345 | 1338 | |
| 1346 | 1339 | // {pagination}, gerer le debut_xx=-1 pour tout voir |
@@ -1358,11 +1351,11 @@ discard block |
||
| 1358 | 1351 | // Utiliser min pour rabattre $fin_boucle sur total_boucle. |
| 1359 | 1352 | |
| 1360 | 1353 | $boucles[$id_boucle]->mode_partie = "\n\t" |
| 1361 | - . '$debut_boucle = ' . $debut . ";\n " |
|
| 1354 | + . '$debut_boucle = '.$debut.";\n " |
|
| 1362 | 1355 | . "\$debut_boucle = intval(\$debut_boucle);\n " |
| 1363 | - . '$fin_boucle = min(' . $fin . ", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1364 | - . '$Numrows[\'' . $id_boucle . "']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1365 | - . '$Numrows[\'' . $id_boucle . '\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1356 | + . '$fin_boucle = min('.$fin.", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1357 | + . '$Numrows[\''.$id_boucle."']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1358 | + . '$Numrows[\''.$id_boucle.'\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1366 | 1359 | . "\n\tif (\$debut_boucle>0" |
| 1367 | 1360 | . " AND \$debut_boucle < \$Numrows['$id_boucle']['grand_total']" |
| 1368 | 1361 | . " AND \$iter->seek(\$debut_boucle,'continue'))" |
@@ -1447,16 +1440,16 @@ discard block |
||
| 1447 | 1440 | // critere personnalise ? |
| 1448 | 1441 | if ( |
| 1449 | 1442 | (!$serveur or |
| 1450 | - ((!function_exists($f = "critere_" . $serveur . "_" . $table . "_" . $critere)) |
|
| 1451 | - and (!function_exists($f = $f . "_dist")) |
|
| 1452 | - and (!function_exists($f = "critere_" . $serveur . "_" . $critere)) |
|
| 1453 | - and (!function_exists($f = $f . "_dist")) |
|
| 1443 | + ((!function_exists($f = "critere_".$serveur."_".$table."_".$critere)) |
|
| 1444 | + and (!function_exists($f = $f."_dist")) |
|
| 1445 | + and (!function_exists($f = "critere_".$serveur."_".$critere)) |
|
| 1446 | + and (!function_exists($f = $f."_dist")) |
|
| 1454 | 1447 | ) |
| 1455 | 1448 | ) |
| 1456 | - and (!function_exists($f = "critere_" . $table . "_" . $critere)) |
|
| 1457 | - and (!function_exists($f = $f . "_dist")) |
|
| 1458 | - and (!function_exists($f = "critere_" . $critere)) |
|
| 1459 | - and (!function_exists($f = $f . "_dist")) |
|
| 1449 | + and (!function_exists($f = "critere_".$table."_".$critere)) |
|
| 1450 | + and (!function_exists($f = $f."_dist")) |
|
| 1451 | + and (!function_exists($f = "critere_".$critere)) |
|
| 1452 | + and (!function_exists($f = $f."_dist")) |
|
| 1460 | 1453 | ) { |
| 1461 | 1454 | // fonction critere standard |
| 1462 | 1455 | $f = $defaut; |
@@ -1489,9 +1482,9 @@ discard block |
||
| 1489 | 1482 | */ |
| 1490 | 1483 | function kwote($lisp, $serveur = '', $type = '') { |
| 1491 | 1484 | if (preg_match(_CODE_QUOTE, $lisp, $r)) { |
| 1492 | - return $r[1] . "\"" . sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type) . "\""; |
|
| 1485 | + return $r[1]."\"".sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type)."\""; |
|
| 1493 | 1486 | } else { |
| 1494 | - return "sql_quote($lisp, '$serveur', '" . str_replace("'", "\\'", $type) . "')"; |
|
| 1487 | + return "sql_quote($lisp, '$serveur', '".str_replace("'", "\\'", $type)."')"; |
|
| 1495 | 1488 | } |
| 1496 | 1489 | } |
| 1497 | 1490 | |
@@ -1513,7 +1506,7 @@ discard block |
||
| 1513 | 1506 | function critere_IN_dist($idb, &$boucles, $crit) { |
| 1514 | 1507 | $r = calculer_critere_infixe($idb, $boucles, $crit); |
| 1515 | 1508 | if (!$r) { |
| 1516 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . " ?"))); |
|
| 1509 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op." ?"))); |
|
| 1517 | 1510 | } |
| 1518 | 1511 | list($arg, $op, $val, $col, $where_complement) = $r; |
| 1519 | 1512 | |
@@ -1540,8 +1533,8 @@ discard block |
||
| 1540 | 1533 | "'NOT'", |
| 1541 | 1534 | array( |
| 1542 | 1535 | "'IN'", |
| 1543 | - "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", |
|
| 1544 | - array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where) |
|
| 1536 | + "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", |
|
| 1537 | + array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where) |
|
| 1545 | 1538 | ) |
| 1546 | 1539 | ); |
| 1547 | 1540 | } |
@@ -1560,22 +1553,22 @@ discard block |
||
| 1560 | 1553 | $descr = $boucles[$idb]->descr; |
| 1561 | 1554 | $cpt = &$num[$descr['nom']][$descr['gram']][$idb]; |
| 1562 | 1555 | |
| 1563 | - $var = '$in' . $cpt++; |
|
| 1556 | + $var = '$in'.$cpt++; |
|
| 1564 | 1557 | $x = "\n\t$var = array();"; |
| 1565 | 1558 | foreach ($val as $k => $v) { |
| 1566 | 1559 | if (preg_match(",^(\n//.*\n)?'(.*)'$,", $v, $r)) { |
| 1567 | 1560 | // optimiser le traitement des constantes |
| 1568 | 1561 | if (is_numeric($r[2])) { |
| 1569 | - $x .= "\n\t$var" . "[]= $r[2];"; |
|
| 1562 | + $x .= "\n\t$var"."[]= $r[2];"; |
|
| 1570 | 1563 | } else { |
| 1571 | - $x .= "\n\t$var" . "[]= " . sql_quote($r[2]) . ";"; |
|
| 1564 | + $x .= "\n\t$var"."[]= ".sql_quote($r[2]).";"; |
|
| 1572 | 1565 | } |
| 1573 | 1566 | } else { |
| 1574 | 1567 | // Pour permettre de passer des tableaux de valeurs |
| 1575 | 1568 | // on repere l'utilisation brute de #ENV**{X}, |
| 1576 | 1569 | // c'est-a-dire sa traduction en ($PILE[0][X]). |
| 1577 | 1570 | // et on deballe mais en rajoutant l'anti XSS |
| 1578 | - $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var" . "[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1571 | + $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var"."[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1579 | 1572 | } |
| 1580 | 1573 | } |
| 1581 | 1574 | |
@@ -1589,7 +1582,7 @@ discard block |
||
| 1589 | 1582 | $boucles[$idb]->default_order[] = "((!\$zqv=sql_quote($var) OR \$zqv===\"''\") ? 0 : ('FIELD($arg,' . \$zqv . ')'))"; |
| 1590 | 1583 | } |
| 1591 | 1584 | |
| 1592 | - return "sql_in('$arg', $var" . ($crit2 == 'NOT' ? ",'NOT'" : "") . ")"; |
|
| 1585 | + return "sql_in('$arg', $var".($crit2 == 'NOT' ? ",'NOT'" : "").")"; |
|
| 1593 | 1586 | } |
| 1594 | 1587 | |
| 1595 | 1588 | /** |
@@ -1662,7 +1655,7 @@ discard block |
||
| 1662 | 1655 | $champs = array_diff($champs, array_keys($boucle->modificateur['criteres'])); |
| 1663 | 1656 | } |
| 1664 | 1657 | // nous aider en mode debug. |
| 1665 | - $boucle->debug[] = "id_ : " . implode(', ', $champs); |
|
| 1658 | + $boucle->debug[] = "id_ : ".implode(', ', $champs); |
|
| 1666 | 1659 | $boucle->modificateur['id_'] = $champs; |
| 1667 | 1660 | |
| 1668 | 1661 | // créer un critère {id_xxx?} de chaque champ retenu |
@@ -1703,7 +1696,7 @@ discard block |
||
| 1703 | 1696 | // Les champs id_xx de la table demandée |
| 1704 | 1697 | $champs = array_filter( |
| 1705 | 1698 | array_keys($desc['field']), |
| 1706 | - function($champ){ |
|
| 1699 | + function($champ) { |
|
| 1707 | 1700 | return |
| 1708 | 1701 | strpos($champ, 'id_') === 0 |
| 1709 | 1702 | or (in_array($champ, array('objet'))); |
@@ -1918,8 +1911,8 @@ discard block |
||
| 1918 | 1911 | "'NOT'", |
| 1919 | 1912 | array( |
| 1920 | 1913 | "'IN'", |
| 1921 | - "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", |
|
| 1922 | - array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where) |
|
| 1914 | + "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", |
|
| 1915 | + array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where) |
|
| 1923 | 1916 | ) |
| 1924 | 1917 | ); |
| 1925 | 1918 | } |
@@ -1930,7 +1923,7 @@ discard block |
||
| 1930 | 1923 | if ($crit->cond) { |
| 1931 | 1924 | $pred = calculer_argument_precedent($idb, $col, $boucles); |
| 1932 | 1925 | if ($col == "date" or $col == "date_redac") { |
| 1933 | - if ($pred == "\$Pile[0]['" . $col . "']") { |
|
| 1926 | + if ($pred == "\$Pile[0]['".$col."']") { |
|
| 1934 | 1927 | $pred = "(\$Pile[0]['{$col}_default']?'':$pred)"; |
| 1935 | 1928 | } |
| 1936 | 1929 | } |
@@ -2091,7 +2084,7 @@ discard block |
||
| 2091 | 2084 | // defaire le quote des int et les passer dans sql_quote avec le bon type de champ si on le connait, int sinon |
| 2092 | 2085 | // prendre en compte le debug ou la valeur arrive avec un commentaire PHP en debut |
| 2093 | 2086 | if (preg_match(",^\\A(\s*//.*?$\s*)?\"'(-?\d+)'\"\\z,ms", $val[0], $r)) { |
| 2094 | - $val[0] = $r[1] . '"' . sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote) . '"'; |
|
| 2087 | + $val[0] = $r[1].'"'.sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote).'"'; |
|
| 2095 | 2088 | } |
| 2096 | 2089 | // sinon expliciter les |
| 2097 | 2090 | // sql_quote(truc) en sql_quote(truc,'',type) |
@@ -2102,22 +2095,22 @@ discard block |
||
| 2102 | 2095 | // sql_quote(truc,'','varchar') |
| 2103 | 2096 | elseif (preg_match('/\Asql_quote[(](.*?)(,[^)]*?)?(,[^)]*(?:\(\d+\)[^)]*)?)?[)]\s*\z/ms', $val[0], $r) |
| 2104 | 2097 | // si pas deja un type |
| 2105 | - and (!isset($r[3]) or !$r[3] or !trim($r[3],", '")) |
|
| 2098 | + and (!isset($r[3]) or !$r[3] or !trim($r[3], ", '")) |
|
| 2106 | 2099 | ) { |
| 2107 | 2100 | $r = $r[1] |
| 2108 | 2101 | . ((isset($r[2]) and $r[2]) ? $r[2] : ",''") |
| 2109 | - . ",'" . addslashes($type_cast_quote) . "'"; |
|
| 2102 | + . ",'".addslashes($type_cast_quote)."'"; |
|
| 2110 | 2103 | $val[0] = "sql_quote($r)"; |
| 2111 | 2104 | } |
| 2112 | - elseif(strpos($val[0], '@@defaultcast@@') !== false |
|
| 2105 | + elseif (strpos($val[0], '@@defaultcast@@') !== false |
|
| 2113 | 2106 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) { |
| 2114 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'" . addslashes($type_cast_quote) . "')"; |
|
| 2107 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'".addslashes($type_cast_quote)."')"; |
|
| 2115 | 2108 | } |
| 2116 | 2109 | } |
| 2117 | 2110 | |
| 2118 | - if(strpos($val[0], '@@defaultcast@@') !== false |
|
| 2111 | + if (strpos($val[0], '@@defaultcast@@') !== false |
|
| 2119 | 2112 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) { |
| 2120 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'char')"; |
|
| 2113 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'char')"; |
|
| 2121 | 2114 | } |
| 2122 | 2115 | |
| 2123 | 2116 | // Indicateur pour permettre aux fonctionx boucle_X de modifier |
@@ -2133,7 +2126,7 @@ discard block |
||
| 2133 | 2126 | // inserer le nom de la table SQL devant le nom du champ |
| 2134 | 2127 | if ($table) { |
| 2135 | 2128 | if ($col[0] == "`") { |
| 2136 | - $arg = "$table." . substr($col, 1, -1); |
|
| 2129 | + $arg = "$table.".substr($col, 1, -1); |
|
| 2137 | 2130 | } else { |
| 2138 | 2131 | $arg = "$table.$col"; |
| 2139 | 2132 | } |
@@ -2267,9 +2260,9 @@ discard block |
||
| 2267 | 2260 | **/ |
| 2268 | 2261 | function primary_doublee($decompose, $table) { |
| 2269 | 2262 | $e1 = reset($decompose); |
| 2270 | - $e2 = "sql_quote('" . end($decompose) . "')"; |
|
| 2263 | + $e2 = "sql_quote('".end($decompose)."')"; |
|
| 2271 | 2264 | |
| 2272 | - return array("'='", "'$table." . $e1 . "'", $e2); |
|
| 2265 | + return array("'='", "'$table.".$e1."'", $e2); |
|
| 2273 | 2266 | } |
| 2274 | 2267 | |
| 2275 | 2268 | /** |
@@ -2307,7 +2300,7 @@ discard block |
||
| 2307 | 2300 | if ($checkarrivee |
| 2308 | 2301 | and is_string($checkarrivee) |
| 2309 | 2302 | and $a = table_objet($checkarrivee) |
| 2310 | - and in_array($a . '_liens', $joints) |
|
| 2303 | + and in_array($a.'_liens', $joints) |
|
| 2311 | 2304 | ) { |
| 2312 | 2305 | if ($res = calculer_lien_externe_init($boucle, $joints, $col, $desc, $cond, $checkarrivee)) { |
| 2313 | 2306 | return $res; |
@@ -2327,12 +2320,12 @@ discard block |
||
| 2327 | 2320 | // la table est déjà dans le FROM, on vérifie si le champ est utilisé. |
| 2328 | 2321 | $joindre = false; |
| 2329 | 2322 | foreach ($cols as $col) { |
| 2330 | - $c = '/\b' . $t . ".$col" . '\b/'; |
|
| 2323 | + $c = '/\b'.$t.".$col".'\b/'; |
|
| 2331 | 2324 | if (trouver_champ($c, $boucle->where)) { |
| 2332 | 2325 | $joindre = true; |
| 2333 | 2326 | } else { |
| 2334 | 2327 | // mais ca peut etre dans le FIELD pour le Having |
| 2335 | - $c = "/FIELD.$t" . ".$col,/"; |
|
| 2328 | + $c = "/FIELD.$t".".$col,/"; |
|
| 2336 | 2329 | if (trouver_champ($c, $boucle->select)) { |
| 2337 | 2330 | $joindre = true; |
| 2338 | 2331 | } |
@@ -2379,7 +2372,7 @@ discard block |
||
| 2379 | 2372 | $primary_arrivee = id_table_objet($checkarrivee); |
| 2380 | 2373 | |
| 2381 | 2374 | // [FIXME] $checkarrivee peut-il arriver avec false ???? |
| 2382 | - $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee . "_liens"); |
|
| 2375 | + $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee."_liens"); |
|
| 2383 | 2376 | $arrivee = trouver_champ_exterieur($col, $joints, $boucle, $checkarrivee); |
| 2384 | 2377 | |
| 2385 | 2378 | if (!$intermediaire or !$arrivee) { |
@@ -2477,7 +2470,7 @@ discard block |
||
| 2477 | 2470 | } elseif ($crit->cond and ($col == "date" or $col == "date_redac")) { |
| 2478 | 2471 | // un critere conditionnel sur date est traite a part |
| 2479 | 2472 | // car la date est mise d'office par SPIP, |
| 2480 | - $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['" . $col . "'])"; |
|
| 2473 | + $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['".$col."'])"; |
|
| 2481 | 2474 | } |
| 2482 | 2475 | |
| 2483 | 2476 | $val = calculer_argument_precedent($idb, $val, $boucles, $defaut); |
@@ -2508,7 +2501,7 @@ discard block |
||
| 2508 | 2501 | and (($p == "'") or ($p == '"')) |
| 2509 | 2502 | and $params[0][1]->type == 'champ' |
| 2510 | 2503 | ) { |
| 2511 | - $val[] = "$p\\$p#" . $params[0][1]->nom_champ . "\\$p$p"; |
|
| 2504 | + $val[] = "$p\\$p#".$params[0][1]->nom_champ."\\$p$p"; |
|
| 2512 | 2505 | } else { |
| 2513 | 2506 | foreach ((($op != 'IN') ? $params : calculer_vieux_in($params)) as $p) { |
| 2514 | 2507 | $a = calculer_liste($p, $idb, $boucles, $parent); |
@@ -2524,7 +2517,7 @@ discard block |
||
| 2524 | 2517 | $fct = $args_sql = ''; |
| 2525 | 2518 | // fonction SQL ? |
| 2526 | 2519 | // chercher FONCTION(champ) tel que CONCAT(titre,descriptif) |
| 2527 | - if (preg_match('/^(.*)' . SQL_ARGS . '$/', $col, $m)) { |
|
| 2520 | + if (preg_match('/^(.*)'.SQL_ARGS.'$/', $col, $m)) { |
|
| 2528 | 2521 | $fct = $m[1]; |
| 2529 | 2522 | preg_match('/^\(([^,]*)(.*)\)$/', $m[2], $a); |
| 2530 | 2523 | $col = $a[1]; |
@@ -2614,7 +2607,7 @@ discard block |
||
| 2614 | 2607 | # si oui choisir ce champ, sinon choisir xxxx |
| 2615 | 2608 | |
| 2616 | 2609 | if (isset($table['field']["date$suite"])) { |
| 2617 | - $date_orig = 'date' . $suite; |
|
| 2610 | + $date_orig = 'date'.$suite; |
|
| 2618 | 2611 | } else { |
| 2619 | 2612 | $date_orig = substr($suite, 1); |
| 2620 | 2613 | } |
@@ -2625,12 +2618,12 @@ discard block |
||
| 2625 | 2618 | } |
| 2626 | 2619 | } |
| 2627 | 2620 | |
| 2628 | - $date_compare = "\"' . normaliser_date(" . |
|
| 2629 | - calculer_argument_precedent($idb, $pred, $boucles) . |
|
| 2621 | + $date_compare = "\"' . normaliser_date(". |
|
| 2622 | + calculer_argument_precedent($idb, $pred, $boucles). |
|
| 2630 | 2623 | ") . '\""; |
| 2631 | 2624 | |
| 2632 | 2625 | $col_vraie = $date_orig; |
| 2633 | - $date_orig = $boucle->id_table . '.' . $date_orig; |
|
| 2626 | + $date_orig = $boucle->id_table.'.'.$date_orig; |
|
| 2634 | 2627 | |
| 2635 | 2628 | switch ($col) { |
| 2636 | 2629 | case 'date': |
@@ -2650,26 +2643,26 @@ discard block |
||
| 2650 | 2643 | break; |
| 2651 | 2644 | case 'age': |
| 2652 | 2645 | $col = calculer_param_date("\'' . date('Y-m-d H:i:00') . '\'", $date_orig); |
| 2653 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2646 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2654 | 2647 | break; |
| 2655 | 2648 | case 'age_relatif': |
| 2656 | 2649 | $col = calculer_param_date($date_compare, $date_orig); |
| 2657 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2650 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2658 | 2651 | break; |
| 2659 | 2652 | case 'jour_relatif': |
| 2660 | - $col = "(TO_DAYS(" . $date_compare . ")-TO_DAYS(" . $date_orig . "))"; |
|
| 2661 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2653 | + $col = "(TO_DAYS(".$date_compare.")-TO_DAYS(".$date_orig."))"; |
|
| 2654 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2662 | 2655 | break; |
| 2663 | 2656 | case 'mois_relatif': |
| 2664 | - $col = "MONTH(" . $date_compare . ")-MONTH(" . |
|
| 2665 | - $date_orig . ")+12*(YEAR(" . $date_compare . |
|
| 2666 | - ")-YEAR(" . $date_orig . "))"; |
|
| 2667 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2657 | + $col = "MONTH(".$date_compare.")-MONTH(". |
|
| 2658 | + $date_orig.")+12*(YEAR(".$date_compare. |
|
| 2659 | + ")-YEAR(".$date_orig."))"; |
|
| 2660 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2668 | 2661 | break; |
| 2669 | 2662 | case 'annee_relatif': |
| 2670 | - $col = "YEAR(" . $date_compare . ")-YEAR(" . |
|
| 2671 | - $date_orig . ")"; |
|
| 2672 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2663 | + $col = "YEAR(".$date_compare.")-YEAR(". |
|
| 2664 | + $date_orig.")"; |
|
| 2665 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2673 | 2666 | break; |
| 2674 | 2667 | } |
| 2675 | 2668 | |
@@ -2728,10 +2721,10 @@ discard block |
||
| 2728 | 2721 | } |
| 2729 | 2722 | |
| 2730 | 2723 | $boucle->hash .= ' |
| 2731 | - $command[\'sourcemode\'] = ' . array_shift($args) . ";\n"; |
|
| 2724 | + $command[\'sourcemode\'] = ' . array_shift($args).";\n"; |
|
| 2732 | 2725 | |
| 2733 | 2726 | $boucle->hash .= ' |
| 2734 | - $command[\'source\'] = array(' . join(', ', $args) . ");\n"; |
|
| 2727 | + $command[\'source\'] = array(' . join(', ', $args).");\n"; |
|
| 2735 | 2728 | } |
| 2736 | 2729 | |
| 2737 | 2730 | /** |
@@ -2750,7 +2743,7 @@ discard block |
||
| 2750 | 2743 | function critere_DATA_datacache_dist($idb, &$boucles, $crit) { |
| 2751 | 2744 | $boucle = &$boucles[$idb]; |
| 2752 | 2745 | $boucle->hash .= ' |
| 2753 | - $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2746 | + $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2754 | 2747 | } |
| 2755 | 2748 | |
| 2756 | 2749 | |
@@ -2769,7 +2762,7 @@ discard block |
||
| 2769 | 2762 | $boucle->hash .= '$command[\'args\']=array();'; |
| 2770 | 2763 | foreach ($crit->param as $param) { |
| 2771 | 2764 | $boucle->hash .= ' |
| 2772 | - $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2765 | + $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2773 | 2766 | } |
| 2774 | 2767 | } |
| 2775 | 2768 | |
@@ -2788,10 +2781,10 @@ discard block |
||
| 2788 | 2781 | */ |
| 2789 | 2782 | function critere_DATA_liste_dist($idb, &$boucles, $crit) { |
| 2790 | 2783 | $boucle = &$boucles[$idb]; |
| 2791 | - $boucle->hash .= "\n\t" . '$command[\'liste\'] = array();' . "\n"; |
|
| 2784 | + $boucle->hash .= "\n\t".'$command[\'liste\'] = array();'."\n"; |
|
| 2792 | 2785 | foreach ($crit->param as $param) { |
| 2793 | - $boucle->hash .= "\t" . '$command[\'liste\'][] = ' . calculer_liste($param, $idb, $boucles, |
|
| 2794 | - $boucles[$idb]->id_parent) . ";\n"; |
|
| 2786 | + $boucle->hash .= "\t".'$command[\'liste\'][] = '.calculer_liste($param, $idb, $boucles, |
|
| 2787 | + $boucles[$idb]->id_parent).";\n"; |
|
| 2795 | 2788 | } |
| 2796 | 2789 | } |
| 2797 | 2790 | |
@@ -2818,10 +2811,10 @@ discard block |
||
| 2818 | 2811 | */ |
| 2819 | 2812 | function critere_DATA_enum_dist($idb, &$boucles, $crit) { |
| 2820 | 2813 | $boucle = &$boucles[$idb]; |
| 2821 | - $boucle->hash .= "\n\t" . '$command[\'enum\'] = array();' . "\n"; |
|
| 2814 | + $boucle->hash .= "\n\t".'$command[\'enum\'] = array();'."\n"; |
|
| 2822 | 2815 | foreach ($crit->param as $param) { |
| 2823 | - $boucle->hash .= "\t" . '$command[\'enum\'][] = ' . calculer_liste($param, $idb, $boucles, |
|
| 2824 | - $boucles[$idb]->id_parent) . ";\n"; |
|
| 2816 | + $boucle->hash .= "\t".'$command[\'enum\'][] = '.calculer_liste($param, $idb, $boucles, |
|
| 2817 | + $boucles[$idb]->id_parent).";\n"; |
|
| 2825 | 2818 | } |
| 2826 | 2819 | } |
| 2827 | 2820 | |
@@ -2840,7 +2833,7 @@ discard block |
||
| 2840 | 2833 | $boucle = &$boucles[$idb]; |
| 2841 | 2834 | foreach ($crit->param as $param) { |
| 2842 | 2835 | $boucle->hash .= ' |
| 2843 | - $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2836 | + $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2844 | 2837 | } |
| 2845 | 2838 | } |
| 2846 | 2839 | |
@@ -2881,7 +2874,7 @@ discard block |
||
| 2881 | 2874 | if ($crit->param) { |
| 2882 | 2875 | foreach ($crit->param as $param) { |
| 2883 | 2876 | $boucle->hash .= "\t\$command['si'][] = " |
| 2884 | - . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ";\n"; |
|
| 2877 | + . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).";\n"; |
|
| 2885 | 2878 | } |
| 2886 | 2879 | // interdire {si 0} aussi ! |
| 2887 | 2880 | } else { |
@@ -2905,7 +2898,7 @@ discard block |
||
| 2905 | 2898 | function critere_POUR_tableau_dist($idb, &$boucles, $crit) { |
| 2906 | 2899 | $boucle = &$boucles[$idb]; |
| 2907 | 2900 | $boucle->hash .= ' |
| 2908 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2901 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).'); |
|
| 2909 | 2902 | $command[\'sourcemode\'] = \'table\';'; |
| 2910 | 2903 | } |
| 2911 | 2904 | |
@@ -2938,11 +2931,10 @@ discard block |
||
| 2938 | 2931 | $table_sql = table_objet_sql(objet_type($table)); |
| 2939 | 2932 | |
| 2940 | 2933 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 2941 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 2942 | - 'id_parent'; |
|
| 2934 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 2943 | 2935 | |
| 2944 | 2936 | $in = "IN"; |
| 2945 | - $where = array("'IN'", "'$boucle->id_table." . "$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"); |
|
| 2937 | + $where = array("'IN'", "'$boucle->id_table."."$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"); |
|
| 2946 | 2938 | if ($not) { |
| 2947 | 2939 | $where = array("'NOT'", $where); |
| 2948 | 2940 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $res = admin_repair_tables(); |
| 40 | 40 | if (!$res) { |
| 41 | - $res = "<div class='error'>" . _T('avis_erreur_mysql') . ' ' . sql_errno() . ': ' . sql_error() . "</div>\n"; |
|
| 41 | + $res = "<div class='error'>"._T('avis_erreur_mysql').' '.sql_errno().': '.sql_error()."</div>\n"; |
|
| 42 | 42 | } else { |
| 43 | 43 | include_spip('inc/rubriques'); |
| 44 | 44 | calculer_rubriques(); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | include_spip('inc/minipres'); |
| 48 | 48 | $res .= pipeline('base_admin_repair', $res); |
| 49 | 49 | echo minipres(_T('texte_tentative_recuperation'), |
| 50 | - $res . generer_form_ecrire('accueil', '', '', _T('public:accueil_site'))); |
|
| 50 | + $res.generer_form_ecrire('accueil', '', '', _T('public:accueil_site'))); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -90,24 +90,24 @@ discard block |
||
| 90 | 90 | $count = sql_countsel($tab); |
| 91 | 91 | |
| 92 | 92 | if ($count > 1) { |
| 93 | - $m .= "(" . _T('texte_compte_elements', array('count' => $count)) . ")\n"; |
|
| 93 | + $m .= "("._T('texte_compte_elements', array('count' => $count)).")\n"; |
|
| 94 | 94 | } else { |
| 95 | 95 | if ($count == 1) { |
| 96 | - $m .= "(" . _T('texte_compte_element', array('count' => $count)) . ")\n"; |
|
| 96 | + $m .= "("._T('texte_compte_element', array('count' => $count)).")\n"; |
|
| 97 | 97 | } else { |
| 98 | - $m .= "(" . _T('texte_vide') . ")\n"; |
|
| 98 | + $m .= "("._T('texte_vide').")\n"; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | if ($result_repair |
| 103 | 103 | and $msg = join(" ", |
| 104 | - (is_resource($result_repair) or is_object($result_repair)) ? sql_fetch($result_repair) : $result_repair) . ' ' |
|
| 104 | + (is_resource($result_repair) or is_object($result_repair)) ? sql_fetch($result_repair) : $result_repair).' ' |
|
| 105 | 105 | and strpos($msg, ' OK ') === false |
| 106 | 106 | ) { |
| 107 | 107 | $class = " class='notice'"; |
| 108 | - $m .= "<br /><tt>" . spip_htmlentities($msg) . "</tt>\n"; |
|
| 108 | + $m .= "<br /><tt>".spip_htmlentities($msg)."</tt>\n"; |
|
| 109 | 109 | } else { |
| 110 | - $m .= " " . _T('texte_table_ok'); |
|
| 110 | + $m .= " "._T('texte_table_ok'); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $res .= "<div$class>$m</div>"; |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | $hsl = _couleur_hex_to_hsl($couleur); |
| 205 | 205 | $hsl = [ |
| 206 | 206 | 'h' => round($hsl['h'] * 360), |
| 207 | - 's' => round($hsl['s'] * 100) . '%', |
|
| 208 | - 'l' => round($hsl['l'] * 100) . '%' |
|
| 207 | + 's' => round($hsl['s'] * 100).'%', |
|
| 208 | + 'l' => round($hsl['l'] * 100).'%' |
|
| 209 | 209 | ]; |
| 210 | 210 | if ($format === null) { |
| 211 | 211 | return "hsl({$hsl['h']}, {$hsl['s']}, {$hsl['l']})"; |
@@ -384,11 +384,11 @@ discard block |
||
| 384 | 384 | $process = 'AUTO' |
| 385 | 385 | ) { |
| 386 | 386 | // PHP 7+ type hint |
| 387 | - $img = (string)$img; |
|
| 388 | - $taille_x = (int)$taille_x; |
|
| 389 | - $taille_y = (int)$taille_y; |
|
| 390 | - $force = (bool)$force; |
|
| 391 | - $process = (string)$process; |
|
| 387 | + $img = (string) $img; |
|
| 388 | + $taille_x = (int) $taille_x; |
|
| 389 | + $taille_y = (int) $taille_y; |
|
| 390 | + $force = (bool) $force; |
|
| 391 | + $process = (string) $process; |
|
| 392 | 392 | |
| 393 | 393 | if (!$img) { |
| 394 | 394 | return ''; |
@@ -465,11 +465,11 @@ discard block |
||
| 465 | 465 | $process = 'AUTO' |
| 466 | 466 | ) { |
| 467 | 467 | // PHP 7+ type hint |
| 468 | - $img = (string)$img; |
|
| 469 | - $taille = (int)$taille; |
|
| 470 | - $taille_y = (int)$taille_y; |
|
| 471 | - $force = (bool)$force; |
|
| 472 | - $process = (string)$process; |
|
| 468 | + $img = (string) $img; |
|
| 469 | + $taille = (int) $taille; |
|
| 470 | + $taille_y = (int) $taille_y; |
|
| 471 | + $force = (bool) $force; |
|
| 472 | + $process = (string) $process; |
|
| 473 | 473 | |
| 474 | 474 | // Determiner la taille x,y maxi |
| 475 | 475 | // prendre le reglage de previsu par defaut |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | * sinon retourne le image_passe_partout usuel |
| 505 | 505 | * |
| 506 | 506 | **/ |
| 507 | -function image_recadre_avec_fallback ( |
|
| 507 | +function image_recadre_avec_fallback( |
|
| 508 | 508 | $im, |
| 509 | 509 | $width, |
| 510 | 510 | $height = '-', |
@@ -533,9 +533,9 @@ discard block |
||
| 533 | 533 | **/ |
| 534 | 534 | function image_reduire_par($img, $val = 1, $force = false) { |
| 535 | 535 | // PHP 7+ type hint |
| 536 | - $img = (string)$img; |
|
| 537 | - $val = (int)$val; |
|
| 538 | - $force = (bool)$force; |
|
| 536 | + $img = (string) $img; |
|
| 537 | + $val = (int) $val; |
|
| 538 | + $force = (bool) $force; |
|
| 539 | 539 | |
| 540 | 540 | list($hauteur, $largeur) = taille_image($img); |
| 541 | 541 | |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | $je_suis_poste = $flux['args']['je_suis_poste']; |
| 48 | 48 | |
| 49 | 49 | $cle_autosave = serialize($cle_autosave); |
| 50 | - $cle_autosave = $form . "_" . md5($cle_autosave); |
|
| 50 | + $cle_autosave = $form."_".md5($cle_autosave); |
|
| 51 | 51 | |
| 52 | 52 | // si on a un backup en session et qu'on est au premier chargement, non poste |
| 53 | 53 | // on restitue les donnees |
| 54 | - if (isset($GLOBALS['visiteur_session']['session_autosave_' . $cle_autosave]) |
|
| 54 | + if (isset($GLOBALS['visiteur_session']['session_autosave_'.$cle_autosave]) |
|
| 55 | 55 | and !$je_suis_poste |
| 56 | 56 | ) { |
| 57 | - parse_str($GLOBALS['visiteur_session']['session_autosave_' . $cle_autosave], $vars); |
|
| 57 | + parse_str($GLOBALS['visiteur_session']['session_autosave_'.$cle_autosave], $vars); |
|
| 58 | 58 | foreach ($vars as $key => $val) { |
| 59 | 59 | if (isset($flux['data'][$key])) { |
| 60 | 60 | $flux['data'][$key] = (is_string($val) ? autosave_clean_value($val) : array_map('autosave_clean_value', |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | if ($je_suis_poste and _request('autosave') === $cle_autosave and function_exists('terminer_actualiser_sessions')) { |
| 69 | 69 | terminer_actualiser_sessions(); |
| 70 | 70 | // et verifions si jamais l'autosave a fait un come back, dans ce cas on le revide |
| 71 | - if (isset($GLOBALS['visiteur_session']['session_autosave_' . $cle_autosave])) { |
|
| 72 | - session_set('session_autosave_' . $cle_autosave, null); |
|
| 71 | + if (isset($GLOBALS['visiteur_session']['session_autosave_'.$cle_autosave])) { |
|
| 72 | + session_set('session_autosave_'.$cle_autosave, null); |
|
| 73 | 73 | // en court sleep pour etre certain que la concurrence est finie |
| 74 | 74 | sleep(1); |
| 75 | 75 | terminer_actualiser_sessions(); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | $flux['data']['_hidden'] .= "<input type='hidden' name='autosave' class='autosaveactive' value='$cle_autosave' />" |
| 84 | 84 | . '<script type="text/javascript">/*<![CDATA[*/if (window.jQuery) jQuery(function(){ |
| 85 | - $("input.autosaveactive").closest("form:not(.autosaveon)").autosave({url:"' . $GLOBALS['meta']['adresse_site'] . '/"}).addClass("autosaveon"); |
|
| 85 | + $("input.autosaveactive").closest("form:not(.autosaveon)").autosave({url:"' . $GLOBALS['meta']['adresse_site'].'/"}).addClass("autosaveon"); |
|
| 86 | 86 | });/*]]>*/</script>'; |
| 87 | 87 | |
| 88 | 88 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | // on elimine les donnees de la session |
| 106 | 106 | if ($cle_autosave = _request('autosave')) { |
| 107 | 107 | include_spip('inc/session'); |
| 108 | - session_set('session_autosave_' . $cle_autosave, null); |
|
| 108 | + session_set('session_autosave_'.$cle_autosave, null); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | if (isset($GLOBALS['visiteur_session']) and $GLOBALS['visiteur_session']) { |
@@ -33,17 +33,17 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | function ranger_cache_gd2() { |
| 35 | 35 | spip_log("ranger_cache_gd2"); |
| 36 | - $base = _DIR_VAR . "cache-gd2/"; |
|
| 36 | + $base = _DIR_VAR."cache-gd2/"; |
|
| 37 | 37 | if (is_dir($base) and is_readable($base)) { |
| 38 | 38 | if ($dir = opendir($base)) { |
| 39 | 39 | while (($f = readdir($dir)) !== false) { |
| 40 | - if (!is_dir($base . $f) and strncmp($f, ".", 1) !== 0 |
|
| 40 | + if (!is_dir($base.$f) and strncmp($f, ".", 1) !== 0 |
|
| 41 | 41 | and preg_match(",[0-9a-f]{32}\.\w+,", $f) |
| 42 | 42 | ) { |
| 43 | 43 | $sub = substr($f, 0, 2); |
| 44 | 44 | $sub = sous_repertoire($base, $sub); |
| 45 | - @rename($base . $f, $sub . substr($f, 2)); |
|
| 46 | - @unlink($base . $f); // au cas ou le rename a foire (collision) |
|
| 45 | + @rename($base.$f, $sub.substr($f, 2)); |
|
| 46 | + @unlink($base.$f); // au cas ou le rename a foire (collision) |
|
| 47 | 47 | } |
| 48 | 48 | if (time() >= _TIME_OUT) { |
| 49 | 49 | return; |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | $exceptions_pluriel = array('forum' => 'forum', 'syndic' => 'syndic'); |
| 61 | 61 | |
| 62 | 62 | $pivot = preg_replace(',[^\w],', '', $pivot); // securite |
| 63 | - $pivots = (isset($exceptions_pluriel[$pivot]) ? $exceptions_pluriel[$pivot] : $pivot . "s"); |
|
| 64 | - $liens = "spip_" . $pivots . "_liens"; |
|
| 65 | - $id_pivot = "id_" . $pivot; |
|
| 63 | + $pivots = (isset($exceptions_pluriel[$pivot]) ? $exceptions_pluriel[$pivot] : $pivot."s"); |
|
| 64 | + $liens = "spip_".$pivots."_liens"; |
|
| 65 | + $id_pivot = "id_".$pivot; |
|
| 66 | 66 | // Creer spip_auteurs_liens |
| 67 | 67 | global $tables_auxiliaires; |
| 68 | 68 | if (!$l) { |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | $l = preg_replace(',[^\w],', '', $l); // securite |
| 75 | 75 | $primary = "id_$l"; |
| 76 | 76 | $objet = ($l == 'syndic' ? 'site' : $l); |
| 77 | - $ls = (isset($exceptions_pluriel[$l]) ? $exceptions_pluriel[$l] : $l . "s"); |
|
| 78 | - $ancienne_table = 'spip_' . $pivots . '_' . $ls; |
|
| 77 | + $ls = (isset($exceptions_pluriel[$l]) ? $exceptions_pluriel[$l] : $l."s"); |
|
| 78 | + $ancienne_table = 'spip_'.$pivots.'_'.$ls; |
|
| 79 | 79 | $pool = 400; |
| 80 | 80 | |
| 81 | 81 | $trouver_table = charger_fonction('trouver_table', 'base'); |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | while ($ids = array_map('reset', sql_allfetsel("$primary", $ancienne_table, '', '', '', "0,$sub_pool"))) { |
| 112 | 112 | $insert = array(); |
| 113 | 113 | foreach ($ids as $id) { |
| 114 | - $n = sql_countsel($liens, "objet='$objet' AND id_objet=" . intval($id)); |
|
| 115 | - while ($t = sql_allfetsel($champs, $ancienne_table, "$primary=" . intval($id), '', $id_pivot, "$n,$pool")) { |
|
| 114 | + $n = sql_countsel($liens, "objet='$objet' AND id_objet=".intval($id)); |
|
| 115 | + while ($t = sql_allfetsel($champs, $ancienne_table, "$primary=".intval($id), '', $id_pivot, "$n,$pool")) { |
|
| 116 | 116 | $n += count($t); |
| 117 | 117 | // empiler en s'assurant a minima de l'unicite |
| 118 | 118 | while ($r = array_shift($t)) { |
| 119 | - $insert[$r[$id_pivot] . ':' . $r['id_objet']] = $r; |
|
| 119 | + $insert[$r[$id_pivot].':'.$r['id_objet']] = $r; |
|
| 120 | 120 | } |
| 121 | 121 | if (count($insert) >= $sub_pool) { |
| 122 | 122 | maj_liens_insertq_multi_check($liens, $insert, $tables_auxiliaires[$liens]); |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | // cas particulier spip_auteurs : retablir le collate binary sur le login |
| 265 | 265 | $desc = $trouver_table("spip_auteurs"); |
| 266 | - spip_log("spip_auteurs : " . var_export($desc['field'], true), "maj." . _LOG_INFO_IMPORTANTE); |
|
| 266 | + spip_log("spip_auteurs : ".var_export($desc['field'], true), "maj."._LOG_INFO_IMPORTANTE); |
|
| 267 | 267 | if (stripos($desc['field']['login'], "BINARY") === false) { |
| 268 | 268 | spip_log("Retablir champ login BINARY sur table spip_auteurs", "maj"); |
| 269 | 269 | sql_alter("table spip_auteurs change login login VARCHAR(255) BINARY"); |
| 270 | 270 | $trouver_table(''); |
| 271 | 271 | $new_desc = $trouver_table("spip_auteurs"); |
| 272 | - spip_log("Apres conversion spip_auteurs : " . var_export($new_desc['field'], true), "maj." . _LOG_INFO_IMPORTANTE); |
|
| 272 | + spip_log("Apres conversion spip_auteurs : ".var_export($new_desc['field'], true), "maj."._LOG_INFO_IMPORTANTE); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | foreach ($tables as $table) { |
@@ -288,24 +288,24 @@ discard block |
||
| 288 | 288 | $data = sql_allfetsel("*", "spip_urls", '', '', 'date DESC'); |
| 289 | 289 | $urls = array(); |
| 290 | 290 | foreach ($data as $d) { |
| 291 | - $key = $d['id_parent'] . "::" . strtolower($d['url']); |
|
| 291 | + $key = $d['id_parent']."::".strtolower($d['url']); |
|
| 292 | 292 | if (!isset($urls[$key])) { |
| 293 | 293 | $urls[$key] = true; |
| 294 | 294 | } else { |
| 295 | - spip_log("Suppression doublon dans spip_urls avant conversion : " . serialize($d), |
|
| 296 | - "maj." . _LOG_INFO_IMPORTANTE); |
|
| 297 | - sql_delete("spip_urls", "id_parent=" . sql_quote($d['id_parent']) . " AND url=" . sql_quote($d['url'])); |
|
| 295 | + spip_log("Suppression doublon dans spip_urls avant conversion : ".serialize($d), |
|
| 296 | + "maj."._LOG_INFO_IMPORTANTE); |
|
| 297 | + sql_delete("spip_urls", "id_parent=".sql_quote($d['id_parent'])." AND url=".sql_quote($d['url'])); |
|
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | foreach ($desc['field'] as $field => $type) { |
| 302 | 302 | if ($desc['field'][$field] !== $desc_collate[$field]) { |
| 303 | - spip_log("Conversion COLLATE table $table", "maj." . _LOG_INFO_IMPORTANTE); |
|
| 304 | - sql_alter("table $table change $field $field " . $desc_collate[$field]); |
|
| 303 | + spip_log("Conversion COLLATE table $table", "maj."._LOG_INFO_IMPORTANTE); |
|
| 304 | + sql_alter("table $table change $field $field ".$desc_collate[$field]); |
|
| 305 | 305 | $trouver_table(''); |
| 306 | 306 | $new_desc = $trouver_table($table); |
| 307 | - spip_log("Apres conversion $table : " . var_export($new_desc['field'], true), |
|
| 308 | - "maj." . _LOG_INFO_IMPORTANTE); |
|
| 307 | + spip_log("Apres conversion $table : ".var_export($new_desc['field'], true), |
|
| 308 | + "maj."._LOG_INFO_IMPORTANTE); |
|
| 309 | 309 | continue 2; // inutile de continuer pour cette table : un seul alter remet tout a jour en sqlite |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | $GLOBALS['maj'][19236] = array( |
| 323 | 323 | array('sql_updateq', 'spip_meta', array('impt' => 'oui'), "nom='version_installee'"), // version base principale |
| 324 | - array('sql_updateq', 'spip_meta', array('impt' => 'oui'), "nom LIKE '%_base_version'"), // version base plugins |
|
| 324 | + array('sql_updateq', 'spip_meta', array('impt' => 'oui'), "nom LIKE '%_base_version'"), // version base plugins |
|
| 325 | 325 | array('maj_collation_sqlite'), |
| 326 | 326 | ); |
| 327 | 327 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | spip_log("supprimer sessions auteur"); |
| 339 | 339 | if ($dir = opendir(_DIR_SESSIONS)) { |
| 340 | 340 | while (($f = readdir($dir)) !== false) { |
| 341 | - spip_unlink(_DIR_SESSIONS . $f); |
|
| 341 | + spip_unlink(_DIR_SESSIONS.$f); |
|
| 342 | 342 | if (time() >= _TIME_OUT) { |
| 343 | 343 | return; |
| 344 | 344 | } |
@@ -64,12 +64,12 @@ |
||
| 64 | 64 | spip_log("Table $table TIMESTAMP incorrect", "maj"); |
| 65 | 65 | foreach ($desc['field'] as $field => $type) { |
| 66 | 66 | if ($desc['field'][$field] !== $fields_corrected[$field]) { |
| 67 | - spip_log("Adaptation TIMESTAMP table $table", "maj." . _LOG_INFO_IMPORTANTE); |
|
| 68 | - sql_alter("table $table change $field $field " . $fields_corrected[$field]); |
|
| 67 | + spip_log("Adaptation TIMESTAMP table $table", "maj."._LOG_INFO_IMPORTANTE); |
|
| 68 | + sql_alter("table $table change $field $field ".$fields_corrected[$field]); |
|
| 69 | 69 | $trouver_table(''); |
| 70 | 70 | $new_desc = $trouver_table($table); |
| 71 | - spip_log("Apres conversion $table : " . var_export($new_desc['field'], true), |
|
| 72 | - "maj." . _LOG_INFO_IMPORTANTE); |
|
| 71 | + spip_log("Apres conversion $table : ".var_export($new_desc['field'], true), |
|
| 72 | + "maj."._LOG_INFO_IMPORTANTE); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | if ($GLOBALS['spip_version_base'] != $GLOBALS['meta']['version_installee']) { |
| 57 | 57 | if (!is_numeric(_request('reinstall'))) { |
| 58 | 58 | include_spip('base/create'); |
| 59 | - spip_log('recree les tables eventuellement disparues', 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 59 | + spip_log('recree les tables eventuellement disparues', 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 60 | 60 | creer_base(); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | exit; |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - spip_log('Fin de mise a jour SQL. Debut m-a-j acces et config', 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 72 | + spip_log('Fin de mise a jour SQL. Debut m-a-j acces et config', 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 73 | 73 | |
| 74 | 74 | // supprimer quelques fichiers temporaires qui peuvent se retrouver invalides |
| 75 | 75 | @spip_unlink(_CACHE_RUBRIQUES); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | @spip_unlink(_CACHE_PLUGINS_OPT); |
| 79 | 79 | @spip_unlink(_CACHE_PLUGINS_FCT); |
| 80 | 80 | @spip_unlink(_CACHE_CHEMIN); |
| 81 | - @spip_unlink(_DIR_TMP . 'plugin_xml_cache.gz'); |
|
| 81 | + @spip_unlink(_DIR_TMP.'plugin_xml_cache.gz'); |
|
| 82 | 82 | |
| 83 | 83 | include_spip('inc/auth'); |
| 84 | 84 | auth_synchroniser_distant(); |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | $version_installee = $GLOBALS['meta']['version_installee'] ?? null; |
| 118 | 118 | |
| 119 | 119 | spip_log( |
| 120 | - "Version anterieure: $version_installee. Courante: " . $GLOBALS['spip_version_base'], |
|
| 121 | - 'maj.' . _LOG_INFO_IMPORTANTE |
|
| 120 | + "Version anterieure: $version_installee. Courante: ".$GLOBALS['spip_version_base'], |
|
| 121 | + 'maj.'._LOG_INFO_IMPORTANTE |
|
| 122 | 122 | ); |
| 123 | 123 | if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) { |
| 124 | 124 | sql_replace( |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | $res = maj_while($version_installee, $cible, $GLOBALS['maj'], 'version_installee', 'meta', $redirect, $debut_page); |
| 152 | 152 | if ($res) { |
| 153 | 153 | if (!is_array($res)) { |
| 154 | - spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_INFO_ERREUR); |
|
| 154 | + spip_log("Pb d'acces SQL a la mise a jour", 'maj.'._LOG_INFO_ERREUR); |
|
| 155 | 155 | } else { |
| 156 | - echo _T('avis_operation_echec') . ' ' . join(' ', $res); |
|
| 156 | + echo _T('avis_operation_echec').' '.join(' ', $res); |
|
| 157 | 157 | echo install_fin_html(); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | $res = maj_while($current_version, $version_cible, $maj, $nom_meta_base_version, $table_meta, $redirect); |
| 241 | 241 | if ($res) { |
| 242 | 242 | if (!is_array($res)) { |
| 243 | - spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_INFO_ERREUR); |
|
| 243 | + spip_log("Pb d'acces SQL a la mise a jour", 'maj.'._LOG_INFO_ERREUR); |
|
| 244 | 244 | } else { |
| 245 | - echo '<p>' . _T('avis_operation_echec') . ' ' . join(' ', $res) . '</p>'; |
|
| 245 | + echo '<p>'._T('avis_operation_echec').' '.join(' ', $res).'</p>'; |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | $timeout = _UPGRADE_TIME_OUT * 2; |
| 295 | 295 | $titre = _T('titre_page_upgrade'); |
| 296 | 296 | $balise_img = charger_filtre('balise_img'); |
| 297 | - $titre .= $balise_img(chemin_image('loader.svg'),'','loader'); |
|
| 297 | + $titre .= $balise_img(chemin_image('loader.svg'), '', 'loader'); |
|
| 298 | 298 | echo(install_debut_html($titre)); |
| 299 | 299 | // script de rechargement auto sur timeout |
| 300 | 300 | $redirect = generer_url_ecrire('upgrade', "reinstall=$installee&meta=$meta&table=$table", true); |
| 301 | - echo http_script("window.setTimeout('location.href=\"" . $redirect . "\";'," . ($timeout * 1000) . ')'); |
|
| 301 | + echo http_script("window.setTimeout('location.href=\"".$redirect."\";',".($timeout * 1000).')'); |
|
| 302 | 302 | echo "<div style='text-align: left'>\n"; |
| 303 | 303 | if (ob_get_level()) { |
| 304 | 304 | ob_flush(); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | return array($v, $etape); |
| 387 | 387 | } |
| 388 | 388 | $n = time() - $time; |
| 389 | - spip_log("$table $meta: $v en $n secondes", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 389 | + spip_log("$table $meta: $v en $n secondes", 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 390 | 390 | if ($meta) { |
| 391 | 391 | ecrire_meta($meta, $installee = $v, 'oui', $table); |
| 392 | 392 | } |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | if ($meta) { |
| 403 | 403 | ecrire_meta($meta, $cible, 'oui', $table); |
| 404 | 404 | } |
| 405 | - spip_log("MAJ terminee. $meta: $installee", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 405 | + spip_log("MAJ terminee. $meta: $installee", 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 406 | 406 | |
| 407 | 407 | return array(); |
| 408 | 408 | } |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | * @return int |
| 428 | 428 | */ |
| 429 | 429 | function serie_alter($serie, $q = array(), $meta = '', $table = 'meta', $redirect = '') { |
| 430 | - $meta2 = $meta . '_maj_' . $serie; |
|
| 430 | + $meta2 = $meta.'_maj_'.$serie; |
|
| 431 | 431 | $etape = 0; |
| 432 | 432 | if (isset($GLOBALS[$table][$meta2])) { |
| 433 | 433 | $etape = intval($GLOBALS[$table][$meta2]); |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | and function_exists($f = array_shift($r)) |
| 440 | 440 | ) { |
| 441 | 441 | // note: $r (arguments de la fonction $f) peut avoir des données tabulaires |
| 442 | - spip_log("$msg: $f " . @join(',', $r), 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 442 | + spip_log("$msg: $f ".@join(',', $r), 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 443 | 443 | // pour les fonctions atomiques sql_xx |
| 444 | 444 | // on enregistre le meta avant de lancer la fonction, |
| 445 | 445 | // de maniere a eviter de boucler sur timeout |
@@ -457,12 +457,12 @@ discard block |
||
| 457 | 457 | relance_maj($meta, $table, $redirect); |
| 458 | 458 | } |
| 459 | 459 | ecrire_meta($meta2, $i + 1, 'non', $table); |
| 460 | - spip_log("$meta2: ok", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 460 | + spip_log("$meta2: ok", 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 461 | 461 | } else { |
| 462 | 462 | if (!is_array($r)) { |
| 463 | - spip_log("maj $i format incorrect", 'maj.' . _LOG_ERREUR); |
|
| 463 | + spip_log("maj $i format incorrect", 'maj.'._LOG_ERREUR); |
|
| 464 | 464 | } else { |
| 465 | - spip_log("maj $i fonction $f non definie", 'maj.' . _LOG_ERREUR); |
|
| 465 | + spip_log("maj $i fonction $f non definie", 'maj.'._LOG_ERREUR); |
|
| 466 | 466 | } |
| 467 | 467 | // en cas d'erreur serieuse, on s'arrete |
| 468 | 468 | // mais on permet de passer par dessus en rechargeant la page. |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | // si port est fourni mais pas host, c'est un socket -> compat avec vieille syntaxe de mysql_connect() et anciens fichiers connect.php |
| 49 | 49 | if ( |
| 50 | 50 | $port and !is_numeric($socket = $port) |
| 51 | - and (!$host or $host=='localhost')) { |
|
| 51 | + and (!$host or $host == 'localhost')) { |
|
| 52 | 52 | $link = @mysqli_connect($host, $login, $pass, '', null, $socket); |
| 53 | 53 | } |
| 54 | 54 | elseif ($port) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if (!$link) { |
| 62 | - spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS); |
|
| 62 | + spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS); |
|
| 63 | 63 | |
| 64 | 64 | return false; |
| 65 | 65 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - spip_log("Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? "operationnelle" : 'impossible'), |
|
| 79 | + spip_log("Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? "operationnelle" : 'impossible'), |
|
| 80 | 80 | _LOG_DEBUG); |
| 81 | 81 | |
| 82 | 82 | return !$ok ? false : array( |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) { |
| 167 | 167 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 168 | - spip_log("changement de charset sql : " . "SET NAMES " . _q($charset), _LOG_DEBUG); |
|
| 168 | + spip_log("changement de charset sql : "."SET NAMES "._q($charset), _LOG_DEBUG); |
|
| 169 | 169 | |
| 170 | - return mysqli_query($connexion['link'], $connexion['last'] = "SET NAMES " . _q($charset)); |
|
| 170 | + return mysqli_query($connexion['link'], $connexion['last'] = "SET NAMES "._q($charset)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | function spip_mysql_get_charset($charset = array(), $serveur = '', $requeter = true) { |
| 183 | 183 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 184 | 184 | $connexion['last'] = $c = "SHOW CHARACTER SET" |
| 185 | - . (!$charset ? '' : (" LIKE " . _q($charset['charset']))); |
|
| 185 | + . (!$charset ? '' : (" LIKE "._q($charset['charset']))); |
|
| 186 | 186 | |
| 187 | 187 | return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur); |
| 188 | 188 | } |
@@ -226,19 +226,19 @@ discard block |
||
| 226 | 226 | $debug = ''; |
| 227 | 227 | if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) { |
| 228 | 228 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 229 | - list(, $id, , $infos) = $GLOBALS['debug']['aucasou']; |
|
| 230 | - $debug .= "BOUCLE$id @ " . (isset($infos[0]) ? $infos[0] : '') . " | "; |
|
| 229 | + list(, $id,, $infos) = $GLOBALS['debug']['aucasou']; |
|
| 230 | + $debug .= "BOUCLE$id @ ".(isset($infos[0]) ? $infos[0] : '')." | "; |
|
| 231 | 231 | } |
| 232 | 232 | if (isset($_SERVER['REQUEST_URI'])) { |
| 233 | 233 | $debug .= $_SERVER['REQUEST_URI']; |
| 234 | 234 | } |
| 235 | 235 | if (!empty($GLOBALS['ip'])) { |
| 236 | - $debug .= ' + ' . $GLOBALS['ip']; |
|
| 236 | + $debug .= ' + '.$GLOBALS['ip']; |
|
| 237 | 237 | } |
| 238 | - $debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */'; |
|
| 238 | + $debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */'; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $r = mysqli_query($link, $query . $debug); |
|
| 241 | + $r = mysqli_query($link, $query.$debug); |
|
| 242 | 242 | |
| 243 | 243 | //Eviter de propager le GoneAway sur les autres requetes d'un même processus PHP |
| 244 | 244 | if ($e = spip_mysql_errno($serveur)) { // Log d'un Gone Away |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 252 | 252 | $link = $connexion['link']; |
| 253 | 253 | //On retente au cas où |
| 254 | - $r = mysqli_query($link, $query . $debug); |
|
| 254 | + $r = mysqli_query($link, $query.$debug); |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | // d'utiliser ceux-ci, copie-colle de phpmyadmin |
| 280 | 280 | $query = preg_replace(",^TABLE\s*`([^`]*)`,i", "TABLE \\1", $query); |
| 281 | 281 | |
| 282 | - return spip_mysql_query("ALTER " . $query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 282 | + return spip_mysql_query("ALTER ".$query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @return bool Toujours true |
| 293 | 293 | */ |
| 294 | 294 | function spip_mysql_optimize($table, $serveur = '', $requeter = true) { |
| 295 | - spip_mysql_query("OPTIMIZE TABLE " . $table); |
|
| 295 | + spip_mysql_query("OPTIMIZE TABLE ".$table); |
|
| 296 | 296 | |
| 297 | 297 | return true; |
| 298 | 298 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $link = $connexion['link']; |
| 316 | 316 | $db = $connexion['db']; |
| 317 | 317 | |
| 318 | - $query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe); |
|
| 318 | + $query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe); |
|
| 319 | 319 | $r = mysqli_query($link, $query); |
| 320 | 320 | |
| 321 | 321 | return spip_mysql_fetch($r, null, $serveur); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | . calculer_mysql_expression('WHERE', $where) |
| 367 | 367 | . calculer_mysql_expression('GROUP BY', $groupby, ',') |
| 368 | 368 | . calculer_mysql_expression('HAVING', $having) |
| 369 | - . ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '') |
|
| 369 | + . ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '') |
|
| 370 | 370 | . ($limit ? "\nLIMIT $limit" : ''); |
| 371 | 371 | |
| 372 | 372 | // renvoyer la requete inerte si demandee |
@@ -456,12 +456,12 @@ discard block |
||
| 456 | 456 | $exp = "\n$expression "; |
| 457 | 457 | |
| 458 | 458 | if (!is_array($v)) { |
| 459 | - return $exp . $v; |
|
| 459 | + return $exp.$v; |
|
| 460 | 460 | } else { |
| 461 | 461 | if (strtoupper($join) === 'AND') { |
| 462 | - return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 462 | + return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 463 | 463 | } else { |
| 464 | - return $exp . join($join, $v); |
|
| 464 | + return $exp.join($join, $v); |
|
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | } |
@@ -479,17 +479,17 @@ discard block |
||
| 479 | 479 | if (substr($k, -1) == '@') { |
| 480 | 480 | // c'est une jointure qui se refere au from precedent |
| 481 | 481 | // pas de virgule |
| 482 | - $res .= ' ' . $v; |
|
| 482 | + $res .= ' '.$v; |
|
| 483 | 483 | } else { |
| 484 | 484 | if (!is_numeric($k)) { |
| 485 | 485 | $p = strpos($v, " "); |
| 486 | 486 | if ($p) { |
| 487 | - $v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p); |
|
| 487 | + $v = substr($v, 0, $p)." AS `$k`".substr($v, $p); |
|
| 488 | 488 | } else { |
| 489 | 489 | $v .= " AS `$k`"; |
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | - $res .= ', ' . $v; |
|
| 492 | + $res .= ', '.$v; |
|
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | |
@@ -518,13 +518,13 @@ discard block |
||
| 518 | 518 | function _mysql_traite_query($query, $db = '', $prefixe = '') { |
| 519 | 519 | |
| 520 | 520 | if ($GLOBALS['mysql_rappel_nom_base'] and $db) { |
| 521 | - $pref = '`' . $db . '`.'; |
|
| 521 | + $pref = '`'.$db.'`.'; |
|
| 522 | 522 | } else { |
| 523 | 523 | $pref = ''; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | if ($prefixe) { |
| 527 | - $pref .= $prefixe . "_"; |
|
| 527 | + $pref .= $prefixe."_"; |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) { |
@@ -538,12 +538,12 @@ discard block |
||
| 538 | 538 | if (stripos($suite, "SELECT") !== false) { |
| 539 | 539 | list($suite, $textes) = query_echappe_textes($suite); |
| 540 | 540 | if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite, $r)) { |
| 541 | - $suite = $r[1] . _mysql_traite_query($r[2], $db, $prefixe); |
|
| 541 | + $suite = $r[1]._mysql_traite_query($r[2], $db, $prefixe); |
|
| 542 | 542 | } |
| 543 | 543 | $suite = query_reinjecte_textes($suite, $textes); |
| 544 | 544 | } |
| 545 | 545 | } |
| 546 | - $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite; |
|
| 546 | + $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite; |
|
| 547 | 547 | |
| 548 | 548 | // en option, remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
| 549 | 549 | // remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | $link = _mysql_link($serveur); |
| 578 | 578 | $ok = mysqli_select_db($link, $db); |
| 579 | 579 | if (!$ok) { |
| 580 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 580 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | return $ok; |
@@ -667,10 +667,10 @@ discard block |
||
| 667 | 667 | |
| 668 | 668 | $character_set = ""; |
| 669 | 669 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 670 | - $character_set .= " CHARACTER SET " . $GLOBALS['meta']['charset_sql_base']; |
|
| 670 | + $character_set .= " CHARACTER SET ".$GLOBALS['meta']['charset_sql_base']; |
|
| 671 | 671 | } |
| 672 | 672 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 673 | - $character_set .= " COLLATE " . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 673 | + $character_set .= " COLLATE ".$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | foreach ($champs as $k => $v) { |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | if (preg_match(',(char|text),i', $defs[1]) |
| 680 | 680 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 681 | 681 | ) { |
| 682 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 682 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 683 | 683 | } |
| 684 | 684 | } |
| 685 | 685 | |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $s = ","; |
| 692 | 692 | } |
| 693 | 693 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 694 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ")" |
|
| 694 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').")" |
|
| 695 | 695 | . " ENGINE=MyISAM" |
| 696 | 696 | . ($character_set ? " DEFAULT $character_set" : "") |
| 697 | 697 | . "\n"; |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | return false; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 774 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 775 | 775 | |
| 776 | 776 | return spip_mysql_query($query, $serveur, $requeter); |
| 777 | 777 | } |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | * Ressource à utiliser avec sql_fetch() |
| 830 | 830 | **/ |
| 831 | 831 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 832 | - return spip_mysql_query("SHOW TABLES LIKE " . _q($match), $serveur, $requeter); |
|
| 832 | + return spip_mysql_query("SHOW TABLES LIKE "._q($match), $serveur, $requeter); |
|
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | /** |
@@ -923,22 +923,22 @@ discard block |
||
| 923 | 923 | } |
| 924 | 924 | if ($val['Default'] === '0' || $val['Default']) { |
| 925 | 925 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 926 | - $nfields[$val["Field"]] .= ' DEFAULT ' . $val['Default']; |
|
| 926 | + $nfields[$val["Field"]] .= ' DEFAULT '.$val['Default']; |
|
| 927 | 927 | } else { |
| 928 | - $nfields[$val["Field"]] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 928 | + $nfields[$val["Field"]] .= " DEFAULT '".$val['Default']."'"; |
|
| 929 | 929 | } |
| 930 | 930 | } |
| 931 | 931 | if ($val['Extra']) { |
| 932 | - $nfields[$val["Field"]] .= ' ' . $val['Extra']; |
|
| 932 | + $nfields[$val["Field"]] .= ' '.$val['Extra']; |
|
| 933 | 933 | } |
| 934 | 934 | if ($val['Key'] == 'PRI') { |
| 935 | 935 | $nkeys['PRIMARY KEY'] = $val["Field"]; |
| 936 | 936 | } else { |
| 937 | 937 | if ($val['Key'] == 'MUL') { |
| 938 | - $nkeys['KEY ' . $val["Field"]] = $val["Field"]; |
|
| 938 | + $nkeys['KEY '.$val["Field"]] = $val["Field"]; |
|
| 939 | 939 | } else { |
| 940 | 940 | if ($val['Key'] == 'UNI') { |
| 941 | - $nkeys['UNIQUE KEY ' . $val["Field"]] = $val["Field"]; |
|
| 941 | + $nkeys['UNIQUE KEY '.$val["Field"]] = $val["Field"]; |
|
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | 944 | } |
@@ -1009,7 +1009,7 @@ discard block |
||
| 1009 | 1009 | $serveur = '', |
| 1010 | 1010 | $requeter = true |
| 1011 | 1011 | ) { |
| 1012 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1012 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1013 | 1013 | |
| 1014 | 1014 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1015 | 1015 | if (!$requeter) { |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | if ($s) { |
| 1050 | 1050 | $trace = debug_backtrace(); |
| 1051 | 1051 | if ($trace[0]['function'] != "spip_mysql_error") { |
| 1052 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1052 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1053 | 1053 | } |
| 1054 | 1054 | } |
| 1055 | 1055 | |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | - return spip_mysql_insert($table, "(" . join(',', array_keys($couples)) . ")", "(" . join(',', $couples) . ")", $desc, |
|
| 1219 | + return spip_mysql_insert($table, "(".join(',', array_keys($couples)).")", "(".join(',', $couples).")", $desc, |
|
| 1220 | 1220 | $serveur, $requeter); |
| 1221 | 1221 | } |
| 1222 | 1222 | |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | } |
| 1251 | 1251 | $fields = isset($desc['field']) ? $desc['field'] : array(); |
| 1252 | 1252 | |
| 1253 | - $cles = "(" . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1253 | + $cles = "(".join(',', array_keys(reset($tab_couples))).')'; |
|
| 1254 | 1254 | $valeurs = array(); |
| 1255 | 1255 | $r = false; |
| 1256 | 1256 | |
@@ -1259,7 +1259,7 @@ discard block |
||
| 1259 | 1259 | foreach ($couples as $champ => $val) { |
| 1260 | 1260 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1261 | 1261 | } |
| 1262 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1262 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1263 | 1263 | if (count($valeurs) >= 100) { |
| 1264 | 1264 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1265 | 1265 | $valeurs = array(); |
@@ -1296,7 +1296,7 @@ discard block |
||
| 1296 | 1296 | function spip_mysql_update($table, $champs, $where = '', $desc = array(), $serveur = '', $requeter = true) { |
| 1297 | 1297 | $set = array(); |
| 1298 | 1298 | foreach ($champs as $champ => $val) { |
| 1299 | - $set[] = $champ . "=$val"; |
|
| 1299 | + $set[] = $champ."=$val"; |
|
| 1300 | 1300 | } |
| 1301 | 1301 | if (!empty($set)) { |
| 1302 | 1302 | return spip_mysql_query( |
@@ -1350,7 +1350,7 @@ discard block |
||
| 1350 | 1350 | } |
| 1351 | 1351 | $set = array(); |
| 1352 | 1352 | foreach ($champs as $champ => $val) { |
| 1353 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1353 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | 1356 | return spip_mysql_query( |
@@ -1415,8 +1415,8 @@ discard block |
||
| 1415 | 1415 | * - False en cas d'erreur. |
| 1416 | 1416 | **/ |
| 1417 | 1417 | function spip_mysql_replace($table, $couples, $desc = array(), $serveur = '', $requeter = true) { |
| 1418 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(',', |
|
| 1419 | - array_map('_q', $couples)) . ')', $serveur, $requeter); |
|
| 1418 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join(',', |
|
| 1419 | + array_map('_q', $couples)).')', $serveur, $requeter); |
|
| 1420 | 1420 | } |
| 1421 | 1421 | |
| 1422 | 1422 | |
@@ -1445,10 +1445,10 @@ discard block |
||
| 1445 | 1445 | * - False en cas d'erreur. |
| 1446 | 1446 | **/ |
| 1447 | 1447 | function spip_mysql_replace_multi($table, $tab_couples, $desc = array(), $serveur = '', $requeter = true) { |
| 1448 | - $cles = "(" . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1448 | + $cles = "(".join(',', array_keys($tab_couples[0])).')'; |
|
| 1449 | 1449 | $valeurs = array(); |
| 1450 | 1450 | foreach ($tab_couples as $couples) { |
| 1451 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1451 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1452 | 1452 | } |
| 1453 | 1453 | $valeurs = implode(', ', $valeurs); |
| 1454 | 1454 | |
@@ -1468,28 +1468,28 @@ discard block |
||
| 1468 | 1468 | */ |
| 1469 | 1469 | function spip_mysql_multi($objet, $lang) { |
| 1470 | 1470 | $lengthlang = strlen("[$lang]"); |
| 1471 | - $posmulti = "INSTR(" . $objet . ", '<multi>')"; |
|
| 1472 | - $posfinmulti = "INSTR(" . $objet . ", '</multi>')"; |
|
| 1473 | - $debutchaine = "LEFT(" . $objet . ", $posmulti-1)"; |
|
| 1474 | - $finchaine = "RIGHT(" . $objet . ", CHAR_LENGTH(" . $objet . ") -(7+$posfinmulti))"; |
|
| 1475 | - $chainemulti = "TRIM(SUBSTRING(" . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1476 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1471 | + $posmulti = "INSTR(".$objet.", '<multi>')"; |
|
| 1472 | + $posfinmulti = "INSTR(".$objet.", '</multi>')"; |
|
| 1473 | + $debutchaine = "LEFT(".$objet.", $posmulti-1)"; |
|
| 1474 | + $finchaine = "RIGHT(".$objet.", CHAR_LENGTH(".$objet.") -(7+$posfinmulti))"; |
|
| 1475 | + $chainemulti = "TRIM(SUBSTRING(".$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1476 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1477 | 1477 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1478 | - $chainelang = "TRIM(SUBSTRING(" . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1479 | - $posfinlang = "INSTR(" . $chainelang . ", '[')"; |
|
| 1478 | + $chainelang = "TRIM(SUBSTRING(".$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1479 | + $posfinlang = "INSTR(".$chainelang.", '[')"; |
|
| 1480 | 1480 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1481 | 1481 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1482 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1483 | - " TRIM(" . $objet . "), " . |
|
| 1484 | - " CONCAT( " . |
|
| 1485 | - " $debutchaine, " . |
|
| 1486 | - " IF( " . |
|
| 1487 | - " $poslang = 0, " . |
|
| 1488 | - " $chainemulti, " . |
|
| 1489 | - " $chainelang" . |
|
| 1490 | - " ), " . |
|
| 1491 | - " $finchaine" . |
|
| 1492 | - " ) " . |
|
| 1482 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1483 | + " TRIM(".$objet."), ". |
|
| 1484 | + " CONCAT( ". |
|
| 1485 | + " $debutchaine, ". |
|
| 1486 | + " IF( ". |
|
| 1487 | + " $poslang = 0, ". |
|
| 1488 | + " $chainemulti, ". |
|
| 1489 | + " $chainelang". |
|
| 1490 | + " ), ". |
|
| 1491 | + " $finchaine". |
|
| 1492 | + " ) ". |
|
| 1493 | 1493 | "))) AS multi"; |
| 1494 | 1494 | |
| 1495 | 1495 | return $retour; |
@@ -1506,7 +1506,7 @@ discard block |
||
| 1506 | 1506 | * Valeur hexadécimale pour MySQL |
| 1507 | 1507 | **/ |
| 1508 | 1508 | function spip_mysql_hex($v) { |
| 1509 | - return "0x" . $v; |
|
| 1509 | + return "0x".$v; |
|
| 1510 | 1510 | } |
| 1511 | 1511 | |
| 1512 | 1512 | /** |
@@ -1546,7 +1546,7 @@ discard block |
||
| 1546 | 1546 | * Expression SQL |
| 1547 | 1547 | **/ |
| 1548 | 1548 | function spip_mysql_date_proche($champ, $interval, $unite) { |
| 1549 | - $use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false ); |
|
| 1549 | + $use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false); |
|
| 1550 | 1550 | return '(' |
| 1551 | 1551 | . $champ |
| 1552 | 1552 | . (($interval <= 0) ? '>' : '<') |
@@ -1600,7 +1600,7 @@ discard block |
||
| 1600 | 1600 | elseif (is_numeric($v)) { |
| 1601 | 1601 | return strval($v); |
| 1602 | 1602 | } |
| 1603 | - return "'" . addslashes($v) . "'"; |
|
| 1603 | + return "'".addslashes($v)."'"; |
|
| 1604 | 1604 | } |
| 1605 | 1605 | |
| 1606 | 1606 | if (is_null($v) |
@@ -1622,7 +1622,7 @@ discard block |
||
| 1622 | 1622 | } |
| 1623 | 1623 | } |
| 1624 | 1624 | |
| 1625 | - return ("'" . addslashes($v) . "'"); |
|
| 1625 | + return ("'".addslashes($v)."'"); |
|
| 1626 | 1626 | } |
| 1627 | 1627 | |
| 1628 | 1628 | /** |
@@ -1656,7 +1656,7 @@ discard block |
||
| 1656 | 1656 | } else { |
| 1657 | 1657 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1658 | 1658 | |
| 1659 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1659 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1660 | 1660 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1661 | 1661 | } |
| 1662 | 1662 | } |