@@ -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', 2_097_152); |
@@ -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,10 +115,10 @@ discard block |
||
| 115 | 115 | ['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 ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 118 | + spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE); |
|
| 119 | 119 | } |
| 120 | 120 | else { |
| 121 | - spip_log("copie_locale : recuperation $source sur $localrac OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant'); |
|
| 121 | + spip_log("copie_locale : recuperation $source sur $localrac OK | taille ".$res['length'].' status '.$res['status'], 'distant'); |
|
| 122 | 122 | } |
| 123 | 123 | if (!$res or !$res['length']) { |
| 124 | 124 | // si $t c'est sans doute juste un not-modified-since |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | if (!$is_known_host) { |
| 209 | 209 | $host = trim($parsed_url['host'], '.'); |
| 210 | - if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 210 | + if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 211 | 211 | $ip = gethostbyname($host); |
| 212 | 212 | if ($ip === $host) { |
| 213 | 213 | // Error condition for gethostbyname() |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | if ($ip) { |
| 231 | - if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 231 | + if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 232 | 232 | return false; |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | $port = $parsed_url['port']; |
| 242 | - if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 242 | + if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 243 | 243 | return $url; |
| 244 | 244 | } |
| 245 | 245 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | if ($taille > 500) { |
| 312 | - $boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8); |
|
| 312 | + $boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8); |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | |
@@ -337,16 +337,16 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | } else { |
| 339 | 339 | // fabrique une chaine HTTP simple pour un POST |
| 340 | - $entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; |
|
| 340 | + $entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n"; |
|
| 341 | 341 | $chaine = []; |
| 342 | 342 | if (is_array($donnees)) { |
| 343 | 343 | foreach ($donnees as $cle => $valeur) { |
| 344 | 344 | if (is_array($valeur)) { |
| 345 | 345 | foreach ($valeur as $val2) { |
| 346 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2); |
|
| 346 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2); |
|
| 347 | 347 | } |
| 348 | 348 | } else { |
| 349 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur); |
|
| 349 | + $chaine[] = rawurlencode($cle).'='.rawurlencode($valeur); |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | $chaine = implode('&', $chaine); |
@@ -451,13 +451,13 @@ discard block |
||
| 451 | 451 | $options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - spip_log("recuperer_url " . $options['methode']. " sur $url", 'distant' . _LOG_DEBUG); |
|
| 454 | + spip_log("recuperer_url ".$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 455 | 455 | |
| 456 | 456 | // Ajout des en-têtes spécifiques si besoin |
| 457 | 457 | $formatted_data = ''; |
| 458 | 458 | if (!empty($options['headers'])) { |
| 459 | 459 | foreach ($options['headers'] as $champ => $valeur) { |
| 460 | - $formatted_data .= $champ . ': ' . $valeur . "\r\n"; |
|
| 460 | + $formatted_data .= $champ.': '.$valeur."\r\n"; |
|
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | |
@@ -465,9 +465,9 @@ discard block |
||
| 465 | 465 | [$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']); |
| 466 | 466 | $head .= $formatted_data; |
| 467 | 467 | if (stripos($head, 'Content-Length:') === false) { |
| 468 | - $head .= 'Content-Length: ' . strlen($postdata) . "\r\n"; |
|
| 468 | + $head .= 'Content-Length: '.strlen($postdata)."\r\n"; |
|
| 469 | 469 | } |
| 470 | - $formatted_data = $head . "\r\n" . $postdata; |
|
| 470 | + $formatted_data = $head."\r\n".$postdata; |
|
| 471 | 471 | if ( |
| 472 | 472 | strlen($postdata) |
| 473 | 473 | and !$methode_demandee |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 482 | 482 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 483 | 483 | if (!tester_url_absolue($url)) { |
| 484 | - $url = 'http://' . $url; |
|
| 484 | + $url = 'http://'.$url; |
|
| 485 | 485 | } elseif (strncmp($url, '//', 2) == 0) { |
| 486 | - $url = 'http:' . $url; |
|
| 486 | + $url = 'http:'.$url; |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | $url = url_to_ascii($url); |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $options['if_modified_since'] |
| 513 | 513 | ); |
| 514 | 514 | if (!$handle) { |
| 515 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 515 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 516 | 516 | |
| 517 | 517 | return false; |
| 518 | 518 | } |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | 'status' => 200, |
| 543 | 543 | ]; |
| 544 | 544 | } else { |
| 545 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 545 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 546 | 546 | return false; |
| 547 | 547 | } |
| 548 | 548 | } elseif ($res['location'] and $options['follow_location']) { |
@@ -558,11 +558,11 @@ discard block |
||
| 558 | 558 | $options['datas'] = ''; |
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | - spip_log("recuperer_url recommence " . $options['methode']. " sur $url", 'distant' . _LOG_DEBUG); |
|
| 561 | + spip_log("recuperer_url recommence ".$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 562 | 562 | |
| 563 | 563 | return recuperer_url($url, $options); |
| 564 | 564 | } elseif ($res['status'] !== 200) { |
| 565 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 565 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 566 | 566 | } |
| 567 | 567 | $result['status'] = $res['status']; |
| 568 | 568 | if (isset($res['headers'])) { |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | // on ne veut que les entetes |
| 580 | 580 | if (!$options['taille_max'] or $options['methode'] == 'HEAD' or $result['status'] == '304') { |
| 581 | - spip_log("RESULTAT recuperer_url " . $options['methode']. " sur $url : " . json_encode($result), 'distant' . _LOG_DEBUG); |
|
| 581 | + spip_log("RESULTAT recuperer_url ".$options['methode']." sur $url : ".json_encode($result), 'distant'._LOG_DEBUG); |
|
| 582 | 582 | return $result; |
| 583 | 583 | } |
| 584 | 584 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | $gz = false; |
| 590 | 590 | if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) { |
| 591 | - $gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz'); |
|
| 591 | + $gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz'); |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | $trace = json_decode(json_encode($result), true); |
| 626 | 626 | $trace['page'] = '...'; |
| 627 | - spip_log("RESULTAT recuperer_url " . $options['methode']. " sur $url : " . json_encode($trace), 'distant' . _LOG_DEBUG); |
|
| 627 | + spip_log("RESULTAT recuperer_url ".$options['methode']." sur $url : ".json_encode($trace), 'distant'._LOG_DEBUG); |
|
| 628 | 628 | |
| 629 | 629 | return $result; |
| 630 | 630 | } |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | $sig['url'] = $url; |
| 679 | 679 | |
| 680 | 680 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 681 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 681 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 682 | 682 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 683 | 683 | $cache = "$sub$cache"; |
| 684 | 684 | |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | $fp = false; |
| 733 | 733 | if ($fichier) { |
| 734 | 734 | include_spip('inc/acces'); |
| 735 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 735 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 736 | 736 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 737 | 737 | if (!$fp and file_exists($fichier)) { |
| 738 | 738 | return filesize($fichier); |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | } |
| 792 | 792 | $result['status'] = intval($r[1]); |
| 793 | 793 | while ($s = trim(fgets($handle, 16384))) { |
| 794 | - $result['headers'][] = $s . "\n"; |
|
| 794 | + $result['headers'][] = $s."\n"; |
|
| 795 | 795 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 796 | 796 | [, $d, $v] = $r; |
| 797 | 797 | if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) { |
@@ -840,13 +840,13 @@ discard block |
||
| 840 | 840 | |
| 841 | 841 | // on se place tout le temps comme si on etait a la racine |
| 842 | 842 | if (_DIR_RACINE) { |
| 843 | - $d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d); |
|
| 843 | + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); |
|
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | $m = md5($source); |
| 847 | 847 | |
| 848 | 848 | return $d |
| 849 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 849 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 850 | 850 | . substr($m, 0, 4) |
| 851 | 851 | . ".$extension"; |
| 852 | 852 | } |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | // Si c'est deja local pas de souci |
| 870 | 870 | if (!tester_url_absolue($source)) { |
| 871 | 871 | if (_DIR_RACINE) { |
| 872 | - $source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source); |
|
| 872 | + $source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source); |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | return $source; |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | $ext |
| 888 | 888 | and preg_match(',^\w+$,', $ext) // pas de php?truc=1&... |
| 889 | 889 | and $f = nom_fichier_copie_locale($source, $ext) |
| 890 | - and file_exists(_DIR_RACINE . $f) |
|
| 890 | + and file_exists(_DIR_RACINE.$f) |
|
| 891 | 891 | ) { |
| 892 | 892 | return $f; |
| 893 | 893 | } |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | |
| 896 | 896 | // Si c'est deja dans la table des documents, |
| 897 | 897 | // ramener le nom de sa copie potentielle |
| 898 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 898 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 899 | 899 | |
| 900 | 900 | if ($ext) { |
| 901 | 901 | return nom_fichier_copie_locale($source, $ext); |
@@ -906,9 +906,9 @@ discard block |
||
| 906 | 906 | |
| 907 | 907 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 908 | 908 | |
| 909 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 909 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 910 | 910 | $f = nom_fichier_copie_locale($source, $ext); |
| 911 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 911 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 912 | 912 | return $f; |
| 913 | 913 | } |
| 914 | 914 | } |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | // Ping pour voir si son extension est connue et autorisee |
| 917 | 917 | // avec mise en cache du resultat du ping |
| 918 | 918 | |
| 919 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 919 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 920 | 920 | if ( |
| 921 | 921 | !@file_exists($cache) |
| 922 | 922 | or !$path_parts = @unserialize(spip_file_get_contents($cache)) |
@@ -926,10 +926,10 @@ discard block |
||
| 926 | 926 | ecrire_fichier($cache, serialize($path_parts)); |
| 927 | 927 | } |
| 928 | 928 | $ext = !empty($path_parts['extension']) ? $path_parts['extension'] : ''; |
| 929 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 929 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 930 | 930 | return nom_fichier_copie_locale($source, $ext); |
| 931 | 931 | } |
| 932 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 932 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | } else { |
| 1014 | 1014 | if ($a['body']) { |
| 1015 | 1015 | $a['extension'] = $extension; |
| 1016 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 1016 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 1017 | 1017 | ecrire_fichier($a['fichier'], $a['body']); |
| 1018 | 1018 | $size_image = @spip_getimagesize($a['fichier']); |
| 1019 | 1019 | $a['largeur'] = intval($size_image[0]); |
@@ -1081,20 +1081,20 @@ discard block |
||
| 1081 | 1081 | !$t |
| 1082 | 1082 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1083 | 1083 | ) { |
| 1084 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1084 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1085 | 1085 | } |
| 1086 | 1086 | if ( |
| 1087 | 1087 | !$t |
| 1088 | 1088 | and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1089 | 1089 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1090 | 1090 | ) { |
| 1091 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1091 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1092 | 1092 | } |
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | 1095 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1096 | 1096 | if (!$t) { |
| 1097 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1097 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1105,11 +1105,11 @@ discard block |
||
| 1105 | 1105 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1106 | 1106 | ) { |
| 1107 | 1107 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1108 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1108 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | if ($t) { |
| 1112 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 1112 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 1113 | 1113 | return $t['extension']; |
| 1114 | 1114 | } else { |
| 1115 | 1115 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | } |
| 1213 | 1213 | } else { |
| 1214 | 1214 | $scheme = $t['scheme']; |
| 1215 | - $noproxy = $scheme . '://'; |
|
| 1215 | + $noproxy = $scheme.'://'; |
|
| 1216 | 1216 | } |
| 1217 | 1217 | if (isset($t['user'])) { |
| 1218 | 1218 | $user = [$t['user'], $t['pass']]; |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | } |
| 1227 | 1227 | |
| 1228 | 1228 | if (!empty($t['query'])) { |
| 1229 | - $path .= '?' . $t['query']; |
|
| 1229 | + $path .= '?'.$t['query']; |
|
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | 1232 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1300,20 +1300,20 @@ discard block |
||
| 1300 | 1300 | $proxy_user = ''; |
| 1301 | 1301 | $http_proxy = need_proxy($host); |
| 1302 | 1302 | if ($user) { |
| 1303 | - $user = urlencode($user[0]) . ':' . urlencode($user[1]); |
|
| 1303 | + $user = urlencode($user[0]).':'.urlencode($user[1]); |
|
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | $connect = ''; |
| 1307 | 1307 | if ($http_proxy) { |
| 1308 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) { |
|
| 1309 | - $path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : ''); |
|
| 1310 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1308 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) { |
|
| 1309 | + $path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : ''); |
|
| 1310 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1311 | 1311 | . "Host: $path_host\r\n" |
| 1312 | 1312 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1313 | 1313 | } else { |
| 1314 | - $path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://") |
|
| 1314 | + $path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://") |
|
| 1315 | 1315 | . (!$user ? '' : "$user@") |
| 1316 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1316 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1317 | 1317 | } |
| 1318 | 1318 | $t2 = @parse_url($http_proxy); |
| 1319 | 1319 | $first_host = $t2['host']; |
@@ -1321,10 +1321,10 @@ discard block |
||
| 1321 | 1321 | $port = 80; |
| 1322 | 1322 | } |
| 1323 | 1323 | if ($t2['user']) { |
| 1324 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1324 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1325 | 1325 | } |
| 1326 | 1326 | } else { |
| 1327 | - $first_host = $noproxy . $host; |
|
| 1327 | + $first_host = $noproxy.$host; |
|
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | 1330 | if ($connect) { |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | ); |
| 1347 | 1347 | spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect'); |
| 1348 | 1348 | if (!$f) { |
| 1349 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1349 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1350 | 1350 | return $errno; |
| 1351 | 1351 | } |
| 1352 | 1352 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1359,7 +1359,7 @@ discard block |
||
| 1359 | 1359 | or !count($res = explode(' ', $res)) |
| 1360 | 1360 | or $res[1] !== '200' |
| 1361 | 1361 | ) { |
| 1362 | - spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1362 | + spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1363 | 1363 | fclose($f); |
| 1364 | 1364 | |
| 1365 | 1365 | return false; |
@@ -1376,7 +1376,7 @@ discard block |
||
| 1376 | 1376 | } while (!$f and $ntry-- and $errno !== 110 and sleep(1)); |
| 1377 | 1377 | spip_log("Recuperer $path sur $first_host:$port par $f"); |
| 1378 | 1378 | if (!$f) { |
| 1379 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1379 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1380 | 1380 | |
| 1381 | 1381 | return $errno; |
| 1382 | 1382 | } |
@@ -1386,16 +1386,16 @@ discard block |
||
| 1386 | 1386 | $site = $GLOBALS['meta']['adresse_site'] ?? ''; |
| 1387 | 1387 | |
| 1388 | 1388 | $host_port = $host; |
| 1389 | - if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) { |
|
| 1389 | + if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) { |
|
| 1390 | 1390 | $host_port .= ":$port"; |
| 1391 | 1391 | } |
| 1392 | 1392 | $req = "$method $path $vers\r\n" |
| 1393 | 1393 | . "Host: $host_port\r\n" |
| 1394 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1395 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1394 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1395 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1396 | 1396 | . (!$site ? '' : "Referer: $site/$referer\r\n") |
| 1397 | - . (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n")) |
|
| 1398 | - . (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n")) |
|
| 1397 | + . (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n")) |
|
| 1398 | + . (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n")) |
|
| 1399 | 1399 | . (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n") |
| 1400 | 1400 | . (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n"); |
| 1401 | 1401 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $boucle = &$boucles[$idb]; |
| 48 | 48 | $id_parent = $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] ?? 'id_parent'; |
| 49 | 49 | |
| 50 | - $c = ["'='", "'$boucle->id_table." . "$id_parent'", 0]; |
|
| 50 | + $c = ["'='", "'$boucle->id_table."."$id_parent'", 0]; |
|
| 51 | 51 | $boucle->where[] = ($crit->not ? ["'NOT'", $c] : $c); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | $id = $boucle->primary; |
| 71 | 71 | |
| 72 | 72 | if ($not or !$id) { |
| 73 | - return (['zbug_critere_inconnu', ['critere' => $not . $crit->op]]); |
|
| 73 | + return (['zbug_critere_inconnu', ['critere' => $not.$crit->op]]); |
|
| 74 | 74 | } |
| 75 | 75 | $arg = kwote(calculer_argument_precedent($idb, $id, $boucles)); |
| 76 | - $boucle->where[] = ["'!='", "'$boucle->id_table." . "$id'", $arg]; |
|
| 76 | + $boucle->where[] = ["'!='", "'$boucle->id_table."."$id'", $arg]; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | $not = ($crit->not ? '' : 'NOT'); |
| 105 | 105 | |
| 106 | 106 | // le doublon s'applique sur un type de boucle (article) |
| 107 | - $nom = "'" . $boucle->type_requete . "'"; |
|
| 107 | + $nom = "'".$boucle->type_requete."'"; |
|
| 108 | 108 | |
| 109 | 109 | // compléter le nom avec un nom précisé {doublons nom} |
| 110 | 110 | // on obtient $nom = "'article' . 'nom'" |
| 111 | 111 | if (isset($crit->param[0])) { |
| 112 | - $nom .= '.' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent); |
|
| 112 | + $nom .= '.'.calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // code qui déclarera l'index du stockage de nos doublons (pour éviter une notice PHP) |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | // $doublons et son index, ici $nom |
| 122 | 122 | |
| 123 | 123 | // debut du code "sql_in('articles.id_article', " |
| 124 | - $debut_in = "sql_in('" . $boucle->id_table . '.' . $primary . "', "; |
|
| 124 | + $debut_in = "sql_in('".$boucle->id_table.'.'.$primary."', "; |
|
| 125 | 125 | // lecture des données du doublon "$doublons[$doublon_index[] = " |
| 126 | 126 | // Attention : boucle->doublons désigne une variable qu'on affecte |
| 127 | - $debut_doub = '$doublons[' . (!$not ? '' : ($boucle->doublons . '[]= ')); |
|
| 127 | + $debut_doub = '$doublons['.(!$not ? '' : ($boucle->doublons.'[]= ')); |
|
| 128 | 128 | |
| 129 | 129 | // le debut complet du code des doublons |
| 130 | - $debut_doub = $debut_in . $debut_doub; |
|
| 130 | + $debut_doub = $debut_in.$debut_doub; |
|
| 131 | 131 | |
| 132 | 132 | // nom du doublon "('article' . 'nom')]" |
| 133 | 133 | $fin_doub = "($nom)]"; |
@@ -137,22 +137,22 @@ discard block |
||
| 137 | 137 | foreach ($boucle->where as $k => $w) { |
| 138 | 138 | if (strpos($w[0], $debut_doub) === 0) { |
| 139 | 139 | // fusionner le sql_in (du where) |
| 140 | - $boucle->where[$k][0] = $debut_doub . $fin_doub . ' . ' . substr($w[0], strlen($debut_in)); |
|
| 140 | + $boucle->where[$k][0] = $debut_doub.$fin_doub.' . '.substr($w[0], strlen($debut_in)); |
|
| 141 | 141 | // fusionner l'initialisation (du hash) pour faire plus joli |
| 142 | 142 | $x = strpos($boucle->hash, $init_comment); |
| 143 | 143 | $len = strlen($init_comment); |
| 144 | 144 | $boucle->hash = |
| 145 | - substr($boucle->hash, 0, $x + $len) . $init_code . substr($boucle->hash, $x + $len); |
|
| 145 | + substr($boucle->hash, 0, $x + $len).$init_code.substr($boucle->hash, $x + $len); |
|
| 146 | 146 | |
| 147 | 147 | return; |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // mettre l'ensemble dans un tableau pour que ce ne soit pas vu comme une constante |
| 152 | - $boucle->where[] = [$debut_doub . $fin_doub . ", '" . $not . "')"]; |
|
| 152 | + $boucle->where[] = [$debut_doub.$fin_doub.", '".$not."')"]; |
|
| 153 | 153 | |
| 154 | 154 | // déclarer le doublon s'il n'existe pas encore |
| 155 | - $boucle->hash .= $init_comment . $init_code; |
|
| 155 | + $boucle->hash .= $init_comment.$init_code; |
|
| 156 | 156 | |
| 157 | 157 | |
| 158 | 158 | # la ligne suivante avait l'intention d'eviter une collecte deja faite |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $deux = $deux[0]->texte; |
| 215 | 215 | if ($deux) { |
| 216 | 216 | $boucles[$idb]->limit = |
| 217 | - 'intval($Pile[0]["debut' . $un . '"]) . ",' . $deux . '"'; |
|
| 217 | + 'intval($Pile[0]["debut'.$un.'"]) . ",'.$deux.'"'; |
|
| 218 | 218 | } else { |
| 219 | 219 | calculer_critere_DEFAUT_dist($idb, $boucles, $crit); |
| 220 | 220 | } |
@@ -276,26 +276,26 @@ discard block |
||
| 276 | 276 | $type = calculer_liste([$crit->param[1][0]], $idb, $boucles, $boucle->id_parent); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut" . substr($type, 1)); |
|
| 279 | + $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut".substr($type, 1)); |
|
| 280 | 280 | $boucle->modificateur['debut_nom'] = $type; |
| 281 | 281 | $partie = |
| 282 | 282 | // tester si le numero de page demande est de la forme '@yyy' |
| 283 | - 'isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : _request(' . $debut . ");\n" |
|
| 283 | + 'isset($Pile[0]['.$debut.']) ? $Pile[0]['.$debut.'] : _request('.$debut.");\n" |
|
| 284 | 284 | . "\tif (\$debut_boucle && \$debut_boucle[0] === '@') {\n" |
| 285 | - . "\t\t" . '$debut_boucle = $Pile[0][' . $debut . '] = quete_debut_pagination(\'' . $boucle->primary . '\',$Pile[0][\'@' . $boucle->primary . '\'] = substr($debut_boucle,1),' . $pas . ',$iter);' . "\n" |
|
| 286 | - . "\t\t" . '$iter->seek(0);' . "\n" |
|
| 285 | + . "\t\t".'$debut_boucle = $Pile[0]['.$debut.'] = quete_debut_pagination(\''.$boucle->primary.'\',$Pile[0][\'@'.$boucle->primary.'\'] = substr($debut_boucle,1),'.$pas.',$iter);'."\n" |
|
| 286 | + . "\t\t".'$iter->seek(0);'."\n" |
|
| 287 | 287 | . "\t}\n" |
| 288 | - . "\t" . '$debut_boucle = intval($debut_boucle)'; |
|
| 288 | + . "\t".'$debut_boucle = intval($debut_boucle)'; |
|
| 289 | 289 | |
| 290 | 290 | $boucle->hash .= ' |
| 291 | - $command[\'pagination\'] = array((isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : null), ' . $pas . ');'; |
|
| 291 | + $command[\'pagination\'] = array((isset($Pile[0][' . $debut.']) ? $Pile[0]['.$debut.'] : null), '.$pas.');'; |
|
| 292 | 292 | |
| 293 | 293 | $boucle->total_parties = $pas; |
| 294 | 294 | calculer_parties($boucles, $idb, $partie, 'p+'); |
| 295 | 295 | // ajouter la cle primaire dans le select pour pouvoir gerer la pagination referencee par @id |
| 296 | 296 | // sauf si pas de primaire, ou si primaire composee |
| 297 | 297 | // dans ce cas, on ne sait pas gerer une pagination indirecte |
| 298 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 298 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 299 | 299 | if ( |
| 300 | 300 | $boucle->primary |
| 301 | 301 | and !preg_match('/[,\s]/', $boucle->primary) |
@@ -342,24 +342,24 @@ discard block |
||
| 342 | 342 | $boucle->hash .= ' |
| 343 | 343 | // RECHERCHE' |
| 344 | 344 | . ($crit->cond ? ' |
| 345 | - if (!strlen(' . $quoi . ')){ |
|
| 345 | + if (!strlen(' . $quoi.')){ |
|
| 346 | 346 | list($rech_select, $rech_where) = array("0 as points",""); |
| 347 | - } else' : '') . ' |
|
| 347 | + } else' : '').' |
|
| 348 | 348 | { |
| 349 | 349 | $prepare_recherche = charger_fonction(\'prepare_recherche\', \'inc\'); |
| 350 | - list($rech_select, $rech_where) = $prepare_recherche(' . $quoi . ', "' . $boucle->id_table . '", "' . $crit->cond . '","' . $boucle->sql_serveur . '",' . $_modificateur . ',"' . $boucle->primary . '"); |
|
| 350 | + list($rech_select, $rech_where) = $prepare_recherche(' . $quoi.', "'.$boucle->id_table.'", "'.$crit->cond.'","'.$boucle->sql_serveur.'",'.$_modificateur.',"'.$boucle->primary.'"); |
|
| 351 | 351 | } |
| 352 | 352 | '; |
| 353 | 353 | |
| 354 | 354 | |
| 355 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 355 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 356 | 356 | if (!in_array($t, $boucles[$idb]->select)) { |
| 357 | 357 | $boucle->select[] = $t; |
| 358 | 358 | } # pour postgres, neuneu ici |
| 359 | 359 | // jointure uniquement sur le serveur principal |
| 360 | 360 | // (on ne peut joindre une table d'un serveur distant avec la table des resultats du serveur principal) |
| 361 | 361 | if (!$boucle->sql_serveur) { |
| 362 | - $boucle->join['resultats'] = ["'" . $boucle->id_table . "'", "'id'", "'" . $boucle->primary . "'"]; |
|
| 362 | + $boucle->join['resultats'] = ["'".$boucle->id_table."'", "'id'", "'".$boucle->primary."'"]; |
|
| 363 | 363 | $boucle->from['resultats'] = 'spip_resultats'; |
| 364 | 364 | } |
| 365 | 365 | $boucle->select[] = '$rech_select'; |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $c = |
| 427 | 427 | [ |
| 428 | 428 | "'OR'", |
| 429 | - ["'='", "'$table." . "id_trad'", "'$table.$prim'"], |
|
| 429 | + ["'='", "'$table."."id_trad'", "'$table.$prim'"], |
|
| 430 | 430 | ["'='", "'$table.id_trad'", "'0'"] |
| 431 | 431 | ]; |
| 432 | 432 | $boucle->where[] = ($crit->not ? ["'NOT'", $c] : $c); |
@@ -449,13 +449,13 @@ discard block |
||
| 449 | 449 | $boucle = &$boucles[$idb]; |
| 450 | 450 | $arg = kwote(calculer_argument_precedent($idb, 'id_parent', $boucles)); |
| 451 | 451 | $id_parent = $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] ?? 'id_parent'; |
| 452 | - $mparent = $boucle->id_table . '.' . $id_parent; |
|
| 452 | + $mparent = $boucle->id_table.'.'.$id_parent; |
|
| 453 | 453 | |
| 454 | 454 | if ($boucle->type_requete == 'rubriques' or isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'])) { |
| 455 | 455 | $boucle->where[] = ["'='", "'$mparent'", $arg]; |
| 456 | 456 | } // le cas FORUMS est gere dans le plugin forum, dans la fonction critere_FORUMS_meme_parent_dist() |
| 457 | 457 | else { |
| 458 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ' . $boucle->type_requete]]); |
|
| 458 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' '.$boucle->type_requete]]); |
|
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
@@ -508,16 +508,15 @@ discard block |
||
| 508 | 508 | if (count(trouver_champs_decomposes($champ, $desc)) > 1) { |
| 509 | 509 | $decompose = decompose_champ_id_objet($champ); |
| 510 | 510 | $champ = array_shift($decompose); |
| 511 | - $boucle->where[] = ["'='", _q($cle . '.' . reset($decompose)), '"' . sql_quote(end($decompose)) . '"']; |
|
| 511 | + $boucle->where[] = ["'='", _q($cle.'.'.reset($decompose)), '"'.sql_quote(end($decompose)).'"']; |
|
| 512 | 512 | } |
| 513 | 513 | } else { |
| 514 | 514 | $cle = $boucle->id_table; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - $c = "sql_in('$cle" . ".$champ', calcul_branche_in($arg)" |
|
| 518 | - . ($not ? ", 'NOT'" : '') . ')'; |
|
| 519 | - $boucle->where[] = !$crit->cond ? $c : |
|
| 520 | - ("($arg ? $c : " . ($not ? "'0=1'" : "'1=1'") . ')'); |
|
| 517 | + $c = "sql_in('$cle".".$champ', calcul_branche_in($arg)" |
|
| 518 | + . ($not ? ", 'NOT'" : '').')'; |
|
| 519 | + $boucle->where[] = !$crit->cond ? $c : ("($arg ? $c : ".($not ? "'0=1'" : "'1=1'").')'); |
|
| 521 | 520 | } |
| 522 | 521 | |
| 523 | 522 | /** |
@@ -537,9 +536,9 @@ discard block |
||
| 537 | 536 | $not = ($crit->not ? 'NOT' : ''); |
| 538 | 537 | $serveur = $boucle->sql_serveur; |
| 539 | 538 | |
| 540 | - $c = "sql_in('" . |
|
| 541 | - $boucle->id_table . '.' . $boucle->primary |
|
| 542 | - . "', lister_objets_avec_logos('" . $boucle->primary . "'), '$not', '$serveur')"; |
|
| 539 | + $c = "sql_in('". |
|
| 540 | + $boucle->id_table.'.'.$boucle->primary |
|
| 541 | + . "', lister_objets_avec_logos('".$boucle->primary."'), '$not', '$serveur')"; |
|
| 543 | 542 | |
| 544 | 543 | $boucle->where[] = $c; |
| 545 | 544 | } |
@@ -571,7 +570,7 @@ discard block |
||
| 571 | 570 | $t = table_objet_sql($r[1]); |
| 572 | 571 | $t = array_search($t, $boucles[$idb]->from); |
| 573 | 572 | if ($t) { |
| 574 | - $t .= '.' . $r[2]; |
|
| 573 | + $t .= '.'.$r[2]; |
|
| 575 | 574 | } |
| 576 | 575 | } |
| 577 | 576 | } else { |
@@ -586,7 +585,7 @@ discard block |
||
| 586 | 585 | $boucles[$idb]->select[] = $t; |
| 587 | 586 | } |
| 588 | 587 | } else { |
| 589 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]); |
|
| 588 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]); |
|
| 590 | 589 | } |
| 591 | 590 | } |
| 592 | 591 | |
@@ -656,25 +655,25 @@ discard block |
||
| 656 | 655 | (false !== $i = strpos($boucle->order[$n - 1], 'ASC')) |
| 657 | 656 | or (false !== $i = strpos($boucle->order[$n - 1], 'DESC')) |
| 658 | 657 | ) { |
| 659 | - $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . " . $boucle->modificateur['collate'] . " . ' ", $i, 0); |
|
| 658 | + $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . ".$boucle->modificateur['collate']." . ' ", $i, 0); |
|
| 660 | 659 | } else { |
| 661 | - $boucle->order[$n - 1] .= ' . ' . $boucle->modificateur['collate']; |
|
| 660 | + $boucle->order[$n - 1] .= ' . '.$boucle->modificateur['collate']; |
|
| 662 | 661 | } |
| 663 | 662 | } |
| 664 | 663 | } else { |
| 665 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ' . (is_countable($boucles[$idb]->order) ? count($boucles[$idb]->order) : 0)]]); |
|
| 664 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' '.(is_countable($boucles[$idb]->order) ? count($boucles[$idb]->order) : 0)]]); |
|
| 666 | 665 | } |
| 667 | 666 | } |
| 668 | 667 | |
| 669 | 668 | function calculer_critere_arg_dynamique($idb, &$boucles, $crit, $suffix = '') { |
| 670 | 669 | $boucle = $boucles[$idb]; |
| 671 | - $alt = "('" . $boucle->id_table . '.\' . $x' . $suffix . ')'; |
|
| 672 | - $var = '$champs_' . $idb; |
|
| 670 | + $alt = "('".$boucle->id_table.'.\' . $x'.$suffix.')'; |
|
| 671 | + $var = '$champs_'.$idb; |
|
| 673 | 672 | $desc = (strpos($boucle->in, (string) "static $var =") !== false); |
| 674 | 673 | if (!$desc) { |
| 675 | 674 | $desc = $boucle->show['field']; |
| 676 | 675 | $desc = implode(',', array_map('_q', array_keys($desc))); |
| 677 | - $boucles[$idb]->in .= "\n\tstatic $var = array(" . $desc . ');'; |
|
| 676 | + $boucles[$idb]->in .= "\n\tstatic $var = array(".$desc.');'; |
|
| 678 | 677 | } |
| 679 | 678 | if ($desc) { |
| 680 | 679 | $alt = "(in_array(\$x, $var) ? $alt :(\$x$suffix))"; |
@@ -749,7 +748,7 @@ discard block |
||
| 749 | 748 | $sens = " . ' DESC'"; |
| 750 | 749 | } |
| 751 | 750 | if (isset($boucle->modificateur['collate'])) { |
| 752 | - $collecte = ' . ' . $boucle->modificateur['collate']; |
|
| 751 | + $collecte = ' . '.$boucle->modificateur['collate']; |
|
| 753 | 752 | } |
| 754 | 753 | |
| 755 | 754 | // Pour chaque paramètre du critère |
@@ -771,14 +770,14 @@ discard block |
||
| 771 | 770 | if (preg_match(',^(\w+)[\s]+(.*)$,', $par, $m)) { |
| 772 | 771 | $expression = trim($m[1]); |
| 773 | 772 | $champ = trim($m[2]); |
| 774 | - if (function_exists($f = 'calculer_critere_par_expression_' . $expression)) { |
|
| 773 | + if (function_exists($f = 'calculer_critere_par_expression_'.$expression)) { |
|
| 775 | 774 | $order = $f($idb, $boucles, $crit, $tri, $champ); |
| 776 | 775 | } else { |
| 777 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " $par"]]; |
|
| 776 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." $par"]]; |
|
| 778 | 777 | } |
| 779 | 778 | |
| 780 | 779 | // tris de la forme {par champ} ou {par FONCTION(champ)} |
| 781 | - } elseif ($boucle->type_requete == 'DATA' or preg_match(',^' . CHAMP_SQL_PLUS_FONC . '$,is', $par, $match)) { |
|
| 780 | + } elseif ($boucle->type_requete == 'DATA' or preg_match(',^'.CHAMP_SQL_PLUS_FONC.'$,is', $par, $match)) { |
|
| 782 | 781 | // {par FONCTION(champ)} |
| 783 | 782 | if (isset($match) and count($match) > 2) { |
| 784 | 783 | $par = substr($match[2], 1, -1); |
@@ -788,7 +787,7 @@ discard block |
||
| 788 | 787 | if ($par == 'hasard') { |
| 789 | 788 | $order = calculer_critere_par_hasard($idb, $boucles, $crit); |
| 790 | 789 | } elseif ($par == 'date' and !empty($boucle->show['date'])) { |
| 791 | - $order = "'" . $boucle->id_table . '.' . $boucle->show['date'] . "'"; |
|
| 790 | + $order = "'".$boucle->id_table.'.'.$boucle->show['date']."'"; |
|
| 792 | 791 | } else { |
| 793 | 792 | // cas général {par champ}, {par table.champ}, ... |
| 794 | 793 | $order = calculer_critere_par_champ($idb, $boucles, $crit, $par); |
@@ -797,7 +796,7 @@ discard block |
||
| 797 | 796 | |
| 798 | 797 | // on ne sait pas traiter… |
| 799 | 798 | else { |
| 800 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " $par"]]; |
|
| 799 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." $par"]]; |
|
| 801 | 800 | } |
| 802 | 801 | |
| 803 | 802 | // En cas d'erreur de squelette retournée par une fonction |
@@ -817,14 +816,14 @@ discard block |
||
| 817 | 816 | |
| 818 | 817 | if ($fct) { |
| 819 | 818 | if (preg_match("/^\s*'(.*)'\s*$/", $order, $r)) { |
| 820 | - $order = "'$fct(" . $r[1] . ")'"; |
|
| 819 | + $order = "'$fct(".$r[1].")'"; |
|
| 821 | 820 | } else { |
| 822 | 821 | $order = "'$fct(' . $order . ')'"; |
| 823 | 822 | } |
| 824 | 823 | } |
| 825 | - $t = $order . $collecte . $sens; |
|
| 824 | + $t = $order.$collecte.$sens; |
|
| 826 | 825 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 827 | - $t = $r[1] . $r[2]; |
|
| 826 | + $t = $r[1].$r[2]; |
|
| 828 | 827 | } |
| 829 | 828 | |
| 830 | 829 | $boucle->order[] = $t; |
@@ -874,16 +873,16 @@ discard block |
||
| 874 | 873 | function calculer_critere_par_expression_num($idb, &$boucles, $crit, $tri, $champ) { |
| 875 | 874 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 876 | 875 | if (is_array($_champ)) { |
| 877 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " num $champ"]]; |
|
| 876 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." num $champ"]]; |
|
| 878 | 877 | } |
| 879 | 878 | $boucle = &$boucles[$idb]; |
| 880 | - $texte = '0+' . $_champ; |
|
| 879 | + $texte = '0+'.$_champ; |
|
| 881 | 880 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 882 | 881 | if ($suite !== "''") { |
| 883 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . ' . "'; |
|
| 882 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')".' . "'; |
|
| 884 | 883 | } |
| 885 | - $asnum = 'num' . ($boucle->order ? count($boucle->order) : ''); |
|
| 886 | - $boucle->select[] = $texte . " AS $asnum"; |
|
| 884 | + $asnum = 'num'.($boucle->order ? count($boucle->order) : ''); |
|
| 885 | + $boucle->select[] = $texte." AS $asnum"; |
|
| 887 | 886 | |
| 888 | 887 | $orderassinum = calculer_critere_par_expression_sinum($idb, $boucles, $crit, $tri, $champ); |
| 889 | 888 | $orderassinum = trim($orderassinum, "'"); |
@@ -912,13 +911,13 @@ discard block |
||
| 912 | 911 | function calculer_critere_par_expression_sinum($idb, &$boucles, $crit, $tri, $champ) { |
| 913 | 912 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 914 | 913 | if (is_array($_champ)) { |
| 915 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " sinum $champ"]]; |
|
| 914 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." sinum $champ"]]; |
|
| 916 | 915 | } |
| 917 | 916 | $boucle = &$boucles[$idb]; |
| 918 | - $texte = '0+' . $_champ; |
|
| 917 | + $texte = '0+'.$_champ; |
|
| 919 | 918 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 920 | 919 | if ($suite !== "''") { |
| 921 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . ' . "'; |
|
| 920 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')".' . "'; |
|
| 922 | 921 | } |
| 923 | 922 | |
| 924 | 923 | $as = false; |
@@ -934,8 +933,8 @@ discard block |
||
| 934 | 933 | } |
| 935 | 934 | |
| 936 | 935 | if (!$as) { |
| 937 | - $as = 'sinum' . ($boucle->order ? count($boucle->order) : ''); |
|
| 938 | - $boucle->select[] = $select . $as; |
|
| 936 | + $as = 'sinum'.($boucle->order ? count($boucle->order) : ''); |
|
| 937 | + $boucle->select[] = $select.$as; |
|
| 939 | 938 | } |
| 940 | 939 | $order = "'$as'"; |
| 941 | 940 | return $order; |
@@ -960,10 +959,10 @@ discard block |
||
| 960 | 959 | function calculer_critere_par_expression_multi($idb, &$boucles, $crit, $tri, $champ) { |
| 961 | 960 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 962 | 961 | if (is_array($_champ)) { |
| 963 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " multi $champ"]]; |
|
| 962 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." multi $champ"]]; |
|
| 964 | 963 | } |
| 965 | 964 | $boucle = &$boucles[$idb]; |
| 966 | - $boucle->select[] = "\".sql_multi('" . $_champ . "', \$GLOBALS['spip_lang']).\""; |
|
| 965 | + $boucle->select[] = "\".sql_multi('".$_champ."', \$GLOBALS['spip_lang']).\""; |
|
| 967 | 966 | $order = "'multi'"; |
| 968 | 967 | return $order; |
| 969 | 968 | } |
@@ -989,7 +988,7 @@ discard block |
||
| 989 | 988 | |
| 990 | 989 | // le champ existe dans la table, pas de souci (le plus commun) |
| 991 | 990 | if (isset($desc['field'][$par])) { |
| 992 | - $par = $boucle->id_table . '.' . $par; |
|
| 991 | + $par = $boucle->id_table.'.'.$par; |
|
| 993 | 992 | } |
| 994 | 993 | // le champ est peut être une jointure |
| 995 | 994 | else { |
@@ -1010,24 +1009,24 @@ discard block |
||
| 1010 | 1009 | // Sinon on cherche le champ dans les tables possibles de jointures |
| 1011 | 1010 | // Si la table est déjà dans le from, on la réutilise. |
| 1012 | 1011 | if ($infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $table)) { |
| 1013 | - $par = $infos['alias'] . '.' . $champ; |
|
| 1012 | + $par = $infos['alias'].'.'.$champ; |
|
| 1014 | 1013 | } elseif ( |
| 1015 | 1014 | $boucle->jointures_explicites |
| 1016 | 1015 | and $alias = trouver_jointure_champ($champ, $boucle, explode(' ', $boucle->jointures_explicites), false, $table) |
| 1017 | 1016 | ) { |
| 1018 | - $par = $alias . '.' . $champ; |
|
| 1017 | + $par = $alias.'.'.$champ; |
|
| 1019 | 1018 | } elseif ($alias = trouver_jointure_champ($champ, $boucle, $boucle->jointures, false, $table)) { |
| 1020 | - $par = $alias . '.' . $champ; |
|
| 1019 | + $par = $alias.'.'.$champ; |
|
| 1021 | 1020 | // en spécifiant directement l'alias {par L2.titre} (situation hasardeuse tout de même) |
| 1022 | 1021 | } elseif ( |
| 1023 | 1022 | $table_alias |
| 1024 | 1023 | and isset($boucle->from[$table_alias]) |
| 1025 | 1024 | and $infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $boucle->from[$table_alias]) |
| 1026 | 1025 | ) { |
| 1027 | - $par = $infos['alias'] . '.' . $champ; |
|
| 1026 | + $par = $infos['alias'].'.'.$champ; |
|
| 1028 | 1027 | } elseif ($table) { |
| 1029 | 1028 | // On avait table + champ, mais on ne les a pas trouvés |
| 1030 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . " $par"]]; |
|
| 1029 | + return ['zbug_critere_inconnu', ['critere' => $crit->op." $par"]]; |
|
| 1031 | 1030 | } else { |
| 1032 | 1031 | // Sinon tant pis, ca doit etre un champ synthetise (cf points) |
| 1033 | 1032 | } |
@@ -1051,7 +1050,7 @@ discard block |
||
| 1051 | 1050 | if (!$t) { |
| 1052 | 1051 | $t = trouver_jointure_champ($champ, $boucle); |
| 1053 | 1052 | } |
| 1054 | - return !$t ? '' : ("'" . $t . '.' . $champ . "'"); |
|
| 1053 | + return !$t ? '' : ("'".$t.'.'.$champ."'"); |
|
| 1055 | 1054 | } |
| 1056 | 1055 | |
| 1057 | 1056 | /** |
@@ -1096,9 +1095,9 @@ discard block |
||
| 1096 | 1095 | $boucle->default_order[] = ' DESC'; |
| 1097 | 1096 | } |
| 1098 | 1097 | } else { |
| 1099 | - $t = $boucle->order[$n - 1] . " . $order"; |
|
| 1098 | + $t = $boucle->order[$n - 1]." . $order"; |
|
| 1100 | 1099 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 1101 | - $t = $r[1] . $r[2]; |
|
| 1100 | + $t = $r[1].$r[2]; |
|
| 1102 | 1101 | } |
| 1103 | 1102 | $boucle->order[$n - 1] = $t; |
| 1104 | 1103 | } |
@@ -1133,7 +1132,7 @@ discard block |
||
| 1133 | 1132 | $_order = array_pop($boucle->order); |
| 1134 | 1133 | |
| 1135 | 1134 | $_liste = calculer_liste($crit->param[1], [], $boucles, $boucles[$idb]->id_parent); |
| 1136 | - $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'" . $boucle->sql_serveur . "')) ? \$zl : '0').')'$sens"; |
|
| 1135 | + $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'".$boucle->sql_serveur."')) ? \$zl : '0').')'$sens"; |
|
| 1137 | 1136 | } |
| 1138 | 1137 | |
| 1139 | 1138 | |
@@ -1141,7 +1140,7 @@ discard block |
||
| 1141 | 1140 | $params = $crit->param; |
| 1142 | 1141 | |
| 1143 | 1142 | if ((is_countable($params) ? count($params) : 0) < 1) { |
| 1144 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]; |
|
| 1143 | + return ['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]; |
|
| 1145 | 1144 | } |
| 1146 | 1145 | |
| 1147 | 1146 | $boucle = &$boucles[$idb]; |
@@ -1162,7 +1161,7 @@ discard block |
||
| 1162 | 1161 | if (((is_countable($date) ? count($date) : 0) == 1) and ($date[0]->type == 'texte')) { |
| 1163 | 1162 | $date = $date[0]->texte; |
| 1164 | 1163 | if (!isset($fields[$date])) { |
| 1165 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . ' ' . $date]]; |
|
| 1164 | + return ['zbug_critere_inconnu', ['critere' => $crit->op.' '.$date]]; |
|
| 1166 | 1165 | } |
| 1167 | 1166 | } else { |
| 1168 | 1167 | $a = calculer_liste($date, $idb, $boucles, $parent); |
@@ -1174,38 +1173,38 @@ discard block |
||
| 1174 | 1173 | $date = "'.(($cond)\n?\$a:\"$defaut\").'"; |
| 1175 | 1174 | } |
| 1176 | 1175 | $annee = $params ? array_shift($params) : ''; |
| 1177 | - $annee = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1178 | - calculer_liste($annee, $idb, $boucles, $parent) . |
|
| 1176 | + $annee = "\n".'sprintf("%04d", ($x = '. |
|
| 1177 | + calculer_liste($annee, $idb, $boucles, $parent). |
|
| 1179 | 1178 | ') ? $x : date("Y"))'; |
| 1180 | 1179 | |
| 1181 | 1180 | $mois = $params ? array_shift($params) : ''; |
| 1182 | - $mois = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1183 | - calculer_liste($mois, $idb, $boucles, $parent) . |
|
| 1181 | + $mois = "\n".'sprintf("%02d", ($x = '. |
|
| 1182 | + calculer_liste($mois, $idb, $boucles, $parent). |
|
| 1184 | 1183 | ') ? $x : date("m"))'; |
| 1185 | 1184 | |
| 1186 | 1185 | $jour = $params ? array_shift($params) : ''; |
| 1187 | - $jour = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1188 | - calculer_liste($jour, $idb, $boucles, $parent) . |
|
| 1186 | + $jour = "\n".'sprintf("%02d", ($x = '. |
|
| 1187 | + calculer_liste($jour, $idb, $boucles, $parent). |
|
| 1189 | 1188 | ') ? $x : date("d"))'; |
| 1190 | 1189 | |
| 1191 | 1190 | $annee2 = $params ? array_shift($params) : ''; |
| 1192 | - $annee2 = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1193 | - calculer_liste($annee2, $idb, $boucles, $parent) . |
|
| 1191 | + $annee2 = "\n".'sprintf("%04d", ($x = '. |
|
| 1192 | + calculer_liste($annee2, $idb, $boucles, $parent). |
|
| 1194 | 1193 | ') ? $x : date("Y"))'; |
| 1195 | 1194 | |
| 1196 | 1195 | $mois2 = $params ? array_shift($params) : ''; |
| 1197 | - $mois2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1198 | - calculer_liste($mois2, $idb, $boucles, $parent) . |
|
| 1196 | + $mois2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1197 | + calculer_liste($mois2, $idb, $boucles, $parent). |
|
| 1199 | 1198 | ') ? $x : date("m"))'; |
| 1200 | 1199 | |
| 1201 | 1200 | $jour2 = $params ? array_shift($params) : ''; |
| 1202 | - $jour2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1203 | - calculer_liste($jour2, $idb, $boucles, $parent) . |
|
| 1201 | + $jour2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1202 | + calculer_liste($jour2, $idb, $boucles, $parent). |
|
| 1204 | 1203 | ') ? $x : date("d"))'; |
| 1205 | 1204 | |
| 1206 | - $date = $boucle->id_table . ".$date"; |
|
| 1205 | + $date = $boucle->id_table.".$date"; |
|
| 1207 | 1206 | |
| 1208 | - $quote_end = ",'" . $boucle->sql_serveur . "','text'"; |
|
| 1207 | + $quote_end = ",'".$boucle->sql_serveur."','text'"; |
|
| 1209 | 1208 | if ($type == 'jour') { |
| 1210 | 1209 | $boucle->where[] = [ |
| 1211 | 1210 | "'='", |
@@ -1277,14 +1276,13 @@ discard block |
||
| 1277 | 1276 | [$a21, $a22] = calculer_critere_parties_aux($idb, $boucles, $a2); |
| 1278 | 1277 | |
| 1279 | 1278 | if (($op == ',') && (is_numeric($a11) && (is_numeric($a21)))) { |
| 1280 | - $boucle->limit = $a11 . ',' . $a21; |
|
| 1279 | + $boucle->limit = $a11.','.$a21; |
|
| 1281 | 1280 | } else { |
| 1282 | 1281 | // 3 dans {1/3}, {2,3} ou {1,n-3} |
| 1283 | 1282 | $boucle->total_parties = ($a21 != 'n') ? $a21 : $a22; |
| 1284 | 1283 | // 2 dans {2/3}, {2,5}, {n-2,1} |
| 1285 | 1284 | $partie = ($a11 != 'n') ? $a11 : $a12; |
| 1286 | - $mode = (($op == '/') ? '/' : |
|
| 1287 | - (($a11 == 'n') ? '-' : '+') . (($a21 == 'n') ? '-' : '+')); |
|
| 1285 | + $mode = (($op == '/') ? '/' : (($a11 == 'n') ? '-' : '+').(($a21 == 'n') ? '-' : '+')); |
|
| 1288 | 1286 | // cas simple {0,#ENV{truc}} compilons le en LIMIT : |
| 1289 | 1287 | if ($a11 !== 'n' and $a21 !== 'n' and $mode == '++' and $op == ',') { |
| 1290 | 1288 | $boucle->limit = |
@@ -1330,8 +1328,7 @@ discard block |
||
| 1330 | 1328 | // {1/3} |
| 1331 | 1329 | if ($op1 == '/') { |
| 1332 | 1330 | $pmoins1 = is_numeric($debut) ? ($debut - 1) : "($debut-1)"; |
| 1333 | - $totpos = is_numeric($total_parties) ? ($total_parties) : |
|
| 1334 | - "($total_parties ? $total_parties : 1)"; |
|
| 1331 | + $totpos = is_numeric($total_parties) ? ($total_parties) : "($total_parties ? $total_parties : 1)"; |
|
| 1335 | 1332 | $fin = "ceil(($nombre_boucle * $debut )/$totpos) - 1"; |
| 1336 | 1333 | $debut = !$pmoins1 ? 0 : "ceil(($nombre_boucle * $pmoins1)/$totpos);"; |
| 1337 | 1334 | } else { |
@@ -1342,15 +1339,13 @@ discard block |
||
| 1342 | 1339 | |
| 1343 | 1340 | // cas {x,n-1} |
| 1344 | 1341 | if ($op2 == '-') { |
| 1345 | - $fin = '$debut_boucle + ' . $nombre_boucle . ' - ' |
|
| 1346 | - . (is_numeric($total_parties) ? ($total_parties + 1) : |
|
| 1347 | - ($total_parties . ' - 1')); |
|
| 1342 | + $fin = '$debut_boucle + '.$nombre_boucle.' - ' |
|
| 1343 | + . (is_numeric($total_parties) ? ($total_parties + 1) : ($total_parties.' - 1')); |
|
| 1348 | 1344 | } else { |
| 1349 | 1345 | // {x,1} ou {pagination} |
| 1350 | 1346 | $fin = '$debut_boucle' |
| 1351 | 1347 | . (is_numeric($total_parties) ? |
| 1352 | - (($total_parties == 1) ? '' : (' + ' . ($total_parties - 1))) : |
|
| 1353 | - ('+' . $total_parties . ' - 1')); |
|
| 1348 | + (($total_parties == 1) ? '' : (' + '.($total_parties - 1))) : ('+'.$total_parties.' - 1')); |
|
| 1354 | 1349 | } |
| 1355 | 1350 | |
| 1356 | 1351 | // {pagination}, gerer le debut_xx=-1 pour tout voir |
@@ -1368,11 +1363,11 @@ discard block |
||
| 1368 | 1363 | // Utiliser min pour rabattre $fin_boucle sur total_boucle. |
| 1369 | 1364 | |
| 1370 | 1365 | $boucles[$id_boucle]->mode_partie = "\n\t" |
| 1371 | - . '$debut_boucle = ' . $debut . ";\n " |
|
| 1366 | + . '$debut_boucle = '.$debut.";\n " |
|
| 1372 | 1367 | . "\$debut_boucle = intval(\$debut_boucle);\n " |
| 1373 | - . '$fin_boucle = min(' . $fin . ", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1374 | - . '$Numrows[\'' . $id_boucle . "']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1375 | - . '$Numrows[\'' . $id_boucle . '\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1368 | + . '$fin_boucle = min('.$fin.", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1369 | + . '$Numrows[\''.$id_boucle."']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1370 | + . '$Numrows[\''.$id_boucle.'\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1376 | 1371 | . "\n\tif (\$debut_boucle>0" |
| 1377 | 1372 | . " AND \$debut_boucle < \$Numrows['$id_boucle']['grand_total']" |
| 1378 | 1373 | . " AND \$iter->seek(\$debut_boucle,'continue'))" |
@@ -1457,16 +1452,16 @@ discard block |
||
| 1457 | 1452 | // critere personnalise ? |
| 1458 | 1453 | if ( |
| 1459 | 1454 | (!$serveur or |
| 1460 | - ((!function_exists($f = 'critere_' . $serveur . '_' . $table . '_' . $critere)) |
|
| 1461 | - and (!function_exists($f = $f . '_dist')) |
|
| 1462 | - and (!function_exists($f = 'critere_' . $serveur . '_' . $critere)) |
|
| 1463 | - and (!function_exists($f = $f . '_dist')) |
|
| 1455 | + ((!function_exists($f = 'critere_'.$serveur.'_'.$table.'_'.$critere)) |
|
| 1456 | + and (!function_exists($f = $f.'_dist')) |
|
| 1457 | + and (!function_exists($f = 'critere_'.$serveur.'_'.$critere)) |
|
| 1458 | + and (!function_exists($f = $f.'_dist')) |
|
| 1464 | 1459 | ) |
| 1465 | 1460 | ) |
| 1466 | - and (!function_exists($f = 'critere_' . $table . '_' . $critere)) |
|
| 1467 | - and (!function_exists($f = $f . '_dist')) |
|
| 1468 | - and (!function_exists($f = 'critere_' . $critere)) |
|
| 1469 | - and (!function_exists($f = $f . '_dist')) |
|
| 1461 | + and (!function_exists($f = 'critere_'.$table.'_'.$critere)) |
|
| 1462 | + and (!function_exists($f = $f.'_dist')) |
|
| 1463 | + and (!function_exists($f = 'critere_'.$critere)) |
|
| 1464 | + and (!function_exists($f = $f.'_dist')) |
|
| 1470 | 1465 | ) { |
| 1471 | 1466 | // fonction critere standard |
| 1472 | 1467 | $f = $defaut; |
@@ -1497,9 +1492,9 @@ discard block |
||
| 1497 | 1492 | */ |
| 1498 | 1493 | function kwote($lisp, $serveur = '', $type = '') { |
| 1499 | 1494 | if (preg_match(_CODE_QUOTE, $lisp, $r)) { |
| 1500 | - return $r[1] . '"' . sql_quote(str_replace(["\\'", '\\\\'], ["'", '\\'], $r[2]), $serveur, $type) . '"'; |
|
| 1495 | + return $r[1].'"'.sql_quote(str_replace(["\\'", '\\\\'], ["'", '\\'], $r[2]), $serveur, $type).'"'; |
|
| 1501 | 1496 | } else { |
| 1502 | - return "sql_quote($lisp, '$serveur', '" . str_replace("'", "\\'", $type) . "')"; |
|
| 1497 | + return "sql_quote($lisp, '$serveur', '".str_replace("'", "\\'", $type)."')"; |
|
| 1503 | 1498 | } |
| 1504 | 1499 | } |
| 1505 | 1500 | |
@@ -1521,7 +1516,7 @@ discard block |
||
| 1521 | 1516 | function critere_IN_dist($idb, &$boucles, $crit) { |
| 1522 | 1517 | $r = calculer_critere_infixe($idb, $boucles, $crit); |
| 1523 | 1518 | if (!$r) { |
| 1524 | - return (['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]); |
|
| 1519 | + return (['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]); |
|
| 1525 | 1520 | } |
| 1526 | 1521 | [$arg, $op, $val, $col, $where_complement] = $r; |
| 1527 | 1522 | |
@@ -1546,8 +1541,8 @@ discard block |
||
| 1546 | 1541 | "'NOT'", |
| 1547 | 1542 | [ |
| 1548 | 1543 | "'IN'", |
| 1549 | - "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", |
|
| 1550 | - ["'SELF'", "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", $where] |
|
| 1544 | + "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", |
|
| 1545 | + ["'SELF'", "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", $where] |
|
| 1551 | 1546 | ] |
| 1552 | 1547 | ]; |
| 1553 | 1548 | } |
@@ -1564,22 +1559,22 @@ discard block |
||
| 1564 | 1559 | $descr = $boucles[$idb]->descr; |
| 1565 | 1560 | $cpt = &$num[$descr['nom']][$descr['gram']][$idb]; |
| 1566 | 1561 | |
| 1567 | - $var = '$in' . $cpt++; |
|
| 1562 | + $var = '$in'.$cpt++; |
|
| 1568 | 1563 | $x = "\n\t$var = array();"; |
| 1569 | 1564 | foreach ($val as $k => $v) { |
| 1570 | 1565 | if (preg_match(",^(\n//.*\n)?'(.*)'$,", $v, $r)) { |
| 1571 | 1566 | // optimiser le traitement des constantes |
| 1572 | 1567 | if (is_numeric($r[2])) { |
| 1573 | - $x .= "\n\t$var" . "[]= $r[2];"; |
|
| 1568 | + $x .= "\n\t$var"."[]= $r[2];"; |
|
| 1574 | 1569 | } else { |
| 1575 | - $x .= "\n\t$var" . '[]= ' . sql_quote($r[2]) . ';'; |
|
| 1570 | + $x .= "\n\t$var".'[]= '.sql_quote($r[2]).';'; |
|
| 1576 | 1571 | } |
| 1577 | 1572 | } else { |
| 1578 | 1573 | // Pour permettre de passer des tableaux de valeurs |
| 1579 | 1574 | // on repere l'utilisation brute de #ENV**{X}, |
| 1580 | 1575 | // c'est-a-dire sa traduction en ($PILE[0][X]). |
| 1581 | 1576 | // et on deballe mais en rajoutant l'anti XSS |
| 1582 | - $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var" . "[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1577 | + $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var"."[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1583 | 1578 | } |
| 1584 | 1579 | } |
| 1585 | 1580 | |
@@ -1593,7 +1588,7 @@ discard block |
||
| 1593 | 1588 | $boucles[$idb]->default_order[] = "((!\$zqv=sql_quote($var) OR \$zqv===\"''\") ? 0 : ('FIELD($arg,' . \$zqv . ')'))"; |
| 1594 | 1589 | } |
| 1595 | 1590 | |
| 1596 | - return "sql_in('$arg', $var" . ($crit2 == 'NOT' ? ",'NOT'" : '') . ')'; |
|
| 1591 | + return "sql_in('$arg', $var".($crit2 == 'NOT' ? ",'NOT'" : '').')'; |
|
| 1597 | 1592 | } |
| 1598 | 1593 | |
| 1599 | 1594 | /** |
@@ -1666,7 +1661,7 @@ discard block |
||
| 1666 | 1661 | $champs = array_diff($champs, array_keys($boucle->modificateur['criteres'])); |
| 1667 | 1662 | } |
| 1668 | 1663 | // nous aider en mode debug. |
| 1669 | - $boucle->debug[] = 'id_ : ' . implode(', ', $champs); |
|
| 1664 | + $boucle->debug[] = 'id_ : '.implode(', ', $champs); |
|
| 1670 | 1665 | $boucle->modificateur['id_'] = $champs; |
| 1671 | 1666 | |
| 1672 | 1667 | // créer un critère {id_xxx?} de chaque champ retenu |
@@ -1917,8 +1912,8 @@ discard block |
||
| 1917 | 1912 | "'NOT'", |
| 1918 | 1913 | [ |
| 1919 | 1914 | "'IN'", |
| 1920 | - "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", |
|
| 1921 | - ["'SELF'", "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", $where] |
|
| 1915 | + "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", |
|
| 1916 | + ["'SELF'", "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", $where] |
|
| 1922 | 1917 | ] |
| 1923 | 1918 | ]; |
| 1924 | 1919 | } |
@@ -1929,7 +1924,7 @@ discard block |
||
| 1929 | 1924 | if ($crit->cond) { |
| 1930 | 1925 | $pred = calculer_argument_precedent($idb, $col, $boucles); |
| 1931 | 1926 | if ($col === 'date' or $col === 'date_redac') { |
| 1932 | - if ($pred === "\$Pile[0]['" . $col . "']") { |
|
| 1927 | + if ($pred === "\$Pile[0]['".$col."']") { |
|
| 1933 | 1928 | $pred = "(\$Pile[0]['{$col}_default']?'':$pred)"; |
| 1934 | 1929 | } |
| 1935 | 1930 | } |
@@ -2092,7 +2087,7 @@ discard block |
||
| 2092 | 2087 | // defaire le quote des int et les passer dans sql_quote avec le bon type de champ si on le connait, int sinon |
| 2093 | 2088 | // prendre en compte le debug ou la valeur arrive avec un commentaire PHP en debut |
| 2094 | 2089 | if (preg_match(",^\\A(\s*//.*?$\s*)?\"'(-?\d+)'\"\\z,ms", $val[0], $r)) { |
| 2095 | - $val[0] = $r[1] . '"' . sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote) . '"'; |
|
| 2090 | + $val[0] = $r[1].'"'.sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote).'"'; |
|
| 2096 | 2091 | } |
| 2097 | 2092 | // sinon expliciter les |
| 2098 | 2093 | // sql_quote(truc) en sql_quote(truc,'',type) |
@@ -2108,14 +2103,14 @@ discard block |
||
| 2108 | 2103 | ) { |
| 2109 | 2104 | $r = $r[1] |
| 2110 | 2105 | . ((isset($r[2]) and $r[2]) ? $r[2] : ",''") |
| 2111 | - . ",'" . addslashes($type_cast_quote) . "'"; |
|
| 2106 | + . ",'".addslashes($type_cast_quote)."'"; |
|
| 2112 | 2107 | $val[0] = "sql_quote($r)"; |
| 2113 | 2108 | } |
| 2114 | 2109 | elseif ( |
| 2115 | 2110 | strpos($val[0], '@@defaultcast@@') !== false |
| 2116 | 2111 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r) |
| 2117 | 2112 | ) { |
| 2118 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'" . addslashes($type_cast_quote) . "')"; |
|
| 2113 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'".addslashes($type_cast_quote)."')"; |
|
| 2119 | 2114 | } |
| 2120 | 2115 | } |
| 2121 | 2116 | |
@@ -2123,7 +2118,7 @@ discard block |
||
| 2123 | 2118 | strpos($val[0], '@@defaultcast@@') !== false |
| 2124 | 2119 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r) |
| 2125 | 2120 | ) { |
| 2126 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'char')"; |
|
| 2121 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'char')"; |
|
| 2127 | 2122 | } |
| 2128 | 2123 | |
| 2129 | 2124 | // Indicateur pour permettre aux fonctionx boucle_X de modifier |
@@ -2139,7 +2134,7 @@ discard block |
||
| 2139 | 2134 | // inserer le nom de la table SQL devant le nom du champ |
| 2140 | 2135 | if ($table) { |
| 2141 | 2136 | if ($col[0] == '`') { |
| 2142 | - $arg = "$table." . substr($col, 1, -1); |
|
| 2137 | + $arg = "$table.".substr($col, 1, -1); |
|
| 2143 | 2138 | } else { |
| 2144 | 2139 | $arg = "$table.$col"; |
| 2145 | 2140 | } |
@@ -2273,9 +2268,9 @@ discard block |
||
| 2273 | 2268 | **/ |
| 2274 | 2269 | function primary_doublee($decompose, $table) { |
| 2275 | 2270 | $e1 = reset($decompose); |
| 2276 | - $e2 = "sql_quote('" . end($decompose) . "')"; |
|
| 2271 | + $e2 = "sql_quote('".end($decompose)."')"; |
|
| 2277 | 2272 | |
| 2278 | - return ["'='", "'$table." . $e1 . "'", $e2]; |
|
| 2273 | + return ["'='", "'$table.".$e1."'", $e2]; |
|
| 2279 | 2274 | } |
| 2280 | 2275 | |
| 2281 | 2276 | /** |
@@ -2314,7 +2309,7 @@ discard block |
||
| 2314 | 2309 | $checkarrivee |
| 2315 | 2310 | and is_string($checkarrivee) |
| 2316 | 2311 | and $a = table_objet($checkarrivee) |
| 2317 | - and in_array($a . '_liens', $joints) |
|
| 2312 | + and in_array($a.'_liens', $joints) |
|
| 2318 | 2313 | ) { |
| 2319 | 2314 | if ($res = calculer_lien_externe_init($boucle, $joints, $col, $desc, $cond, $checkarrivee)) { |
| 2320 | 2315 | return $res; |
@@ -2334,12 +2329,12 @@ discard block |
||
| 2334 | 2329 | // la table est déjà dans le FROM, on vérifie si le champ est utilisé. |
| 2335 | 2330 | $joindre = false; |
| 2336 | 2331 | foreach ($cols as $col) { |
| 2337 | - $c = '/\b' . $t . ".$col" . '\b/'; |
|
| 2332 | + $c = '/\b'.$t.".$col".'\b/'; |
|
| 2338 | 2333 | if (trouver_champ($c, $boucle->where)) { |
| 2339 | 2334 | $joindre = true; |
| 2340 | 2335 | } else { |
| 2341 | 2336 | // mais ca peut etre dans le FIELD pour le Having |
| 2342 | - $c = "/FIELD.$t" . ".$col,/"; |
|
| 2337 | + $c = "/FIELD.$t".".$col,/"; |
|
| 2343 | 2338 | if (trouver_champ($c, $boucle->select)) { |
| 2344 | 2339 | $joindre = true; |
| 2345 | 2340 | } |
@@ -2385,7 +2380,7 @@ discard block |
||
| 2385 | 2380 | $primary_arrivee = id_table_objet($checkarrivee); |
| 2386 | 2381 | |
| 2387 | 2382 | // [FIXME] $checkarrivee peut-il arriver avec false ???? |
| 2388 | - $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee . '_liens'); |
|
| 2383 | + $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee.'_liens'); |
|
| 2389 | 2384 | $arrivee = trouver_champ_exterieur($col, $joints, $boucle, $checkarrivee); |
| 2390 | 2385 | |
| 2391 | 2386 | if (!$intermediaire or !$arrivee) { |
@@ -2489,7 +2484,7 @@ discard block |
||
| 2489 | 2484 | } elseif ($crit->cond and ($col == 'date' or $col == 'date_redac')) { |
| 2490 | 2485 | // un critere conditionnel sur date est traite a part |
| 2491 | 2486 | // car la date est mise d'office par SPIP, |
| 2492 | - $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['" . $col . "'])"; |
|
| 2487 | + $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['".$col."'])"; |
|
| 2493 | 2488 | } |
| 2494 | 2489 | |
| 2495 | 2490 | $val = calculer_argument_precedent($idb, $val, $boucles, $defaut); |
@@ -2521,7 +2516,7 @@ discard block |
||
| 2521 | 2516 | and (($p == "'") or ($p == '"')) |
| 2522 | 2517 | and $params[0][1]->type == 'champ' |
| 2523 | 2518 | ) { |
| 2524 | - $val[] = "$p\\$p#" . $params[0][1]->nom_champ . "\\$p$p"; |
|
| 2519 | + $val[] = "$p\\$p#".$params[0][1]->nom_champ."\\$p$p"; |
|
| 2525 | 2520 | } else { |
| 2526 | 2521 | foreach ((($op != 'IN') ? $params : calculer_vieux_in($params)) as $p) { |
| 2527 | 2522 | $a = calculer_liste($p, $idb, $boucles, $parent); |
@@ -2537,7 +2532,7 @@ discard block |
||
| 2537 | 2532 | $fct = $args_sql = ''; |
| 2538 | 2533 | // fonction SQL ? |
| 2539 | 2534 | // chercher FONCTION(champ) tel que CONCAT(titre,descriptif) |
| 2540 | - if (preg_match('/^(.*)' . SQL_ARGS . '$/', $col, $m)) { |
|
| 2535 | + if (preg_match('/^(.*)'.SQL_ARGS.'$/', $col, $m)) { |
|
| 2541 | 2536 | $fct = $m[1]; |
| 2542 | 2537 | preg_match('/^\(([^,]*)(.*)\)$/', $m[2], $a); |
| 2543 | 2538 | $col = $a[1]; |
@@ -2627,7 +2622,7 @@ discard block |
||
| 2627 | 2622 | # si oui choisir ce champ, sinon choisir xxxx |
| 2628 | 2623 | |
| 2629 | 2624 | if (isset($table['field']["date$suite"])) { |
| 2630 | - $date_orig = 'date' . $suite; |
|
| 2625 | + $date_orig = 'date'.$suite; |
|
| 2631 | 2626 | } else { |
| 2632 | 2627 | $date_orig = substr($suite, 1); |
| 2633 | 2628 | } |
@@ -2638,12 +2633,12 @@ discard block |
||
| 2638 | 2633 | } |
| 2639 | 2634 | } |
| 2640 | 2635 | |
| 2641 | - $date_compare = "\"' . normaliser_date(" . |
|
| 2642 | - calculer_argument_precedent($idb, $pred, $boucles) . |
|
| 2636 | + $date_compare = "\"' . normaliser_date(". |
|
| 2637 | + calculer_argument_precedent($idb, $pred, $boucles). |
|
| 2643 | 2638 | ") . '\""; |
| 2644 | 2639 | |
| 2645 | 2640 | $col_vraie = $date_orig; |
| 2646 | - $date_orig = $boucle->id_table . '.' . $date_orig; |
|
| 2641 | + $date_orig = $boucle->id_table.'.'.$date_orig; |
|
| 2647 | 2642 | |
| 2648 | 2643 | switch ($col) { |
| 2649 | 2644 | case 'date': |
@@ -2663,26 +2658,26 @@ discard block |
||
| 2663 | 2658 | break; |
| 2664 | 2659 | case 'age': |
| 2665 | 2660 | $col = calculer_param_date("\'' . date('Y-m-d H:i:00') . '\'", $date_orig); |
| 2666 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2661 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2667 | 2662 | break; |
| 2668 | 2663 | case 'age_relatif': |
| 2669 | 2664 | $col = calculer_param_date($date_compare, $date_orig); |
| 2670 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2665 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2671 | 2666 | break; |
| 2672 | 2667 | case 'jour_relatif': |
| 2673 | - $col = '(TO_DAYS(' . $date_compare . ')-TO_DAYS(' . $date_orig . '))'; |
|
| 2674 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2668 | + $col = '(TO_DAYS('.$date_compare.')-TO_DAYS('.$date_orig.'))'; |
|
| 2669 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2675 | 2670 | break; |
| 2676 | 2671 | case 'mois_relatif': |
| 2677 | - $col = 'MONTH(' . $date_compare . ')-MONTH(' . |
|
| 2678 | - $date_orig . ')+12*(YEAR(' . $date_compare . |
|
| 2679 | - ')-YEAR(' . $date_orig . '))'; |
|
| 2680 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2672 | + $col = 'MONTH('.$date_compare.')-MONTH('. |
|
| 2673 | + $date_orig.')+12*(YEAR('.$date_compare. |
|
| 2674 | + ')-YEAR('.$date_orig.'))'; |
|
| 2675 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2681 | 2676 | break; |
| 2682 | 2677 | case 'annee_relatif': |
| 2683 | - $col = 'YEAR(' . $date_compare . ')-YEAR(' . |
|
| 2684 | - $date_orig . ')'; |
|
| 2685 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2678 | + $col = 'YEAR('.$date_compare.')-YEAR('. |
|
| 2679 | + $date_orig.')'; |
|
| 2680 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2686 | 2681 | break; |
| 2687 | 2682 | } |
| 2688 | 2683 | |
@@ -2743,10 +2738,10 @@ discard block |
||
| 2743 | 2738 | } |
| 2744 | 2739 | |
| 2745 | 2740 | $boucle->hash .= ' |
| 2746 | - $command[\'sourcemode\'] = ' . array_shift($args) . ";\n"; |
|
| 2741 | + $command[\'sourcemode\'] = ' . array_shift($args).";\n"; |
|
| 2747 | 2742 | |
| 2748 | 2743 | $boucle->hash .= ' |
| 2749 | - $command[\'source\'] = array(' . join(', ', $args) . ");\n"; |
|
| 2744 | + $command[\'source\'] = array(' . join(', ', $args).");\n"; |
|
| 2750 | 2745 | } |
| 2751 | 2746 | |
| 2752 | 2747 | /** |
@@ -2765,7 +2760,7 @@ discard block |
||
| 2765 | 2760 | function critere_DATA_datacache_dist($idb, &$boucles, $crit) { |
| 2766 | 2761 | $boucle = &$boucles[$idb]; |
| 2767 | 2762 | $boucle->hash .= ' |
| 2768 | - $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2763 | + $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2769 | 2764 | } |
| 2770 | 2765 | |
| 2771 | 2766 | |
@@ -2784,7 +2779,7 @@ discard block |
||
| 2784 | 2779 | $boucle->hash .= '$command[\'args\']=array();'; |
| 2785 | 2780 | foreach ($crit->param as $param) { |
| 2786 | 2781 | $boucle->hash .= ' |
| 2787 | - $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2782 | + $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2788 | 2783 | } |
| 2789 | 2784 | } |
| 2790 | 2785 | |
@@ -2803,14 +2798,14 @@ discard block |
||
| 2803 | 2798 | */ |
| 2804 | 2799 | function critere_DATA_liste_dist($idb, &$boucles, $crit) { |
| 2805 | 2800 | $boucle = &$boucles[$idb]; |
| 2806 | - $boucle->hash .= "\n\t" . '$command[\'liste\'] = array();' . "\n"; |
|
| 2801 | + $boucle->hash .= "\n\t".'$command[\'liste\'] = array();'."\n"; |
|
| 2807 | 2802 | foreach ($crit->param as $param) { |
| 2808 | - $boucle->hash .= "\t" . '$command[\'liste\'][] = ' . calculer_liste( |
|
| 2803 | + $boucle->hash .= "\t".'$command[\'liste\'][] = '.calculer_liste( |
|
| 2809 | 2804 | $param, |
| 2810 | 2805 | $idb, |
| 2811 | 2806 | $boucles, |
| 2812 | 2807 | $boucles[$idb]->id_parent |
| 2813 | - ) . ";\n"; |
|
| 2808 | + ).";\n"; |
|
| 2814 | 2809 | } |
| 2815 | 2810 | } |
| 2816 | 2811 | |
@@ -2837,14 +2832,14 @@ discard block |
||
| 2837 | 2832 | */ |
| 2838 | 2833 | function critere_DATA_enum_dist($idb, &$boucles, $crit) { |
| 2839 | 2834 | $boucle = &$boucles[$idb]; |
| 2840 | - $boucle->hash .= "\n\t" . '$command[\'enum\'] = array();' . "\n"; |
|
| 2835 | + $boucle->hash .= "\n\t".'$command[\'enum\'] = array();'."\n"; |
|
| 2841 | 2836 | foreach ($crit->param as $param) { |
| 2842 | - $boucle->hash .= "\t" . '$command[\'enum\'][] = ' . calculer_liste( |
|
| 2837 | + $boucle->hash .= "\t".'$command[\'enum\'][] = '.calculer_liste( |
|
| 2843 | 2838 | $param, |
| 2844 | 2839 | $idb, |
| 2845 | 2840 | $boucles, |
| 2846 | 2841 | $boucles[$idb]->id_parent |
| 2847 | - ) . ";\n"; |
|
| 2842 | + ).";\n"; |
|
| 2848 | 2843 | } |
| 2849 | 2844 | } |
| 2850 | 2845 | |
@@ -2863,7 +2858,7 @@ discard block |
||
| 2863 | 2858 | $boucle = &$boucles[$idb]; |
| 2864 | 2859 | foreach ($crit->param as $param) { |
| 2865 | 2860 | $boucle->hash .= ' |
| 2866 | - $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2861 | + $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2867 | 2862 | } |
| 2868 | 2863 | } |
| 2869 | 2864 | |
@@ -2904,7 +2899,7 @@ discard block |
||
| 2904 | 2899 | if ($crit->param) { |
| 2905 | 2900 | foreach ($crit->param as $param) { |
| 2906 | 2901 | $boucle->hash .= "\t\$command['si'][] = " |
| 2907 | - . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ";\n"; |
|
| 2902 | + . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).";\n"; |
|
| 2908 | 2903 | } |
| 2909 | 2904 | // interdire {si 0} aussi ! |
| 2910 | 2905 | } else { |
@@ -2928,7 +2923,7 @@ discard block |
||
| 2928 | 2923 | function critere_POUR_tableau_dist($idb, &$boucles, $crit) { |
| 2929 | 2924 | $boucle = &$boucles[$idb]; |
| 2930 | 2925 | $boucle->hash .= ' |
| 2931 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2926 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).'); |
|
| 2932 | 2927 | $command[\'sourcemode\'] = \'table\';'; |
| 2933 | 2928 | } |
| 2934 | 2929 | |
@@ -2963,7 +2958,7 @@ discard block |
||
| 2963 | 2958 | $id_parent = $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] ?? 'id_parent'; |
| 2964 | 2959 | |
| 2965 | 2960 | $in = 'IN'; |
| 2966 | - $where = ["'IN'", "'$boucle->id_table." . "$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"]; |
|
| 2961 | + $where = ["'IN'", "'$boucle->id_table."."$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"]; |
|
| 2967 | 2962 | if ($not) { |
| 2968 | 2963 | $where = ["'NOT'", $where]; |
| 2969 | 2964 | } |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | foreach ($debug['sourcefile'] as $k => $v) { |
| 103 | 103 | if (strpos($v, 'administration.') !== false) { |
| 104 | - if (isset($debug['resultat'][$k . 'tout'])) { |
|
| 105 | - return $debug['resultat'][$k . 'tout']; |
|
| 104 | + if (isset($debug['resultat'][$k.'tout'])) { |
|
| 105 | + return $debug['resultat'][$k.'tout']; |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | and $id = intval($id) |
| 181 | 181 | and $desc = $trouver_table(table_objet_sql($type)) |
| 182 | 182 | ) { |
| 183 | - $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id)); |
|
| 183 | + $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=".intval($id)); |
|
| 184 | 184 | if ($id) { |
| 185 | 185 | $env[$_id_type] = $id; |
| 186 | 186 | $env['objet'] = $type; |
| 187 | 187 | $env['id_objet'] = $id; |
| 188 | - $env['voir_' . $obj] = |
|
| 188 | + $env['voir_'.$obj] = |
|
| 189 | 189 | str_replace('&', '&', generer_objet_url($id, $obj, '', '', false)); |
| 190 | 190 | if ( |
| 191 | 191 | isset($desc['field']['id_rubrique']) |
@@ -239,10 +239,10 @@ discard block |
||
| 239 | 239 | $notpub = sql_in('statut', ['prop', 'prive']); |
| 240 | 240 | |
| 241 | 241 | if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') { |
| 242 | - $notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ')'; |
|
| 242 | + $notpub .= " OR (statut='publie' AND date>".sql_quote(date('Y-m-d H:i:s')).')'; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . '=' . $id . " AND ($notpub)"); |
|
| 245 | + return sql_fetsel('1', table_objet_sql($type), id_table_objet($type).'='.$id." AND ($notpub)"); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | $alang = ''; |
| 257 | 257 | if (!empty($_COOKIE['spip_admin'])) { |
| 258 | 258 | $email_or_login = preg_replace(',^@,', '', $_COOKIE['spip_admin']); |
| 259 | - $alang = sql_getfetsel('lang', 'spip_auteurs', 'email=' . sql_quote($email_or_login)); |
|
| 259 | + $alang = sql_getfetsel('lang', 'spip_auteurs', 'email='.sql_quote($email_or_login)); |
|
| 260 | 260 | if (!$alang) { |
| 261 | - $alang = sql_getfetsel('lang', 'spip_auteurs', 'login=' . sql_quote($email_or_login)); |
|
| 261 | + $alang = sql_getfetsel('lang', 'spip_auteurs', 'login='.sql_quote($email_or_login)); |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | if (!$alang) { |
@@ -283,9 +283,8 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ? |
| 285 | 285 | (parametre_url(self(), 'var_mode', 'debug', '&') |
| 286 | - . '&var_mode_affiche=validation') : |
|
| 287 | - ('http://validator.w3.org/check?uri=' |
|
| 288 | - . rawurlencode('http://' . $_SERVER['HTTP_HOST'] . nettoyer_uri()))); |
|
| 286 | + . '&var_mode_affiche=validation') : ('http://validator.w3.org/check?uri=' |
|
| 287 | + . rawurlencode('http://'.$_SERVER['HTTP_HOST'].nettoyer_uri()))); |
|
| 289 | 288 | } |
| 290 | 289 | |
| 291 | 290 | /** |
@@ -54,12 +54,12 @@ |
||
| 54 | 54 | $_params = '['; |
| 55 | 55 | $nb_params = is_countable($p->param[0]) ? count($p->param[0]) : 0; // 1ère valeur vide donc 1 en plus |
| 56 | 56 | for ($i = 3; $i < $nb_params; $i++) { |
| 57 | - $_params .= interprete_argument_balise($i, $p) . ','; |
|
| 57 | + $_params .= interprete_argument_balise($i, $p).','; |
|
| 58 | 58 | } |
| 59 | 59 | $_params .= ']'; |
| 60 | 60 | |
| 61 | 61 | $info_sql = strtolower(substr($info, 5)); |
| 62 | - $code = "generer_objet_info($id_objet, $type_objet, '$info_sql', " . ($p->etoile ? _q($p->etoile) : "''") . ", $_params)"; |
|
| 62 | + $code = "generer_objet_info($id_objet, $type_objet, '$info_sql', ".($p->etoile ? _q($p->etoile) : "''").", $_params)"; |
|
| 63 | 63 | $p->code = champ_sql($info, $p, $code); |
| 64 | 64 | $p->interdire_scripts = true; |
| 65 | 65 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | # attention toutefois seuls '' et '=' figurent dans les modes de compatibilite |
| 24 | 24 | define('_separateur_urls_page', ''); |
| 25 | 25 | # on peut indiquer '' si on a installe le .htaccess |
| 26 | -define('_debut_urls_page', get_spip_script('./') . '?'); |
|
| 26 | +define('_debut_urls_page', get_spip_script('./').'?'); |
|
| 27 | 27 | ####### |
| 28 | 28 | |
| 29 | 29 | |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $url = \_debut_urls_page . $objet . \_separateur_urls_page |
|
| 50 | - . $id . \_terminaison_urls_page; |
|
| 49 | + $url = \_debut_urls_page.$objet.\_separateur_urls_page |
|
| 50 | + . $id.\_terminaison_urls_page; |
|
| 51 | 51 | |
| 52 | 52 | if ($args) { |
| 53 | 53 | $args = strpos($url, '?') ? "&$args" : "?$args"; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
|
| 56 | + return _DIR_RACINE.$url.$args.($ancre ? "#$ancre" : ''); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $result = sql_select( |
| 44 | 44 | 'id_rubrique, id_parent, titre, descriptif, lang', |
| 45 | 45 | 'spip_rubriques', |
| 46 | - 'id_parent=' . intval($collection), |
|
| 46 | + 'id_parent='.intval($collection), |
|
| 47 | 47 | '', |
| 48 | 48 | '0+titre,titre', |
| 49 | 49 | "$debut,$limite" |
@@ -74,19 +74,18 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : |
|
| 78 | - http_img_pack( |
|
| 77 | + $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : http_img_pack( |
|
| 79 | 78 | 'auteur-0minirezo-16.png', |
| 80 | 79 | '', |
| 81 | 80 | " width='16' height='16'", |
| 82 | 81 | _T('image_administrer_rubrique') |
| 83 | - )) . |
|
| 84 | - " <a class='titremlien' dir='$lang_dir'" . |
|
| 85 | - ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') . |
|
| 86 | - " href='" . |
|
| 87 | - generer_objet_url($id_rubrique, 'rubrique') . |
|
| 88 | - "'><span class='titre'>" . |
|
| 89 | - $rang . $titre |
|
| 82 | + )). |
|
| 83 | + " <a class='titremlien' dir='$lang_dir'". |
|
| 84 | + ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='".$row['lang']."'" : ''). |
|
| 85 | + " href='". |
|
| 86 | + generer_objet_url($id_rubrique, 'rubrique'). |
|
| 87 | + "'><span class='titre'>". |
|
| 88 | + $rang.$titre |
|
| 90 | 89 | . '</span>' |
| 91 | 90 | . (is_string($logo) ? $logo : '') |
| 92 | 91 | . '</a>'; |
@@ -96,8 +95,8 @@ discard block |
||
| 96 | 95 | ; |
| 97 | 96 | |
| 98 | 97 | $res[] = |
| 99 | - debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) . |
|
| 100 | - $les_sous_enfants . |
|
| 98 | + debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre). |
|
| 99 | + $les_sous_enfants. |
|
| 101 | 100 | fin_cadre_sous_rub(); |
| 102 | 101 | } |
| 103 | 102 | } |
@@ -116,7 +115,7 @@ discard block |
||
| 116 | 115 | * Le contenu du bloc dépliable |
| 117 | 116 | */ |
| 118 | 117 | function sous_enfant_rub($collection2) { |
| 119 | - $nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($collection2)); |
|
| 118 | + $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($collection2)); |
|
| 120 | 119 | |
| 121 | 120 | $retour = ''; |
| 122 | 121 | $pagination = ''; |
@@ -128,23 +127,23 @@ discard block |
||
| 128 | 127 | * Si > 500 on affiche une pagination |
| 129 | 128 | */ |
| 130 | 129 | if ($nb > $limite) { |
| 131 | - $debut = _request('debut_rubrique' . $collection2) ?: $debut; |
|
| 130 | + $debut = _request('debut_rubrique'.$collection2) ?: $debut; |
|
| 132 | 131 | $pagination = chercher_filtre('pagination'); |
| 133 | - $pagination = '<p class="pagination">' . $pagination( |
|
| 132 | + $pagination = '<p class="pagination">'.$pagination( |
|
| 134 | 133 | $nb, |
| 135 | - '_rubrique' . $collection2, |
|
| 134 | + '_rubrique'.$collection2, |
|
| 136 | 135 | $debut, |
| 137 | 136 | $limite, |
| 138 | 137 | true, |
| 139 | 138 | 'prive' |
| 140 | - ) . '</p>'; |
|
| 139 | + ).'</p>'; |
|
| 141 | 140 | $limite = $debut + $limite; |
| 142 | 141 | } |
| 143 | 142 | |
| 144 | 143 | $result = sql_select( |
| 145 | 144 | 'id_rubrique, id_parent, titre, lang', |
| 146 | 145 | 'spip_rubriques', |
| 147 | - 'id_parent=' . intval($collection2), |
|
| 146 | + 'id_parent='.intval($collection2), |
|
| 148 | 147 | '', |
| 149 | 148 | '0+titre,titre', |
| 150 | 149 | "$debut,$limite" |
@@ -164,14 +163,14 @@ discard block |
||
| 164 | 163 | changer_typo($row['lang']); |
| 165 | 164 | $lang_dir = lang_dir($row['lang']); |
| 166 | 165 | if (autoriser('voir', 'rubrique', $id_rubrique2)) { |
| 167 | - $retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_objet_url( |
|
| 166 | + $retour .= "\n<li class='item' dir='$lang_dir'><a href='".generer_objet_url( |
|
| 168 | 167 | $id_rubrique2, |
| 169 | 168 | 'rubrique' |
| 170 | - ) . "'>" . $rang2 . $titre2 . "</a></li>\n"; |
|
| 169 | + )."'>".$rang2.$titre2."</a></li>\n"; |
|
| 171 | 170 | } |
| 172 | 171 | } |
| 173 | 172 | |
| 174 | - $retour = $pagination . $retour . $pagination; |
|
| 173 | + $retour = $pagination.$retour.$pagination; |
|
| 175 | 174 | |
| 176 | 175 | if (!$retour) { |
| 177 | 176 | return ''; |
@@ -180,7 +179,7 @@ discard block |
||
| 180 | 179 | return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2") |
| 181 | 180 | . "\n<ul class='liste-items sous-sous-rub'>\n" |
| 182 | 181 | . $retour |
| 183 | - . "</ul>\n" . fin_block() . "\n\n"; |
|
| 182 | + . "</ul>\n".fin_block()."\n\n"; |
|
| 184 | 183 | } |
| 185 | 184 | |
| 186 | 185 | /** |
@@ -199,13 +198,13 @@ discard block |
||
| 199 | 198 | $debut = 0; |
| 200 | 199 | $limite = 500; |
| 201 | 200 | |
| 202 | - $nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($id_rubrique)); |
|
| 201 | + $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique)); |
|
| 203 | 202 | |
| 204 | 203 | if ($nb > $limite) { |
| 205 | - $debut = _request('debut_rubrique' . $id_rubrique) ?: $debut; |
|
| 204 | + $debut = _request('debut_rubrique'.$id_rubrique) ?: $debut; |
|
| 206 | 205 | $pagination = chercher_filtre('pagination'); |
| 207 | - $pagination = '<br class="nettoyeur"><p class="pagination">' . |
|
| 208 | - $pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') . |
|
| 206 | + $pagination = '<br class="nettoyeur"><p class="pagination">'. |
|
| 207 | + $pagination($nb, '_rubrique'.$id_rubrique, $debut, $limite, true, 'prive'). |
|
| 209 | 208 | '</p>'; |
| 210 | 209 | } |
| 211 | 210 | |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | // on renvoi un 401 qui fait echouer la requete ajax silencieusement |
| 40 | 40 | if (!autoriser('ecrire')) { |
| 41 | 41 | $retour = |
| 42 | - '<ul class="deroulant__sous-menu" data-profondeur="1">' . |
|
| 43 | - '<li class="deroulant__item deroulant__item_plan plan_site" data-profondeur="1">' . |
|
| 44 | - '<a class="deroulant__lien" href="' . generer_url_ecrire('accueil') . '" data-profondeur="1">' . |
|
| 45 | - '<span class="libelle">' . _T('public:lien_connecter') . '</span>' . |
|
| 46 | - '</a>' . |
|
| 47 | - '</li>' . |
|
| 42 | + '<ul class="deroulant__sous-menu" data-profondeur="1">'. |
|
| 43 | + '<li class="deroulant__item deroulant__item_plan plan_site" data-profondeur="1">'. |
|
| 44 | + '<a class="deroulant__lien" href="'.generer_url_ecrire('accueil').'" data-profondeur="1">'. |
|
| 45 | + '<span class="libelle">'._T('public:lien_connecter').'</span>'. |
|
| 46 | + '</a>'. |
|
| 47 | + '</li>'. |
|
| 48 | 48 | '</ul>'; |
| 49 | 49 | include_spip('inc/actions'); |
| 50 | 50 | ajax_retour($retour); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | if ($date = intval(_request('date'))) { |
| 55 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $date) . ' GMT'); |
|
| 55 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s', $date).' GMT'); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $r = gen_liste_rubriques(); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | and !strstr($_SERVER['SERVER_SOFTWARE'], 'IIS/') |
| 63 | 63 | ) { |
| 64 | 64 | include_spip('inc/headers'); |
| 65 | - header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']); |
|
| 65 | + header('Content-Type: text/html; charset='.$GLOBALS['meta']['charset']); |
|
| 66 | 66 | http_response_code(304); |
| 67 | 67 | exit; |
| 68 | 68 | } else { |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | **/ |
| 86 | 86 | function menu_rubriques($complet = true) { |
| 87 | 87 | $ret = '<li class="deroulant__item deroulant__item_tout toutsite" data-profondeur="1">' |
| 88 | - . '<a class="deroulant__lien" href="' . generer_url_ecrire('plan') . '" data-profondeur="1">' |
|
| 89 | - . '<span class="libelle">' . _T('info_tout_site') . '</span>' |
|
| 88 | + . '<a class="deroulant__lien" href="'.generer_url_ecrire('plan').'" data-profondeur="1">' |
|
| 89 | + . '<span class="libelle">'._T('info_tout_site').'</span>' |
|
| 90 | 90 | . '</a>' |
| 91 | 91 | . '</li>'; |
| 92 | 92 | |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | static $zmax = 6; |
| 146 | 146 | $profondeur_next = $profondeur + 1; |
| 147 | 147 | |
| 148 | - $nav = '<a class="deroulant__lien" href="' . generer_objet_url($id_rubrique, 'rubrique', '', '', false) . "\" data-profondeur=\"$profondeur\">" |
|
| 149 | - . '<span class="libelle">' . supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)) . '</span>' |
|
| 148 | + $nav = '<a class="deroulant__lien" href="'.generer_objet_url($id_rubrique, 'rubrique', '', '', false)."\" data-profondeur=\"$profondeur\">" |
|
| 149 | + . '<span class="libelle">'.supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)).'</span>' |
|
| 150 | 150 | . "</a>\n"; |
| 151 | 151 | |
| 152 | 152 | // Limiter volontairement le nombre de sous-menus |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | $link = @mysqli_connect($host, $login, $pass); |
| 59 | 59 | } |
| 60 | 60 | } catch (\mysqli_sql_exception $e) { |
| 61 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 61 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 62 | 62 | $link = false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (!$link) { |
| 66 | - spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS); |
|
| 66 | + spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS); |
|
| 67 | 67 | |
| 68 | 68 | return false; |
| 69 | 69 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | spip_log( |
| 85 | - "Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? 'operationnelle' : 'impossible'), |
|
| 85 | + "Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? 'operationnelle' : 'impossible'), |
|
| 86 | 86 | _LOG_DEBUG |
| 87 | 87 | ); |
| 88 | 88 | |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) { |
| 175 | 175 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 176 | - spip_log('changement de charset sql : ' . 'SET NAMES ' . _q($charset), _LOG_DEBUG); |
|
| 176 | + spip_log('changement de charset sql : '.'SET NAMES '._q($charset), _LOG_DEBUG); |
|
| 177 | 177 | |
| 178 | - return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES ' . _q($charset)); |
|
| 178 | + return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES '._q($charset)); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | function spip_mysql_get_charset($charset = [], $serveur = '', $requeter = true) { |
| 191 | 191 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 192 | 192 | $connexion['last'] = $c = 'SHOW CHARACTER SET' |
| 193 | - . (!$charset ? '' : (' LIKE ' . _q($charset['charset']))); |
|
| 193 | + . (!$charset ? '' : (' LIKE '._q($charset['charset']))); |
|
| 194 | 194 | |
| 195 | 195 | return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur); |
| 196 | 196 | } |
@@ -234,21 +234,21 @@ discard block |
||
| 234 | 234 | $debug = ''; |
| 235 | 235 | if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) { |
| 236 | 236 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 237 | - [, $id, , $infos] = $GLOBALS['debug']['aucasou']; |
|
| 238 | - $debug .= "BOUCLE$id @ " . ($infos[0] ?? '') . ' | '; |
|
| 237 | + [, $id,, $infos] = $GLOBALS['debug']['aucasou']; |
|
| 238 | + $debug .= "BOUCLE$id @ ".($infos[0] ?? '').' | '; |
|
| 239 | 239 | } |
| 240 | 240 | if (isset($_SERVER['REQUEST_URI'])) { |
| 241 | 241 | $debug .= $_SERVER['REQUEST_URI']; |
| 242 | 242 | } |
| 243 | 243 | if (!empty($GLOBALS['ip'])) { |
| 244 | - $debug .= ' + ' . $GLOBALS['ip']; |
|
| 244 | + $debug .= ' + '.$GLOBALS['ip']; |
|
| 245 | 245 | } |
| 246 | - $debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */'; |
|
| 246 | + $debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */'; |
|
| 247 | 247 | } |
| 248 | 248 | try { |
| 249 | - $r = mysqli_query($link, $query . $debug); |
|
| 249 | + $r = mysqli_query($link, $query.$debug); |
|
| 250 | 250 | } catch (\mysqli_sql_exception $e) { |
| 251 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 251 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 252 | 252 | $r = false; |
| 253 | 253 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 254 | 254 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | $link = $connexion['link']; |
| 267 | 267 | //On retente au cas où |
| 268 | 268 | try { |
| 269 | - $r = mysqli_query($link, $query . $debug); |
|
| 269 | + $r = mysqli_query($link, $query.$debug); |
|
| 270 | 270 | } catch (\mysqli_sql_exception $e) { |
| 271 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 271 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 272 | 272 | $r = false; |
| 273 | 273 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 274 | 274 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | // d'utiliser ceux-ci, copie-colle de phpmyadmin |
| 302 | 302 | $query = preg_replace(',^TABLE\s*`([^`]*)`,i', "TABLE \\1", $query); |
| 303 | 303 | |
| 304 | - return spip_mysql_query('ALTER ' . $query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 304 | + return spip_mysql_query('ALTER '.$query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @return bool Toujours true |
| 315 | 315 | */ |
| 316 | 316 | function spip_mysql_optimize($table, $serveur = '', $requeter = true) { |
| 317 | - spip_mysql_query('OPTIMIZE TABLE ' . $table); |
|
| 317 | + spip_mysql_query('OPTIMIZE TABLE '.$table); |
|
| 318 | 318 | |
| 319 | 319 | return true; |
| 320 | 320 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $link = $connexion['link']; |
| 338 | 338 | $db = $connexion['db']; |
| 339 | 339 | |
| 340 | - $query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe); |
|
| 340 | + $query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe); |
|
| 341 | 341 | $r = mysqli_query($link, $query); |
| 342 | 342 | |
| 343 | 343 | return spip_mysql_fetch($r, null, $serveur); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | . calculer_mysql_expression('WHERE', $where) |
| 389 | 389 | . calculer_mysql_expression('GROUP BY', $groupby, ',') |
| 390 | 390 | . calculer_mysql_expression('HAVING', $having) |
| 391 | - . ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '') |
|
| 391 | + . ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '') |
|
| 392 | 392 | . ($limit ? "\nLIMIT $limit" : ''); |
| 393 | 393 | |
| 394 | 394 | // renvoyer la requete inerte si demandee |
@@ -478,12 +478,12 @@ discard block |
||
| 478 | 478 | $exp = "\n$expression "; |
| 479 | 479 | |
| 480 | 480 | if (!is_array($v)) { |
| 481 | - return $exp . $v; |
|
| 481 | + return $exp.$v; |
|
| 482 | 482 | } else { |
| 483 | 483 | if (strtoupper($join) === 'AND') { |
| 484 | - return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 484 | + return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 485 | 485 | } else { |
| 486 | - return $exp . join($join, $v); |
|
| 486 | + return $exp.join($join, $v); |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -501,17 +501,17 @@ discard block |
||
| 501 | 501 | if (substr($k, -1) == '@') { |
| 502 | 502 | // c'est une jointure qui se refere au from precedent |
| 503 | 503 | // pas de virgule |
| 504 | - $res .= ' ' . $v; |
|
| 504 | + $res .= ' '.$v; |
|
| 505 | 505 | } else { |
| 506 | 506 | if (!is_numeric($k)) { |
| 507 | 507 | $p = strpos($v, ' '); |
| 508 | 508 | if ($p) { |
| 509 | - $v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p); |
|
| 509 | + $v = substr($v, 0, $p)." AS `$k`".substr($v, $p); |
|
| 510 | 510 | } else { |
| 511 | 511 | $v .= " AS `$k`"; |
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | - $res .= ', ' . $v; |
|
| 514 | + $res .= ', '.$v; |
|
| 515 | 515 | } |
| 516 | 516 | } |
| 517 | 517 | |
@@ -541,13 +541,13 @@ discard block |
||
| 541 | 541 | function _mysql_traite_query($query, $db = '', $prefixe = '', $echappe_textes = true) { |
| 542 | 542 | |
| 543 | 543 | if ($GLOBALS['mysql_rappel_nom_base'] and $db) { |
| 544 | - $pref = '`' . $db . '`.'; |
|
| 544 | + $pref = '`'.$db.'`.'; |
|
| 545 | 545 | } else { |
| 546 | 546 | $pref = ''; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | if ($prefixe) { |
| 550 | - $pref .= $prefixe . '_'; |
|
| 550 | + $pref .= $prefixe.'_'; |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) { |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | $suite_echap = $suite; |
| 567 | 567 | } |
| 568 | 568 | if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite_echap, $r)) { |
| 569 | - $suite_echap = $r[1] . _mysql_traite_query($r[2], $db, $prefixe, false); |
|
| 569 | + $suite_echap = $r[1]._mysql_traite_query($r[2], $db, $prefixe, false); |
|
| 570 | 570 | if ($echappe_textes) { |
| 571 | 571 | $suite = query_reinjecte_textes($suite_echap, $textes); |
| 572 | 572 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | } |
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | - $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite; |
|
| 579 | + $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite; |
|
| 580 | 580 | |
| 581 | 581 | // en option, remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
| 582 | 582 | // remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | $link = _mysql_link($serveur); |
| 613 | 613 | $ok = mysqli_select_db($link, $db); |
| 614 | 614 | if (!$ok) { |
| 615 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 615 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | return $ok; |
@@ -702,10 +702,10 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | $character_set = ''; |
| 704 | 704 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 705 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 705 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 706 | 706 | } |
| 707 | 707 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 708 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 708 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | foreach ($champs as $k => $v) { |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | preg_match(',(char|text),i', $defs[1]) |
| 716 | 716 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 717 | 717 | ) { |
| 718 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 718 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 719 | 719 | } |
| 720 | 720 | } |
| 721 | 721 | |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | $s = ','; |
| 728 | 728 | } |
| 729 | 729 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 730 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ')' |
|
| 730 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').')' |
|
| 731 | 731 | . ' ENGINE=MyISAM' |
| 732 | 732 | . ($character_set ? " DEFAULT $character_set" : '') |
| 733 | 733 | . "\n"; |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | return false; |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 810 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 811 | 811 | |
| 812 | 812 | return spip_mysql_query($query, $serveur, $requeter); |
| 813 | 813 | } |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | * Ressource à utiliser avec sql_fetch() |
| 866 | 866 | **/ |
| 867 | 867 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 868 | - return spip_mysql_query('SHOW TABLES LIKE ' . _q($match), $serveur, $requeter); |
|
| 868 | + return spip_mysql_query('SHOW TABLES LIKE '._q($match), $serveur, $requeter); |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | /** |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | * Ressource à utiliser avec sql_fetch() |
| 899 | 899 | **/ |
| 900 | 900 | function spip_mysql_table_exists(string $table, $serveur = '', $requeter = true) { |
| 901 | - $r = spip_mysql_query('SHOW TABLES LIKE ' . _q($table), $serveur, $requeter); |
|
| 901 | + $r = spip_mysql_query('SHOW TABLES LIKE '._q($table), $serveur, $requeter); |
|
| 902 | 902 | if (!$requeter) { |
| 903 | 903 | return $r; |
| 904 | 904 | } |
@@ -980,22 +980,22 @@ discard block |
||
| 980 | 980 | } |
| 981 | 981 | if ($val['Default'] === '0' || $val['Default']) { |
| 982 | 982 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 983 | - $nfields[$val['Field']] .= ' DEFAULT ' . $val['Default']; |
|
| 983 | + $nfields[$val['Field']] .= ' DEFAULT '.$val['Default']; |
|
| 984 | 984 | } else { |
| 985 | - $nfields[$val['Field']] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 985 | + $nfields[$val['Field']] .= " DEFAULT '".$val['Default']."'"; |
|
| 986 | 986 | } |
| 987 | 987 | } |
| 988 | 988 | if ($val['Extra']) { |
| 989 | - $nfields[$val['Field']] .= ' ' . $val['Extra']; |
|
| 989 | + $nfields[$val['Field']] .= ' '.$val['Extra']; |
|
| 990 | 990 | } |
| 991 | 991 | if ($val['Key'] == 'PRI') { |
| 992 | 992 | $nkeys['PRIMARY KEY'] = $val['Field']; |
| 993 | 993 | } else { |
| 994 | 994 | if ($val['Key'] == 'MUL') { |
| 995 | - $nkeys['KEY ' . $val['Field']] = $val['Field']; |
|
| 995 | + $nkeys['KEY '.$val['Field']] = $val['Field']; |
|
| 996 | 996 | } else { |
| 997 | 997 | if ($val['Key'] == 'UNI') { |
| 998 | - $nkeys['UNIQUE KEY ' . $val['Field']] = $val['Field']; |
|
| 998 | + $nkeys['UNIQUE KEY '.$val['Field']] = $val['Field']; |
|
| 999 | 999 | } |
| 1000 | 1000 | } |
| 1001 | 1001 | } |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | $serveur = '', |
| 1067 | 1067 | $requeter = true |
| 1068 | 1068 | ) { |
| 1069 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1069 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1070 | 1070 | |
| 1071 | 1071 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1072 | 1072 | if (!$requeter) { |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | if ($s) { |
| 1107 | 1107 | $trace = debug_backtrace(); |
| 1108 | 1108 | if ($trace[0]['function'] != 'spip_mysql_error') { |
| 1109 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1109 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1110 | 1110 | } |
| 1111 | 1111 | } |
| 1112 | 1112 | |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | try { |
| 1233 | 1233 | $insert = mysqli_query($link, $query); |
| 1234 | 1234 | } catch (\mysqli_sql_exception $e) { |
| 1235 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 1235 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 1236 | 1236 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 1237 | 1237 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
| 1238 | 1238 | } |
@@ -1287,8 +1287,8 @@ discard block |
||
| 1287 | 1287 | |
| 1288 | 1288 | return spip_mysql_insert( |
| 1289 | 1289 | $table, |
| 1290 | - '(' . join(',', array_keys($couples)) . ')', |
|
| 1291 | - '(' . join(',', $couples) . ')', |
|
| 1290 | + '('.join(',', array_keys($couples)).')', |
|
| 1291 | + '('.join(',', $couples).')', |
|
| 1292 | 1292 | $desc, |
| 1293 | 1293 | $serveur, |
| 1294 | 1294 | $requeter |
@@ -1325,7 +1325,7 @@ discard block |
||
| 1325 | 1325 | } |
| 1326 | 1326 | $fields = $desc['field'] ?? []; |
| 1327 | 1327 | |
| 1328 | - $cles = '(' . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1328 | + $cles = '('.join(',', array_keys(reset($tab_couples))).')'; |
|
| 1329 | 1329 | $valeurs = []; |
| 1330 | 1330 | $r = false; |
| 1331 | 1331 | |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | foreach ($couples as $champ => $val) { |
| 1335 | 1335 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1336 | 1336 | } |
| 1337 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1337 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1338 | 1338 | if (count($valeurs) >= 100) { |
| 1339 | 1339 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1340 | 1340 | $valeurs = []; |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | function spip_mysql_update($table, $champs, $where = '', $desc = [], $serveur = '', $requeter = true) { |
| 1372 | 1372 | $set = []; |
| 1373 | 1373 | foreach ($champs as $champ => $val) { |
| 1374 | - $set[] = $champ . "=$val"; |
|
| 1374 | + $set[] = $champ."=$val"; |
|
| 1375 | 1375 | } |
| 1376 | 1376 | if (!empty($set)) { |
| 1377 | 1377 | return spip_mysql_query( |
@@ -1427,7 +1427,7 @@ discard block |
||
| 1427 | 1427 | } |
| 1428 | 1428 | $set = []; |
| 1429 | 1429 | foreach ($champs as $champ => $val) { |
| 1430 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1430 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1431 | 1431 | } |
| 1432 | 1432 | |
| 1433 | 1433 | return spip_mysql_query( |
@@ -1496,10 +1496,10 @@ discard block |
||
| 1496 | 1496 | * - False en cas d'erreur. |
| 1497 | 1497 | **/ |
| 1498 | 1498 | function spip_mysql_replace($table, $couples, $desc = [], $serveur = '', $requeter = true) { |
| 1499 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1499 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1500 | 1500 | ',', |
| 1501 | 1501 | array_map('_q', $couples) |
| 1502 | - ) . ')', $serveur, $requeter); |
|
| 1502 | + ).')', $serveur, $requeter); |
|
| 1503 | 1503 | } |
| 1504 | 1504 | |
| 1505 | 1505 | |
@@ -1528,10 +1528,10 @@ discard block |
||
| 1528 | 1528 | * - False en cas d'erreur. |
| 1529 | 1529 | **/ |
| 1530 | 1530 | function spip_mysql_replace_multi($table, $tab_couples, $desc = [], $serveur = '', $requeter = true) { |
| 1531 | - $cles = '(' . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1531 | + $cles = '('.join(',', array_keys($tab_couples[0])).')'; |
|
| 1532 | 1532 | $valeurs = []; |
| 1533 | 1533 | foreach ($tab_couples as $couples) { |
| 1534 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1534 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1535 | 1535 | } |
| 1536 | 1536 | $valeurs = implode(', ', $valeurs); |
| 1537 | 1537 | |
@@ -1551,28 +1551,28 @@ discard block |
||
| 1551 | 1551 | */ |
| 1552 | 1552 | function spip_mysql_multi($objet, $lang) { |
| 1553 | 1553 | $lengthlang = strlen("[$lang]"); |
| 1554 | - $posmulti = 'INSTR(' . $objet . ", '<multi>')"; |
|
| 1555 | - $posfinmulti = 'INSTR(' . $objet . ", '</multi>')"; |
|
| 1556 | - $debutchaine = 'LEFT(' . $objet . ", $posmulti-1)"; |
|
| 1557 | - $finchaine = 'RIGHT(' . $objet . ', CHAR_LENGTH(' . $objet . ") -(7+$posfinmulti))"; |
|
| 1558 | - $chainemulti = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1559 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1554 | + $posmulti = 'INSTR('.$objet.", '<multi>')"; |
|
| 1555 | + $posfinmulti = 'INSTR('.$objet.", '</multi>')"; |
|
| 1556 | + $debutchaine = 'LEFT('.$objet.", $posmulti-1)"; |
|
| 1557 | + $finchaine = 'RIGHT('.$objet.', CHAR_LENGTH('.$objet.") -(7+$posfinmulti))"; |
|
| 1558 | + $chainemulti = 'TRIM(SUBSTRING('.$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1559 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1560 | 1560 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1561 | - $chainelang = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1562 | - $posfinlang = 'INSTR(' . $chainelang . ", '[')"; |
|
| 1561 | + $chainelang = 'TRIM(SUBSTRING('.$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1562 | + $posfinlang = 'INSTR('.$chainelang.", '[')"; |
|
| 1563 | 1563 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1564 | 1564 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1565 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1566 | - ' TRIM(' . $objet . '), ' . |
|
| 1567 | - ' CONCAT( ' . |
|
| 1568 | - " $debutchaine, " . |
|
| 1569 | - ' IF( ' . |
|
| 1570 | - " $poslang = 0, " . |
|
| 1571 | - " $chainemulti, " . |
|
| 1572 | - " $chainelang" . |
|
| 1573 | - ' ), ' . |
|
| 1574 | - " $finchaine" . |
|
| 1575 | - ' ) ' . |
|
| 1565 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1566 | + ' TRIM('.$objet.'), '. |
|
| 1567 | + ' CONCAT( '. |
|
| 1568 | + " $debutchaine, ". |
|
| 1569 | + ' IF( '. |
|
| 1570 | + " $poslang = 0, ". |
|
| 1571 | + " $chainemulti, ". |
|
| 1572 | + " $chainelang". |
|
| 1573 | + ' ), '. |
|
| 1574 | + " $finchaine". |
|
| 1575 | + ' ) '. |
|
| 1576 | 1576 | '))) AS multi'; |
| 1577 | 1577 | |
| 1578 | 1578 | return $retour; |
@@ -1589,7 +1589,7 @@ discard block |
||
| 1589 | 1589 | * Valeur hexadécimale pour MySQL |
| 1590 | 1590 | **/ |
| 1591 | 1591 | function spip_mysql_hex($v) { |
| 1592 | - return '0x' . $v; |
|
| 1592 | + return '0x'.$v; |
|
| 1593 | 1593 | } |
| 1594 | 1594 | |
| 1595 | 1595 | /** |
@@ -1629,7 +1629,7 @@ discard block |
||
| 1629 | 1629 | * Expression SQL |
| 1630 | 1630 | **/ |
| 1631 | 1631 | function spip_mysql_date_proche($champ, $interval, $unite) { |
| 1632 | - $use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false ); |
|
| 1632 | + $use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false); |
|
| 1633 | 1633 | return '(' |
| 1634 | 1634 | . $champ |
| 1635 | 1635 | . (($interval <= 0) ? '>' : '<') |
@@ -1684,7 +1684,7 @@ discard block |
||
| 1684 | 1684 | } elseif ($v === null) { |
| 1685 | 1685 | return "''"; |
| 1686 | 1686 | } |
| 1687 | - return "'" . addslashes($v) . "'"; |
|
| 1687 | + return "'".addslashes($v)."'"; |
|
| 1688 | 1688 | } |
| 1689 | 1689 | |
| 1690 | 1690 | if ($v === null) { |
@@ -1708,7 +1708,7 @@ discard block |
||
| 1708 | 1708 | } |
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | - return ("'" . addslashes($v) . "'"); |
|
| 1711 | + return ("'".addslashes($v)."'"); |
|
| 1712 | 1712 | } |
| 1713 | 1713 | |
| 1714 | 1714 | /** |
@@ -1742,7 +1742,7 @@ discard block |
||
| 1742 | 1742 | } else { |
| 1743 | 1743 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1744 | 1744 | |
| 1745 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1745 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1746 | 1746 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1747 | 1747 | } |
| 1748 | 1748 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $res['message_ok'] = _T('info_modification_enregistree'); |
| 101 | 101 | if ($retour) { |
| 102 | 102 | if (strncmp($retour, 'javascript:', 11) == 0) { |
| 103 | - $res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>'; |
|
| 103 | + $res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/'.substr($retour, 11).'/*]]>*/</script>'; |
|
| 104 | 104 | $res['editable'] = true; |
| 105 | 105 | } else { |
| 106 | 106 | $res['redirect'] = parametre_url($retour, $id_table_objet, $id); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | if (!isset($erreurs[$champ])) { |
| 141 | 141 | $erreurs[$champ] = ''; |
| 142 | 142 | } |
| 143 | - $erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>'; |
|
| 143 | + $erreurs[$champ] .= _T('alerte_modif_info_concourante')."<br /><textarea readonly='readonly' class='forml'>".entites_html($conflit['base']).'</textarea>'; |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | if ( |
| 219 | 219 | $config_fonc |
| 220 | 220 | and !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config']) |
| 221 | - and $config_fonc !== $table_objet . '_edit_config' |
|
| 221 | + and $config_fonc !== $table_objet.'_edit_config' |
|
| 222 | 222 | ) { |
| 223 | 223 | if ( |
| 224 | 224 | $args = test_formulaire_inclus_par_modele() |
@@ -233,12 +233,12 @@ discard block |
||
| 233 | 233 | // Appel direct dans un squelette |
| 234 | 234 | if (!$row) { |
| 235 | 235 | if (!$new or $lier_trad) { |
| 236 | - if ($select = charger_fonction('precharger_' . $type, 'inc', true)) { |
|
| 236 | + if ($select = charger_fonction('precharger_'.$type, 'inc', true)) { |
|
| 237 | 237 | $row = $select($id, $id_parent, $lier_trad); |
| 238 | 238 | // si on a une fonction precharger, elle pu faire un reglage de langue |
| 239 | 239 | $lang_default = (!empty($row['lang']) ? $row['lang'] : null); |
| 240 | 240 | } else { |
| 241 | - $row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . intval($id)); |
|
| 241 | + $row = sql_fetsel('*', $table_objet_sql, $id_table_objet.'='.intval($id)); |
|
| 242 | 242 | } |
| 243 | 243 | if (!$new) { |
| 244 | 244 | $md5 = controles_md5($row ?? []); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | if ($config_fonc) { |
| 289 | 289 | $contexte['config'] = $config = $config_fonc($contexte); |
| 290 | 290 | if (!$lang_default) { |
| 291 | - $lang_default = $config['langue'] ?? session_get('lang') ; |
|
| 291 | + $lang_default = $config['langue'] ?? session_get('lang'); |
|
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | $config = $config + [ |
@@ -312,13 +312,12 @@ discard block |
||
| 312 | 312 | unset($contexte['lang']); |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - $contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" . |
|
| 316 | - (!$lier_trad ? '' : |
|
| 317 | - ("\n<input type='hidden' name='lier_trad' value='" . |
|
| 318 | - $lier_trad . |
|
| 319 | - "' />" . |
|
| 320 | - "\n<input type='hidden' name='changer_lang' value='" . |
|
| 321 | - $lang_default . |
|
| 315 | + $contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n". |
|
| 316 | + (!$lier_trad ? '' : ("\n<input type='hidden' name='lier_trad' value='". |
|
| 317 | + $lier_trad. |
|
| 318 | + "' />". |
|
| 319 | + "\n<input type='hidden' name='changer_lang' value='". |
|
| 320 | + $lang_default. |
|
| 322 | 321 | "' />")) |
| 323 | 322 | . $hidden |
| 324 | 323 | . ($md5 ?? ''); |
@@ -358,14 +357,14 @@ discard block |
||
| 358 | 357 | $aider = charger_fonction('aider', 'inc'); |
| 359 | 358 | if (strlen($texte) > 28 * 1024) { |
| 360 | 359 | $texte = str_replace("\r\n", "\n", $texte); |
| 361 | - $pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko |
|
| 360 | + $pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko |
|
| 362 | 361 | if ($pos > 0 and $pos < 32 * 1024) { |
| 363 | - $debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n"; |
|
| 362 | + $debut = substr($texte, 0, $pos)."\n\n<!--SPIP-->\n"; |
|
| 364 | 363 | $suite = substr($texte, $pos + 2); |
| 365 | 364 | } else { |
| 366 | - $pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace |
|
| 365 | + $pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace |
|
| 367 | 366 | if (!($pos > 0 and $pos < 32 * 1024)) { |
| 368 | - $pos = 28 * 1024; // au pire (pas d'espace trouv'e) |
|
| 367 | + $pos = 28 * 1024; // au pire (pas d'espace trouv'e) |
|
| 369 | 368 | $decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere |
| 370 | 369 | } else { |
| 371 | 370 | $decalage = 1; |
@@ -396,13 +395,13 @@ discard block |
||
| 396 | 395 | } |
| 397 | 396 | |
| 398 | 397 | include_spip('inc/barre'); |
| 399 | - $textes_supplement = "<br /><span style='color: red'>" . _T('info_texte_long') . "</span>\n"; |
|
| 398 | + $textes_supplement = "<br /><span style='color: red'>"._T('info_texte_long')."</span>\n"; |
|
| 400 | 399 | $nombre = 0; |
| 401 | 400 | |
| 402 | 401 | while (strlen($texte) > 29 * 1024) { |
| 403 | 402 | $nombre++; |
| 404 | 403 | [$texte1, $texte] = coupe_trop_long($texte); |
| 405 | - $textes_supplement .= '<br />' . |
|
| 404 | + $textes_supplement .= '<br />'. |
|
| 406 | 405 | "<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n"; |
| 407 | 406 | } |
| 408 | 407 | |
@@ -485,7 +484,7 @@ discard block |
||
| 485 | 484 | $ctr = []; |
| 486 | 485 | foreach ($data as $key => $val) { |
| 487 | 486 | $m = md5($val ?? ''); |
| 488 | - $k = $prefixe . $key; |
|
| 487 | + $k = $prefixe.$key; |
|
| 489 | 488 | |
| 490 | 489 | switch ($format) { |
| 491 | 490 | case 'html': |
@@ -498,7 +497,7 @@ discard block |
||
| 498 | 497 | } |
| 499 | 498 | |
| 500 | 499 | if ($format === 'html') { |
| 501 | - return "\n\n<!-- controles md5 -->\n" . join("\n", $ctr) . "\n\n"; |
|
| 500 | + return "\n\n<!-- controles md5 -->\n".join("\n", $ctr)."\n\n"; |
|
| 502 | 501 | } else { |
| 503 | 502 | return $ctr; |
| 504 | 503 | } |
@@ -650,7 +649,7 @@ discard block |
||
| 650 | 649 | // On elimine les donnees non modifiees par le formulaire (mais |
| 651 | 650 | // potentiellement modifiees entre temps par un autre utilisateur) |
| 652 | 651 | foreach ($champs as $key => $val) { |
| 653 | - if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) { |
|
| 652 | + if (isset($ctr[$prefix.$key]) and $m = $ctr[$prefix.$key]) { |
|
| 654 | 653 | if (is_scalar($val) and $m == md5($val)) { |
| 655 | 654 | unset($champs[$key]); |
| 656 | 655 | } |
@@ -679,7 +678,7 @@ discard block |
||
| 679 | 678 | // de conflit. |
| 680 | 679 | $ctrh = $ctrq = $conflits = []; |
| 681 | 680 | foreach (array_keys($champs) as $key) { |
| 682 | - if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) { |
|
| 681 | + if (isset($ctr[$prefix.$key]) and $m = $ctr[$prefix.$key]) { |
|
| 683 | 682 | $ctrh[$key] = $m; |
| 684 | 683 | $ctrq[] = $key; |
| 685 | 684 | } |
@@ -713,9 +712,9 @@ discard block |
||
| 713 | 712 | */ |
| 714 | 713 | function display_conflit_champ($x) { |
| 715 | 714 | if (strstr($x, "\n") or strlen($x) > 80) { |
| 716 | - return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n"; |
|
| 715 | + return "<textarea style='width:99%; height:10em;'>".entites_html($x)."</textarea>\n"; |
|
| 717 | 716 | } else { |
| 718 | - return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n"; |
|
| 717 | + return "<input type='text' size='40' style='width:99%' value=\"".entites_html($x)."\" />\n"; |
|
| 719 | 718 | } |
| 720 | 719 | } |
| 721 | 720 | |
@@ -755,11 +754,11 @@ discard block |
||
| 755 | 754 | ) : $champ; |
| 756 | 755 | |
| 757 | 756 | $diffs[] = "<h2>$titre</h2>\n" |
| 758 | - . '<h3>' . _T('info_conflit_edition_differences') . "</h3>\n" |
|
| 759 | - . "<div style='max-height:8em; overflow: auto; width:99%;'>" . $d . "</div>\n" |
|
| 760 | - . '<h4>' . _T('info_conflit_edition_votre_version') . '</h4>' |
|
| 757 | + . '<h3>'._T('info_conflit_edition_differences')."</h3>\n" |
|
| 758 | + . "<div style='max-height:8em; overflow: auto; width:99%;'>".$d."</div>\n" |
|
| 759 | + . '<h4>'._T('info_conflit_edition_votre_version').'</h4>' |
|
| 761 | 760 | . display_conflit_champ($a['post']) |
| 762 | - . '<h4>' . _T('info_conflit_edition_version_enregistree') . '</h4>' |
|
| 761 | + . '<h4>'._T('info_conflit_edition_version_enregistree').'</h4>' |
|
| 763 | 762 | . display_conflit_champ($base); |
| 764 | 763 | } |
| 765 | 764 | |
@@ -767,16 +766,16 @@ discard block |
||
| 767 | 766 | $id = uniqid(random_int(0, mt_getrandmax())); |
| 768 | 767 | $redirect = "<form action='$redirect' method='get' |
| 769 | 768 | id='$id' |
| 770 | - style='float:" . $GLOBALS['spip_lang_right'] . "; margin-top:2em;'>\n" |
|
| 769 | + style='float:".$GLOBALS['spip_lang_right']."; margin-top:2em;'>\n" |
|
| 771 | 770 | . form_hidden($redirect) |
| 772 | - . "<input type='submit' value='" . _T('icone_retour') . "' /> |
|
| 771 | + . "<input type='submit' value='"._T('icone_retour')."' /> |
|
| 773 | 772 | </form>\n"; |
| 774 | 773 | |
| 775 | 774 | // pour les documents, on est probablement en ajax : il faut ajaxer |
| 776 | 775 | if (_AJAX) { |
| 777 | 776 | $redirect .= '<script type="text/javascript">' |
| 778 | - . 'setTimeout(function(){$("#' . $id . '") |
|
| 779 | - .ajaxForm({target:$("#' . $id . '").parent()}); |
|
| 777 | + . 'setTimeout(function(){$("#'.$id.'") |
|
| 778 | + .ajaxForm({target:$("#' . $id.'").parent()}); |
|
| 780 | 779 | }, 200);' |
| 781 | 780 | . "</script>\n"; |
| 782 | 781 | } |
@@ -795,9 +794,9 @@ discard block |
||
| 795 | 794 | .diff-para-deplace .diff-supprime { background: #ffb8b8; border: 1px solid #808080; } |
| 796 | 795 | .diff-para-deplace .diff-deplace { background: #b8b8ff; border: 1px solid #808080; } |
| 797 | 796 | </style>' |
| 798 | - . '<p>' . _T('info_conflit_edition_avis_non_sauvegarde') . '</p>' |
|
| 799 | - . '<p>' . _T('texte_conflit_edition_correction') . '</p>' |
|
| 800 | - . "<div style='text-align:" . $GLOBALS['spip_lang_left'] . ";'>" |
|
| 797 | + . '<p>'._T('info_conflit_edition_avis_non_sauvegarde').'</p>' |
|
| 798 | + . '<p>'._T('texte_conflit_edition_correction').'</p>' |
|
| 799 | + . "<div style='text-align:".$GLOBALS['spip_lang_left'].";'>" |
|
| 801 | 800 | . join("\n", $diffs) |
| 802 | 801 | . "</div>\n" |
| 803 | 802 | |