@@ -38,16 +38,16 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // Regarder dans le repertoire local des images TeX et blocs MathML |
| 41 | - if (!@is_dir($dir_tex = _DIR_VAR . 'cache-TeX/')) { |
|
| 41 | + if (!@is_dir($dir_tex = _DIR_VAR.'cache-TeX/')) { |
|
| 42 | 42 | @mkdir($dir_tex, _SPIP_CHMOD); |
| 43 | 43 | } |
| 44 | - $fichier = $dir_tex . md5(trim($tex)) . $ext; |
|
| 44 | + $fichier = $dir_tex.md5(trim($tex)).$ext; |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | if (!@file_exists($fichier)) { |
| 48 | 48 | // Aller chercher l'image sur le serveur |
| 49 | 49 | if ($server) { |
| 50 | - spip_log($url = $server . '?' . rawurlencode($tex)); |
|
| 50 | + spip_log($url = $server.'?'.rawurlencode($tex)); |
|
| 51 | 51 | include_spip('inc/distant'); |
| 52 | 52 | recuperer_url($url, ['file' => $fichier]); |
| 53 | 53 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | return implode("", file($fichier)); |
| 64 | 64 | } // TeX |
| 65 | 65 | else { |
| 66 | - list(, , , $size) = @spip_getimagesize($fichier); |
|
| 66 | + list(,,, $size) = @spip_getimagesize($fichier); |
|
| 67 | 67 | $alt = "alt=\"$tex\" title=\"$tex\""; |
| 68 | 68 | |
| 69 | 69 | return "<img src=\"$fichier\" style=\"vertical-align:middle;\" $size $alt />"; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | if ($defaire_amp) { |
| 127 | 127 | $expression = str_replace('&', '&', $expression); |
| 128 | 128 | } |
| 129 | - $echap = "\n<p class=\"spip\" style=\"text-align: center;\">" . produire_image_math($expression) . "</p>\n"; |
|
| 129 | + $echap = "\n<p class=\"spip\" style=\"text-align: center;\">".produire_image_math($expression)."</p>\n"; |
|
| 130 | 130 | $pos = strpos($texte_milieu, $regs[0]); |
| 131 | 131 | $texte_milieu = substr($texte_milieu, 0, $pos) |
| 132 | 132 | . code_echappement($echap, $source) |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | . substr($texte_milieu, $pos + strlen($regs[0])); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $texte_a_voir = $texte_debut . $texte_milieu . $texte_fin; |
|
| 149 | + $texte_a_voir = $texte_debut.$texte_milieu.$texte_fin; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return $texte_a_voir; |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | function balise_DOSSIER_SQUELETTE_dist($p) { |
| 364 | 364 | $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
| 365 | - $p->code = "_DIR_RACINE . '$code'" . |
|
| 365 | + $p->code = "_DIR_RACINE . '$code'". |
|
| 366 | 366 | $p->interdire_scripts = false; |
| 367 | 367 | |
| 368 | 368 | return $p; |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | */ |
| 382 | 382 | function balise_SQUELETTE_dist($p) { |
| 383 | 383 | $code = addslashes($p->descr['sourcefile']); |
| 384 | - $p->code = "'$code'" . |
|
| 384 | + $p->code = "'$code'". |
|
| 385 | 385 | $p->interdire_scripts = false; |
| 386 | 386 | |
| 387 | 387 | return $p; |
@@ -433,9 +433,9 @@ discard block |
||
| 433 | 433 | **/ |
| 434 | 434 | function balise_NOM_SITE_dist($p) { |
| 435 | 435 | if (!$p->etoile) { |
| 436 | - $p->code = "supprimer_numero(calculer_url(" . |
|
| 437 | - champ_sql('url_site', $p) . "," . |
|
| 438 | - champ_sql('nom_site', $p) . |
|
| 436 | + $p->code = "supprimer_numero(calculer_url(". |
|
| 437 | + champ_sql('url_site', $p).",". |
|
| 438 | + champ_sql('nom_site', $p). |
|
| 439 | 439 | ", 'titre', \$connect, false))"; |
| 440 | 440 | } else { |
| 441 | 441 | $p->code = champ_sql('nom_site', $p); |
@@ -586,8 +586,8 @@ discard block |
||
| 586 | 586 | * Pile complétée par le code à générer |
| 587 | 587 | **/ |
| 588 | 588 | function balise_POPULARITE_ABSOLUE_dist($p) { |
| 589 | - $p->code = 'ceil(' . |
|
| 590 | - champ_sql('popularite', $p) . |
|
| 589 | + $p->code = 'ceil('. |
|
| 590 | + champ_sql('popularite', $p). |
|
| 591 | 591 | ')'; |
| 592 | 592 | $p->interdire_scripts = false; |
| 593 | 593 | |
@@ -665,9 +665,9 @@ discard block |
||
| 665 | 665 | **/ |
| 666 | 666 | function balise_VALEUR_dist($p) { |
| 667 | 667 | $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
| 668 | - $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b);; |
|
| 668 | + $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b); ; |
|
| 669 | 669 | if (($v = interprete_argument_balise(1, $p)) !== null) { |
| 670 | - $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 670 | + $p->code = 'table_valeur('.$p->code.', '.$v.')'; |
|
| 671 | 671 | } |
| 672 | 672 | $p->interdire_scripts = true; |
| 673 | 673 | |
@@ -808,16 +808,16 @@ discard block |
||
| 808 | 808 | $trouver_table = charger_fonction('trouver_table', 'base'); |
| 809 | 809 | if ($desc = $trouver_table(table_objet_sql($type_objet))) { |
| 810 | 810 | if (isset($desc['field']['descriptif'])) { |
| 811 | - $_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ','; |
|
| 811 | + $_ligne .= "'descriptif' => ".champ_sql('descriptif', $p).','; |
|
| 812 | 812 | } |
| 813 | 813 | if (isset($desc['field']['texte'])) { |
| 814 | - $_ligne .= "'texte' => " . champ_sql('texte', $p) . ','; |
|
| 814 | + $_ligne .= "'texte' => ".champ_sql('texte', $p).','; |
|
| 815 | 815 | } |
| 816 | 816 | if (isset($desc['field']['chapo'])) { |
| 817 | - $_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ','; |
|
| 817 | + $_ligne .= "'chapo' => ".champ_sql('chapo', $p).','; |
|
| 818 | 818 | } |
| 819 | 819 | if (isset($desc['introduction_longueur'])) { |
| 820 | - $_introduction_longueur = "'" . $desc['introduction_longueur'] . "'"; |
|
| 820 | + $_introduction_longueur = "'".$desc['introduction_longueur']."'"; |
|
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | $_ligne .= ')'; |
@@ -913,10 +913,10 @@ discard block |
||
| 913 | 913 | $c = memoriser_contexte_compil($p); |
| 914 | 914 | |
| 915 | 915 | $p->code = sprintf(CODE_RECUPERER_FOND, "'modeles/lesauteurs'", |
| 916 | - "array('objet'=>'" . $objet . |
|
| 917 | - "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 918 | - ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 919 | - ($objet == 'article' ? "" : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 916 | + "array('objet'=>'".$objet. |
|
| 917 | + "','id_objet' => ".champ_sql($id_table_objet, $p). |
|
| 918 | + ",'$id_table_objet' => ".champ_sql($id_table_objet, $p). |
|
| 919 | + ($objet == 'article' ? "" : ",'id_article' => ".champ_sql('id_article', $p)). |
|
| 920 | 920 | ")", |
| 921 | 921 | "'trim'=>true, 'compil'=>array($c)", |
| 922 | 922 | _q($connect)); |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | $m = trim($m); |
| 985 | 985 | if ($m != "''") { |
| 986 | 986 | if (!preg_match(",\W,", $m)) { |
| 987 | - $m = $boucle->id_table . ".$m"; |
|
| 987 | + $m = $boucle->id_table.".$m"; |
|
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | $m .= " AS titre_rang"; |
@@ -1008,8 +1008,8 @@ discard block |
||
| 1008 | 1008 | $_primary = champ_sql($id_table_objet, $p, '', false); |
| 1009 | 1009 | $_env = '$Pile[0]'; |
| 1010 | 1010 | |
| 1011 | - if (!$_titre) {$_titre = "''";} |
|
| 1012 | - if (!$_primary) {$_primary = "''";} |
|
| 1011 | + if (!$_titre) {$_titre = "''"; } |
|
| 1012 | + if (!$_primary) {$_primary = "''"; } |
|
| 1013 | 1013 | $_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)"; |
| 1014 | 1014 | |
| 1015 | 1015 | } |
@@ -1142,7 +1142,7 @@ discard block |
||
| 1142 | 1142 | $f_pagination = chercher_filtre('pagination'); |
| 1143 | 1143 | $type = $p->boucles[$b]->modificateur['debut_nom']; |
| 1144 | 1144 | $modif = ($type[0] !== "'") ? "'debut'.$type" |
| 1145 | - : ("'debut" . substr($type, 1)); |
|
| 1145 | + : ("'debut".substr($type, 1)); |
|
| 1146 | 1146 | |
| 1147 | 1147 | $p->code = sprintf(CODE_PAGINATION, $f_pagination, $b, $type, $modif, $pas, $liste, |
| 1148 | 1148 | ((isset($__modele) and $__modele) ? $__modele : "''"), _q($connect), $code_contexte); |
@@ -1276,7 +1276,7 @@ discard block |
||
| 1276 | 1276 | $msg = array('zbug_balise_sans_argument', array('balise' => ' CHEMIN')); |
| 1277 | 1277 | erreur_squelette($msg, $p); |
| 1278 | 1278 | } else { |
| 1279 | - $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1279 | + $p->code = 'find_in_path('.$arg.')'; |
|
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | $p->interdire_scripts = false; |
@@ -1311,7 +1311,7 @@ discard block |
||
| 1311 | 1311 | $msg = array('zbug_balise_sans_argument', array('balise' => ' CHEMIN_IMAGE')); |
| 1312 | 1312 | erreur_squelette($msg, $p); |
| 1313 | 1313 | } else { |
| 1314 | - $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1314 | + $p->code = 'chemin_image('.$arg.')'; |
|
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | $p->interdire_scripts = false; |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | // cas de #ENV sans argument : on retourne le serialize() du tableau |
| 1366 | 1366 | // une belle fonction [(#ENV|affiche_env)] serait pratique |
| 1367 | 1367 | if ($src) { |
| 1368 | - $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1368 | + $p->code = '(is_array($a = ('.$src.')) ? serialize($a) : "")'; |
|
| 1369 | 1369 | } else { |
| 1370 | 1370 | $p->code = '@serialize($Pile[0])'; |
| 1371 | 1371 | } |
@@ -1418,8 +1418,8 @@ discard block |
||
| 1418 | 1418 | $_sinon = interprete_argument_balise(2, $p); |
| 1419 | 1419 | $_unserialize = sinon(interprete_argument_balise(3, $p), "false"); |
| 1420 | 1420 | |
| 1421 | - $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1422 | - ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1421 | + $p->code = '(include_spip(\'inc/config\')?lire_config('.$arg.','. |
|
| 1422 | + ($_sinon && $_sinon != "''" ? $_sinon : 'null').','.$_unserialize."):'')"; |
|
| 1423 | 1423 | |
| 1424 | 1424 | return $p; |
| 1425 | 1425 | } |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'SESSION_SET')); |
| 1513 | 1513 | erreur_squelette($err_b_s_a, $p); |
| 1514 | 1514 | } else { |
| 1515 | - $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1515 | + $p->code = '(include_spip("inc/session") AND session_set('.$_nom.','.$_val.'))'; |
|
| 1516 | 1516 | } |
| 1517 | 1517 | |
| 1518 | 1518 | $p->interdire_scripts = false; |
@@ -1555,7 +1555,7 @@ discard block |
||
| 1555 | 1555 | if (preg_match(",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms", |
| 1556 | 1556 | $php, $r)) { |
| 1557 | 1557 | $p->code = /* $r[1]. */ |
| 1558 | - '(' . $r[2] . ')'; |
|
| 1558 | + '('.$r[2].')'; |
|
| 1559 | 1559 | } else { |
| 1560 | 1560 | $p->code = "eval('return '.$php.';')"; |
| 1561 | 1561 | } |
@@ -1798,9 +1798,9 @@ discard block |
||
| 1798 | 1798 | |
| 1799 | 1799 | // noter la duree du cache dans un entete proprietaire |
| 1800 | 1800 | |
| 1801 | - $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1801 | + $code = "'<'.'".'?php header("X-Spip-Cache: ' |
|
| 1802 | 1802 | . $duree |
| 1803 | - . '"); ?' . "'.'>'"; |
|
| 1803 | + . '"); ?'."'.'>'"; |
|
| 1804 | 1804 | |
| 1805 | 1805 | // Remplir le header Cache-Control |
| 1806 | 1806 | // cas #CACHE{0} |
@@ -1820,9 +1820,9 @@ discard block |
||
| 1820 | 1820 | if ($pa == 'cache-client' |
| 1821 | 1821 | and $duree > 0 |
| 1822 | 1822 | ) { |
| 1823 | - $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1823 | + $code .= ".'<'.'".'?php header("Cache-Control: max-age=' |
|
| 1824 | 1824 | . $duree |
| 1825 | - . '"); ?' . "'.'>'"; |
|
| 1825 | + . '"); ?'."'.'>'"; |
|
| 1826 | 1826 | // il semble logique, si on cache-client, de ne pas invalider |
| 1827 | 1827 | $pa = 'statique'; |
| 1828 | 1828 | } |
@@ -1830,7 +1830,7 @@ discard block |
||
| 1830 | 1830 | if ($pa == 'statique' |
| 1831 | 1831 | and $duree > 0 |
| 1832 | 1832 | ) { |
| 1833 | - $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1833 | + $code .= ".'<'.'".'?php header("X-Spip-Statique: oui"); ?'."'.'>'"; |
|
| 1834 | 1834 | } |
| 1835 | 1835 | } |
| 1836 | 1836 | } else { |
@@ -1995,9 +1995,9 @@ discard block |
||
| 1995 | 1995 | if ($p->etoile) { |
| 1996 | 1996 | $_options[] = "'etoile'=>true"; |
| 1997 | 1997 | } |
| 1998 | - $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ")"; |
|
| 1998 | + $_options[] = "'compil'=>array(".memoriser_contexte_compil($p).")"; |
|
| 1999 | 1999 | |
| 2000 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2000 | + $_l = 'array('.join(",\n\t", $_contexte).')'; |
|
| 2001 | 2001 | if ($flag_env) { |
| 2002 | 2002 | $_l = "array_merge(\$Pile[0],$_l)"; |
| 2003 | 2003 | } |
@@ -2008,7 +2008,7 @@ discard block |
||
| 2008 | 2008 | $msg = array('zbug_balise_sans_argument', array('balise' => ' INCLURE')); |
| 2009 | 2009 | erreur_squelette($msg, $p); |
| 2010 | 2010 | } else { |
| 2011 | - $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2011 | + $p->code = 'charge_scripts('.$_contexte[1].',false)'; |
|
| 2012 | 2012 | } |
| 2013 | 2013 | |
| 2014 | 2014 | $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
@@ -2056,7 +2056,7 @@ discard block |
||
| 2056 | 2056 | unset($_contexte[1]); |
| 2057 | 2057 | |
| 2058 | 2058 | if (preg_match("/^\s*'[^']*'/s", $nom)) { |
| 2059 | - $nom = "'modeles/" . substr($nom, 1); |
|
| 2059 | + $nom = "'modeles/".substr($nom, 1); |
|
| 2060 | 2060 | } else { |
| 2061 | 2061 | $nom = "'modeles/' . $nom"; |
| 2062 | 2062 | } |
@@ -2073,8 +2073,8 @@ discard block |
||
| 2073 | 2073 | $primary = $p->boucles[$p->id_boucle]->primary; |
| 2074 | 2074 | if (!strpos($primary, ',')) { |
| 2075 | 2075 | $id = champ_sql($primary, $p); |
| 2076 | - $_contexte[] = "'$primary'=>" . $id; |
|
| 2077 | - $_contexte[] = "'id'=>" . $id; |
|
| 2076 | + $_contexte[] = "'$primary'=>".$id; |
|
| 2077 | + $_contexte[] = "'id'=>".$id; |
|
| 2078 | 2078 | } |
| 2079 | 2079 | } |
| 2080 | 2080 | $_contexte[] = "'recurs'=>(++\$recurs)"; |
@@ -2086,11 +2086,11 @@ discard block |
||
| 2086 | 2086 | $_options = memoriser_contexte_compil($p); |
| 2087 | 2087 | $_options = "'compil'=>array($_options), 'trim'=>true"; |
| 2088 | 2088 | if (isset($_contexte['ajax'])) { |
| 2089 | - $_options .= ", " . preg_replace(",=>(.*)$,ims", '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2089 | + $_options .= ", ".preg_replace(",=>(.*)$,ims", '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2090 | 2090 | unset($_contexte['ajax']); |
| 2091 | 2091 | } |
| 2092 | 2092 | |
| 2093 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2093 | + $_l = 'array('.join(",\n\t", $_contexte).')'; |
|
| 2094 | 2094 | if ($flag_env) { |
| 2095 | 2095 | $_l = "array_merge(\$Pile[0],$_l)"; |
| 2096 | 2096 | } |
@@ -2200,12 +2200,12 @@ discard block |
||
| 2200 | 2200 | function balise_DOUBLONS_dist($p) { |
| 2201 | 2201 | if ($type = interprete_argument_balise(1, $p)) { |
| 2202 | 2202 | if ($famille = interprete_argument_balise(2, $p)) { |
| 2203 | - $type .= '.' . $famille; |
|
| 2203 | + $type .= '.'.$famille; |
|
| 2204 | 2204 | } |
| 2205 | - $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2205 | + $p->code = '(isset($doublons['.$type.']) ? $doublons['.$type.'] : "")'; |
|
| 2206 | 2206 | if (!$p->etoile) { |
| 2207 | 2207 | $p->code = 'array_filter(array_map("intval",explode(",",' |
| 2208 | - . $p->code . ')))'; |
|
| 2208 | + . $p->code.')))'; |
|
| 2209 | 2209 | } |
| 2210 | 2210 | } else { |
| 2211 | 2211 | $p->code = '$doublons'; |
@@ -2334,7 +2334,7 @@ discard block |
||
| 2334 | 2334 | $_code[] = "$_key => $_val"; |
| 2335 | 2335 | } |
| 2336 | 2336 | } while ($_key && $_val); |
| 2337 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2337 | + $p->code = 'array('.join(', ', $_code).')'; |
|
| 2338 | 2338 | $p->interdire_scripts = false; |
| 2339 | 2339 | |
| 2340 | 2340 | return $p; |
@@ -2361,7 +2361,7 @@ discard block |
||
| 2361 | 2361 | while ($_val = interprete_argument_balise($n++, $p)) { |
| 2362 | 2362 | $_code[] = $_val; |
| 2363 | 2363 | } |
| 2364 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2364 | + $p->code = 'array('.join(', ', $_code).')'; |
|
| 2365 | 2365 | $p->interdire_scripts = false; |
| 2366 | 2366 | |
| 2367 | 2367 | return $p; |
@@ -2406,8 +2406,8 @@ discard block |
||
| 2406 | 2406 | $_code[] = $_v; |
| 2407 | 2407 | } |
| 2408 | 2408 | |
| 2409 | - $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join(', ', |
|
| 2410 | - $_code) . ')?" ":"")'; |
|
| 2409 | + $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser('.join(', ', |
|
| 2410 | + $_code).')?" ":"")'; |
|
| 2411 | 2411 | $p->interdire_scripts = false; |
| 2412 | 2412 | |
| 2413 | 2413 | return $p; |
@@ -2440,7 +2440,7 @@ discard block |
||
| 2440 | 2440 | $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
| 2441 | 2441 | |
| 2442 | 2442 | $f = chercher_filtre('info_plugin'); |
| 2443 | - $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2443 | + $p->code = $f.'('.$plugin.', '.$type_info.')'; |
|
| 2444 | 2444 | |
| 2445 | 2445 | return $p; |
| 2446 | 2446 | } |
@@ -2690,12 +2690,12 @@ discard block |
||
| 2690 | 2690 | $_issens = "in_array($_champ,array('>','<'))"; |
| 2691 | 2691 | $_sens = "(strpos('< >',$_champ)-1)"; |
| 2692 | 2692 | |
| 2693 | - $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2693 | + $_variable = "((\$s=$_issens)?'sens':'tri').".$boucle->modificateur['tri_nom']; |
|
| 2694 | 2694 | $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
| 2695 | - $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2696 | - $_on = "\$s?(" . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2695 | + $_url = "parametre_url($_url,'var_memotri',strncmp(".$boucle->modificateur['tri_nom'].",'session',7)==0?$_variable:'')"; |
|
| 2696 | + $_on = "\$s?(".$boucle->modificateur['tri_sens']."==$_sens".'):('.$boucle->modificateur['tri_champ']."==$_champ)"; |
|
| 2697 | 2697 | |
| 2698 | - $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : "") . ")"; |
|
| 2698 | + $p->code = "lien_ou_expose($_url,$_libelle,$_on".($_class ? ",$_class" : "").")"; |
|
| 2699 | 2699 | //$p->code = "''"; |
| 2700 | 2700 | $p->interdire_scripts = false; |
| 2701 | 2701 | |
@@ -2769,7 +2769,7 @@ discard block |
||
| 2769 | 2769 | $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
| 2770 | 2770 | } |
| 2771 | 2771 | |
| 2772 | - $p->code = "(objet_test_si_publie(" . $_type . ",intval(" . $_id . ")," . _q($connect) . ")?' ':'')"; |
|
| 2772 | + $p->code = "(objet_test_si_publie(".$_type.",intval(".$_id."),"._q($connect).")?' ':'')"; |
|
| 2773 | 2773 | $p->interdire_scripts = false; |
| 2774 | 2774 | |
| 2775 | 2775 | return $p; |
@@ -55,12 +55,12 @@ |
||
| 55 | 55 | $_params = '['; |
| 56 | 56 | $nb_params = count($p->param[0]); // 1ère valeur vide donc 1 en plus |
| 57 | 57 | for ($i = 3; $i < $nb_params; $i++) { |
| 58 | - $_params .= interprete_argument_balise($i, $p) . ','; |
|
| 58 | + $_params .= interprete_argument_balise($i, $p).','; |
|
| 59 | 59 | } |
| 60 | 60 | $_params .= ']'; |
| 61 | 61 | |
| 62 | 62 | $info_sql = strtolower(substr($info, 5)); |
| 63 | - $code = "generer_info_entite($id_objet, $type_objet, '$info_sql', " . ($p->etoile ? _q($p->etoile) : "''") . ", $_params)"; |
|
| 63 | + $code = "generer_info_entite($id_objet, $type_objet, '$info_sql', ".($p->etoile ? _q($p->etoile) : "''").", $_params)"; |
|
| 64 | 64 | $p->code = champ_sql($info, $p, $code); |
| 65 | 65 | $p->interdire_scripts = true; |
| 66 | 66 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * Mot de passe |
| 32 | 32 | **/ |
| 33 | 33 | function creer_pass_aleatoire($longueur = 16, $sel = '') { |
| 34 | - $seed = (int)round(((float)microtime() + 1) * time()); |
|
| 34 | + $seed = (int) round(((float) microtime() + 1) * time()); |
|
| 35 | 35 | |
| 36 | 36 | mt_srand($seed); |
| 37 | 37 | srand($seed); |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | if (!$s) { |
| 44 | 44 | $s = rand(); |
| 45 | 45 | } |
| 46 | - $s = substr(md5(uniqid($s) . $sel), 0, 16); |
|
| 46 | + $s = substr(md5(uniqid($s).$sel), 0, 16); |
|
| 47 | 47 | } |
| 48 | - $r = unpack('Cr', pack('H2', $s . $s)); |
|
| 48 | + $r = unpack('Cr', pack('H2', $s.$s)); |
|
| 49 | 49 | $x = $r['r'] & 63; |
| 50 | 50 | if ($x < 10) { |
| 51 | 51 | $x = chr($x + 48); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | static $seeded; |
| 84 | 84 | |
| 85 | 85 | if (!$seeded) { |
| 86 | - $seed = (int)round(((float)microtime() + 1) * time()); |
|
| 86 | + $seed = (int) round(((float) microtime() + 1) * time()); |
|
| 87 | 87 | mt_srand($seed); |
| 88 | 88 | srand($seed); |
| 89 | 89 | $seeded = true; |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | foreach ($args as $val => $var) { |
| 194 | 194 | if ($var) { |
| 195 | 195 | if ($val <> 'statut') { |
| 196 | - $a .= ':' . $val . '-' . $var; |
|
| 196 | + $a .= ':'.$val.'-'.$var; |
|
| 197 | 197 | } |
| 198 | - $b .= $val . '=' . $var . '&'; |
|
| 198 | + $b .= $val.'='.$var.'&'; |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | $a = substr($a, 1); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * Clé |
| 226 | 226 | **/ |
| 227 | 227 | function afficher_low_sec($id_auteur, $action = '') { |
| 228 | - return substr(md5($action . low_sec($id_auteur)), 0, 8); |
|
| 228 | + return substr(md5($action.low_sec($id_auteur)), 0, 8); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | function initialiser_sel() { |
| 268 | 268 | if (!isset($GLOBALS['htsalt'])) { |
| 269 | 269 | if (CRYPT_MD5) { |
| 270 | - $GLOBALS['htsalt'] = '$1$' . creer_pass_aleatoire(); |
|
| 270 | + $GLOBALS['htsalt'] = '$1$'.creer_pass_aleatoire(); |
|
| 271 | 271 | } else { |
| 272 | 272 | $GLOBALS['htsalt'] = ''; |
| 273 | 273 | } |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | * - void sinon. |
| 290 | 290 | **/ |
| 291 | 291 | function ecrire_acces() { |
| 292 | - $htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME; |
|
| 293 | - $htpasswd = _DIR_TMP . _AUTH_USER_FILE; |
|
| 292 | + $htaccess = _DIR_RESTREINT._ACCESS_FILE_NAME; |
|
| 293 | + $htpasswd = _DIR_TMP._AUTH_USER_FILE; |
|
| 294 | 294 | |
| 295 | 295 | // Cette variable de configuration peut etre posee par un plugin |
| 296 | 296 | // par exemple acces_restreint ; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | and !@file_exists($htaccess) |
| 301 | 301 | ) { |
| 302 | 302 | spip_unlink($htpasswd); |
| 303 | - spip_unlink($htpasswd . '-admin'); |
|
| 303 | + spip_unlink($htpasswd.'-admin'); |
|
| 304 | 304 | return; |
| 305 | 305 | } |
| 306 | 306 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | $res = sql_select('login, htpass, statut', 'spip_auteurs', "htpass!='' AND login!='' AND ".sql_in('statut', ['1comite', '0minirezo', 'nouveau'])); |
| 333 | 333 | while ($row = sql_fetch($res)) { |
| 334 | 334 | if (strlen($row['login']) and strlen($row['htpass'])) { |
| 335 | - $ligne = $row['login'] . ':' . $row['htpass'] . "\n"; |
|
| 335 | + $ligne = $row['login'].':'.$row['htpass']."\n"; |
|
| 336 | 336 | $pwd_all .= $ligne; |
| 337 | 337 | if ($row['statut'] == '0minirezo') { |
| 338 | 338 | $pwd_admin .= $ligne; |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | * @return boolean |
| 378 | 378 | */ |
| 379 | 379 | function verifier_htaccess($rep, $force = false) { |
| 380 | - $htaccess = rtrim($rep, '/') . '/' . _ACCESS_FILE_NAME; |
|
| 380 | + $htaccess = rtrim($rep, '/').'/'._ACCESS_FILE_NAME; |
|
| 381 | 381 | if (((@file_exists($htaccess)) or defined('_TEST_DIRS')) and !$force) { |
| 382 | 382 | return true; |
| 383 | 383 | } |
@@ -404,17 +404,17 @@ discard block |
||
| 404 | 404 | fputs($ht, $deny); |
| 405 | 405 | fclose($ht); |
| 406 | 406 | @chmod($htaccess, _SPIP_CHMOD & 0666); |
| 407 | - $t = rtrim($rep, '/') . '/.ok'; |
|
| 407 | + $t = rtrim($rep, '/').'/.ok'; |
|
| 408 | 408 | if ($ht = @fopen($t, 'w')) { |
| 409 | 409 | @fclose($ht); |
| 410 | 410 | include_spip('inc/distant'); |
| 411 | 411 | $t = substr($t, strlen(_DIR_RACINE)); |
| 412 | - $t = url_de_base() . $t; |
|
| 412 | + $t = url_de_base().$t; |
|
| 413 | 413 | $ht = recuperer_url($t, ['methode' => 'HEAD', 'taille_max' => 0, 'follow_location' => false]); |
| 414 | 414 | $ht = ($ht['status'] ?? null) === 403; |
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | - spip_log("Creation de $htaccess " . ($ht ? ' reussie' : ' manquee')); |
|
| 417 | + spip_log("Creation de $htaccess ".($ht ? ' reussie' : ' manquee')); |
|
| 418 | 418 | |
| 419 | 419 | return $ht; |
| 420 | 420 | } |
@@ -440,11 +440,11 @@ discard block |
||
| 440 | 440 | $dirs = sql_allfetsel('extension', 'spip_types_documents'); |
| 441 | 441 | $dirs[] = array('extension' => 'distant'); |
| 442 | 442 | foreach ($dirs as $e) { |
| 443 | - if (is_dir($dir = _DIR_IMG . $e['extension'])) { |
|
| 443 | + if (is_dir($dir = _DIR_IMG.$e['extension'])) { |
|
| 444 | 444 | if ($f) { |
| 445 | 445 | verifier_htaccess($dir); |
| 446 | 446 | } else { |
| 447 | - spip_unlink($dir . '/' . _ACCESS_FILE_NAME); |
|
| 447 | + spip_unlink($dir.'/'._ACCESS_FILE_NAME); |
|
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | 450 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | define('_INC_DISTANT_CONTENT_ENCODING', 'gzip'); |
| 27 | 27 | } |
| 28 | 28 | if (!defined('_INC_DISTANT_USER_AGENT')) { |
| 29 | - define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')'); |
|
| 29 | + define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')'); |
|
| 30 | 30 | } |
| 31 | 31 | if (!defined('_INC_DISTANT_MAX_SIZE')) { |
| 32 | 32 | define('_INC_DISTANT_MAX_SIZE', 2097152); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | define('_INC_DISTANT_CONNECT_TIMEOUT', 10); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -define('_REGEXP_COPIE_LOCALE', ',' . |
|
| 38 | +define('_REGEXP_COPIE_LOCALE', ','. |
|
| 39 | 39 | preg_replace( |
| 40 | 40 | '@^https?:@', |
| 41 | 41 | 'https?:', |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // si c'est la protection de soi-meme, retourner le path |
| 72 | 72 | if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) { |
| 73 | - $source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]); |
|
| 73 | + $source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]); |
|
| 74 | 74 | |
| 75 | 75 | return @file_exists($source) ? $source : false; |
| 76 | 76 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $localrac = _DIR_RACINE . $local; |
|
| 93 | + $localrac = _DIR_RACINE.$local; |
|
| 94 | 94 | $t = ($mode == 'force') ? false : @file_exists($localrac); |
| 95 | 95 | |
| 96 | 96 | // test d'existence du fichier |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | array('file' => $localrac, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : '') |
| 116 | 116 | ); |
| 117 | 117 | if (!$res or (!$res['length'] and $res['status'] != 304)) { |
| 118 | - spip_log("copie_locale : Echec recuperation $source sur $localrac status : " . $res['status'], 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 118 | + spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".$res['status'], 'distant'._LOG_INFO_IMPORTANTE); |
|
| 119 | 119 | } |
| 120 | 120 | if (!$res['length']) { |
| 121 | 121 | // si $t c'est sans doute juste un not-modified-since |
| 122 | 122 | return $t ? $local : false; |
| 123 | 123 | } |
| 124 | - spip_log("copie_locale : recuperation $source sur $localrac taille " . $res['length'] . ' OK', 'distant'); |
|
| 124 | + spip_log("copie_locale : recuperation $source sur $localrac taille ".$res['length'].' OK', 'distant'); |
|
| 125 | 125 | |
| 126 | 126 | // pour une eventuelle indexation |
| 127 | 127 | pipeline( |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * url ou false en cas d'echec |
| 154 | 154 | */ |
| 155 | 155 | function valider_url_distante($url, $known_hosts = array()) { |
| 156 | - if (!function_exists('protocole_verifier')){ |
|
| 156 | + if (!function_exists('protocole_verifier')) { |
|
| 157 | 157 | include_spip('inc/filtres_mini'); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $parsed_url = parse_url($url); |
| 165 | - if (!$parsed_url or empty($parsed_url['host']) ) { |
|
| 165 | + if (!$parsed_url or empty($parsed_url['host'])) { |
|
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | if ($ip) { |
| 206 | - $parts = array_map('intval', explode( '.', $ip )); |
|
| 206 | + $parts = array_map('intval', explode('.', $ip)); |
|
| 207 | 207 | if (127 === $parts[0] or 10 === $parts[0] or 0 === $parts[0] |
| 208 | - or ( 172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1] ) |
|
| 209 | - or ( 192 === $parts[0] && 168 === $parts[1] ) |
|
| 208 | + or (172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1]) |
|
| 209 | + or (192 === $parts[0] && 168 === $parts[1]) |
|
| 210 | 210 | ) { |
| 211 | 211 | return false; |
| 212 | 212 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $port = $parsed_url['port']; |
| 221 | - if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 221 | + if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 222 | 222 | return $url; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | if ($taille > 500) { |
| 289 | - $boundary = substr(md5(rand() . 'spip'), 0, 8); |
|
| 289 | + $boundary = substr(md5(rand().'spip'), 0, 8); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
@@ -314,16 +314,16 @@ discard block |
||
| 314 | 314 | } |
| 315 | 315 | } else { |
| 316 | 316 | // fabrique une chaine HTTP simple pour un POST |
| 317 | - $entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; |
|
| 317 | + $entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n"; |
|
| 318 | 318 | $chaine = array(); |
| 319 | 319 | if (is_array($donnees)) { |
| 320 | 320 | foreach ($donnees as $cle => $valeur) { |
| 321 | 321 | if (is_array($valeur)) { |
| 322 | 322 | foreach ($valeur as $val2) { |
| 323 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2); |
|
| 323 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2); |
|
| 324 | 324 | } |
| 325 | 325 | } else { |
| 326 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur); |
|
| 326 | + $chaine[] = rawurlencode($cle).'='.rawurlencode($valeur); |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | $chaine = implode('&', $chaine); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $head_add = ''; |
| 434 | 434 | if (!empty($options['headers'])) { |
| 435 | 435 | foreach ($options['headers'] as $champ => $valeur) { |
| 436 | - $head_add .= $champ . ': ' . $valeur . "\r\n"; |
|
| 436 | + $head_add .= $champ.': '.$valeur."\r\n"; |
|
| 437 | 437 | } |
| 438 | 438 | // ne pas le repasser a recuperer_url si on follow un location, car ils seront dans datas |
| 439 | 439 | unset($options['entetes']); |
@@ -443,9 +443,9 @@ discard block |
||
| 443 | 443 | list($head, $postdata) = prepare_donnees_post($options['datas'], $options['boundary']); |
| 444 | 444 | $head .= $head_add; |
| 445 | 445 | if (stripos($head, 'Content-Length:') === false) { |
| 446 | - $head .= 'Content-Length: ' . strlen($postdata) . "\r\n"; |
|
| 446 | + $head .= 'Content-Length: '.strlen($postdata)."\r\n"; |
|
| 447 | 447 | } |
| 448 | - $options['datas'] = $head . "\r\n" . $postdata; |
|
| 448 | + $options['datas'] = $head."\r\n".$postdata; |
|
| 449 | 449 | if ( |
| 450 | 450 | strlen($postdata) |
| 451 | 451 | and !$methode_demandee |
@@ -453,15 +453,15 @@ discard block |
||
| 453 | 453 | $options['methode'] = 'POST'; |
| 454 | 454 | } |
| 455 | 455 | } elseif ($head_add) { |
| 456 | - $options['datas'] = $head_add . "\r\n"; |
|
| 456 | + $options['datas'] = $head_add."\r\n"; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 460 | 460 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 461 | 461 | if (!tester_url_absolue($url)) { |
| 462 | - $url = 'http://' . $url; |
|
| 462 | + $url = 'http://'.$url; |
|
| 463 | 463 | } elseif (strncmp($url, '//', 2) == 0) { |
| 464 | - $url = 'http:' . $url; |
|
| 464 | + $url = 'http:'.$url; |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | $url = url_to_ascii($url); |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $options['if_modified_since'] |
| 491 | 491 | ); |
| 492 | 492 | if (!$handle) { |
| 493 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 493 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 494 | 494 | |
| 495 | 495 | return false; |
| 496 | 496 | } |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | 'status' => 200, |
| 520 | 520 | ); |
| 521 | 521 | } else { |
| 522 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 522 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 523 | 523 | return false; |
| 524 | 524 | } |
| 525 | 525 | } elseif ($res['location'] and $options['follow_location']) { |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | |
| 532 | 532 | return recuperer_url($url, $options); |
| 533 | 533 | } elseif ($res['status'] !== 200) { |
| 534 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 534 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 535 | 535 | } |
| 536 | 536 | $result['status'] = $res['status']; |
| 537 | 537 | if (isset($res['headers'])) { |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | $gz = false; |
| 558 | 558 | if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) { |
| 559 | - $gz = (_DIR_TMP . md5(uniqid(mt_rand())) . '.tmp.gz'); |
|
| 559 | + $gz = (_DIR_TMP.md5(uniqid(mt_rand())).'.tmp.gz'); |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | $sig['url'] = $url; |
| 643 | 643 | |
| 644 | 644 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 645 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 645 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 646 | 646 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 647 | 647 | $cache = "$sub$cache"; |
| 648 | 648 | |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | $fp = false; |
| 695 | 695 | if ($fichier) { |
| 696 | 696 | include_spip('inc/acces'); |
| 697 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 697 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 698 | 698 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 699 | 699 | if (!$fp and file_exists($fichier)) { |
| 700 | 700 | return filesize($fichier); |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | } |
| 754 | 754 | $result['status'] = intval($r[1]); |
| 755 | 755 | while ($s = trim(fgets($handle, 16384))) { |
| 756 | - $result['headers'][] = $s . "\n"; |
|
| 756 | + $result['headers'][] = $s."\n"; |
|
| 757 | 757 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 758 | 758 | list(, $d, $v) = $r; |
| 759 | 759 | if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) { |
@@ -801,13 +801,13 @@ discard block |
||
| 801 | 801 | |
| 802 | 802 | // on se place tout le temps comme si on etait a la racine |
| 803 | 803 | if (_DIR_RACINE) { |
| 804 | - $d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d); |
|
| 804 | + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); |
|
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | $m = md5($source); |
| 808 | 808 | |
| 809 | 809 | return $d |
| 810 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 810 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 811 | 811 | . substr($m, 0, 4) |
| 812 | 812 | . ".$extension"; |
| 813 | 813 | } |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | // Si c'est deja local pas de souci |
| 831 | 831 | if (!tester_url_absolue($source)) { |
| 832 | 832 | if (_DIR_RACINE) { |
| 833 | - $source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source); |
|
| 833 | + $source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source); |
|
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | return $source; |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | if ($ext |
| 848 | 848 | and preg_match(',^\w+$,', $ext) // pas de php?truc=1&... |
| 849 | 849 | and $f = nom_fichier_copie_locale($source, $ext) |
| 850 | - and file_exists(_DIR_RACINE . $f) |
|
| 850 | + and file_exists(_DIR_RACINE.$f) |
|
| 851 | 851 | ) { |
| 852 | 852 | return $f; |
| 853 | 853 | } |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | |
| 856 | 856 | // Si c'est deja dans la table des documents, |
| 857 | 857 | // ramener le nom de sa copie potentielle |
| 858 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 858 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 859 | 859 | |
| 860 | 860 | if ($ext) { |
| 861 | 861 | return nom_fichier_copie_locale($source, $ext); |
@@ -866,9 +866,9 @@ discard block |
||
| 866 | 866 | |
| 867 | 867 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 868 | 868 | |
| 869 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 869 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 870 | 870 | $f = nom_fichier_copie_locale($source, $ext); |
| 871 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 871 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 872 | 872 | return $f; |
| 873 | 873 | } |
| 874 | 874 | } |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | // Ping pour voir si son extension est connue et autorisee |
| 877 | 877 | // avec mise en cache du resultat du ping |
| 878 | 878 | |
| 879 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 879 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 880 | 880 | if (!@file_exists($cache) |
| 881 | 881 | or !$path_parts = @unserialize(spip_file_get_contents($cache)) |
| 882 | 882 | or _request('var_mode') == 'recalcul' |
@@ -885,10 +885,10 @@ discard block |
||
| 885 | 885 | ecrire_fichier($cache, serialize($path_parts)); |
| 886 | 886 | } |
| 887 | 887 | $ext = !empty($path_parts['extension']) ? $path_parts['extension'] : ''; |
| 888 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 888 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 889 | 889 | return nom_fichier_copie_locale($source, $ext); |
| 890 | 890 | } |
| 891 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 891 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | |
@@ -954,19 +954,19 @@ discard block |
||
| 954 | 954 | if (!$t |
| 955 | 955 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 956 | 956 | ) { |
| 957 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 957 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 958 | 958 | } |
| 959 | 959 | if (!$t |
| 960 | 960 | and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 961 | 961 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 962 | 962 | ) { |
| 963 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 963 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 964 | 964 | } |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 968 | 968 | if (!$t) { |
| 969 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 969 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -976,11 +976,11 @@ discard block |
||
| 976 | 976 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 977 | 977 | ) { |
| 978 | 978 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 979 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 979 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 980 | 980 | } |
| 981 | 981 | |
| 982 | 982 | if ($t) { |
| 983 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 983 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 984 | 984 | $a['extension'] = $t['extension']; |
| 985 | 985 | } else { |
| 986 | 986 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | } else { |
| 1023 | 1023 | if ($a['body']) { |
| 1024 | 1024 | $a['extension'] = $extension; |
| 1025 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 1025 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 1026 | 1026 | ecrire_fichier($a['fichier'], $a['body']); |
| 1027 | 1027 | $size_image = @spip_getimagesize($a['fichier']); |
| 1028 | 1028 | $a['largeur'] = intval($size_image[0]); |
@@ -1148,7 +1148,7 @@ discard block |
||
| 1148 | 1148 | } |
| 1149 | 1149 | } else { |
| 1150 | 1150 | $scheme = $t['scheme']; |
| 1151 | - $noproxy = $scheme . '://'; |
|
| 1151 | + $noproxy = $scheme.'://'; |
|
| 1152 | 1152 | } |
| 1153 | 1153 | if (isset($t['user'])) { |
| 1154 | 1154 | $user = array($t['user'], $t['pass']); |
@@ -1162,7 +1162,7 @@ discard block |
||
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | 1164 | if (!empty($t['query'])) { |
| 1165 | - $path .= '?' . $t['query']; |
|
| 1165 | + $path .= '?'.$t['query']; |
|
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1235,20 +1235,20 @@ discard block |
||
| 1235 | 1235 | $proxy_user = ''; |
| 1236 | 1236 | $http_proxy = need_proxy($host); |
| 1237 | 1237 | if ($user) { |
| 1238 | - $user = urlencode($user[0]) . ':' . urlencode($user[1]); |
|
| 1238 | + $user = urlencode($user[0]).':'.urlencode($user[1]); |
|
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | 1241 | $connect = ''; |
| 1242 | 1242 | if ($http_proxy) { |
| 1243 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme , array('tls','ssl'))) { |
|
| 1244 | - $path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : ''); |
|
| 1245 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1243 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, array('tls', 'ssl'))) { |
|
| 1244 | + $path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : ''); |
|
| 1245 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1246 | 1246 | . "Host: $path_host\r\n" |
| 1247 | 1247 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1248 | 1248 | } else { |
| 1249 | - $path = (in_array($scheme , array('tls','ssl')) ? 'https://' : "$scheme://") |
|
| 1249 | + $path = (in_array($scheme, array('tls', 'ssl')) ? 'https://' : "$scheme://") |
|
| 1250 | 1250 | . (!$user ? '' : "$user@") |
| 1251 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1251 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1252 | 1252 | } |
| 1253 | 1253 | $t2 = @parse_url($http_proxy); |
| 1254 | 1254 | $first_host = $t2['host']; |
@@ -1256,10 +1256,10 @@ discard block |
||
| 1256 | 1256 | $port = 80; |
| 1257 | 1257 | } |
| 1258 | 1258 | if ($t2['user']) { |
| 1259 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1259 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1260 | 1260 | } |
| 1261 | 1261 | } else { |
| 1262 | - $first_host = $noproxy . $host; |
|
| 1262 | + $first_host = $noproxy.$host; |
|
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | if ($connect) { |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | ); |
| 1282 | 1282 | spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect'); |
| 1283 | 1283 | if (!$f) { |
| 1284 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1284 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1285 | 1285 | return $errno; |
| 1286 | 1286 | } |
| 1287 | 1287 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | or !count($res = explode(' ', $res)) |
| 1294 | 1294 | or $res[1] !== '200' |
| 1295 | 1295 | ) { |
| 1296 | - spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1296 | + spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1297 | 1297 | fclose($f); |
| 1298 | 1298 | |
| 1299 | 1299 | return false; |
@@ -1310,7 +1310,7 @@ discard block |
||
| 1310 | 1310 | } while (!$f and $ntry-- and $errno !== 110 and sleep(1)); |
| 1311 | 1311 | spip_log("Recuperer $path sur $first_host:$port par $f"); |
| 1312 | 1312 | if (!$f) { |
| 1313 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1313 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1314 | 1314 | |
| 1315 | 1315 | return $errno; |
| 1316 | 1316 | } |
@@ -1320,16 +1320,16 @@ discard block |
||
| 1320 | 1320 | $site = isset($GLOBALS['meta']['adresse_site']) ? $GLOBALS['meta']['adresse_site'] : ''; |
| 1321 | 1321 | |
| 1322 | 1322 | $host_port = $host; |
| 1323 | - if ($port != (in_array($scheme , array('tls','ssl')) ? 443 : 80)) { |
|
| 1323 | + if ($port != (in_array($scheme, array('tls', 'ssl')) ? 443 : 80)) { |
|
| 1324 | 1324 | $host_port .= ":$port"; |
| 1325 | 1325 | } |
| 1326 | 1326 | $req = "$method $path $vers\r\n" |
| 1327 | 1327 | . "Host: $host_port\r\n" |
| 1328 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1329 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1328 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1329 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1330 | 1330 | . (!$site ? '' : "Referer: $site/$referer\r\n") |
| 1331 | - . (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n")) |
|
| 1332 | - . (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n")) |
|
| 1331 | + . (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n")) |
|
| 1332 | + . (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n")) |
|
| 1333 | 1333 | . (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n") |
| 1334 | 1334 | . (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n"); |
| 1335 | 1335 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | // https://code.spip.net/@_sqlite_func_preg_replace |
| 252 | 252 | function _sqlite_func_preg_replace($quoi, $cherche, $remplace) { |
| 253 | - $return = preg_replace('%' . $cherche . '%', $remplace, $quoi); |
|
| 253 | + $return = preg_replace('%'.$cherche.'%', $remplace, $quoi); |
|
| 254 | 254 | |
| 255 | 255 | #spip_log("preg_replace : $quoi, $cherche, $remplace, $return",'sqlite.'._LOG_DEBUG); |
| 256 | 256 | return $return; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | // il faut enlever un niveau d'echappement pour être homogène à mysql |
| 309 | 309 | $cherche = str_replace('\\\\', '\\', $cherche); |
| 310 | 310 | $u = isset($GLOBALS['meta']['pcre_u']) ? $GLOBALS['meta']['pcre_u'] : 'u'; |
| 311 | - $return = preg_match('%' . $cherche . '%imsS' . $u, $quoi); |
|
| 311 | + $return = preg_match('%'.$cherche.'%imsS'.$u, $quoi); |
|
| 312 | 312 | |
| 313 | 313 | #spip_log("regexp_replace : $quoi, $cherche, $remplace, $return",'sqlite.'._LOG_DEBUG); |
| 314 | 314 | return $return; |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | $count = 0; |
| 358 | 358 | str_replace($mysql_to_strftime_not_ok, '', $conv, $count); |
| 359 | 359 | if ($count > 0) { |
| 360 | - spip_log("DATE_FORMAT : At least one parameter can't be parsed by strftime with format '$conv'", 'sqlite.' . _LOG_ERREUR); |
|
| 360 | + spip_log("DATE_FORMAT : At least one parameter can't be parsed by strftime with format '$conv'", 'sqlite.'._LOG_ERREUR); |
|
| 361 | 361 | } |
| 362 | 362 | $to_strftime[$conv] = str_replace(array_keys($mysql_to_strftime), $mysql_to_strftime, $conv); |
| 363 | 363 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | function _sqlite_func_to_days($d) { |
| 376 | 376 | static $offset = 719528; // nb de jour entre 0000-00-00 et timestamp 0=1970-01-01 |
| 377 | - $result = $offset + (int)ceil(_sqlite_func_unix_timestamp($d) / (24 * 3600)); |
|
| 377 | + $result = $offset + (int) ceil(_sqlite_func_unix_timestamp($d) / (24 * 3600)); |
|
| 378 | 378 | |
| 379 | 379 | #spip_log("Passage avec TO_DAYS : $d, $result",'sqlite.'._LOG_DEBUG); |
| 380 | 380 | return $result; |
@@ -64,27 +64,27 @@ discard block |
||
| 64 | 64 | // determiner le dossier de la base : $addr ou _DIR_DB |
| 65 | 65 | $f = _DIR_DB; |
| 66 | 66 | if ($addr and strpos($addr, '/') !== false) { |
| 67 | - $f = rtrim($addr, '/') . '/'; |
|
| 67 | + $f = rtrim($addr, '/').'/'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // un nom de base demande et impossible d'obtenir la base, on s'en va : |
| 71 | 71 | // il faut que la base existe ou que le repertoire parent soit writable |
| 72 | - if ($db and !is_file($f .= $db . '.sqlite') and !is_writable(dirname($f))) { |
|
| 73 | - spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.' . _LOG_HS); |
|
| 72 | + if ($db and !is_file($f .= $db.'.sqlite') and !is_writable(dirname($f))) { |
|
| 73 | + spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.'._LOG_HS); |
|
| 74 | 74 | |
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // charger les modules sqlite au besoin |
| 79 | 79 | if (!_sqlite_charger_version($sqlite_version)) { |
| 80 | - spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.' . _LOG_HS); |
|
| 80 | + spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.'._LOG_HS); |
|
| 81 | 81 | |
| 82 | 82 | return false; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // chargement des constantes |
| 86 | 86 | // il ne faut pas definir les constantes avant d'avoir charge les modules sqlite |
| 87 | - $define = "spip_sqlite" . $sqlite_version . "_constantes"; |
|
| 87 | + $define = "spip_sqlite".$sqlite_version."_constantes"; |
|
| 88 | 88 | $define(); |
| 89 | 89 | |
| 90 | 90 | $ok = false; |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | // si pas de db -> |
| 93 | 93 | // base temporaire tant qu'on ne connait pas son vrai nom |
| 94 | 94 | // pour tester la connexion |
| 95 | - $db = "_sqlite" . $sqlite_version . "_install"; |
|
| 96 | - $tmp = _DIR_DB . $db . ".sqlite"; |
|
| 95 | + $db = "_sqlite".$sqlite_version."_install"; |
|
| 96 | + $tmp = _DIR_DB.$db.".sqlite"; |
|
| 97 | 97 | $ok = $link = new \PDO("sqlite:$tmp"); |
| 98 | 98 | } else { |
| 99 | 99 | // Ouvrir (eventuellement creer la base) |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | if (!$ok) { |
| 104 | 104 | $e = _sqlite_last_error_from_link($link); |
| 105 | - spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.' . _LOG_HS); |
|
| 105 | + spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.'._LOG_HS); |
|
| 106 | 106 | |
| 107 | 107 | return false; |
| 108 | 108 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $table = $regs[3]; |
| 189 | 189 | $suite = $regs[4]; |
| 190 | 190 | } else { |
| 191 | - spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.' . _LOG_ERREUR); |
|
| 191 | + spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.'._LOG_ERREUR); |
|
| 192 | 192 | |
| 193 | 193 | return false; |
| 194 | 194 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $i = 0; |
| 206 | 206 | $ouverte = false; |
| 207 | 207 | while ($do = array_shift($todo)) { |
| 208 | - $todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . "," . $do : $do; |
|
| 208 | + $todo2[$i] = isset($todo2[$i]) ? $todo2[$i].",".$do : $do; |
|
| 209 | 209 | $o = (false !== strpos($do, "(")); |
| 210 | 210 | $f = (false !== strpos($do, ")")); |
| 211 | 211 | if ($o and !$f) { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | . ')\s*([^\s]*)\s*(.*)?/i', $do, $matches) |
| 230 | 230 | ) { |
| 231 | 231 | spip_log("SQLite : Probleme de ALTER TABLE, utilisation non reconnue dans : $do \n(requete d'origine : $query)", |
| 232 | - 'sqlite.' . _LOG_ERREUR); |
|
| 232 | + 'sqlite.'._LOG_ERREUR); |
|
| 233 | 233 | |
| 234 | 234 | return false; |
| 235 | 235 | } |
@@ -316,10 +316,10 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | // pas geres en sqlite2 |
| 318 | 318 | case 'RENAME': |
| 319 | - $do = "RENAME TO" . substr($do, 6); |
|
| 319 | + $do = "RENAME TO".substr($do, 6); |
|
| 320 | 320 | case 'RENAME TO': |
| 321 | 321 | if (!spip_sqlite::executer_requete("$debut $do", $serveur)) { |
| 322 | - spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 322 | + spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.'._LOG_ERREUR); |
|
| 323 | 323 | |
| 324 | 324 | return false; |
| 325 | 325 | } |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | $colonnes = substr($colonne_origine, 1, -1); |
| 361 | 361 | if (false !== strpos(",", $colonnes)) { |
| 362 | 362 | spip_log("SQLite : Erreur, impossible de creer un index sur plusieurs colonnes" |
| 363 | - . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.' . _LOG_ERREUR); |
|
| 363 | + . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.'._LOG_ERREUR); |
|
| 364 | 364 | break; |
| 365 | 365 | } else { |
| 366 | 366 | $nom_index = $colonnes; |
@@ -375,12 +375,12 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | // pas geres en sqlite2 |
| 377 | 377 | case 'ADD COLUMN': |
| 378 | - $do = "ADD" . substr($do, 10); |
|
| 378 | + $do = "ADD".substr($do, 10); |
|
| 379 | 379 | case 'ADD': |
| 380 | 380 | default: |
| 381 | 381 | if (!preg_match(',primary\s+key,i', $do)) { |
| 382 | 382 | if (!spip_sqlite::executer_requete("$debut $do", $serveur)) { |
| 383 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 383 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 384 | 384 | |
| 385 | 385 | return false; |
| 386 | 386 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | } |
| 402 | 402 | $opts['field'] = array($colonne_ajoutee => $def); |
| 403 | 403 | if (!_sqlite_modifier_table($table, array($colonne_ajoutee), $opts, $serveur)) { |
| 404 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 404 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 405 | 405 | |
| 406 | 406 | return false; |
| 407 | 407 | } |
@@ -409,10 +409,10 @@ discard block |
||
| 409 | 409 | break; |
| 410 | 410 | } |
| 411 | 411 | // tout est bon, ouf ! |
| 412 | - spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.' . _LOG_INFO); |
|
| 412 | + spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.'._LOG_INFO); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.' . _LOG_INFO); |
|
| 415 | + spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.'._LOG_INFO); |
|
| 416 | 416 | |
| 417 | 417 | return true; |
| 418 | 418 | } |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | * @return bool true si la base est créee. |
| 482 | 482 | **/ |
| 483 | 483 | function spip_sqlite_create_base($nom, $serveur = '', $option = true) { |
| 484 | - $f = $nom . '.sqlite'; |
|
| 484 | + $f = $nom.'.sqlite'; |
|
| 485 | 485 | if (strpos($nom, "/") === false) { |
| 486 | - $f = _DIR_DB . $f; |
|
| 486 | + $f = _DIR_DB.$f; |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | $ok = new \PDO("sqlite:$f"); |
@@ -522,12 +522,12 @@ discard block |
||
| 522 | 522 | // vue deja presente |
| 523 | 523 | if (sql_showtable($nom, false, $serveur)) { |
| 524 | 524 | spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", |
| 525 | - 'sqlite.' . _LOG_ERREUR); |
|
| 525 | + 'sqlite.'._LOG_ERREUR); |
|
| 526 | 526 | |
| 527 | 527 | return false; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 530 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 531 | 531 | |
| 532 | 532 | return spip_sqlite_query($query, $serveur, $requeter); |
| 533 | 533 | } |
@@ -552,15 +552,15 @@ discard block |
||
| 552 | 552 | */ |
| 553 | 553 | function spip_sqlite_create_index($nom, $table, $champs, $unique = '', $serveur = '', $requeter = true) { |
| 554 | 554 | if (!($nom or $table or $champs)) { |
| 555 | - spip_log("Champ manquant pour creer un index sqlite ($nom, $table, (" . join(',', $champs) . "))", |
|
| 556 | - 'sqlite.' . _LOG_ERREUR); |
|
| 555 | + spip_log("Champ manquant pour creer un index sqlite ($nom, $table, (".join(',', $champs)."))", |
|
| 556 | + 'sqlite.'._LOG_ERREUR); |
|
| 557 | 557 | |
| 558 | 558 | return false; |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | // SQLite ne differentie pas noms des index en fonction des tables |
| 562 | 562 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 563 | - $nom = $table . '_' . $nom; |
|
| 563 | + $nom = $table.'_'.$nom; |
|
| 564 | 564 | // enlever d'eventuelles parentheses deja presentes sur champs |
| 565 | 565 | if (!is_array($champs)) { |
| 566 | 566 | if ($champs[0] == "(") { |
@@ -582,12 +582,12 @@ discard block |
||
| 582 | 582 | } else { |
| 583 | 583 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 584 | 584 | $a = spip_sqlite_showtable($table, $serveur); |
| 585 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 585 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 586 | 586 | return true; |
| 587 | 587 | } |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | - $query = "CREATE " . ($unique ? "UNIQUE " : "") . "INDEX$ifnotexists $nom ON $table (" . join(',', $champs) . ")"; |
|
| 590 | + $query = "CREATE ".($unique ? "UNIQUE " : "")."INDEX$ifnotexists $nom ON $table (".join(',', $champs).")"; |
|
| 591 | 591 | $res = spip_sqlite_query($query, $serveur, $requeter); |
| 592 | 592 | if (!$requeter) { |
| 593 | 593 | return $res; |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | $serveur = '', |
| 664 | 664 | $requeter = true |
| 665 | 665 | ) { |
| 666 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 666 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 667 | 667 | $r = spip_sqlite_select("COUNT($c)", $from, $where, '', '', '', |
| 668 | 668 | $having, $serveur, $requeter); |
| 669 | 669 | if ((is_resource($r) or is_object($r)) && $requeter) { // ressource : sqlite2, object : sqlite3 |
@@ -761,14 +761,14 @@ discard block |
||
| 761 | 761 | */ |
| 762 | 762 | function spip_sqlite_drop_index($nom, $table, $serveur = '', $requeter = true) { |
| 763 | 763 | if (!($nom or $table)) { |
| 764 | - spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.' . _LOG_ERREUR); |
|
| 764 | + spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.'._LOG_ERREUR); |
|
| 765 | 765 | |
| 766 | 766 | return false; |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | // SQLite ne differentie pas noms des index en fonction des tables |
| 770 | 770 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 771 | - $index = $table . '_' . $nom; |
|
| 771 | + $index = $table.'_'.$nom; |
|
| 772 | 772 | $exist = " IF EXISTS"; |
| 773 | 773 | |
| 774 | 774 | $query = "DROP INDEX$exist $index"; |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | if ($s) { |
| 801 | 801 | $trace = debug_backtrace(); |
| 802 | 802 | if ($trace[0]['function'] != "spip_sqlite_error") { |
| 803 | - spip_log("$s - $query - " . sql_error_backtrace(), 'sqlite.' . _LOG_ERREUR); |
|
| 803 | + spip_log("$s - $query - ".sql_error_backtrace(), 'sqlite.'._LOG_ERREUR); |
|
| 804 | 804 | } |
| 805 | 805 | } |
| 806 | 806 | |
@@ -847,14 +847,14 @@ discard block |
||
| 847 | 847 | $t = $link->errorInfo(); |
| 848 | 848 | $s = ltrim($t[0], '0'); // 00000 si pas d'erreur |
| 849 | 849 | if ($s) { |
| 850 | - $s .= ' / ' . $t[1]; |
|
| 850 | + $s .= ' / '.$t[1]; |
|
| 851 | 851 | } // ajoute l'erreur du moteur SQLite |
| 852 | 852 | } else { |
| 853 | 853 | $s = ": aucune ressource sqlite (link)"; |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | if ($s) { |
| 857 | - spip_log("Erreur sqlite $s", 'sqlite.' . _LOG_ERREUR); |
|
| 857 | + spip_log("Erreur sqlite $s", 'sqlite.'._LOG_ERREUR); |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | return $s ? $s : 0; |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | $query = spip_sqlite::traduire_requete($query, $serveur); |
| 881 | - $query = 'EXPLAIN ' . $query; |
|
| 881 | + $query = 'EXPLAIN '.$query; |
|
| 882 | 882 | if (!$requeter) { |
| 883 | 883 | return $query; |
| 884 | 884 | } |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | **/ |
| 1039 | 1039 | function spip_sqlite_insert($table, $champs, $valeurs, $desc = array(), $serveur = '', $requeter = true) { |
| 1040 | 1040 | |
| 1041 | - $query = "INSERT INTO $table " . ($champs ? "$champs VALUES $valeurs" : "DEFAULT VALUES"); |
|
| 1041 | + $query = "INSERT INTO $table ".($champs ? "$champs VALUES $valeurs" : "DEFAULT VALUES"); |
|
| 1042 | 1042 | if ($r = spip_sqlite_query($query, $serveur, $requeter)) { |
| 1043 | 1043 | if (!$requeter) { |
| 1044 | 1044 | return $r; |
@@ -1094,8 +1094,8 @@ discard block |
||
| 1094 | 1094 | |
| 1095 | 1095 | $cles = $valeurs = ""; |
| 1096 | 1096 | if (count($couples)) { |
| 1097 | - $cles = "(" . join(',', array_keys($couples)) . ")"; |
|
| 1098 | - $valeurs = "(" . join(',', $couples) . ")"; |
|
| 1097 | + $cles = "(".join(',', array_keys($couples)).")"; |
|
| 1098 | + $valeurs = "(".join(',', $couples).")"; |
|
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | return spip_sqlite_insert($table, $cles, $valeurs, $desc, $serveur, $requeter); |
@@ -1155,11 +1155,11 @@ discard block |
||
| 1155 | 1155 | |
| 1156 | 1156 | $champs = $valeurs = ""; |
| 1157 | 1157 | if (count($couples)) { |
| 1158 | - $champs = "(" . join(',', array_keys($couples)) . ")"; |
|
| 1159 | - $valeurs = "(" . join(',', $couples) . ")"; |
|
| 1160 | - $query = $query_start . "$champs VALUES $valeurs"; |
|
| 1158 | + $champs = "(".join(',', array_keys($couples)).")"; |
|
| 1159 | + $valeurs = "(".join(',', $couples).")"; |
|
| 1160 | + $query = $query_start."$champs VALUES $valeurs"; |
|
| 1161 | 1161 | } else { |
| 1162 | - $query = $query_start . "DEFAULT VALUES"; |
|
| 1162 | + $query = $query_start."DEFAULT VALUES"; |
|
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | 1165 | if ($requeter) { |
@@ -1291,7 +1291,7 @@ discard block |
||
| 1291 | 1291 | * @return string Texte de sélection pour la requête |
| 1292 | 1292 | */ |
| 1293 | 1293 | function spip_sqlite_multi($objet, $lang) { |
| 1294 | - $r = "EXTRAIRE_MULTI(" . $objet . ", '" . $lang . "') AS multi"; |
|
| 1294 | + $r = "EXTRAIRE_MULTI(".$objet.", '".$lang."') AS multi"; |
|
| 1295 | 1295 | |
| 1296 | 1296 | return $r; |
| 1297 | 1297 | } |
@@ -1362,7 +1362,7 @@ discard block |
||
| 1362 | 1362 | function spip_sqlite_date_proche($champ, $interval, $unite) { |
| 1363 | 1363 | $op = (($interval <= 0) ? '>' : '<'); |
| 1364 | 1364 | |
| 1365 | - return "($champ $op datetime('" . date("Y-m-d H:i:s") . "', '$interval $unite'))"; |
|
| 1365 | + return "($champ $op datetime('".date("Y-m-d H:i:s")."', '$interval $unite'))"; |
|
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | |
@@ -1392,7 +1392,7 @@ discard block |
||
| 1392 | 1392 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1393 | 1393 | ) { |
| 1394 | 1394 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur); |
| 1395 | - spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
|
| 1395 | + spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE); |
|
| 1396 | 1396 | } |
| 1397 | 1397 | if (preg_match(",^(INTEGER),i", $d) |
| 1398 | 1398 | and stripos($d, "NOT NULL") !== false |
@@ -1401,7 +1401,7 @@ discard block |
||
| 1401 | 1401 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1402 | 1402 | ) { |
| 1403 | 1403 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur); |
| 1404 | - spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
|
| 1404 | + spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE); |
|
| 1405 | 1405 | } |
| 1406 | 1406 | if (preg_match(",^(datetime),i", $d) |
| 1407 | 1407 | and stripos($d, "NOT NULL") !== false |
@@ -1410,7 +1410,7 @@ discard block |
||
| 1410 | 1410 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1411 | 1411 | ) { |
| 1412 | 1412 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur); |
| 1413 | - spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
|
| 1413 | + spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE); |
|
| 1414 | 1414 | } |
| 1415 | 1415 | } |
| 1416 | 1416 | |
@@ -1461,8 +1461,8 @@ discard block |
||
| 1461 | 1461 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
| 1462 | 1462 | $couples = _sqlite_ajouter_champs_timestamp($table, $couples, $desc, $serveur); |
| 1463 | 1463 | |
| 1464 | - return spip_sqlite_query("REPLACE INTO $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(',', |
|
| 1465 | - $couples) . ')', $serveur); |
|
| 1464 | + return spip_sqlite_query("REPLACE INTO $table (".join(',', array_keys($couples)).') VALUES ('.join(',', |
|
| 1465 | + $couples).')', $serveur); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | 1468 | |
@@ -1548,7 +1548,7 @@ discard block |
||
| 1548 | 1548 | . _sqlite_calculer_expression('WHERE', $where) |
| 1549 | 1549 | . _sqlite_calculer_expression('GROUP BY', $groupby, ',') |
| 1550 | 1550 | . _sqlite_calculer_expression('HAVING', $having) |
| 1551 | - . ($orderby ? ("\nORDER BY " . _sqlite_calculer_order($orderby)) : '') |
|
| 1551 | + . ($orderby ? ("\nORDER BY "._sqlite_calculer_order($orderby)) : '') |
|
| 1552 | 1552 | . ($limit ? "\nLIMIT $limit" : ''); |
| 1553 | 1553 | |
| 1554 | 1554 | // dans un select, on doit renvoyer la requête en cas d'erreur |
@@ -1585,10 +1585,10 @@ discard block |
||
| 1585 | 1585 | |
| 1586 | 1586 | // interdire la creation d'une nouvelle base, |
| 1587 | 1587 | // sauf si on est dans l'installation |
| 1588 | - if (!is_file($f = _DIR_DB . $db . '.sqlite') |
|
| 1588 | + if (!is_file($f = _DIR_DB.$db.'.sqlite') |
|
| 1589 | 1589 | && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL) |
| 1590 | 1590 | ) { |
| 1591 | - spip_log("Il est interdit de creer la base $db", 'sqlite.' . _LOG_HS); |
|
| 1591 | + spip_log("Il est interdit de creer la base $db", 'sqlite.'._LOG_HS); |
|
| 1592 | 1592 | |
| 1593 | 1593 | return false; |
| 1594 | 1594 | } |
@@ -1597,12 +1597,12 @@ discard block |
||
| 1597 | 1597 | // avec les identifiants connus |
| 1598 | 1598 | $index = $serveur ? $serveur : 0; |
| 1599 | 1599 | |
| 1600 | - if ($link = spip_connect_db('', '', '', '', '@selectdb@' . $db, $serveur, '', '')) { |
|
| 1600 | + if ($link = spip_connect_db('', '', '', '', '@selectdb@'.$db, $serveur, '', '')) { |
|
| 1601 | 1601 | if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) { |
| 1602 | 1602 | return $db; |
| 1603 | 1603 | } |
| 1604 | 1604 | } else { |
| 1605 | - spip_log("Impossible de selectionner la base $db", 'sqlite.' . _LOG_HS); |
|
| 1605 | + spip_log("Impossible de selectionner la base $db", 'sqlite.'._LOG_HS); |
|
| 1606 | 1606 | |
| 1607 | 1607 | return false; |
| 1608 | 1608 | } |
@@ -1653,7 +1653,7 @@ discard block |
||
| 1653 | 1653 | $match = str_replace("[[POURCENT]]", "%", $match); |
| 1654 | 1654 | $match = "^$match$"; |
| 1655 | 1655 | |
| 1656 | - return spip_sqlite_query("SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP " . _q($match), |
|
| 1656 | + return spip_sqlite_query("SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP "._q($match), |
|
| 1657 | 1657 | $serveur, $requeter); |
| 1658 | 1658 | } |
| 1659 | 1659 | |
@@ -1743,7 +1743,7 @@ discard block |
||
| 1743 | 1743 | // s'il y a une parenthèse fermante dans la clé |
| 1744 | 1744 | // ou dans la définition sans qu'il n'y ait une ouverture avant |
| 1745 | 1745 | if (false !== strpos($k, ')') or preg_match('/^[^\(]*\)/', $def)) { |
| 1746 | - $fields[$k_precedent] .= ',' . $k . ' ' . $def; |
|
| 1746 | + $fields[$k_precedent] .= ','.$k.' '.$def; |
|
| 1747 | 1747 | continue; |
| 1748 | 1748 | } |
| 1749 | 1749 | |
@@ -1778,13 +1778,13 @@ discard block |
||
| 1778 | 1778 | . 'ORDER BY substr(type,2,1), name'; |
| 1779 | 1779 | $a = spip_sqlite_query($query, $serveur, $requeter); |
| 1780 | 1780 | while ($r = spip_sqlite_fetch($a, null, $serveur)) { |
| 1781 | - $key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1781 | + $key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1782 | 1782 | $keytype = "KEY"; |
| 1783 | 1783 | if (strpos($r['sql'], "UNIQUE INDEX") !== false) { |
| 1784 | 1784 | $keytype = "UNIQUE KEY"; |
| 1785 | 1785 | } |
| 1786 | 1786 | $colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']); |
| 1787 | - $keys[$keytype . ' ' . $key] = $colonnes; |
|
| 1787 | + $keys[$keytype.' '.$key] = $colonnes; |
|
| 1788 | 1788 | } |
| 1789 | 1789 | } |
| 1790 | 1790 | |
@@ -1833,7 +1833,7 @@ discard block |
||
| 1833 | 1833 | |
| 1834 | 1834 | $set = array(); |
| 1835 | 1835 | foreach ($champs as $champ => $val) { |
| 1836 | - $set[] = $champ . "=$val"; |
|
| 1836 | + $set[] = $champ."=$val"; |
|
| 1837 | 1837 | } |
| 1838 | 1838 | if (!empty($set)) { |
| 1839 | 1839 | return spip_sqlite_query( |
@@ -1884,7 +1884,7 @@ discard block |
||
| 1884 | 1884 | |
| 1885 | 1885 | $set = array(); |
| 1886 | 1886 | foreach ($champs as $champ => $val) { |
| 1887 | - $set[$champ] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1887 | + $set[$champ] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1888 | 1888 | } |
| 1889 | 1889 | |
| 1890 | 1890 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
@@ -1892,7 +1892,7 @@ discard block |
||
| 1892 | 1892 | $maj = _sqlite_ajouter_champs_timestamp($table, [], $desc, $serveur); |
| 1893 | 1893 | foreach ($maj as $champ => $val) { |
| 1894 | 1894 | if (!isset($set[$champ])) { |
| 1895 | - $set[$champ] = $champ . '=' . $val; |
|
| 1895 | + $set[$champ] = $champ.'='.$val; |
|
| 1896 | 1896 | } |
| 1897 | 1897 | } |
| 1898 | 1898 | |
@@ -1919,7 +1919,7 @@ discard block |
||
| 1919 | 1919 | */ |
| 1920 | 1920 | function _sqlite_init() { |
| 1921 | 1921 | if (!defined('_DIR_DB')) { |
| 1922 | - define('_DIR_DB', _DIR_ETC . 'bases/'); |
|
| 1922 | + define('_DIR_DB', _DIR_ETC.'bases/'); |
|
| 1923 | 1923 | } |
| 1924 | 1924 | if (!defined('_SQLITE_CHMOD')) { |
| 1925 | 1925 | define('_SQLITE_CHMOD', _SPIP_CHMOD); |
@@ -2025,9 +2025,9 @@ discard block |
||
| 2025 | 2025 | } |
| 2026 | 2026 | |
| 2027 | 2027 | // echapper les ' en '' |
| 2028 | - spip_log("Pas de methode ->quote pour echapper", "sqlite." . _LOG_INFO_IMPORTANTE); |
|
| 2028 | + spip_log("Pas de methode ->quote pour echapper", "sqlite."._LOG_INFO_IMPORTANTE); |
|
| 2029 | 2029 | |
| 2030 | - return ("'" . str_replace("'", "''", $v) . "'"); |
|
| 2030 | + return ("'".str_replace("'", "''", $v)."'"); |
|
| 2031 | 2031 | } |
| 2032 | 2032 | |
| 2033 | 2033 | |
@@ -2050,12 +2050,12 @@ discard block |
||
| 2050 | 2050 | $exp = "\n$expression "; |
| 2051 | 2051 | |
| 2052 | 2052 | if (!is_array($v)) { |
| 2053 | - return $exp . $v; |
|
| 2053 | + return $exp.$v; |
|
| 2054 | 2054 | } else { |
| 2055 | 2055 | if (strtoupper($join) === 'AND') { |
| 2056 | - return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2056 | + return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2057 | 2057 | } else { |
| 2058 | - return $exp . join($join, $v); |
|
| 2058 | + return $exp.join($join, $v); |
|
| 2059 | 2059 | } |
| 2060 | 2060 | } |
| 2061 | 2061 | } |
@@ -2089,17 +2089,17 @@ discard block |
||
| 2089 | 2089 | if (substr($k, -1) == '@') { |
| 2090 | 2090 | // c'est une jointure qui se refere au from precedent |
| 2091 | 2091 | // pas de virgule |
| 2092 | - $res .= ' ' . $v; |
|
| 2092 | + $res .= ' '.$v; |
|
| 2093 | 2093 | } else { |
| 2094 | 2094 | if (!is_numeric($k)) { |
| 2095 | 2095 | $p = strpos($v, " "); |
| 2096 | 2096 | if ($p) { |
| 2097 | - $v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p); |
|
| 2097 | + $v = substr($v, 0, $p)." AS '$k'".substr($v, $p); |
|
| 2098 | 2098 | } else { |
| 2099 | 2099 | $v .= " AS '$k'"; |
| 2100 | 2100 | } |
| 2101 | 2101 | } |
| 2102 | - $res .= ', ' . $v; |
|
| 2102 | + $res .= ', '.$v; |
|
| 2103 | 2103 | } |
| 2104 | 2104 | } |
| 2105 | 2105 | |
@@ -2237,13 +2237,13 @@ discard block |
||
| 2237 | 2237 | |
| 2238 | 2238 | $def_origine = sql_showtable($table_origine, false, $serveur); |
| 2239 | 2239 | if (!$def_origine or !isset($def_origine['field'])) { |
| 2240 | - spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR); |
|
| 2240 | + spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR); |
|
| 2241 | 2241 | |
| 2242 | 2242 | return false; |
| 2243 | 2243 | } |
| 2244 | 2244 | |
| 2245 | 2245 | |
| 2246 | - $table_tmp = $table_origine . '_tmp'; |
|
| 2246 | + $table_tmp = $table_origine.'_tmp'; |
|
| 2247 | 2247 | |
| 2248 | 2248 | // 1) creer une table temporaire avec les modifications |
| 2249 | 2249 | // - DROP : suppression de la colonne |
@@ -2329,7 +2329,7 @@ discard block |
||
| 2329 | 2329 | } else { |
| 2330 | 2330 | // enlever KEY |
| 2331 | 2331 | $k = substr($k, 4); |
| 2332 | - $queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)"; |
|
| 2332 | + $queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)"; |
|
| 2333 | 2333 | } |
| 2334 | 2334 | } |
| 2335 | 2335 | |
@@ -2340,7 +2340,7 @@ discard block |
||
| 2340 | 2340 | foreach ($queries as $q) { |
| 2341 | 2341 | if (!spip_sqlite::executer_requete($q, $serveur)) { |
| 2342 | 2342 | spip_log("SQLite : ALTER TABLE table :" |
| 2343 | - . " Erreur a l'execution de la requete : $q", 'sqlite.' . _LOG_ERREUR); |
|
| 2343 | + . " Erreur a l'execution de la requete : $q", 'sqlite.'._LOG_ERREUR); |
|
| 2344 | 2344 | spip_sqlite::annuler_transaction($serveur); |
| 2345 | 2345 | |
| 2346 | 2346 | return false; |
@@ -2429,27 +2429,27 @@ discard block |
||
| 2429 | 2429 | $enum = "(\s*\([^\)]*\))?"; |
| 2430 | 2430 | |
| 2431 | 2431 | $remplace = array( |
| 2432 | - '/enum' . $enum . '/is' => 'VARCHAR(255)', |
|
| 2432 | + '/enum'.$enum.'/is' => 'VARCHAR(255)', |
|
| 2433 | 2433 | '/COLLATE \w+_bin/is' => 'COLLATE BINARY', |
| 2434 | 2434 | '/COLLATE \w+_ci/is' => 'COLLATE NOCASE', |
| 2435 | 2435 | '/auto_increment/is' => '', |
| 2436 | 2436 | '/current_timestamp\(\)/is' => 'CURRENT_TIMESTAMP', // Fix export depuis mariaDB #4374 |
| 2437 | 2437 | '/(timestamp .* )ON .*$/is' => '\\1', |
| 2438 | 2438 | '/character set \w+/is' => '', |
| 2439 | - '/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2439 | + '/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2440 | 2440 | '/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
| 2441 | - '/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2441 | + '/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2442 | 2442 | '/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'", |
| 2443 | 2443 | '/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'", |
| 2444 | 2444 | ); |
| 2445 | 2445 | |
| 2446 | 2446 | // pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY |
| 2447 | 2447 | $remplace_autocinc = array( |
| 2448 | - '/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER' |
|
| 2448 | + '/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER' |
|
| 2449 | 2449 | ); |
| 2450 | 2450 | // pour les int non autoincrement, il faut un DEFAULT |
| 2451 | 2451 | $remplace_nonautocinc = array( |
| 2452 | - '/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2452 | + '/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2453 | 2453 | ); |
| 2454 | 2454 | |
| 2455 | 2455 | if (is_string($query)) { |
@@ -2491,7 +2491,7 @@ discard block |
||
| 2491 | 2491 | return str_ireplace("BINARY", "COLLATE BINARY", $champ); |
| 2492 | 2492 | } |
| 2493 | 2493 | if (preg_match(",^(char|varchar|(long|small|medium|tiny)?text),i", $champ)) { |
| 2494 | - return $champ . " COLLATE NOCASE"; |
|
| 2494 | + return $champ." COLLATE NOCASE"; |
|
| 2495 | 2495 | } |
| 2496 | 2496 | |
| 2497 | 2497 | return $champ; |
@@ -2578,7 +2578,7 @@ discard block |
||
| 2578 | 2578 | } else { |
| 2579 | 2579 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 2580 | 2580 | $a = spip_sqlite_showtable($nom, $serveur); |
| 2581 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 2581 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 2582 | 2582 | return true; |
| 2583 | 2583 | } |
| 2584 | 2584 | } |
@@ -2586,7 +2586,7 @@ discard block |
||
| 2586 | 2586 | } |
| 2587 | 2587 | |
| 2588 | 2588 | $temporary = $temporary ? ' TEMPORARY' : ''; |
| 2589 | - $q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n"; |
|
| 2589 | + $q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n"; |
|
| 2590 | 2590 | |
| 2591 | 2591 | return $q; |
| 2592 | 2592 | } |
@@ -2807,7 +2807,7 @@ discard block |
||
| 2807 | 2807 | $this->serveur = strtolower($serveur); |
| 2808 | 2808 | |
| 2809 | 2809 | if (!($this->link = _sqlite_link($this->serveur)) && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)) { |
| 2810 | - spip_log("Aucune connexion sqlite (link)", 'sqlite.' . _LOG_ERREUR); |
|
| 2810 | + spip_log("Aucune connexion sqlite (link)", 'sqlite.'._LOG_ERREUR); |
|
| 2811 | 2811 | |
| 2812 | 2812 | return false; |
| 2813 | 2813 | } |
@@ -2853,7 +2853,7 @@ discard block |
||
| 2853 | 2853 | try { |
| 2854 | 2854 | $r = $this->link->query($query); |
| 2855 | 2855 | } catch (\PDOException $e) { |
| 2856 | - spip_log("PDOException: " . $e->getMessage(), 'sqlite.' . _LOG_DEBUG); |
|
| 2856 | + spip_log("PDOException: ".$e->getMessage(), 'sqlite.'._LOG_DEBUG); |
|
| 2857 | 2857 | $r = false; |
| 2858 | 2858 | } |
| 2859 | 2859 | // sauvegarde de la requete (elle y est deja dans $r->queryString) |
@@ -2874,11 +2874,11 @@ discard block |
||
| 2874 | 2874 | |
| 2875 | 2875 | // loger les warnings/erreurs eventuels de sqlite remontant dans PHP |
| 2876 | 2876 | if ($e and $e instanceof \PDOException) { |
| 2877 | - $err = strip_tags($e->getMessage()) . " in " . $e->getFile() . " line " . $e->getLine(); |
|
| 2878 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2877 | + $err = strip_tags($e->getMessage())." in ".$e->getFile()." line ".$e->getLine(); |
|
| 2878 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2879 | 2879 | } elseif ($err = (function_exists('error_get_last') ? error_get_last() : "") and $err != $last_error) { |
| 2880 | - $err = strip_tags($err['message']) . " in " . $err['file'] . " line " . $err['line']; |
|
| 2881 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2880 | + $err = strip_tags($err['message'])." in ".$err['file']." line ".$err['line']; |
|
| 2881 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2882 | 2882 | } else { |
| 2883 | 2883 | $err = ""; |
| 2884 | 2884 | } |
@@ -2957,15 +2957,15 @@ discard block |
||
| 2957 | 2957 | // Correction Create Database |
| 2958 | 2958 | // Create Database -> requete ignoree |
| 2959 | 2959 | if (strpos($this->query, 'CREATE DATABASE') === 0) { |
| 2960 | - spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT); |
|
| 2960 | + spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT); |
|
| 2961 | 2961 | $this->query = "SELECT 1"; |
| 2962 | 2962 | } |
| 2963 | 2963 | |
| 2964 | 2964 | // Correction Insert Ignore |
| 2965 | 2965 | // INSERT IGNORE -> insert (tout court et pas 'insert or replace') |
| 2966 | 2966 | if (strpos($this->query, 'INSERT IGNORE') === 0) { |
| 2967 | - spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG); |
|
| 2968 | - $this->query = 'INSERT ' . substr($this->query, '13'); |
|
| 2967 | + spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG); |
|
| 2968 | + $this->query = 'INSERT '.substr($this->query, '13'); |
|
| 2969 | 2969 | } |
| 2970 | 2970 | |
| 2971 | 2971 | // Correction des dates avec INTERVAL |
@@ -2990,7 +2990,7 @@ discard block |
||
| 2990 | 2990 | // problematique car la jointure ne se fait pas du coup. |
| 2991 | 2991 | if (($this->sqlite_version == 2) && (strpos($this->query, "USING") !== false)) { |
| 2992 | 2992 | spip_log("'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'", |
| 2993 | - 'sqlite.' . _LOG_ERREUR); |
|
| 2993 | + 'sqlite.'._LOG_ERREUR); |
|
| 2994 | 2994 | $this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query); |
| 2995 | 2995 | } |
| 2996 | 2996 | |
@@ -3010,8 +3010,8 @@ discard block |
||
| 3010 | 3010 | } else { |
| 3011 | 3011 | $suite = ''; |
| 3012 | 3012 | } |
| 3013 | - $pref = ($this->prefixe) ? $this->prefixe . "_" : ""; |
|
| 3014 | - $this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite; |
|
| 3013 | + $pref = ($this->prefixe) ? $this->prefixe."_" : ""; |
|
| 3014 | + $this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite; |
|
| 3015 | 3015 | |
| 3016 | 3016 | // Correction zero AS x |
| 3017 | 3017 | // pg n'aime pas 0+x AS alias, sqlite, dans le meme style, |
@@ -46,10 +46,9 @@ discard block |
||
| 46 | 46 | $not = $crit->not; |
| 47 | 47 | $boucle = &$boucles[$idb]; |
| 48 | 48 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 49 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 50 | - 'id_parent'; |
|
| 49 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 51 | 50 | |
| 52 | - $c = array("'='", "'$boucle->id_table." . "$id_parent'", 0); |
|
| 51 | + $c = array("'='", "'$boucle->id_table."."$id_parent'", 0); |
|
| 53 | 52 | $boucle->where[] = ($crit->not ? array("'NOT'", $c) : $c); |
| 54 | 53 | } |
| 55 | 54 | |
@@ -72,10 +71,10 @@ discard block |
||
| 72 | 71 | $id = $boucle->primary; |
| 73 | 72 | |
| 74 | 73 | if ($not or !$id) { |
| 75 | - return (array('zbug_critere_inconnu', array('critere' => $not . $crit->op))); |
|
| 74 | + return (array('zbug_critere_inconnu', array('critere' => $not.$crit->op))); |
|
| 76 | 75 | } |
| 77 | 76 | $arg = kwote(calculer_argument_precedent($idb, $id, $boucles)); |
| 78 | - $boucle->where[] = array("'!='", "'$boucle->id_table." . "$id'", $arg); |
|
| 77 | + $boucle->where[] = array("'!='", "'$boucle->id_table."."$id'", $arg); |
|
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | |
@@ -106,12 +105,12 @@ discard block |
||
| 106 | 105 | $not = ($crit->not ? '' : 'NOT'); |
| 107 | 106 | |
| 108 | 107 | // le doublon s'applique sur un type de boucle (article) |
| 109 | - $nom = "'" . $boucle->type_requete . "'"; |
|
| 108 | + $nom = "'".$boucle->type_requete."'"; |
|
| 110 | 109 | |
| 111 | 110 | // compléter le nom avec un nom précisé {doublons nom} |
| 112 | 111 | // on obtient $nom = "'article' . 'nom'" |
| 113 | 112 | if (isset($crit->param[0])) { |
| 114 | - $nom .= "." . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent); |
|
| 113 | + $nom .= ".".calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent); |
|
| 115 | 114 | } |
| 116 | 115 | |
| 117 | 116 | // code qui déclarera l'index du stockage de nos doublons (pour éviter une notice PHP) |
@@ -123,13 +122,13 @@ discard block |
||
| 123 | 122 | // $doublons et son index, ici $nom |
| 124 | 123 | |
| 125 | 124 | // debut du code "sql_in('articles.id_article', " |
| 126 | - $debut_in = "sql_in('" . $boucle->id_table . '.' . $primary . "', "; |
|
| 125 | + $debut_in = "sql_in('".$boucle->id_table.'.'.$primary."', "; |
|
| 127 | 126 | // lecture des données du doublon "$doublons[$doublon_index[] = " |
| 128 | 127 | // Attention : boucle->doublons désigne une variable qu'on affecte |
| 129 | - $debut_doub = '$doublons[' . (!$not ? '' : ($boucle->doublons . "[]= ")); |
|
| 128 | + $debut_doub = '$doublons['.(!$not ? '' : ($boucle->doublons."[]= ")); |
|
| 130 | 129 | |
| 131 | 130 | // le debut complet du code des doublons |
| 132 | - $debut_doub = $debut_in . $debut_doub; |
|
| 131 | + $debut_doub = $debut_in.$debut_doub; |
|
| 133 | 132 | |
| 134 | 133 | // nom du doublon "('article' . 'nom')]" |
| 135 | 134 | $fin_doub = "($nom)]"; |
@@ -139,22 +138,22 @@ discard block |
||
| 139 | 138 | foreach ($boucle->where as $k => $w) { |
| 140 | 139 | if (strpos($w[0], $debut_doub) === 0) { |
| 141 | 140 | // fusionner le sql_in (du where) |
| 142 | - $boucle->where[$k][0] = $debut_doub . $fin_doub . ' . ' . substr($w[0], strlen($debut_in)); |
|
| 141 | + $boucle->where[$k][0] = $debut_doub.$fin_doub.' . '.substr($w[0], strlen($debut_in)); |
|
| 143 | 142 | // fusionner l'initialisation (du hash) pour faire plus joli |
| 144 | 143 | $x = strpos($boucle->hash, $init_comment); |
| 145 | 144 | $len = strlen($init_comment); |
| 146 | 145 | $boucle->hash = |
| 147 | - substr($boucle->hash, 0, $x + $len) . $init_code . substr($boucle->hash, $x + $len); |
|
| 146 | + substr($boucle->hash, 0, $x + $len).$init_code.substr($boucle->hash, $x + $len); |
|
| 148 | 147 | |
| 149 | 148 | return; |
| 150 | 149 | } |
| 151 | 150 | } |
| 152 | 151 | |
| 153 | 152 | // mettre l'ensemble dans un tableau pour que ce ne soit pas vu comme une constante |
| 154 | - $boucle->where[] = array($debut_doub . $fin_doub . ", '" . $not . "')"); |
|
| 153 | + $boucle->where[] = array($debut_doub.$fin_doub.", '".$not."')"); |
|
| 155 | 154 | |
| 156 | 155 | // déclarer le doublon s'il n'existe pas encore |
| 157 | - $boucle->hash .= $init_comment . $init_code; |
|
| 156 | + $boucle->hash .= $init_comment.$init_code; |
|
| 158 | 157 | |
| 159 | 158 | |
| 160 | 159 | # la ligne suivante avait l'intention d'eviter une collecte deja faite |
@@ -215,10 +214,10 @@ discard block |
||
| 215 | 214 | $un = $un[0]->texte; |
| 216 | 215 | $deux = $deux[0]->texte; |
| 217 | 216 | if ($deux) { |
| 218 | - $boucles[$idb]->limit = 'intval($Pile[0]["debut' . |
|
| 219 | - $un . |
|
| 220 | - '"]) . ",' . |
|
| 221 | - $deux . |
|
| 217 | + $boucles[$idb]->limit = 'intval($Pile[0]["debut'. |
|
| 218 | + $un. |
|
| 219 | + '"]) . ",'. |
|
| 220 | + $deux. |
|
| 222 | 221 | '"'; |
| 223 | 222 | } else { |
| 224 | 223 | calculer_critere_DEFAUT_dist($idb, $boucles, $crit); |
@@ -281,26 +280,26 @@ discard block |
||
| 281 | 280 | $type = calculer_liste(array($crit->param[1][0]), $idb, $boucles, $boucle->id_parent); |
| 282 | 281 | } |
| 283 | 282 | |
| 284 | - $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut" . substr($type, 1)); |
|
| 283 | + $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut".substr($type, 1)); |
|
| 285 | 284 | $boucle->modificateur['debut_nom'] = $type; |
| 286 | 285 | $partie = |
| 287 | 286 | // tester si le numero de page demande est de la forme '@yyy' |
| 288 | - 'isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : _request(' . $debut . ");\n" |
|
| 287 | + 'isset($Pile[0]['.$debut.']) ? $Pile[0]['.$debut.'] : _request('.$debut.");\n" |
|
| 289 | 288 | . "\tif(substr(\$debut_boucle,0,1)=='@'){\n" |
| 290 | - . "\t\t" . '$debut_boucle = $Pile[0][' . $debut . '] = quete_debut_pagination(\'' . $boucle->primary . '\',$Pile[0][\'@' . $boucle->primary . '\'] = substr($debut_boucle,1),' . $pas . ',$iter);' . "\n" |
|
| 291 | - . "\t\t" . '$iter->seek(0);' . "\n" |
|
| 289 | + . "\t\t".'$debut_boucle = $Pile[0]['.$debut.'] = quete_debut_pagination(\''.$boucle->primary.'\',$Pile[0][\'@'.$boucle->primary.'\'] = substr($debut_boucle,1),'.$pas.',$iter);'."\n" |
|
| 290 | + . "\t\t".'$iter->seek(0);'."\n" |
|
| 292 | 291 | . "\t}\n" |
| 293 | - . "\t" . '$debut_boucle = intval($debut_boucle)'; |
|
| 292 | + . "\t".'$debut_boucle = intval($debut_boucle)'; |
|
| 294 | 293 | |
| 295 | 294 | $boucle->hash .= ' |
| 296 | - $command[\'pagination\'] = array((isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : null), ' . $pas . ');'; |
|
| 295 | + $command[\'pagination\'] = array((isset($Pile[0][' . $debut.']) ? $Pile[0]['.$debut.'] : null), '.$pas.');'; |
|
| 297 | 296 | |
| 298 | 297 | $boucle->total_parties = $pas; |
| 299 | 298 | calculer_parties($boucles, $idb, $partie, 'p+'); |
| 300 | 299 | // ajouter la cle primaire dans le select pour pouvoir gerer la pagination referencee par @id |
| 301 | 300 | // sauf si pas de primaire, ou si primaire composee |
| 302 | 301 | // dans ce cas, on ne sait pas gerer une pagination indirecte |
| 303 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 302 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 304 | 303 | if ($boucle->primary |
| 305 | 304 | and !preg_match('/[,\s]/', $boucle->primary) |
| 306 | 305 | and !in_array($t, $boucle->select) |
@@ -346,24 +345,24 @@ discard block |
||
| 346 | 345 | $boucle->hash .= ' |
| 347 | 346 | // RECHERCHE' |
| 348 | 347 | . ($crit->cond ? ' |
| 349 | - if (!strlen(' . $quoi . ')){ |
|
| 348 | + if (!strlen(' . $quoi.')){ |
|
| 350 | 349 | list($rech_select, $rech_where) = array("0 as points",""); |
| 351 | - } else' : '') . ' |
|
| 350 | + } else' : '').' |
|
| 352 | 351 | { |
| 353 | 352 | $prepare_recherche = charger_fonction(\'prepare_recherche\', \'inc\'); |
| 354 | - list($rech_select, $rech_where) = $prepare_recherche(' . $quoi . ', "' . $boucle->id_table . '", "' . $crit->cond . '","' . $boucle->sql_serveur . '",' . $_modificateur . ',"' . $boucle->primary . '"); |
|
| 353 | + list($rech_select, $rech_where) = $prepare_recherche(' . $quoi.', "'.$boucle->id_table.'", "'.$crit->cond.'","'.$boucle->sql_serveur.'",'.$_modificateur.',"'.$boucle->primary.'"); |
|
| 355 | 354 | } |
| 356 | 355 | '; |
| 357 | 356 | |
| 358 | 357 | |
| 359 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 358 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 360 | 359 | if (!in_array($t, $boucles[$idb]->select)) { |
| 361 | 360 | $boucle->select[] = $t; |
| 362 | 361 | } # pour postgres, neuneu ici |
| 363 | 362 | // jointure uniquement sur le serveur principal |
| 364 | 363 | // (on ne peut joindre une table d'un serveur distant avec la table des resultats du serveur principal) |
| 365 | 364 | if (!$boucle->sql_serveur) { |
| 366 | - $boucle->join['resultats'] = array("'" . $boucle->id_table . "'", "'id'", "'" . $boucle->primary . "'"); |
|
| 365 | + $boucle->join['resultats'] = array("'".$boucle->id_table."'", "'id'", "'".$boucle->primary."'"); |
|
| 367 | 366 | $boucle->from['resultats'] = 'spip_resultats'; |
| 368 | 367 | } |
| 369 | 368 | $boucle->select[] = '$rech_select'; |
@@ -430,7 +429,7 @@ discard block |
||
| 430 | 429 | $c = |
| 431 | 430 | array( |
| 432 | 431 | "'OR'", |
| 433 | - array("'='", "'$table." . "id_trad'", "'$table.$prim'"), |
|
| 432 | + array("'='", "'$table."."id_trad'", "'$table.$prim'"), |
|
| 434 | 433 | array("'='", "'$table.id_trad'", "'0'") |
| 435 | 434 | ); |
| 436 | 435 | $boucle->where[] = ($crit->not ? array("'NOT'", $c) : $c); |
@@ -453,16 +452,15 @@ discard block |
||
| 453 | 452 | $boucle = &$boucles[$idb]; |
| 454 | 453 | $arg = kwote(calculer_argument_precedent($idb, 'id_parent', $boucles)); |
| 455 | 454 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 456 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 457 | - 'id_parent'; |
|
| 458 | - $mparent = $boucle->id_table . '.' . $id_parent; |
|
| 455 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 456 | + $mparent = $boucle->id_table.'.'.$id_parent; |
|
| 459 | 457 | |
| 460 | 458 | if ($boucle->type_requete == 'rubriques' or isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'])) { |
| 461 | 459 | $boucle->where[] = array("'='", "'$mparent'", $arg); |
| 462 | 460 | |
| 463 | 461 | } // le cas FORUMS est gere dans le plugin forum, dans la fonction critere_FORUMS_meme_parent_dist() |
| 464 | 462 | else { |
| 465 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . ' ' . $boucle->type_requete))); |
|
| 463 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op.' '.$boucle->type_requete))); |
|
| 466 | 464 | } |
| 467 | 465 | } |
| 468 | 466 | |
@@ -515,16 +513,15 @@ discard block |
||
| 515 | 513 | if (count(trouver_champs_decomposes($champ, $desc)) > 1) { |
| 516 | 514 | $decompose = decompose_champ_id_objet($champ); |
| 517 | 515 | $champ = array_shift($decompose); |
| 518 | - $boucle->where[] = array("'='", _q($cle . "." . reset($decompose)), '"' . sql_quote(end($decompose)) . '"'); |
|
| 516 | + $boucle->where[] = array("'='", _q($cle.".".reset($decompose)), '"'.sql_quote(end($decompose)).'"'); |
|
| 519 | 517 | } |
| 520 | 518 | } else { |
| 521 | 519 | $cle = $boucle->id_table; |
| 522 | 520 | } |
| 523 | 521 | |
| 524 | - $c = "sql_in('$cle" . ".$champ', calcul_branche_in($arg)" |
|
| 525 | - . ($not ? ", 'NOT'" : '') . ")"; |
|
| 526 | - $boucle->where[] = !$crit->cond ? $c : |
|
| 527 | - ("($arg ? $c : " . ($not ? "'0=1'" : "'1=1'") . ')'); |
|
| 522 | + $c = "sql_in('$cle".".$champ', calcul_branche_in($arg)" |
|
| 523 | + . ($not ? ", 'NOT'" : '').")"; |
|
| 524 | + $boucle->where[] = !$crit->cond ? $c : ("($arg ? $c : ".($not ? "'0=1'" : "'1=1'").')'); |
|
| 528 | 525 | } |
| 529 | 526 | |
| 530 | 527 | /** |
@@ -544,9 +541,9 @@ discard block |
||
| 544 | 541 | $not = ($crit->not ? 'NOT' : ''); |
| 545 | 542 | $serveur = $boucle->sql_serveur; |
| 546 | 543 | |
| 547 | - $c = "sql_in('" . |
|
| 548 | - $boucle->id_table . '.' . $boucle->primary |
|
| 549 | - . "', lister_objets_avec_logos('" . $boucle->primary . "'), '$not', '$serveur')"; |
|
| 544 | + $c = "sql_in('". |
|
| 545 | + $boucle->id_table.'.'.$boucle->primary |
|
| 546 | + . "', lister_objets_avec_logos('".$boucle->primary."'), '$not', '$serveur')"; |
|
| 550 | 547 | |
| 551 | 548 | $boucle->where[] = $c; |
| 552 | 549 | } |
@@ -578,7 +575,7 @@ discard block |
||
| 578 | 575 | $t = table_objet_sql($r[1]); |
| 579 | 576 | $t = array_search($t, $boucles[$idb]->from); |
| 580 | 577 | if ($t) { |
| 581 | - $t .= '.' . $r[2]; |
|
| 578 | + $t .= '.'.$r[2]; |
|
| 582 | 579 | } |
| 583 | 580 | } |
| 584 | 581 | } else { |
@@ -593,7 +590,7 @@ discard block |
||
| 593 | 590 | $boucles[$idb]->select[] = $t; |
| 594 | 591 | } |
| 595 | 592 | } else { |
| 596 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . ' ?'))); |
|
| 593 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op.' ?'))); |
|
| 597 | 594 | } |
| 598 | 595 | } |
| 599 | 596 | |
@@ -613,7 +610,7 @@ discard block |
||
| 613 | 610 | * @param Critere $crit Paramètres du critère dans cette boucle |
| 614 | 611 | * @return void |
| 615 | 612 | **/ |
| 616 | -function critere_fusion_supprimer_dist($idb, &$boucles, $crit){ |
|
| 613 | +function critere_fusion_supprimer_dist($idb, &$boucles, $crit) { |
|
| 617 | 614 | $boucles[$idb]->group = array(); |
| 618 | 615 | } |
| 619 | 616 | |
@@ -663,26 +660,26 @@ discard block |
||
| 663 | 660 | (false !== $i = strpos($boucle->order[$n - 1], 'ASC')) |
| 664 | 661 | OR (false !== $i = strpos($boucle->order[$n - 1], 'DESC')) |
| 665 | 662 | ) { |
| 666 | - $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . " . $boucle->modificateur['collate'] . " . ' ", $i, 0); |
|
| 663 | + $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . ".$boucle->modificateur['collate']." . ' ", $i, 0); |
|
| 667 | 664 | } else { |
| 668 | - $boucle->order[$n - 1] .= " . " . $boucle->modificateur['collate']; |
|
| 665 | + $boucle->order[$n - 1] .= " . ".$boucle->modificateur['collate']; |
|
| 669 | 666 | } |
| 670 | 667 | } |
| 671 | 668 | } else { |
| 672 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . " " . count($boucles[$idb]->order)))); |
|
| 669 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op." ".count($boucles[$idb]->order)))); |
|
| 673 | 670 | } |
| 674 | 671 | } |
| 675 | 672 | |
| 676 | 673 | // https://code.spip.net/@calculer_critere_arg_dynamique |
| 677 | 674 | function calculer_critere_arg_dynamique($idb, &$boucles, $crit, $suffix = '') { |
| 678 | 675 | $boucle = $boucles[$idb]; |
| 679 | - $alt = "('" . $boucle->id_table . '.\' . $x' . $suffix . ')'; |
|
| 680 | - $var = '$champs_' . $idb; |
|
| 676 | + $alt = "('".$boucle->id_table.'.\' . $x'.$suffix.')'; |
|
| 677 | + $var = '$champs_'.$idb; |
|
| 681 | 678 | $desc = (strpos($boucle->in, "static $var =") !== false); |
| 682 | 679 | if (!$desc) { |
| 683 | 680 | $desc = $boucle->show['field']; |
| 684 | 681 | $desc = implode(',', array_map('_q', array_keys($desc))); |
| 685 | - $boucles[$idb]->in .= "\n\tstatic $var = array(" . $desc . ");"; |
|
| 682 | + $boucles[$idb]->in .= "\n\tstatic $var = array(".$desc.");"; |
|
| 686 | 683 | } |
| 687 | 684 | if ($desc) { |
| 688 | 685 | $alt = "(in_array(\$x, $var) ? $alt :(\$x$suffix))"; |
@@ -757,7 +754,7 @@ discard block |
||
| 757 | 754 | $sens = " . ' DESC'"; |
| 758 | 755 | } |
| 759 | 756 | if (isset($boucle->modificateur['collate'])) { |
| 760 | - $collecte = ' . ' . $boucle->modificateur['collate']; |
|
| 757 | + $collecte = ' . '.$boucle->modificateur['collate']; |
|
| 761 | 758 | } |
| 762 | 759 | |
| 763 | 760 | // Pour chaque paramètre du critère |
@@ -779,14 +776,14 @@ discard block |
||
| 779 | 776 | if (preg_match(",^(\w+)[\s]+(.*)$,", $par, $m)) { |
| 780 | 777 | $expression = trim($m[1]); |
| 781 | 778 | $champ = trim($m[2]); |
| 782 | - if (function_exists($f = 'calculer_critere_par_expression_' . $expression)) { |
|
| 779 | + if (function_exists($f = 'calculer_critere_par_expression_'.$expression)) { |
|
| 783 | 780 | $order = $f($idb, $boucles, $crit, $tri, $champ); |
| 784 | 781 | } else { |
| 785 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 782 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 786 | 783 | } |
| 787 | 784 | |
| 788 | 785 | // tris de la forme {par champ} ou {par FONCTION(champ)} |
| 789 | - } elseif (preg_match(",^" . CHAMP_SQL_PLUS_FONC . '$,is', $par, $match)) { |
|
| 786 | + } elseif (preg_match(",^".CHAMP_SQL_PLUS_FONC.'$,is', $par, $match)) { |
|
| 790 | 787 | // {par FONCTION(champ)} |
| 791 | 788 | if (count($match) > 2) { |
| 792 | 789 | $par = substr($match[2], 1, -1); |
@@ -796,7 +793,7 @@ discard block |
||
| 796 | 793 | if ($par == 'hasard') { |
| 797 | 794 | $order = calculer_critere_par_hasard($idb, $boucles, $crit); |
| 798 | 795 | } elseif ($par == 'date' and !empty($boucle->show['date'])) { |
| 799 | - $order = "'" . $boucle->id_table . "." . $boucle->show['date'] . "'"; |
|
| 796 | + $order = "'".$boucle->id_table.".".$boucle->show['date']."'"; |
|
| 800 | 797 | } else { |
| 801 | 798 | // cas général {par champ}, {par table.champ}, ... |
| 802 | 799 | $order = calculer_critere_par_champ($idb, $boucles, $crit, $par); |
@@ -805,7 +802,7 @@ discard block |
||
| 805 | 802 | |
| 806 | 803 | // on ne sait pas traiter… |
| 807 | 804 | else { |
| 808 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 805 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 809 | 806 | } |
| 810 | 807 | |
| 811 | 808 | // En cas d'erreur de squelette retournée par une fonction |
@@ -825,14 +822,14 @@ discard block |
||
| 825 | 822 | |
| 826 | 823 | if ($fct) { |
| 827 | 824 | if (preg_match("/^\s*'(.*)'\s*$/", $order, $r)) { |
| 828 | - $order = "'$fct(" . $r[1] . ")'"; |
|
| 825 | + $order = "'$fct(".$r[1].")'"; |
|
| 829 | 826 | } else { |
| 830 | 827 | $order = "'$fct(' . $order . ')'"; |
| 831 | 828 | } |
| 832 | 829 | } |
| 833 | - $t = $order . $collecte . $sens; |
|
| 830 | + $t = $order.$collecte.$sens; |
|
| 834 | 831 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 835 | - $t = $r[1] . $r[2]; |
|
| 832 | + $t = $r[1].$r[2]; |
|
| 836 | 833 | } |
| 837 | 834 | |
| 838 | 835 | $boucle->order[] = $t; |
@@ -882,16 +879,16 @@ discard block |
||
| 882 | 879 | function calculer_critere_par_expression_num($idb, &$boucles, $crit, $tri, $champ) { |
| 883 | 880 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 884 | 881 | if (is_array($_champ)) { |
| 885 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " num $champ")); |
|
| 882 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." num $champ")); |
|
| 886 | 883 | } |
| 887 | 884 | $boucle = &$boucles[$idb]; |
| 888 | - $texte = '0+' . $_champ; |
|
| 885 | + $texte = '0+'.$_champ; |
|
| 889 | 886 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 890 | 887 | if ($suite !== "''") { |
| 891 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \""; |
|
| 888 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \""; |
|
| 892 | 889 | } |
| 893 | - $asnum = 'num' . ($boucle->order ? count($boucle->order) : ""); |
|
| 894 | - $boucle->select[] = $texte . " AS $asnum"; |
|
| 890 | + $asnum = 'num'.($boucle->order ? count($boucle->order) : ""); |
|
| 891 | + $boucle->select[] = $texte." AS $asnum"; |
|
| 895 | 892 | |
| 896 | 893 | $orderassinum = calculer_critere_par_expression_sinum($idb, $boucles, $crit, $tri, $champ); |
| 897 | 894 | $orderassinum = trim($orderassinum, "'"); |
@@ -920,13 +917,13 @@ discard block |
||
| 920 | 917 | function calculer_critere_par_expression_sinum($idb, &$boucles, $crit, $tri, $champ) { |
| 921 | 918 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 922 | 919 | if (is_array($_champ)) { |
| 923 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " sinum $champ")); |
|
| 920 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." sinum $champ")); |
|
| 924 | 921 | } |
| 925 | 922 | $boucle = &$boucles[$idb]; |
| 926 | - $texte = '0+' . $_champ; |
|
| 923 | + $texte = '0+'.$_champ; |
|
| 927 | 924 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 928 | 925 | if ($suite !== "''") { |
| 929 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \""; |
|
| 926 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \""; |
|
| 930 | 927 | } |
| 931 | 928 | |
| 932 | 929 | $as = false; |
@@ -942,8 +939,8 @@ discard block |
||
| 942 | 939 | } |
| 943 | 940 | |
| 944 | 941 | if (!$as) { |
| 945 | - $as = 'sinum' . ($boucle->order ? count($boucle->order) : ""); |
|
| 946 | - $boucle->select[] = $select . $as; |
|
| 942 | + $as = 'sinum'.($boucle->order ? count($boucle->order) : ""); |
|
| 943 | + $boucle->select[] = $select.$as; |
|
| 947 | 944 | } |
| 948 | 945 | $order = "'$as'"; |
| 949 | 946 | return $order; |
@@ -968,10 +965,10 @@ discard block |
||
| 968 | 965 | function calculer_critere_par_expression_multi($idb, &$boucles, $crit, $tri, $champ) { |
| 969 | 966 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 970 | 967 | if (is_array($_champ)) { |
| 971 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " multi $champ")); |
|
| 968 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." multi $champ")); |
|
| 972 | 969 | } |
| 973 | 970 | $boucle = &$boucles[$idb]; |
| 974 | - $boucle->select[] = "\".sql_multi('" . $_champ . "', \$GLOBALS['spip_lang']).\""; |
|
| 971 | + $boucle->select[] = "\".sql_multi('".$_champ."', \$GLOBALS['spip_lang']).\""; |
|
| 975 | 972 | $order = "'multi'"; |
| 976 | 973 | return $order; |
| 977 | 974 | } |
@@ -991,13 +988,13 @@ discard block |
||
| 991 | 988 | * @param bool $raw Retourne le champ pour le compilateur ("'alias.champ'") ou brut ('alias.champ') |
| 992 | 989 | * @return array|string |
| 993 | 990 | */ |
| 994 | -function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) { |
|
| 991 | +function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) { |
|
| 995 | 992 | $boucle = &$boucles[$idb]; |
| 996 | 993 | $desc = $boucle->show; |
| 997 | 994 | |
| 998 | 995 | // le champ existe dans la table, pas de souci (le plus commun) |
| 999 | 996 | if (isset($desc['field'][$par])) { |
| 1000 | - $par = $boucle->id_table . "." . $par; |
|
| 997 | + $par = $boucle->id_table.".".$par; |
|
| 1001 | 998 | } |
| 1002 | 999 | // le champ est peut être une jointure |
| 1003 | 1000 | else { |
@@ -1018,24 +1015,24 @@ discard block |
||
| 1018 | 1015 | // Sinon on cherche le champ dans les tables possibles de jointures |
| 1019 | 1016 | // Si la table est déjà dans le from, on la réutilise. |
| 1020 | 1017 | if ($infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $table)) { |
| 1021 | - $par = $infos['alias'] . "." . $champ; |
|
| 1018 | + $par = $infos['alias'].".".$champ; |
|
| 1022 | 1019 | } elseif ( |
| 1023 | 1020 | $boucle->jointures_explicites |
| 1024 | 1021 | and $alias = trouver_jointure_champ($champ, $boucle, explode(' ', $boucle->jointures_explicites), false, $table) |
| 1025 | 1022 | ) { |
| 1026 | - $par = $alias . "." . $champ; |
|
| 1023 | + $par = $alias.".".$champ; |
|
| 1027 | 1024 | } elseif ($alias = trouver_jointure_champ($champ, $boucle, $boucle->jointures, false, $table)) { |
| 1028 | - $par = $alias . "." . $champ; |
|
| 1025 | + $par = $alias.".".$champ; |
|
| 1029 | 1026 | // en spécifiant directement l'alias {par L2.titre} (situation hasardeuse tout de même) |
| 1030 | 1027 | } elseif ( |
| 1031 | 1028 | $table_alias |
| 1032 | 1029 | and isset($boucle->from[$table_alias]) |
| 1033 | 1030 | and $infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $boucle->from[$table_alias]) |
| 1034 | 1031 | ) { |
| 1035 | - $par = $infos['alias'] . "." . $champ; |
|
| 1032 | + $par = $infos['alias'].".".$champ; |
|
| 1036 | 1033 | } elseif ($table) { |
| 1037 | 1034 | // On avait table + champ, mais on ne les a pas trouvés |
| 1038 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 1035 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 1039 | 1036 | } else { |
| 1040 | 1037 | // Sinon tant pis, ca doit etre un champ synthetise (cf points) |
| 1041 | 1038 | } |
@@ -1059,7 +1056,7 @@ discard block |
||
| 1059 | 1056 | if (!$t) { |
| 1060 | 1057 | $t = trouver_jointure_champ($champ, $boucle); |
| 1061 | 1058 | } |
| 1062 | - return !$t ? '' : ("'" . $t . '.' . $champ . "'"); |
|
| 1059 | + return !$t ? '' : ("'".$t.'.'.$champ."'"); |
|
| 1063 | 1060 | } |
| 1064 | 1061 | |
| 1065 | 1062 | /** |
@@ -1104,9 +1101,9 @@ discard block |
||
| 1104 | 1101 | $boucle->default_order[] = ' DESC'; |
| 1105 | 1102 | } |
| 1106 | 1103 | } else { |
| 1107 | - $t = $boucle->order[$n - 1] . " . $order"; |
|
| 1104 | + $t = $boucle->order[$n - 1]." . $order"; |
|
| 1108 | 1105 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 1109 | - $t = $r[1] . $r[2]; |
|
| 1106 | + $t = $r[1].$r[2]; |
|
| 1110 | 1107 | } |
| 1111 | 1108 | $boucle->order[$n - 1] = $t; |
| 1112 | 1109 | } |
@@ -1120,11 +1117,11 @@ discard block |
||
| 1120 | 1117 | * @param $crit |
| 1121 | 1118 | * @return array|string |
| 1122 | 1119 | */ |
| 1123 | -function critere_par_ordre_liste_dist($idb, &$boucles, $crit){ |
|
| 1120 | +function critere_par_ordre_liste_dist($idb, &$boucles, $crit) { |
|
| 1124 | 1121 | $boucle = &$boucles[$idb]; |
| 1125 | 1122 | |
| 1126 | 1123 | $sens = $collecte = ''; |
| 1127 | - if ($crit->not){ |
|
| 1124 | + if ($crit->not) { |
|
| 1128 | 1125 | $sens = " . ' DESC'"; |
| 1129 | 1126 | } |
| 1130 | 1127 | |
@@ -1134,14 +1131,14 @@ discard block |
||
| 1134 | 1131 | $res = critere_parinverse($idb, $boucles, $crit2); |
| 1135 | 1132 | |
| 1136 | 1133 | // erreur ? |
| 1137 | - if (is_array($res)){ |
|
| 1134 | + if (is_array($res)) { |
|
| 1138 | 1135 | return $res; |
| 1139 | 1136 | } |
| 1140 | 1137 | |
| 1141 | 1138 | $_order = array_pop($boucle->order); |
| 1142 | 1139 | |
| 1143 | 1140 | $_liste = calculer_liste($crit->param[1], array(), $boucles, $boucles[$idb]->id_parent); |
| 1144 | - $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'" . $boucle->sql_serveur . "')) ? \$zl : '0').')'$sens"; |
|
| 1141 | + $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'".$boucle->sql_serveur."')) ? \$zl : '0').')'$sens"; |
|
| 1145 | 1142 | } |
| 1146 | 1143 | |
| 1147 | 1144 | |
@@ -1150,7 +1147,7 @@ discard block |
||
| 1150 | 1147 | $params = $crit->param; |
| 1151 | 1148 | |
| 1152 | 1149 | if (count($params) < 1) { |
| 1153 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " ?")); |
|
| 1150 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." ?")); |
|
| 1154 | 1151 | } |
| 1155 | 1152 | |
| 1156 | 1153 | $boucle = &$boucles[$idb]; |
@@ -1171,7 +1168,7 @@ discard block |
||
| 1171 | 1168 | if ((count($date) == 1) and ($date[0]->type == 'texte')) { |
| 1172 | 1169 | $date = $date[0]->texte; |
| 1173 | 1170 | if (!isset($fields[$date])) { |
| 1174 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " " . $date)); |
|
| 1171 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." ".$date)); |
|
| 1175 | 1172 | } |
| 1176 | 1173 | } else { |
| 1177 | 1174 | $a = calculer_liste($date, $idb, $boucles, $parent); |
@@ -1183,38 +1180,38 @@ discard block |
||
| 1183 | 1180 | $date = "'.(($cond)\n?\$a:\"$defaut\").'"; |
| 1184 | 1181 | } |
| 1185 | 1182 | $annee = $params ? array_shift($params) : ""; |
| 1186 | - $annee = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1187 | - calculer_liste($annee, $idb, $boucles, $parent) . |
|
| 1183 | + $annee = "\n".'sprintf("%04d", ($x = '. |
|
| 1184 | + calculer_liste($annee, $idb, $boucles, $parent). |
|
| 1188 | 1185 | ') ? $x : date("Y"))'; |
| 1189 | 1186 | |
| 1190 | 1187 | $mois = $params ? array_shift($params) : ""; |
| 1191 | - $mois = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1192 | - calculer_liste($mois, $idb, $boucles, $parent) . |
|
| 1188 | + $mois = "\n".'sprintf("%02d", ($x = '. |
|
| 1189 | + calculer_liste($mois, $idb, $boucles, $parent). |
|
| 1193 | 1190 | ') ? $x : date("m"))'; |
| 1194 | 1191 | |
| 1195 | 1192 | $jour = $params ? array_shift($params) : ""; |
| 1196 | - $jour = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1197 | - calculer_liste($jour, $idb, $boucles, $parent) . |
|
| 1193 | + $jour = "\n".'sprintf("%02d", ($x = '. |
|
| 1194 | + calculer_liste($jour, $idb, $boucles, $parent). |
|
| 1198 | 1195 | ') ? $x : date("d"))'; |
| 1199 | 1196 | |
| 1200 | 1197 | $annee2 = $params ? array_shift($params) : ""; |
| 1201 | - $annee2 = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1202 | - calculer_liste($annee2, $idb, $boucles, $parent) . |
|
| 1198 | + $annee2 = "\n".'sprintf("%04d", ($x = '. |
|
| 1199 | + calculer_liste($annee2, $idb, $boucles, $parent). |
|
| 1203 | 1200 | ') ? $x : date("Y"))'; |
| 1204 | 1201 | |
| 1205 | 1202 | $mois2 = $params ? array_shift($params) : ""; |
| 1206 | - $mois2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1207 | - calculer_liste($mois2, $idb, $boucles, $parent) . |
|
| 1203 | + $mois2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1204 | + calculer_liste($mois2, $idb, $boucles, $parent). |
|
| 1208 | 1205 | ') ? $x : date("m"))'; |
| 1209 | 1206 | |
| 1210 | 1207 | $jour2 = $params ? array_shift($params) : ""; |
| 1211 | - $jour2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1212 | - calculer_liste($jour2, $idb, $boucles, $parent) . |
|
| 1208 | + $jour2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1209 | + calculer_liste($jour2, $idb, $boucles, $parent). |
|
| 1213 | 1210 | ') ? $x : date("d"))'; |
| 1214 | 1211 | |
| 1215 | - $date = $boucle->id_table . ".$date"; |
|
| 1212 | + $date = $boucle->id_table.".$date"; |
|
| 1216 | 1213 | |
| 1217 | - $quote_end = ",'" . $boucle->sql_serveur . "','text'"; |
|
| 1214 | + $quote_end = ",'".$boucle->sql_serveur."','text'"; |
|
| 1218 | 1215 | if ($type == 'jour') { |
| 1219 | 1216 | $boucle->where[] = array( |
| 1220 | 1217 | "'='", |
@@ -1286,14 +1283,13 @@ discard block |
||
| 1286 | 1283 | list($a21, $a22) = calculer_critere_parties_aux($idb, $boucles, $a2); |
| 1287 | 1284 | |
| 1288 | 1285 | if (($op == ',') && (is_numeric($a11) && (is_numeric($a21)))) { |
| 1289 | - $boucle->limit = $a11 . ',' . $a21; |
|
| 1286 | + $boucle->limit = $a11.','.$a21; |
|
| 1290 | 1287 | } else { |
| 1291 | 1288 | // 3 dans {1/3}, {2,3} ou {1,n-3} |
| 1292 | 1289 | $boucle->total_parties = ($a21 != 'n') ? $a21 : $a22; |
| 1293 | 1290 | // 2 dans {2/3}, {2,5}, {n-2,1} |
| 1294 | 1291 | $partie = ($a11 != 'n') ? $a11 : $a12; |
| 1295 | - $mode = (($op == '/') ? '/' : |
|
| 1296 | - (($a11 == 'n') ? '-' : '+') . (($a21 == 'n') ? '-' : '+')); |
|
| 1292 | + $mode = (($op == '/') ? '/' : (($a11 == 'n') ? '-' : '+').(($a21 == 'n') ? '-' : '+')); |
|
| 1297 | 1293 | // cas simple {0,#ENV{truc}} compilons le en LIMIT : |
| 1298 | 1294 | if ($a11 !== 'n' and $a21 !== 'n' and $mode == "++" and $op == ',') { |
| 1299 | 1295 | $boucle->limit = |
@@ -1339,8 +1335,7 @@ discard block |
||
| 1339 | 1335 | // {1/3} |
| 1340 | 1336 | if ($op1 == '/') { |
| 1341 | 1337 | $pmoins1 = is_numeric($debut) ? ($debut - 1) : "($debut-1)"; |
| 1342 | - $totpos = is_numeric($total_parties) ? ($total_parties) : |
|
| 1343 | - "($total_parties ? $total_parties : 1)"; |
|
| 1338 | + $totpos = is_numeric($total_parties) ? ($total_parties) : "($total_parties ? $total_parties : 1)"; |
|
| 1344 | 1339 | $fin = "ceil(($nombre_boucle * $debut )/$totpos) - 1"; |
| 1345 | 1340 | $debut = !$pmoins1 ? 0 : "ceil(($nombre_boucle * $pmoins1)/$totpos);"; |
| 1346 | 1341 | } else { |
@@ -1351,15 +1346,13 @@ discard block |
||
| 1351 | 1346 | |
| 1352 | 1347 | // cas {x,n-1} |
| 1353 | 1348 | if ($op2 == '-') { |
| 1354 | - $fin = '$debut_boucle + ' . $nombre_boucle . ' - ' |
|
| 1355 | - . (is_numeric($total_parties) ? ($total_parties + 1) : |
|
| 1356 | - ($total_parties . ' - 1')); |
|
| 1349 | + $fin = '$debut_boucle + '.$nombre_boucle.' - ' |
|
| 1350 | + . (is_numeric($total_parties) ? ($total_parties + 1) : ($total_parties.' - 1')); |
|
| 1357 | 1351 | } else { |
| 1358 | 1352 | // {x,1} ou {pagination} |
| 1359 | 1353 | $fin = '$debut_boucle' |
| 1360 | 1354 | . (is_numeric($total_parties) ? |
| 1361 | - (($total_parties == 1) ? "" : (' + ' . ($total_parties - 1))) : |
|
| 1362 | - ('+' . $total_parties . ' - 1')); |
|
| 1355 | + (($total_parties == 1) ? "" : (' + '.($total_parties - 1))) : ('+'.$total_parties.' - 1')); |
|
| 1363 | 1356 | } |
| 1364 | 1357 | |
| 1365 | 1358 | // {pagination}, gerer le debut_xx=-1 pour tout voir |
@@ -1377,11 +1370,11 @@ discard block |
||
| 1377 | 1370 | // Utiliser min pour rabattre $fin_boucle sur total_boucle. |
| 1378 | 1371 | |
| 1379 | 1372 | $boucles[$id_boucle]->mode_partie = "\n\t" |
| 1380 | - . '$debut_boucle = ' . $debut . ";\n " |
|
| 1373 | + . '$debut_boucle = '.$debut.";\n " |
|
| 1381 | 1374 | . "\$debut_boucle = intval(\$debut_boucle);\n " |
| 1382 | - . '$fin_boucle = min(' . $fin . ", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1383 | - . '$Numrows[\'' . $id_boucle . "']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1384 | - . '$Numrows[\'' . $id_boucle . '\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1375 | + . '$fin_boucle = min('.$fin.", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1376 | + . '$Numrows[\''.$id_boucle."']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1377 | + . '$Numrows[\''.$id_boucle.'\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1385 | 1378 | . "\n\tif (\$debut_boucle>0" |
| 1386 | 1379 | . " AND \$debut_boucle < \$Numrows['$id_boucle']['grand_total']" |
| 1387 | 1380 | . " AND \$iter->seek(\$debut_boucle,'continue'))" |
@@ -1466,16 +1459,16 @@ discard block |
||
| 1466 | 1459 | // critere personnalise ? |
| 1467 | 1460 | if ( |
| 1468 | 1461 | (!$serveur or |
| 1469 | - ((!function_exists($f = "critere_" . $serveur . "_" . $table . "_" . $critere)) |
|
| 1470 | - and (!function_exists($f = $f . "_dist")) |
|
| 1471 | - and (!function_exists($f = "critere_" . $serveur . "_" . $critere)) |
|
| 1472 | - and (!function_exists($f = $f . "_dist")) |
|
| 1462 | + ((!function_exists($f = "critere_".$serveur."_".$table."_".$critere)) |
|
| 1463 | + and (!function_exists($f = $f."_dist")) |
|
| 1464 | + and (!function_exists($f = "critere_".$serveur."_".$critere)) |
|
| 1465 | + and (!function_exists($f = $f."_dist")) |
|
| 1473 | 1466 | ) |
| 1474 | 1467 | ) |
| 1475 | - and (!function_exists($f = "critere_" . $table . "_" . $critere)) |
|
| 1476 | - and (!function_exists($f = $f . "_dist")) |
|
| 1477 | - and (!function_exists($f = "critere_" . $critere)) |
|
| 1478 | - and (!function_exists($f = $f . "_dist")) |
|
| 1468 | + and (!function_exists($f = "critere_".$table."_".$critere)) |
|
| 1469 | + and (!function_exists($f = $f."_dist")) |
|
| 1470 | + and (!function_exists($f = "critere_".$critere)) |
|
| 1471 | + and (!function_exists($f = $f."_dist")) |
|
| 1479 | 1472 | ) { |
| 1480 | 1473 | // fonction critere standard |
| 1481 | 1474 | $f = $defaut; |
@@ -1508,9 +1501,9 @@ discard block |
||
| 1508 | 1501 | */ |
| 1509 | 1502 | function kwote($lisp, $serveur = '', $type = '') { |
| 1510 | 1503 | if (preg_match(_CODE_QUOTE, $lisp, $r)) { |
| 1511 | - return $r[1] . "\"" . sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type) . "\""; |
|
| 1504 | + return $r[1]."\"".sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type)."\""; |
|
| 1512 | 1505 | } else { |
| 1513 | - return "sql_quote($lisp, '$serveur', '" . str_replace("'", "\\'", $type) . "')"; |
|
| 1506 | + return "sql_quote($lisp, '$serveur', '".str_replace("'", "\\'", $type)."')"; |
|
| 1514 | 1507 | } |
| 1515 | 1508 | } |
| 1516 | 1509 | |
@@ -1532,7 +1525,7 @@ discard block |
||
| 1532 | 1525 | function critere_IN_dist($idb, &$boucles, $crit) { |
| 1533 | 1526 | $r = calculer_critere_infixe($idb, $boucles, $crit); |
| 1534 | 1527 | if (!$r) { |
| 1535 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . " ?"))); |
|
| 1528 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op." ?"))); |
|
| 1536 | 1529 | } |
| 1537 | 1530 | list($arg, $op, $val, $col, $where_complement) = $r; |
| 1538 | 1531 | |
@@ -1559,8 +1552,8 @@ discard block |
||
| 1559 | 1552 | "'NOT'", |
| 1560 | 1553 | array( |
| 1561 | 1554 | "'IN'", |
| 1562 | - "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", |
|
| 1563 | - array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where) |
|
| 1555 | + "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", |
|
| 1556 | + array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where) |
|
| 1564 | 1557 | ) |
| 1565 | 1558 | ); |
| 1566 | 1559 | } |
@@ -1579,22 +1572,22 @@ discard block |
||
| 1579 | 1572 | $descr = $boucles[$idb]->descr; |
| 1580 | 1573 | $cpt = &$num[$descr['nom']][$descr['gram']][$idb]; |
| 1581 | 1574 | |
| 1582 | - $var = '$in' . $cpt++; |
|
| 1575 | + $var = '$in'.$cpt++; |
|
| 1583 | 1576 | $x = "\n\t$var = array();"; |
| 1584 | 1577 | foreach ($val as $k => $v) { |
| 1585 | 1578 | if (preg_match(",^(\n//.*\n)?'(.*)'$,", $v, $r)) { |
| 1586 | 1579 | // optimiser le traitement des constantes |
| 1587 | 1580 | if (is_numeric($r[2])) { |
| 1588 | - $x .= "\n\t$var" . "[]= $r[2];"; |
|
| 1581 | + $x .= "\n\t$var"."[]= $r[2];"; |
|
| 1589 | 1582 | } else { |
| 1590 | - $x .= "\n\t$var" . "[]= " . sql_quote($r[2]) . ";"; |
|
| 1583 | + $x .= "\n\t$var"."[]= ".sql_quote($r[2]).";"; |
|
| 1591 | 1584 | } |
| 1592 | 1585 | } else { |
| 1593 | 1586 | // Pour permettre de passer des tableaux de valeurs |
| 1594 | 1587 | // on repere l'utilisation brute de #ENV**{X}, |
| 1595 | 1588 | // c'est-a-dire sa traduction en ($PILE[0][X]). |
| 1596 | 1589 | // et on deballe mais en rajoutant l'anti XSS |
| 1597 | - $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var" . "[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1590 | + $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var"."[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1598 | 1591 | } |
| 1599 | 1592 | } |
| 1600 | 1593 | |
@@ -1608,7 +1601,7 @@ discard block |
||
| 1608 | 1601 | $boucles[$idb]->default_order[] = "((!\$zqv=sql_quote($var) OR \$zqv===\"''\") ? 0 : ('FIELD($arg,' . \$zqv . ')'))"; |
| 1609 | 1602 | } |
| 1610 | 1603 | |
| 1611 | - return "sql_in('$arg', $var" . ($crit2 == 'NOT' ? ",'NOT'" : "") . ")"; |
|
| 1604 | + return "sql_in('$arg', $var".($crit2 == 'NOT' ? ",'NOT'" : "").")"; |
|
| 1612 | 1605 | } |
| 1613 | 1606 | |
| 1614 | 1607 | /** |
@@ -1681,7 +1674,7 @@ discard block |
||
| 1681 | 1674 | $champs = array_diff($champs, array_keys($boucle->modificateur['criteres'])); |
| 1682 | 1675 | } |
| 1683 | 1676 | // nous aider en mode debug. |
| 1684 | - $boucle->debug[] = "id_ : " . implode(', ', $champs); |
|
| 1677 | + $boucle->debug[] = "id_ : ".implode(', ', $champs); |
|
| 1685 | 1678 | $boucle->modificateur['id_'] = $champs; |
| 1686 | 1679 | |
| 1687 | 1680 | // créer un critère {id_xxx?} de chaque champ retenu |
@@ -1722,7 +1715,7 @@ discard block |
||
| 1722 | 1715 | // Les champs id_xx de la table demandée |
| 1723 | 1716 | $champs = array_filter( |
| 1724 | 1717 | array_keys($desc['field']), |
| 1725 | - function($champ){ |
|
| 1718 | + function($champ) { |
|
| 1726 | 1719 | return |
| 1727 | 1720 | strpos($champ, 'id_') === 0 |
| 1728 | 1721 | or (in_array($champ, array('objet'))); |
@@ -1937,8 +1930,8 @@ discard block |
||
| 1937 | 1930 | "'NOT'", |
| 1938 | 1931 | array( |
| 1939 | 1932 | "'IN'", |
| 1940 | - "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", |
|
| 1941 | - array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where) |
|
| 1933 | + "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", |
|
| 1934 | + array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where) |
|
| 1942 | 1935 | ) |
| 1943 | 1936 | ); |
| 1944 | 1937 | } |
@@ -1949,7 +1942,7 @@ discard block |
||
| 1949 | 1942 | if ($crit->cond) { |
| 1950 | 1943 | $pred = calculer_argument_precedent($idb, $col, $boucles); |
| 1951 | 1944 | if ($col == "date" or $col == "date_redac") { |
| 1952 | - if ($pred == "\$Pile[0]['" . $col . "']") { |
|
| 1945 | + if ($pred == "\$Pile[0]['".$col."']") { |
|
| 1953 | 1946 | $pred = "(\$Pile[0]['{$col}_default']?'':$pred)"; |
| 1954 | 1947 | } |
| 1955 | 1948 | } |
@@ -2110,7 +2103,7 @@ discard block |
||
| 2110 | 2103 | // defaire le quote des int et les passer dans sql_quote avec le bon type de champ si on le connait, int sinon |
| 2111 | 2104 | // prendre en compte le debug ou la valeur arrive avec un commentaire PHP en debut |
| 2112 | 2105 | if (preg_match(",^\\A(\s*//.*?$\s*)?\"'(-?\d+)'\"\\z,ms", $val[0], $r)) { |
| 2113 | - $val[0] = $r[1] . '"' . sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote) . '"'; |
|
| 2106 | + $val[0] = $r[1].'"'.sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote).'"'; |
|
| 2114 | 2107 | } |
| 2115 | 2108 | // sinon expliciter les |
| 2116 | 2109 | // sql_quote(truc) en sql_quote(truc,'',type) |
@@ -2121,22 +2114,22 @@ discard block |
||
| 2121 | 2114 | // sql_quote(truc,'','varchar') |
| 2122 | 2115 | elseif (preg_match('/\Asql_quote[(](.*?)(,[^)]*?)?(,[^)]*(?:\(\d+\)[^)]*)?)?[)]\s*\z/ms', $val[0], $r) |
| 2123 | 2116 | // si pas deja un type |
| 2124 | - and (!isset($r[3]) or !$r[3] or !trim($r[3],", '")) |
|
| 2117 | + and (!isset($r[3]) or !$r[3] or !trim($r[3], ", '")) |
|
| 2125 | 2118 | ) { |
| 2126 | 2119 | $r = $r[1] |
| 2127 | 2120 | . ((isset($r[2]) and $r[2]) ? $r[2] : ",''") |
| 2128 | - . ",'" . addslashes($type_cast_quote) . "'"; |
|
| 2121 | + . ",'".addslashes($type_cast_quote)."'"; |
|
| 2129 | 2122 | $val[0] = "sql_quote($r)"; |
| 2130 | 2123 | } |
| 2131 | - elseif(strpos($val[0], '@@defaultcast@@') !== false |
|
| 2124 | + elseif (strpos($val[0], '@@defaultcast@@') !== false |
|
| 2132 | 2125 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) { |
| 2133 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'" . addslashes($type_cast_quote) . "')"; |
|
| 2126 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'".addslashes($type_cast_quote)."')"; |
|
| 2134 | 2127 | } |
| 2135 | 2128 | } |
| 2136 | 2129 | |
| 2137 | - if(strpos($val[0], '@@defaultcast@@') !== false |
|
| 2130 | + if (strpos($val[0], '@@defaultcast@@') !== false |
|
| 2138 | 2131 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) { |
| 2139 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'char')"; |
|
| 2132 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'char')"; |
|
| 2140 | 2133 | } |
| 2141 | 2134 | |
| 2142 | 2135 | // Indicateur pour permettre aux fonctionx boucle_X de modifier |
@@ -2152,7 +2145,7 @@ discard block |
||
| 2152 | 2145 | // inserer le nom de la table SQL devant le nom du champ |
| 2153 | 2146 | if ($table) { |
| 2154 | 2147 | if ($col[0] == "`") { |
| 2155 | - $arg = "$table." . substr($col, 1, -1); |
|
| 2148 | + $arg = "$table.".substr($col, 1, -1); |
|
| 2156 | 2149 | } else { |
| 2157 | 2150 | $arg = "$table.$col"; |
| 2158 | 2151 | } |
@@ -2286,9 +2279,9 @@ discard block |
||
| 2286 | 2279 | **/ |
| 2287 | 2280 | function primary_doublee($decompose, $table) { |
| 2288 | 2281 | $e1 = reset($decompose); |
| 2289 | - $e2 = "sql_quote('" . end($decompose) . "')"; |
|
| 2282 | + $e2 = "sql_quote('".end($decompose)."')"; |
|
| 2290 | 2283 | |
| 2291 | - return array("'='", "'$table." . $e1 . "'", $e2); |
|
| 2284 | + return array("'='", "'$table.".$e1."'", $e2); |
|
| 2292 | 2285 | } |
| 2293 | 2286 | |
| 2294 | 2287 | /** |
@@ -2326,7 +2319,7 @@ discard block |
||
| 2326 | 2319 | if ($checkarrivee |
| 2327 | 2320 | and is_string($checkarrivee) |
| 2328 | 2321 | and $a = table_objet($checkarrivee) |
| 2329 | - and in_array($a . '_liens', $joints) |
|
| 2322 | + and in_array($a.'_liens', $joints) |
|
| 2330 | 2323 | ) { |
| 2331 | 2324 | if ($res = calculer_lien_externe_init($boucle, $joints, $col, $desc, $cond, $checkarrivee)) { |
| 2332 | 2325 | return $res; |
@@ -2346,12 +2339,12 @@ discard block |
||
| 2346 | 2339 | // la table est déjà dans le FROM, on vérifie si le champ est utilisé. |
| 2347 | 2340 | $joindre = false; |
| 2348 | 2341 | foreach ($cols as $col) { |
| 2349 | - $c = '/\b' . $t . ".$col" . '\b/'; |
|
| 2342 | + $c = '/\b'.$t.".$col".'\b/'; |
|
| 2350 | 2343 | if (trouver_champ($c, $boucle->where)) { |
| 2351 | 2344 | $joindre = true; |
| 2352 | 2345 | } else { |
| 2353 | 2346 | // mais ca peut etre dans le FIELD pour le Having |
| 2354 | - $c = "/FIELD.$t" . ".$col,/"; |
|
| 2347 | + $c = "/FIELD.$t".".$col,/"; |
|
| 2355 | 2348 | if (trouver_champ($c, $boucle->select)) { |
| 2356 | 2349 | $joindre = true; |
| 2357 | 2350 | } |
@@ -2398,7 +2391,7 @@ discard block |
||
| 2398 | 2391 | $primary_arrivee = id_table_objet($checkarrivee); |
| 2399 | 2392 | |
| 2400 | 2393 | // [FIXME] $checkarrivee peut-il arriver avec false ???? |
| 2401 | - $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee . "_liens"); |
|
| 2394 | + $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee."_liens"); |
|
| 2402 | 2395 | $arrivee = trouver_champ_exterieur($col, $joints, $boucle, $checkarrivee); |
| 2403 | 2396 | |
| 2404 | 2397 | if (!$intermediaire or !$arrivee) { |
@@ -2496,7 +2489,7 @@ discard block |
||
| 2496 | 2489 | } elseif ($crit->cond and ($col == "date" or $col == "date_redac")) { |
| 2497 | 2490 | // un critere conditionnel sur date est traite a part |
| 2498 | 2491 | // car la date est mise d'office par SPIP, |
| 2499 | - $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['" . $col . "'])"; |
|
| 2492 | + $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['".$col."'])"; |
|
| 2500 | 2493 | } |
| 2501 | 2494 | |
| 2502 | 2495 | $val = calculer_argument_precedent($idb, $val, $boucles, $defaut); |
@@ -2527,7 +2520,7 @@ discard block |
||
| 2527 | 2520 | and (($p == "'") or ($p == '"')) |
| 2528 | 2521 | and $params[0][1]->type == 'champ' |
| 2529 | 2522 | ) { |
| 2530 | - $val[] = "$p\\$p#" . $params[0][1]->nom_champ . "\\$p$p"; |
|
| 2523 | + $val[] = "$p\\$p#".$params[0][1]->nom_champ."\\$p$p"; |
|
| 2531 | 2524 | } else { |
| 2532 | 2525 | foreach ((($op != 'IN') ? $params : calculer_vieux_in($params)) as $p) { |
| 2533 | 2526 | $a = calculer_liste($p, $idb, $boucles, $parent); |
@@ -2543,7 +2536,7 @@ discard block |
||
| 2543 | 2536 | $fct = $args_sql = ''; |
| 2544 | 2537 | // fonction SQL ? |
| 2545 | 2538 | // chercher FONCTION(champ) tel que CONCAT(titre,descriptif) |
| 2546 | - if (preg_match('/^(.*)' . SQL_ARGS . '$/', $col, $m)) { |
|
| 2539 | + if (preg_match('/^(.*)'.SQL_ARGS.'$/', $col, $m)) { |
|
| 2547 | 2540 | $fct = $m[1]; |
| 2548 | 2541 | preg_match('/^\(([^,]*)(.*)\)$/', $m[2], $a); |
| 2549 | 2542 | $col = $a[1]; |
@@ -2633,7 +2626,7 @@ discard block |
||
| 2633 | 2626 | # si oui choisir ce champ, sinon choisir xxxx |
| 2634 | 2627 | |
| 2635 | 2628 | if (isset($table['field']["date$suite"])) { |
| 2636 | - $date_orig = 'date' . $suite; |
|
| 2629 | + $date_orig = 'date'.$suite; |
|
| 2637 | 2630 | } else { |
| 2638 | 2631 | $date_orig = substr($suite, 1); |
| 2639 | 2632 | } |
@@ -2644,12 +2637,12 @@ discard block |
||
| 2644 | 2637 | } |
| 2645 | 2638 | } |
| 2646 | 2639 | |
| 2647 | - $date_compare = "\"' . normaliser_date(" . |
|
| 2648 | - calculer_argument_precedent($idb, $pred, $boucles) . |
|
| 2640 | + $date_compare = "\"' . normaliser_date(". |
|
| 2641 | + calculer_argument_precedent($idb, $pred, $boucles). |
|
| 2649 | 2642 | ") . '\""; |
| 2650 | 2643 | |
| 2651 | 2644 | $col_vraie = $date_orig; |
| 2652 | - $date_orig = $boucle->id_table . '.' . $date_orig; |
|
| 2645 | + $date_orig = $boucle->id_table.'.'.$date_orig; |
|
| 2653 | 2646 | |
| 2654 | 2647 | switch ($col) { |
| 2655 | 2648 | case 'date': |
@@ -2669,26 +2662,26 @@ discard block |
||
| 2669 | 2662 | break; |
| 2670 | 2663 | case 'age': |
| 2671 | 2664 | $col = calculer_param_date("\'' . date('Y-m-d H:i:00') . '\'", $date_orig); |
| 2672 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2665 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2673 | 2666 | break; |
| 2674 | 2667 | case 'age_relatif': |
| 2675 | 2668 | $col = calculer_param_date($date_compare, $date_orig); |
| 2676 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2669 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2677 | 2670 | break; |
| 2678 | 2671 | case 'jour_relatif': |
| 2679 | - $col = "(TO_DAYS(" . $date_compare . ")-TO_DAYS(" . $date_orig . "))"; |
|
| 2680 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2672 | + $col = "(TO_DAYS(".$date_compare.")-TO_DAYS(".$date_orig."))"; |
|
| 2673 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2681 | 2674 | break; |
| 2682 | 2675 | case 'mois_relatif': |
| 2683 | - $col = "MONTH(" . $date_compare . ")-MONTH(" . |
|
| 2684 | - $date_orig . ")+12*(YEAR(" . $date_compare . |
|
| 2685 | - ")-YEAR(" . $date_orig . "))"; |
|
| 2686 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2676 | + $col = "MONTH(".$date_compare.")-MONTH(". |
|
| 2677 | + $date_orig.")+12*(YEAR(".$date_compare. |
|
| 2678 | + ")-YEAR(".$date_orig."))"; |
|
| 2679 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2687 | 2680 | break; |
| 2688 | 2681 | case 'annee_relatif': |
| 2689 | - $col = "YEAR(" . $date_compare . ")-YEAR(" . |
|
| 2690 | - $date_orig . ")"; |
|
| 2691 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2682 | + $col = "YEAR(".$date_compare.")-YEAR(". |
|
| 2683 | + $date_orig.")"; |
|
| 2684 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2692 | 2685 | break; |
| 2693 | 2686 | } |
| 2694 | 2687 | |
@@ -2747,10 +2740,10 @@ discard block |
||
| 2747 | 2740 | } |
| 2748 | 2741 | |
| 2749 | 2742 | $boucle->hash .= ' |
| 2750 | - $command[\'sourcemode\'] = ' . array_shift($args) . ";\n"; |
|
| 2743 | + $command[\'sourcemode\'] = ' . array_shift($args).";\n"; |
|
| 2751 | 2744 | |
| 2752 | 2745 | $boucle->hash .= ' |
| 2753 | - $command[\'source\'] = array(' . join(', ', $args) . ");\n"; |
|
| 2746 | + $command[\'source\'] = array(' . join(', ', $args).");\n"; |
|
| 2754 | 2747 | } |
| 2755 | 2748 | |
| 2756 | 2749 | /** |
@@ -2769,7 +2762,7 @@ discard block |
||
| 2769 | 2762 | function critere_DATA_datacache_dist($idb, &$boucles, $crit) { |
| 2770 | 2763 | $boucle = &$boucles[$idb]; |
| 2771 | 2764 | $boucle->hash .= ' |
| 2772 | - $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2765 | + $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2773 | 2766 | } |
| 2774 | 2767 | |
| 2775 | 2768 | |
@@ -2788,7 +2781,7 @@ discard block |
||
| 2788 | 2781 | $boucle->hash .= '$command[\'args\']=array();'; |
| 2789 | 2782 | foreach ($crit->param as $param) { |
| 2790 | 2783 | $boucle->hash .= ' |
| 2791 | - $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2784 | + $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2792 | 2785 | } |
| 2793 | 2786 | } |
| 2794 | 2787 | |
@@ -2807,10 +2800,10 @@ discard block |
||
| 2807 | 2800 | */ |
| 2808 | 2801 | function critere_DATA_liste_dist($idb, &$boucles, $crit) { |
| 2809 | 2802 | $boucle = &$boucles[$idb]; |
| 2810 | - $boucle->hash .= "\n\t" . '$command[\'liste\'] = array();' . "\n"; |
|
| 2803 | + $boucle->hash .= "\n\t".'$command[\'liste\'] = array();'."\n"; |
|
| 2811 | 2804 | foreach ($crit->param as $param) { |
| 2812 | - $boucle->hash .= "\t" . '$command[\'liste\'][] = ' . calculer_liste($param, $idb, $boucles, |
|
| 2813 | - $boucles[$idb]->id_parent) . ";\n"; |
|
| 2805 | + $boucle->hash .= "\t".'$command[\'liste\'][] = '.calculer_liste($param, $idb, $boucles, |
|
| 2806 | + $boucles[$idb]->id_parent).";\n"; |
|
| 2814 | 2807 | } |
| 2815 | 2808 | } |
| 2816 | 2809 | |
@@ -2837,10 +2830,10 @@ discard block |
||
| 2837 | 2830 | */ |
| 2838 | 2831 | function critere_DATA_enum_dist($idb, &$boucles, $crit) { |
| 2839 | 2832 | $boucle = &$boucles[$idb]; |
| 2840 | - $boucle->hash .= "\n\t" . '$command[\'enum\'] = array();' . "\n"; |
|
| 2833 | + $boucle->hash .= "\n\t".'$command[\'enum\'] = array();'."\n"; |
|
| 2841 | 2834 | foreach ($crit->param as $param) { |
| 2842 | - $boucle->hash .= "\t" . '$command[\'enum\'][] = ' . calculer_liste($param, $idb, $boucles, |
|
| 2843 | - $boucles[$idb]->id_parent) . ";\n"; |
|
| 2835 | + $boucle->hash .= "\t".'$command[\'enum\'][] = '.calculer_liste($param, $idb, $boucles, |
|
| 2836 | + $boucles[$idb]->id_parent).";\n"; |
|
| 2844 | 2837 | } |
| 2845 | 2838 | } |
| 2846 | 2839 | |
@@ -2859,7 +2852,7 @@ discard block |
||
| 2859 | 2852 | $boucle = &$boucles[$idb]; |
| 2860 | 2853 | foreach ($crit->param as $param) { |
| 2861 | 2854 | $boucle->hash .= ' |
| 2862 | - $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2855 | + $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2863 | 2856 | } |
| 2864 | 2857 | } |
| 2865 | 2858 | |
@@ -2900,7 +2893,7 @@ discard block |
||
| 2900 | 2893 | if ($crit->param) { |
| 2901 | 2894 | foreach ($crit->param as $param) { |
| 2902 | 2895 | $boucle->hash .= "\t\$command['si'][] = " |
| 2903 | - . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ";\n"; |
|
| 2896 | + . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).";\n"; |
|
| 2904 | 2897 | } |
| 2905 | 2898 | // interdire {si 0} aussi ! |
| 2906 | 2899 | } else { |
@@ -2924,7 +2917,7 @@ discard block |
||
| 2924 | 2917 | function critere_POUR_tableau_dist($idb, &$boucles, $crit) { |
| 2925 | 2918 | $boucle = &$boucles[$idb]; |
| 2926 | 2919 | $boucle->hash .= ' |
| 2927 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2920 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).'); |
|
| 2928 | 2921 | $command[\'sourcemode\'] = \'table\';'; |
| 2929 | 2922 | } |
| 2930 | 2923 | |
@@ -2957,11 +2950,10 @@ discard block |
||
| 2957 | 2950 | $table_sql = table_objet_sql(objet_type($table)); |
| 2958 | 2951 | |
| 2959 | 2952 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 2960 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 2961 | - 'id_parent'; |
|
| 2953 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 2962 | 2954 | |
| 2963 | 2955 | $in = "IN"; |
| 2964 | - $where = array("'IN'", "'$boucle->id_table." . "$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"); |
|
| 2956 | + $where = array("'IN'", "'$boucle->id_table."."$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"); |
|
| 2965 | 2957 | if ($not) { |
| 2966 | 2958 | $where = array("'NOT'", $where); |
| 2967 | 2959 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | if (strlen($intro)) { |
| 84 | 84 | $texte = $intro; |
| 85 | 85 | } else { |
| 86 | - if (strpos("\n" . $texte, "\n|") === false |
|
| 86 | + if (strpos("\n".$texte, "\n|") === false |
|
| 87 | 87 | and strlen($texte) > 2.5 * $longueur |
| 88 | 88 | ) { |
| 89 | 89 | if (strpos($texte, "<multi") !== false) { |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | if ($pas < 1) { |
| 169 | 169 | return ''; |
| 170 | 170 | } |
| 171 | - $ancre = 'pagination' . $nom; // #pagination_articles |
|
| 172 | - $debut = 'debut' . $nom; // 'debut_articles' |
|
| 171 | + $ancre = 'pagination'.$nom; // #pagination_articles |
|
| 172 | + $debut = 'debut'.$nom; // 'debut_articles' |
|
| 173 | 173 | |
| 174 | 174 | // n'afficher l'ancre qu'une fois |
| 175 | 175 | if (!isset($ancres[$ancre])) { |
| 176 | - $bloc_ancre = $ancres[$ancre] = "<a id='" . $ancre . "' class='pagination_ancre'></a>"; |
|
| 176 | + $bloc_ancre = $ancres[$ancre] = "<a id='".$ancre."' class='pagination_ancre'></a>"; |
|
| 177 | 177 | } else { |
| 178 | 178 | $bloc_ancre = ''; |
| 179 | 179 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | if ($modele) { |
| 207 | 207 | $pagination['type_pagination'] = $modele; |
| 208 | 208 | if (trouver_fond('pagination_'.$modele, 'modeles')) { |
| 209 | - $modele = '_' . $modele; |
|
| 209 | + $modele = '_'.$modele; |
|
| 210 | 210 | } |
| 211 | 211 | else { |
| 212 | 212 | $modele = ''; |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | * @param $objet_lien |
| 338 | 338 | * @return string |
| 339 | 339 | */ |
| 340 | -function retrouver_rang_lien($objet_source, $ids, $objet_lie, $idl, $objet_lien){ |
|
| 340 | +function retrouver_rang_lien($objet_source, $ids, $objet_lie, $idl, $objet_lien) { |
|
| 341 | 341 | $res = lister_objets_liens($objet_source, $objet_lie, $idl, $objet_lien); |
| 342 | 342 | $res = array_column($res, 'rang_lien', $objet_source); |
| 343 | 343 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | * @param array $from |
| 429 | 429 | * @return string |
| 430 | 430 | */ |
| 431 | -function tri_champ_order($t, $from = null, $senstri='') { |
|
| 431 | +function tri_champ_order($t, $from = null, $senstri = '') { |
|
| 432 | 432 | if (strncmp($t, 'multi ', 6) == 0) { |
| 433 | 433 | return "multi"; |
| 434 | 434 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | case 'sinum ': |
| 464 | 464 | return "CASE( 0+$champ ) WHEN 0 THEN 1 ELSE 0 END{$senstri}"; |
| 465 | 465 | default: |
| 466 | - return $champ . $senstri; |
|
| 466 | + return $champ.$senstri; |
|
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | |
@@ -500,12 +500,12 @@ discard block |
||
| 500 | 500 | * @param string $serveur |
| 501 | 501 | * @return string |
| 502 | 502 | */ |
| 503 | -function formate_liste_critere_par_ordre_liste($valeurs, $serveur = ''){ |
|
| 504 | - if (!is_array($valeurs)){ |
|
| 503 | +function formate_liste_critere_par_ordre_liste($valeurs, $serveur = '') { |
|
| 504 | + if (!is_array($valeurs)) { |
|
| 505 | 505 | return ''; |
| 506 | 506 | } |
| 507 | 507 | $f = sql_serveur('quote', $serveur, true); |
| 508 | - if (!is_string($f) or !$f){ |
|
| 508 | + if (!is_string($f) or !$f) { |
|
| 509 | 509 | return ''; |
| 510 | 510 | } |
| 511 | 511 | $valeurs = implode(',', array_map($f, array_unique($valeurs))); |