@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | $blue = dechex($blue); |
| 44 | 44 | |
| 45 | 45 | if (strlen($red) == 1) { |
| 46 | - $red = '0' . $red; |
|
| 46 | + $red = '0'.$red; |
|
| 47 | 47 | } |
| 48 | 48 | if (strlen($green) == 1) { |
| 49 | - $green = '0' . $green; |
|
| 49 | + $green = '0'.$green; |
|
| 50 | 50 | } |
| 51 | 51 | if (strlen($blue) == 1) { |
| 52 | - $blue = '0' . $blue; |
|
| 52 | + $blue = '0'.$blue; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | return "$red$green$blue"; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $couleur = couleur_html_to_hex($couleur); |
| 68 | 68 | $couleur = ltrim($couleur, '#'); |
| 69 | 69 | if (strlen($couleur) === 3) { |
| 70 | - $couleur = $couleur[0] . $couleur[0] . $couleur[1] . $couleur[1] . $couleur[2] . $couleur[2]; |
|
| 70 | + $couleur = $couleur[0].$couleur[0].$couleur[1].$couleur[1].$couleur[2].$couleur[2]; |
|
| 71 | 71 | } |
| 72 | 72 | $retour = []; |
| 73 | 73 | $retour['red'] = hexdec(substr($couleur, 0, 2)); |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | $var_G = ($G / 255); |
| 126 | 126 | $var_B = ($B / 255); |
| 127 | 127 | |
| 128 | - $var_Min = min($var_R, $var_G, $var_B); //Min. value of RGB |
|
| 129 | - $var_Max = max($var_R, $var_G, $var_B); //Max. value of RGB |
|
| 130 | - $del_Max = $var_Max - $var_Min; //Delta RGB value |
|
| 128 | + $var_Min = min($var_R, $var_G, $var_B); //Min. value of RGB |
|
| 129 | + $var_Max = max($var_R, $var_G, $var_B); //Max. value of RGB |
|
| 130 | + $del_Max = $var_Max - $var_Min; //Delta RGB value |
|
| 131 | 131 | |
| 132 | 132 | $L = ($var_Max + $var_Min) / 2; |
| 133 | 133 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | function _couleur_hsl_to_rgb($H, $S, $L) { |
| 191 | 191 | // helper |
| 192 | - $hue_2_rgb = function ($v1, $v2, $vH) { |
|
| 192 | + $hue_2_rgb = function($v1, $v2, $vH) { |
|
| 193 | 193 | if ($vH < 0) { |
| 194 | 194 | $vH += 1; |
| 195 | 195 | } |
@@ -321,11 +321,11 @@ discard block |
||
| 321 | 321 | $img = "<img src='$source' />"; |
| 322 | 322 | } elseif ( |
| 323 | 323 | preg_match('@^data:image/([^;]*);base64,(.*)$@isS', $source, $regs) |
| 324 | - and $extension = _image_trouver_extension_depuis_mime('image/' . $regs[1]) |
|
| 324 | + and $extension = _image_trouver_extension_depuis_mime('image/'.$regs[1]) |
|
| 325 | 325 | and in_array($extension, _image_extensions_acceptees_en_entree()) |
| 326 | 326 | ) { |
| 327 | 327 | # gerer img src="data:....base64" |
| 328 | - $local = sous_repertoire(_DIR_VAR, 'image-data') . md5($regs[2]) . '.' . _image_extension_normalisee($extension); |
|
| 328 | + $local = sous_repertoire(_DIR_VAR, 'image-data').md5($regs[2]).'.'._image_extension_normalisee($extension); |
|
| 329 | 329 | if (!file_exists($local)) { |
| 330 | 330 | ecrire_fichier($local, base64_decode($regs[2])); |
| 331 | 331 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | // les protocoles web prennent au moins 3 lettres |
| 343 | 343 | if (tester_url_absolue($source)) { |
| 344 | 344 | include_spip('inc/distant'); |
| 345 | - $fichier = _DIR_RACINE . copie_locale($source); |
|
| 345 | + $fichier = _DIR_RACINE.copie_locale($source); |
|
| 346 | 346 | if (!$fichier) { |
| 347 | 347 | return ''; |
| 348 | 348 | } |
@@ -440,9 +440,9 @@ discard block |
||
| 440 | 440 | // on garde la terminaison initiale car image simplement copiee |
| 441 | 441 | // et on postfixe son nom avec un md5 du path |
| 442 | 442 | $terminaison_dest = $terminaison; |
| 443 | - $fichier_dest .= '-' . substr(md5("$identifiant"), 0, 5); |
|
| 443 | + $fichier_dest .= '-'.substr(md5("$identifiant"), 0, 5); |
|
| 444 | 444 | } else { |
| 445 | - $fichier_dest .= '-' . substr(md5("$identifiant-$effet"), 0, 5); |
|
| 445 | + $fichier_dest .= '-'.substr(md5("$identifiant-$effet"), 0, 5); |
|
| 446 | 446 | } |
| 447 | 447 | $cache = sous_repertoire(_DIR_VAR, $cache); |
| 448 | 448 | $cache = sous_repertoire($cache, $effet); |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $fichier_dest = substr($fichier_dest, 2); |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - $fichier_dest = $cache . $fichier_dest . '.' . $terminaison_dest; |
|
| 456 | + $fichier_dest = $cache.$fichier_dest.'.'.$terminaison_dest; |
|
| 457 | 457 | |
| 458 | 458 | $GLOBALS['images_calculees'][] = $fichier_dest; |
| 459 | 459 | |
@@ -491,15 +491,15 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | if ($creer) { |
| 493 | 493 | spip_log( |
| 494 | - 'filtre image ' . ($fonction_creation ? reset($fonction_creation) : '') . "[$effet] sur $fichier", |
|
| 495 | - 'images' . _LOG_DEBUG |
|
| 494 | + 'filtre image '.($fonction_creation ? reset($fonction_creation) : '')."[$effet] sur $fichier", |
|
| 495 | + 'images'._LOG_DEBUG |
|
| 496 | 496 | ); |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | $term_fonction = _image_trouver_extension_pertinente($fichier); |
| 500 | - $ret['fonction_imagecreatefrom'] = '_imagecreatefrom' . $term_fonction; |
|
| 500 | + $ret['fonction_imagecreatefrom'] = '_imagecreatefrom'.$term_fonction; |
|
| 501 | 501 | $ret['fichier'] = $fichier; |
| 502 | - $ret['fonction_image'] = '_image_image' . $terminaison_dest; |
|
| 502 | + $ret['fonction_image'] = '_image_image'.$terminaison_dest; |
|
| 503 | 503 | $ret['fichier_dest'] = $fichier_dest; |
| 504 | 504 | $ret['format_source'] = _image_extension_normalisee($terminaison); |
| 505 | 505 | $ret['format_dest'] = $terminaison_dest; |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | |
| 650 | 650 | $_terminaison = _image_trouver_extension_depuis_mime($mime); |
| 651 | 651 | if ($_terminaison and $_terminaison !== $terminaison) { |
| 652 | - spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", 'images.' . _LOG_INFO_IMPORTANTE); |
|
| 652 | + spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", 'images.'._LOG_INFO_IMPORTANTE); |
|
| 653 | 653 | $terminaison = $_terminaison; |
| 654 | 654 | } |
| 655 | 655 | return $terminaison; |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | if (!function_exists('imagepng')) { |
| 807 | 807 | return false; |
| 808 | 808 | } |
| 809 | - $tmp = $fichier . '.tmp'; |
|
| 809 | + $tmp = $fichier.'.tmp'; |
|
| 810 | 810 | $ret = imagepng($img, $tmp); |
| 811 | 811 | if (file_exists($tmp)) { |
| 812 | 812 | $taille_test = getimagesize($tmp); |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | if (!function_exists('imagegif')) { |
| 842 | 842 | return false; |
| 843 | 843 | } |
| 844 | - $tmp = $fichier . '.tmp'; |
|
| 844 | + $tmp = $fichier.'.tmp'; |
|
| 845 | 845 | $ret = imagegif($img, $tmp); |
| 846 | 846 | if (file_exists($tmp)) { |
| 847 | 847 | $taille_test = getimagesize($tmp); |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | if (!function_exists('imagejpeg')) { |
| 882 | 882 | return false; |
| 883 | 883 | } |
| 884 | - $tmp = $fichier . '.tmp'; |
|
| 884 | + $tmp = $fichier.'.tmp'; |
|
| 885 | 885 | |
| 886 | 886 | // Enable interlancing |
| 887 | 887 | imageinterlace($img, true); |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | if (!function_exists('imagewebp')) { |
| 943 | 943 | return false; |
| 944 | 944 | } |
| 945 | - $tmp = $fichier . '.tmp'; |
|
| 945 | + $tmp = $fichier.'.tmp'; |
|
| 946 | 946 | $ret = imagewebp($img, $tmp, $qualite); |
| 947 | 947 | if (file_exists($tmp)) { |
| 948 | 948 | $taille_test = getimagesize($tmp); |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | */ |
| 977 | 977 | function _image_imagesvg($img, $fichier) { |
| 978 | 978 | |
| 979 | - $tmp = $fichier . '.tmp'; |
|
| 979 | + $tmp = $fichier.'.tmp'; |
|
| 980 | 980 | if (strpos($img, '<') === false) { |
| 981 | 981 | $img = supprimer_timestamp($img); |
| 982 | 982 | if (!file_exists($img)) { |
@@ -1033,13 +1033,13 @@ discard block |
||
| 1033 | 1033 | */ |
| 1034 | 1034 | function _image_gd_output($img, $valeurs, $qualite = _IMG_GD_QUALITE, $fonction = null) { |
| 1035 | 1035 | if (is_null($fonction)) { |
| 1036 | - $fonction = '_image_image' . $valeurs['format_dest']; |
|
| 1036 | + $fonction = '_image_image'.$valeurs['format_dest']; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | $ret = false; |
| 1039 | 1039 | #un flag pour reperer les images gravees |
| 1040 | 1040 | $lock = ( |
| 1041 | 1041 | !statut_effacer_images_temporaires('get') // si la fonction n'a pas ete activee, on grave tout |
| 1042 | - or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'] . '.src')) |
|
| 1042 | + or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'].'.src')) |
|
| 1043 | 1043 | ); |
| 1044 | 1044 | if ( |
| 1045 | 1045 | function_exists($fonction) |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | // dans tous les cas mettre a jour la taille de l'image finale |
| 1052 | 1052 | [$valeurs['hauteur_dest'], $valeurs['largeur_dest']] = taille_image($valeurs['fichier_dest']); |
| 1053 | 1053 | $valeurs['date'] = @filemtime($valeurs['fichier_dest']); // pour la retrouver apres disparition |
| 1054 | - ecrire_fichier($valeurs['fichier_dest'] . '.src', serialize($valeurs), true); |
|
| 1054 | + ecrire_fichier($valeurs['fichier_dest'].'.src', serialize($valeurs), true); |
|
| 1055 | 1055 | } |
| 1056 | 1056 | } |
| 1057 | 1057 | |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | |
| 1227 | 1227 | // attributs deprecies. Transformer en CSS |
| 1228 | 1228 | if ($espace = extraire_attribut($tag, 'hspace')) { |
| 1229 | - $style = "margin:{$espace}px;" . $style; |
|
| 1229 | + $style = "margin:{$espace}px;".$style; |
|
| 1230 | 1230 | $tag = inserer_attribut($tag, 'hspace', ''); |
| 1231 | 1231 | } |
| 1232 | 1232 | |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | $image = $valeurs['fichier']; |
| 1354 | 1354 | $format = $valeurs['format_source']; |
| 1355 | 1355 | $destdir = dirname($valeurs['fichier_dest']); |
| 1356 | - $destfile = basename($valeurs['fichier_dest'], '.' . $valeurs['format_dest']); |
|
| 1356 | + $destfile = basename($valeurs['fichier_dest'], '.'.$valeurs['format_dest']); |
|
| 1357 | 1357 | |
| 1358 | 1358 | $format_sortie = $valeurs['format_dest']; |
| 1359 | 1359 | |
@@ -1385,14 +1385,14 @@ discard block |
||
| 1385 | 1385 | |
| 1386 | 1386 | // Si l'image est de la taille demandee (ou plus petite), simplement la retourner |
| 1387 | 1387 | if ($srcWidth and $srcWidth <= $maxWidth and $srcHeight <= $maxHeight) { |
| 1388 | - $vignette = $destination . '.' . $format; |
|
| 1388 | + $vignette = $destination.'.'.$format; |
|
| 1389 | 1389 | @copy($image, $vignette); |
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | 1392 | elseif ($valeurs['format_source'] === 'svg') { |
| 1393 | 1393 | if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)) { |
| 1394 | 1394 | $format_sortie = 'svg'; |
| 1395 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1395 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1396 | 1396 | $valeurs['fichier_dest'] = $vignette; |
| 1397 | 1397 | _image_gd_output($svg, $valeurs); |
| 1398 | 1398 | } |
@@ -1404,9 +1404,9 @@ discard block |
||
| 1404 | 1404 | define('_CONVERT_COMMAND', 'convert'); |
| 1405 | 1405 | } // Securite : mes_options.php peut preciser le chemin absolu |
| 1406 | 1406 | if (!defined('_RESIZE_COMMAND')) { |
| 1407 | - define('_RESIZE_COMMAND', _CONVERT_COMMAND . ' -quality ' . _IMG_CONVERT_QUALITE . ' -resize %xx%y! %src %dest'); |
|
| 1407 | + define('_RESIZE_COMMAND', _CONVERT_COMMAND.' -quality '._IMG_CONVERT_QUALITE.' -resize %xx%y! %src %dest'); |
|
| 1408 | 1408 | } |
| 1409 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1409 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1410 | 1410 | $commande = str_replace( |
| 1411 | 1411 | ['%x', '%y', '%src', '%dest'], |
| 1412 | 1412 | [ |
@@ -1422,7 +1422,7 @@ discard block |
||
| 1422 | 1422 | if (!@file_exists($vignette)) { |
| 1423 | 1423 | spip_log("echec convert sur $vignette"); |
| 1424 | 1424 | |
| 1425 | - return; // echec commande |
|
| 1425 | + return; // echec commande |
|
| 1426 | 1426 | } |
| 1427 | 1427 | } |
| 1428 | 1428 | |
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | if (!$output) { |
| 1440 | 1440 | return; |
| 1441 | 1441 | } |
| 1442 | - $vignette = $output . DIRECTORY_SEPARATOR . basename($destination) . '.' . $format_sortie; |
|
| 1442 | + $vignette = $output.DIRECTORY_SEPARATOR.basename($destination).'.'.$format_sortie; |
|
| 1443 | 1443 | |
| 1444 | 1444 | $imagick = new Imagick(); |
| 1445 | 1445 | $imagick->readImage(realpath($image)); |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | $destHeight, |
| 1449 | 1449 | Imagick::FILTER_LANCZOS, |
| 1450 | 1450 | 1 |
| 1451 | - );//, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100); |
|
| 1451 | + ); //, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100); |
|
| 1452 | 1452 | $imagick->writeImage($vignette); |
| 1453 | 1453 | |
| 1454 | 1454 | if (!@file_exists($vignette)) { |
@@ -1457,7 +1457,7 @@ discard block |
||
| 1457 | 1457 | return; |
| 1458 | 1458 | } |
| 1459 | 1459 | // remettre le chemin relatif car c'est ce qu'attend SPIP pour la suite (en particlier action/tester) |
| 1460 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1460 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | // netpbm |
@@ -1468,11 +1468,11 @@ discard block |
||
| 1468 | 1468 | if (_PNMSCALE_COMMAND == '') { |
| 1469 | 1469 | return; |
| 1470 | 1470 | } |
| 1471 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1471 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1472 | 1472 | $pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND); |
| 1473 | 1473 | if ($format == 'jpg') { |
| 1474 | 1474 | $jpegtopnm_command = str_replace('pnmscale', 'jpegtopnm', _PNMSCALE_COMMAND); |
| 1475 | - exec("$jpegtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1475 | + exec("$jpegtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1476 | 1476 | if (!($s = @filesize($vignette))) { |
| 1477 | 1477 | spip_unlink($vignette); |
| 1478 | 1478 | } |
@@ -1484,7 +1484,7 @@ discard block |
||
| 1484 | 1484 | } else { |
| 1485 | 1485 | if ($format == 'gif') { |
| 1486 | 1486 | $giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND); |
| 1487 | - exec("$giftopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1487 | + exec("$giftopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1488 | 1488 | if (!($s = @filesize($vignette))) { |
| 1489 | 1489 | spip_unlink($vignette); |
| 1490 | 1490 | } |
@@ -1496,7 +1496,7 @@ discard block |
||
| 1496 | 1496 | } else { |
| 1497 | 1497 | if ($format == 'png') { |
| 1498 | 1498 | $pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND); |
| 1499 | - exec("$pngtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1499 | + exec("$pngtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1500 | 1500 | if (!($s = @filesize($vignette))) { |
| 1501 | 1501 | spip_unlink($vignette); |
| 1502 | 1502 | } |
@@ -1518,7 +1518,7 @@ discard block |
||
| 1518 | 1518 | return; |
| 1519 | 1519 | } |
| 1520 | 1520 | if (_IMG_GD_MAX_PIXELS && $srcWidth * $srcHeight > _IMG_GD_MAX_PIXELS) { |
| 1521 | - spip_log('vignette gd1/gd2 impossible : ' . $srcWidth * $srcHeight . 'pixels'); |
|
| 1521 | + spip_log('vignette gd1/gd2 impossible : '.$srcWidth * $srcHeight.'pixels'); |
|
| 1522 | 1522 | |
| 1523 | 1523 | return; |
| 1524 | 1524 | } |
@@ -1828,7 +1828,7 @@ discard block |
||
| 1828 | 1828 | // de l'image, de facon a tromper le cache du navigateur |
| 1829 | 1829 | // quand on fait supprimer/reuploader un logo |
| 1830 | 1830 | // (pas de filemtime si SAFE MODE) |
| 1831 | - $date = test_espace_prive() ? ('?' . $date) : ''; |
|
| 1831 | + $date = test_espace_prive() ? ('?'.$date) : ''; |
|
| 1832 | 1832 | |
| 1833 | 1833 | return _image_ecrire_tag($image, ['src' => "$logo$date", 'width' => $destWidth, 'height' => $destHeight]); |
| 1834 | 1834 | } |
@@ -1874,7 +1874,7 @@ discard block |
||
| 1874 | 1874 | public static function LittleEndian2String($number, $minbytes = 1) { |
| 1875 | 1875 | $intstring = ''; |
| 1876 | 1876 | while ($number > 0) { |
| 1877 | - $intstring = $intstring . chr($number & 255); |
|
| 1877 | + $intstring = $intstring.chr($number & 255); |
|
| 1878 | 1878 | $number >>= 8; |
| 1879 | 1879 | } |
| 1880 | 1880 | |
@@ -1906,9 +1906,9 @@ discard block |
||
| 1906 | 1906 | $b = $argb['blue']; |
| 1907 | 1907 | |
| 1908 | 1908 | if ($bpp[$key] == 32) { |
| 1909 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r) . chr($a); |
|
| 1909 | + $icXOR[$key] .= chr($b).chr($g).chr($r).chr($a); |
|
| 1910 | 1910 | } elseif ($bpp[$key] == 24) { |
| 1911 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r); |
|
| 1911 | + $icXOR[$key] .= chr($b).chr($g).chr($r); |
|
| 1912 | 1912 | } |
| 1913 | 1913 | |
| 1914 | 1914 | if ($a < 128) { |
@@ -1935,48 +1935,48 @@ discard block |
||
| 1935 | 1935 | |
| 1936 | 1936 | // BITMAPINFOHEADER - 40 bytes |
| 1937 | 1937 | $BitmapInfoHeader[$key] = ''; |
| 1938 | - $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
| 1939 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
| 1938 | + $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
| 1939 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
| 1940 | 1940 | // The biHeight member specifies the combined |
| 1941 | 1941 | // height of the XOR and AND masks. |
| 1942 | 1942 | $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4); // LONG biHeight; |
| 1943 | - $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
| 1944 | - $BitmapInfoHeader[$key] .= chr($bpp[$key]) . "\x00"; // wBitCount; |
|
| 1945 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
| 1946 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
| 1947 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
| 1948 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
| 1949 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
| 1950 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
| 1943 | + $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
| 1944 | + $BitmapInfoHeader[$key] .= chr($bpp[$key])."\x00"; // wBitCount; |
|
| 1945 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
| 1946 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
| 1947 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
| 1948 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
| 1949 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
| 1950 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
| 1951 | 1951 | } |
| 1952 | 1952 | |
| 1953 | 1953 | |
| 1954 | - $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
| 1955 | - $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
| 1956 | - $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
| 1954 | + $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
| 1955 | + $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
| 1956 | + $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
| 1957 | 1957 | |
| 1958 | 1958 | $dwImageOffset = 6 + (count($gd_image_array) * 16); |
| 1959 | 1959 | foreach ($gd_image_array as $key => $gd_image) { |
| 1960 | 1960 | // ICONDIRENTRY idEntries[1]; // An entry for each image (idCount of 'em) |
| 1961 | 1961 | |
| 1962 | - $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
| 1963 | - $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
| 1964 | - $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
| 1965 | - $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
| 1962 | + $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
| 1963 | + $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
| 1964 | + $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
| 1965 | + $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
| 1966 | 1966 | |
| 1967 | - $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
| 1968 | - $icondata .= chr($bpp[$key]) . "\x00"; // wBitCount; // Bits per pixel |
|
| 1967 | + $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
| 1968 | + $icondata .= chr($bpp[$key])."\x00"; // wBitCount; // Bits per pixel |
|
| 1969 | 1969 | |
| 1970 | 1970 | $dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]); |
| 1971 | 1971 | $icondata .= phpthumb_functions::LittleEndian2String( |
| 1972 | 1972 | $dwBytesInRes, |
| 1973 | 1973 | 4 |
| 1974 | - ); // dwBytesInRes; // How many bytes in this resource? |
|
| 1974 | + ); // dwBytesInRes; // How many bytes in this resource? |
|
| 1975 | 1975 | |
| 1976 | 1976 | $icondata .= phpthumb_functions::LittleEndian2String( |
| 1977 | 1977 | $dwImageOffset, |
| 1978 | 1978 | 4 |
| 1979 | - ); // dwImageOffset; // Where in the file is this image? |
|
| 1979 | + ); // dwImageOffset; // Where in the file is this image? |
|
| 1980 | 1980 | $dwImageOffset += strlen($BitmapInfoHeader[$key]); |
| 1981 | 1981 | $dwImageOffset += strlen($icXOR[$key]); |
| 1982 | 1982 | $dwImageOffset += strlen($icAND[$key]); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | static $dirs = []; |
| 42 | 42 | $liste = []; |
| 43 | 43 | foreach (creer_chemin() as $dir) { |
| 44 | - if (!isset($dirs[$a = $dir . $dirname])) { |
|
| 44 | + if (!isset($dirs[$a = $dir.$dirname])) { |
|
| 45 | 45 | $dirs[$a] = (is_dir($a) || !$a); |
| 46 | 46 | } |
| 47 | 47 | if ($dirs[$a]) { |
@@ -67,21 +67,21 @@ discard block |
||
| 67 | 67 | **/ |
| 68 | 68 | function chercher_module_lang($module, $lang = '') { |
| 69 | 69 | if ($lang) { |
| 70 | - $lang = '_' . $lang; |
|
| 70 | + $lang = '_'.$lang; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // 1) dans un repertoire nomme lang/ se trouvant sur le chemin |
| 74 | 74 | if ( |
| 75 | 75 | $f = ($module == 'local' |
| 76 | - ? find_in_path($module . $lang . '.php', 'lang/') |
|
| 77 | - : find_langs_in_path($module . $lang . '.php', 'lang/')) |
|
| 76 | + ? find_in_path($module.$lang.'.php', 'lang/') |
|
| 77 | + : find_langs_in_path($module.$lang.'.php', 'lang/')) |
|
| 78 | 78 | ) { |
| 79 | 79 | return is_array($f) ? $f : [$f]; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // 2) directement dans le chemin (old style, uniquement pour local) |
| 83 | 83 | return (($module == 'local') or strpos($module, '/')) |
| 84 | - ? (($f = find_in_path($module . $lang . '.php')) ? [$f] : false) |
|
| 84 | + ? (($f = find_in_path($module.$lang.'.php')) ? [$f] : false) |
|
| 85 | 85 | : false; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | **/ |
| 106 | 106 | function charger_langue($lang, $module = 'spip') { |
| 107 | 107 | static $langs = []; |
| 108 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 108 | + $var = 'i18n_'.$module.'_'.$lang; |
|
| 109 | 109 | if (!isset($langs[$lang])) { |
| 110 | 110 | $langs[$lang] = []; |
| 111 | 111 | if ($lang) { |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | foreach ($langs[$lang] as $l) { |
| 122 | 122 | if ($fichiers_lang = chercher_module_lang($module, $l)) { |
| 123 | - $GLOBALS['idx_lang'] = 'i18n_' . $module . '_' . $l; |
|
| 123 | + $GLOBALS['idx_lang'] = 'i18n_'.$module.'_'.$l; |
|
| 124 | 124 | $GLOBALS[$GLOBALS['idx_lang']] = lire_fichier_langue(array_shift($fichiers_lang)); |
| 125 | 125 | surcharger_langue($fichiers_lang); |
| 126 | 126 | if ($l !== $lang) { |
| 127 | - $GLOBALS[$var] = &$GLOBALS['i18n_' . $module . '_' . $l]; |
|
| 127 | + $GLOBALS[$var] = &$GLOBALS['i18n_'.$module.'_'.$l]; |
|
| 128 | 128 | } |
| 129 | - $GLOBALS['lang_' . $var] = $l; |
|
| 129 | + $GLOBALS['lang_'.$var] = $l; |
|
| 130 | 130 | #spip_log("module de langue : {$module}_$l.php", 'traduire'); |
| 131 | 131 | break; |
| 132 | 132 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | function lire_fichier_langue(string $fichier): array { |
| 146 | 146 | $idx_lang_before = $GLOBALS['idx_lang'] ?? null; |
| 147 | - $idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang') . '@temporaire'; |
|
| 147 | + $idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang').'@temporaire'; |
|
| 148 | 148 | $GLOBALS['idx_lang'] = $idx_lang_tmp; |
| 149 | 149 | $idx_lang = include $fichier; |
| 150 | 150 | $GLOBALS['idx_lang'] = $idx_lang_before; |
@@ -273,27 +273,27 @@ discard block |
||
| 273 | 273 | } else { |
| 274 | 274 | $modules = ['spip', 'ecrire']; |
| 275 | 275 | $code = $ori; |
| 276 | - $ori_complet = implode('|', $modules) . ':' . $ori; |
|
| 276 | + $ori_complet = implode('|', $modules).':'.$ori; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | $desc = new SPIP_Traductions_Description(); |
| 280 | 280 | |
| 281 | 281 | // parcourir tous les modules jusqu'a ce qu'on trouve |
| 282 | 282 | foreach ($modules as $module) { |
| 283 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 283 | + $var = 'i18n_'.$module.'_'.$lang; |
|
| 284 | 284 | |
| 285 | 285 | if (empty($GLOBALS[$var])) { |
| 286 | 286 | charger_langue($lang, $module); |
| 287 | 287 | // surcharges persos -- on cherche |
| 288 | 288 | // (lang/)local_xx.php et/ou (lang/)local.php ... |
| 289 | - if (!isset($local['local_' . $lang])) { |
|
| 289 | + if (!isset($local['local_'.$lang])) { |
|
| 290 | 290 | // redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer) |
| 291 | 291 | $GLOBALS['idx_lang'] = $var; |
| 292 | 292 | // ... (lang/)local_xx.php |
| 293 | - $local['local_' . $lang] = chercher_module_lang('local', $lang); |
|
| 293 | + $local['local_'.$lang] = chercher_module_lang('local', $lang); |
|
| 294 | 294 | } |
| 295 | - if ($local['local_' . $lang]) { |
|
| 296 | - surcharger_langue($local['local_' . $lang]); |
|
| 295 | + if ($local['local_'.$lang]) { |
|
| 296 | + surcharger_langue($local['local_'.$lang]); |
|
| 297 | 297 | } |
| 298 | 298 | // ... puis (lang/)local.php |
| 299 | 299 | if (!isset($local['local'])) { |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | if (isset($GLOBALS[$var][$code])) { |
| 308 | 308 | $desc->code = $code; |
| 309 | 309 | $desc->module = $module; |
| 310 | - $desc->langue = $GLOBALS['lang_' . $var] ?? $lang; |
|
| 310 | + $desc->langue = $GLOBALS['lang_'.$var] ?? $lang; |
|
| 311 | 311 | $desc->texte = $GLOBALS[$var][$code]; |
| 312 | 312 | break; |
| 313 | 313 | } |
@@ -365,13 +365,13 @@ discard block |
||
| 365 | 365 | if (!$desc->mode and $desc->texte) { |
| 366 | 366 | // ne pas modifier 2 fois l'affichage |
| 367 | 367 | $desc->mode = 'traduction'; |
| 368 | - $classe = 'debug-traduction' . ($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 368 | + $classe = 'debug-traduction'.($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 369 | 369 | $desc->texte = '<span ' |
| 370 | - . 'lang=' . $desc->langue |
|
| 371 | - . ' class=' . $classe |
|
| 372 | - . ' data-module=' . $desc->module |
|
| 373 | - . ' data-code=' . $desc->code |
|
| 374 | - . ' title=' . $modules . '(' . $desc->langue . ')>' |
|
| 370 | + . 'lang='.$desc->langue |
|
| 371 | + . ' class='.$classe |
|
| 372 | + . ' data-module='.$desc->module |
|
| 373 | + . ' data-code='.$desc->code |
|
| 374 | + . ' title='.$modules.'('.$desc->langue.')>' |
|
| 375 | 375 | . $desc->texte |
| 376 | 376 | . '</span>'; |
| 377 | 377 | $desc->texte = str_replace( |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | : calculer_liste($val, $p->descr, $boucles, $id_boucle); |
| 121 | 121 | if ($var !== 1) { |
| 122 | 122 | $val = ($echap ? "\'$var\' => ' . argumenter_squelette(" : "'$var' => ") |
| 123 | - . $val . ($echap ? ") . '" : ' '); |
|
| 123 | + . $val.($echap ? ") . '" : ' '); |
|
| 124 | 124 | } else { |
| 125 | 125 | $val = $echap ? "'.$val.'" : $val; |
| 126 | 126 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | if (!$lang) { |
| 142 | 142 | $lang = '$GLOBALS["spip_lang"]'; |
| 143 | 143 | } |
| 144 | - $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ") . $lang . ($echap ? ") . '" : ' '); |
|
| 144 | + $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ").$lang.($echap ? ") . '" : ' '); |
|
| 145 | 145 | |
| 146 | 146 | return $l; |
| 147 | 147 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $_contexte = argumenter_inclure($p->param, false, $p, $boucles, $id_boucle, true, '', true); |
| 172 | 172 | if (is_string($p->texte)) { |
| 173 | 173 | $fichier = $p->texte; |
| 174 | - $code = '"' . str_replace('"', '\"', $fichier) . '"'; |
|
| 174 | + $code = '"'.str_replace('"', '\"', $fichier).'"'; |
|
| 175 | 175 | } else { |
| 176 | 176 | $code = calculer_liste($p->texte, $p->descr, $boucles, $id_boucle); |
| 177 | 177 | if ($code and preg_match("/^'([^']*)'/s", $code, $r)) { |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | return false; |
| 221 | 221 | } // j'aurais voulu toucher le fond ... |
| 222 | 222 | |
| 223 | - $contexte = 'array(' . $_contexte . ')'; |
|
| 223 | + $contexte = 'array('.$_contexte.')'; |
|
| 224 | 224 | |
| 225 | 225 | if ($env) { |
| 226 | 226 | $contexte = "array_merge('.var_export(\$Pile[0],1).',$contexte)"; |
@@ -235,16 +235,16 @@ discard block |
||
| 235 | 235 | $_options[] = $ajax; |
| 236 | 236 | } |
| 237 | 237 | $code = " ' . argumenter_squelette($code) . '"; |
| 238 | - $code = 'echo ' . sprintf( |
|
| 238 | + $code = 'echo '.sprintf( |
|
| 239 | 239 | CODE_RECUPERER_FOND, |
| 240 | 240 | $code, |
| 241 | 241 | $contexte, |
| 242 | 242 | implode(',', $_options), |
| 243 | 243 | "_request(\\'connect\\') ?? \\'\\'" |
| 244 | - ) . ';'; |
|
| 244 | + ).';'; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - return "\n'<'.'" . '?php ' . $code . "\n?'." . "'>'"; |
|
| 247 | + return "\n'<'.'".'?php '.$code."\n?'."."'>'"; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $id = $id_table; |
| 325 | 325 | $statut = preg_replace(',\W,', '', $s['champ']); // securite |
| 326 | 326 | } |
| 327 | - $mstatut = $id . '.' . $statut; |
|
| 327 | + $mstatut = $id.'.'.$statut; |
|
| 328 | 328 | |
| 329 | 329 | $arg_ignore_previsu = ($ignore_previsu ? ',true' : ''); |
| 330 | 330 | include_spip('public/quete'); |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | isset($s['post_date']) and $s['post_date'] |
| 333 | 333 | and $GLOBALS['meta']['post_dates'] == 'non' |
| 334 | 334 | ) { |
| 335 | - $date = $id . '.' . preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 335 | + $date = $id.'.'.preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 336 | 336 | array_unshift( |
| 337 | 337 | $boucle->where, |
| 338 | 338 | $echapper ? |
| 339 | - "\nquete_condition_postdates('$date'," . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 339 | + "\nquete_condition_postdates('$date',"._q($boucle->sql_serveur)."$arg_ignore_previsu)" |
|
| 340 | 340 | : |
| 341 | 341 | quete_condition_postdates($date, $boucle->sql_serveur, $ignore_previsu) |
| 342 | 342 | ); |
@@ -345,9 +345,9 @@ discard block |
||
| 345 | 345 | $boucle->where, |
| 346 | 346 | $echapper ? |
| 347 | 347 | "\nquete_condition_statut('$mstatut'," |
| 348 | - . _q($s['previsu']) . ',' |
|
| 349 | - . _q($s['publie']) . ',' |
|
| 350 | - . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 348 | + . _q($s['previsu']).',' |
|
| 349 | + . _q($s['publie']).',' |
|
| 350 | + . _q($boucle->sql_serveur)."$arg_ignore_previsu)" |
|
| 351 | 351 | : |
| 352 | 352 | quete_condition_statut($mstatut, $s['previsu'], $s['publie'], $boucle->sql_serveur, $ignore_previsu) |
| 353 | 353 | ); |
@@ -381,14 +381,14 @@ discard block |
||
| 381 | 381 | if (_request('var_mode_affiche') != 'resultat') { |
| 382 | 382 | $trace = ''; |
| 383 | 383 | } else { |
| 384 | - $_trace = $boucles[$id_boucle]->descr['nom'] . $id_boucle; |
|
| 384 | + $_trace = $boucles[$id_boucle]->descr['nom'].$id_boucle; |
|
| 385 | 385 | $_trace = "\$GLOBALS['debug_objets']['resultat']['$_trace']"; |
| 386 | 386 | $trace = " |
| 387 | 387 | if (empty($_trace)) { |
| 388 | 388 | $_trace = []; |
| 389 | 389 | } |
| 390 | 390 | if (count($_trace) < 3) { |
| 391 | - $_trace" . '[] = $t0; |
|
| 391 | + $_trace".'[] = $t0; |
|
| 392 | 392 | }'; |
| 393 | 393 | } |
| 394 | 394 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | return |
| 423 | 423 | // Numrows[$nom] peut ne pas être encore defini |
| 424 | 424 | "\n\t\$save_numrows = (isset(\$Numrows['$nom']) ? \$Numrows['$nom'] : array());" |
| 425 | - . "\n\t\$t0 = " . $boucles[$id_boucle]->return . ';' |
|
| 425 | + . "\n\t\$t0 = ".$boucles[$id_boucle]->return.';' |
|
| 426 | 426 | . "\n\t\$Numrows['$nom'] = (\$save_numrows);" |
| 427 | 427 | . $trace |
| 428 | 428 | . "\n\treturn \$t0;"; |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | // faudrait expanser le foreach a la compil, car y en a souvent qu'un |
| 491 | 491 | // et puis faire un [] plutot qu'un "','." |
| 492 | 492 | if ($boucle->doublons) { |
| 493 | - $corps .= "\n\t\t\tforeach(" . $boucle->doublons . ' as $k) $doublons[$k] .= "," . ' . |
|
| 493 | + $corps .= "\n\t\t\tforeach(".$boucle->doublons.' as $k) $doublons[$k] .= "," . '. |
|
| 494 | 494 | index_pile($id_boucle, $primary, $boucles) |
| 495 | 495 | . "; // doublons\n"; |
| 496 | 496 | } |
@@ -518,13 +518,13 @@ discard block |
||
| 518 | 518 | $corps .= |
| 519 | 519 | "\n\t\tlang_select_public(" |
| 520 | 520 | . index_pile($id_boucle, 'lang', $boucles) |
| 521 | - . ", '" . $boucle->lang_select . "'" |
|
| 521 | + . ", '".$boucle->lang_select."'" |
|
| 522 | 522 | . (in_array($type_boucle, [ |
| 523 | 523 | 'articles', |
| 524 | 524 | 'rubriques', |
| 525 | 525 | 'hierarchie', |
| 526 | 526 | 'breves' |
| 527 | - ]) ? ', ' . index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 527 | + ]) ? ', '.index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 528 | 528 | . ');'; |
| 529 | 529 | } else { |
| 530 | 530 | $init_lang = ''; |
@@ -546,20 +546,16 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | // gestion optimale des separateurs et des boucles constantes |
| 548 | 548 | if (is_countable($boucle->separateur) ? count($boucle->separateur) : 0) { |
| 549 | - $code_sep = ("'" . str_replace("'", "\'", join('', $boucle->separateur)) . "'"); |
|
| 549 | + $code_sep = ("'".str_replace("'", "\'", join('', $boucle->separateur))."'"); |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | $corps .= |
| 553 | 553 | ((!$boucle->separateur) ? |
| 554 | - (($constant && !$corps && !$flag_cpt) ? $return : |
|
| 555 | - (($return === "''") ? '' : |
|
| 556 | - ("\n\t\t" . '$t0 .= ' . $return . ';'))) : |
|
| 557 | - ("\n\t\t\$t1 " . |
|
| 554 | + (($constant && !$corps && !$flag_cpt) ? $return : (($return === "''") ? '' : ("\n\t\t".'$t0 .= '.$return.';'))) : ("\n\t\t\$t1 ". |
|
| 558 | 555 | ((strpos($return, '$t1.') === 0) ? |
| 559 | - ('.=' . substr($return, 4)) : |
|
| 560 | - ('= ' . $return)) . |
|
| 561 | - ";\n\t\t" . |
|
| 562 | - '$t0 .= ((strlen($t1) && strlen($t0)) ? ' . $code_sep . " : '') . \$t1;")); |
|
| 556 | + ('.='.substr($return, 4)) : ('= '.$return)). |
|
| 557 | + ";\n\t\t". |
|
| 558 | + '$t0 .= ((strlen($t1) && strlen($t0)) ? '.$code_sep." : '') . \$t1;")); |
|
| 563 | 559 | |
| 564 | 560 | // Calculer les invalideurs si c'est une boucle non constante et si on |
| 565 | 561 | // souhaite invalider ces elements |
@@ -641,7 +637,7 @@ discard block |
||
| 641 | 637 | $corps, |
| 642 | 638 | $fin_lang, |
| 643 | 639 | $trace, |
| 644 | - 'BOUCLE' . $id_boucle . ' @ ' . ($boucle->descr['sourcefile']) |
|
| 640 | + 'BOUCLE'.$id_boucle.' @ '.($boucle->descr['sourcefile']) |
|
| 645 | 641 | ); |
| 646 | 642 | |
| 647 | 643 | # var_dump($a);exit; |
@@ -662,25 +658,24 @@ discard block |
||
| 662 | 658 | **/ |
| 663 | 659 | function calculer_requete_sql($boucle) { |
| 664 | 660 | $init = []; |
| 665 | - $init[] = calculer_dec('table', "'" . $boucle->id_table . "'"); |
|
| 666 | - $init[] = calculer_dec('id', "'" . $boucle->id_boucle . "'"); |
|
| 661 | + $init[] = calculer_dec('table', "'".$boucle->id_table."'"); |
|
| 662 | + $init[] = calculer_dec('id', "'".$boucle->id_boucle."'"); |
|
| 667 | 663 | # En absence de champ c'est un decompte : |
| 668 | 664 | $init[] = calculer_dec('from', calculer_from($boucle)); |
| 669 | 665 | $init[] = calculer_dec('type', calculer_from_type($boucle)); |
| 670 | 666 | $init[] = calculer_dec( |
| 671 | 667 | 'groupby', |
| 672 | - 'array(' . (($g = join("\",\n\t\t\"", $boucle->group)) ? '"' . $g . '"' : '') . ')' |
|
| 668 | + 'array('.(($g = join("\",\n\t\t\"", $boucle->group)) ? '"'.$g.'"' : '').')' |
|
| 673 | 669 | ); |
| 674 | - $init[] = calculer_dec('select', 'array("' . join("\",\n\t\t\"", $boucle->select) . '")'); |
|
| 675 | - $init[] = calculer_dec('orderby', 'array(' . calculer_order($boucle) . ')'); |
|
| 670 | + $init[] = calculer_dec('select', 'array("'.join("\",\n\t\t\"", $boucle->select).'")'); |
|
| 671 | + $init[] = calculer_dec('orderby', 'array('.calculer_order($boucle).')'); |
|
| 676 | 672 | $init[] = calculer_dec('where', calculer_dump_array($boucle->where)); |
| 677 | 673 | $init[] = calculer_dec('join', calculer_dump_join($boucle->join)); |
| 678 | 674 | $init[] = calculer_dec( |
| 679 | 675 | 'limit', |
| 680 | 676 | ( |
| 681 | 677 | strpos($boucle->limit, 'intval') === false ? |
| 682 | - "'" . ($boucle->limit) . "'" : |
|
| 683 | - $boucle->limit |
|
| 678 | + "'".($boucle->limit)."'" : $boucle->limit |
|
| 684 | 679 | ) |
| 685 | 680 | ); |
| 686 | 681 | $init[] = calculer_dec('having', calculer_dump_array($boucle->having)); |
@@ -689,17 +684,17 @@ discard block |
||
| 689 | 684 | // ou recalculée à chaque passage (vide) |
| 690 | 685 | foreach ($init as $i) { |
| 691 | 686 | if (reset($i)) { |
| 692 | - $s .= "\n\t\t" . end($i); |
|
| 687 | + $s .= "\n\t\t".end($i); |
|
| 693 | 688 | } # statique |
| 694 | 689 | else { |
| 695 | - $d .= "\n\t" . end($i); |
|
| 690 | + $d .= "\n\t".end($i); |
|
| 696 | 691 | } # dynamique |
| 697 | 692 | } |
| 698 | 693 | |
| 699 | 694 | return ($boucle->hierarchie ? "\n\t$boucle->hierarchie" : '') |
| 700 | 695 | . $boucle->in |
| 701 | 696 | . $boucle->hash |
| 702 | - . "\n\t" . 'if (!isset($command[\'table\'])) {' |
|
| 697 | + . "\n\t".'if (!isset($command[\'table\'])) {' |
|
| 703 | 698 | . $s |
| 704 | 699 | . "\n\t}" |
| 705 | 700 | . $d; |
@@ -754,7 +749,7 @@ discard block |
||
| 754 | 749 | ]; |
| 755 | 750 | |
| 756 | 751 | $p->id_boucle = $context_compil[2] ?? ''; |
| 757 | - $p->ligne = (int)($context_compil[3] ?? 0); |
|
| 752 | + $p->ligne = (int) ($context_compil[3] ?? 0); |
|
| 758 | 753 | $p->lang = $context_compil[4] ?? ''; |
| 759 | 754 | |
| 760 | 755 | return $p; |
@@ -783,7 +778,7 @@ discard block |
||
| 783 | 778 | * - index 1 : Code de l'affectation |
| 784 | 779 | **/ |
| 785 | 780 | function calculer_dec($nom, $val) { |
| 786 | - $static = 'if (!isset($command[\'' . $nom . '\'])) '; |
|
| 781 | + $static = 'if (!isset($command[\''.$nom.'\'])) '; |
|
| 787 | 782 | // si une variable apparait dans le calcul de la clause |
| 788 | 783 | // il faut la re-evaluer a chaque passage |
| 789 | 784 | if ( |
@@ -800,7 +795,7 @@ discard block |
||
| 800 | 795 | $static = ''; |
| 801 | 796 | } |
| 802 | 797 | |
| 803 | - return [$static, '$command[\'' . $nom . '\'] = ' . $val . ';']; |
|
| 798 | + return [$static, '$command[\''.$nom.'\'] = '.$val.';']; |
|
| 804 | 799 | } |
| 805 | 800 | |
| 806 | 801 | /** |
@@ -825,27 +820,27 @@ discard block |
||
| 825 | 820 | } |
| 826 | 821 | $res = ''; |
| 827 | 822 | if ($a and $a[0] == "'?'") { |
| 828 | - return ('(' . calculer_dump_array($a[1]) . |
|
| 829 | - ' ? ' . calculer_dump_array($a[2]) . |
|
| 830 | - ' : ' . calculer_dump_array($a[3]) . |
|
| 823 | + return ('('.calculer_dump_array($a[1]). |
|
| 824 | + ' ? '.calculer_dump_array($a[2]). |
|
| 825 | + ' : '.calculer_dump_array($a[3]). |
|
| 831 | 826 | ')'); |
| 832 | 827 | } else { |
| 833 | 828 | foreach ($a as $k => $v) { |
| 834 | - $showk = (is_numeric($k) ? '' : sql_quote($k) . ' => '); |
|
| 835 | - $res .= ', ' . $showk . calculer_dump_array($v); |
|
| 829 | + $showk = (is_numeric($k) ? '' : sql_quote($k).' => '); |
|
| 830 | + $res .= ', '.$showk.calculer_dump_array($v); |
|
| 836 | 831 | } |
| 837 | 832 | |
| 838 | - return "\n\t\t\tarray(" . substr($res, 2) . ')'; |
|
| 833 | + return "\n\t\t\tarray(".substr($res, 2).')'; |
|
| 839 | 834 | } |
| 840 | 835 | } |
| 841 | 836 | |
| 842 | 837 | function calculer_dump_join($a) { |
| 843 | 838 | $res = ''; |
| 844 | 839 | foreach ($a as $k => $v) { |
| 845 | - $res .= ", '$k' => array(" . implode(',', $v) . ')'; |
|
| 840 | + $res .= ", '$k' => array(".implode(',', $v).')'; |
|
| 846 | 841 | } |
| 847 | 842 | |
| 848 | - return 'array(' . substr($res, 2) . ')'; |
|
| 843 | + return 'array('.substr($res, 2).')'; |
|
| 849 | 844 | } |
| 850 | 845 | |
| 851 | 846 | /** |
@@ -862,7 +857,7 @@ discard block |
||
| 862 | 857 | $res .= ",'$k' => '$v'"; |
| 863 | 858 | } |
| 864 | 859 | |
| 865 | - return 'array(' . substr($res, 1) . ')'; |
|
| 860 | + return 'array('.substr($res, 1).')'; |
|
| 866 | 861 | } |
| 867 | 862 | |
| 868 | 863 | /** |
@@ -880,7 +875,7 @@ discard block |
||
| 880 | 875 | $res .= ",'$k' => '$v'"; |
| 881 | 876 | } |
| 882 | 877 | |
| 883 | - return 'array(' . substr($res, 1) . ')'; |
|
| 878 | + return 'array('.substr($res, 1).')'; |
|
| 884 | 879 | } |
| 885 | 880 | |
| 886 | 881 | function calculer_order(&$boucle) { |
@@ -949,19 +944,19 @@ discard block |
||
| 949 | 944 | ) { |
| 950 | 945 | $res .= " .\n$tab$code"; |
| 951 | 946 | } else { |
| 952 | - $res = substr($res, 0, -1) . substr($code, 1); |
|
| 947 | + $res = substr($res, 0, -1).substr($code, 1); |
|
| 953 | 948 | } |
| 954 | 949 | } |
| 955 | 950 | |
| 956 | - return '(' . substr($res, 2 + $descr['niv']) . ')'; |
|
| 951 | + return '('.substr($res, 2 + $descr['niv']).')'; |
|
| 957 | 952 | } |
| 958 | 953 | } else { |
| 959 | - $nom = $descr['nom'] . $id_boucle . ($descr['niv'] ?: ''); |
|
| 954 | + $nom = $descr['nom'].$id_boucle.($descr['niv'] ?: ''); |
|
| 960 | 955 | |
| 961 | - return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(" . join( |
|
| 956 | + return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(".join( |
|
| 962 | 957 | " ,\n$tab", |
| 963 | 958 | $codes |
| 964 | - ) . ')))'; |
|
| 959 | + ).')))'; |
|
| 965 | 960 | } |
| 966 | 961 | } |
| 967 | 962 | |
@@ -988,7 +983,7 @@ discard block |
||
| 988 | 983 | // texte seul |
| 989 | 984 | case 'texte': |
| 990 | 985 | $code = sandbox_composer_texte($p->texte, $p); |
| 991 | - $commentaire = strlen($p->texte) . ' signes'; |
|
| 986 | + $commentaire = strlen($p->texte).' signes'; |
|
| 992 | 987 | $avant = ''; |
| 993 | 988 | $apres = ''; |
| 994 | 989 | $altern = "''"; |
@@ -997,14 +992,14 @@ discard block |
||
| 997 | 992 | case 'polyglotte': |
| 998 | 993 | $code = ''; |
| 999 | 994 | foreach ($p->traductions as $k => $v) { |
| 1000 | - $code .= ",'" . |
|
| 1001 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $k) . |
|
| 1002 | - "' => '" . |
|
| 1003 | - str_replace(['\\', "'"], ['\\\\', "\\'"], $v) . |
|
| 995 | + $code .= ",'". |
|
| 996 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $k). |
|
| 997 | + "' => '". |
|
| 998 | + str_replace(['\\', "'"], ['\\\\', "\\'"], $v). |
|
| 1004 | 999 | "'"; |
| 1005 | 1000 | } |
| 1006 | - $code = 'choisir_traduction(array(' . |
|
| 1007 | - substr($code, 1) . |
|
| 1001 | + $code = 'choisir_traduction(array('. |
|
| 1002 | + substr($code, 1). |
|
| 1008 | 1003 | '))'; |
| 1009 | 1004 | $commentaire = '&'; |
| 1010 | 1005 | $avant = ''; |
@@ -1020,7 +1015,7 @@ discard block |
||
| 1020 | 1015 | $err_e_c = true; |
| 1021 | 1016 | $code = "''"; |
| 1022 | 1017 | } else { |
| 1023 | - $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 1018 | + $commentaire = '<INCLURE '.addslashes(str_replace("\n", ' ', $code)).'>'; |
|
| 1024 | 1019 | $avant = ''; |
| 1025 | 1020 | $apres = ''; |
| 1026 | 1021 | $altern = "''"; |
@@ -1049,8 +1044,8 @@ discard block |
||
| 1049 | 1044 | $err_e_c = true; |
| 1050 | 1045 | $code = "''"; |
| 1051 | 1046 | } else { |
| 1052 | - $code = 'BOUCLE' . |
|
| 1053 | - str_replace('-', '_', $nom) . $descr['nom'] . |
|
| 1047 | + $code = 'BOUCLE'. |
|
| 1048 | + str_replace('-', '_', $nom).$descr['nom']. |
|
| 1054 | 1049 | '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
| 1055 | 1050 | $commentaire = "?$nom"; |
| 1056 | 1051 | if ( |
@@ -1092,24 +1087,22 @@ discard block |
||
| 1092 | 1087 | foreach ($p->arg as $k => $v) { |
| 1093 | 1088 | $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
| 1094 | 1089 | if ($k) { |
| 1095 | - $l[] = _q($k) . ' => ' . $_v; |
|
| 1090 | + $l[] = _q($k).' => '.$_v; |
|
| 1096 | 1091 | } else { |
| 1097 | 1092 | $code = $_v; |
| 1098 | 1093 | } |
| 1099 | 1094 | } |
| 1100 | 1095 | // Si le module n'est pas fourni, l'expliciter sauf si calculé |
| 1101 | 1096 | if ($p->module) { |
| 1102 | - $m = $p->module . ':' . $p->nom_champ; |
|
| 1097 | + $m = $p->module.':'.$p->nom_champ; |
|
| 1103 | 1098 | } elseif ($p->nom_champ) { |
| 1104 | - $m = MODULES_IDIOMES . ':' . $p->nom_champ; |
|
| 1099 | + $m = MODULES_IDIOMES.':'.$p->nom_champ; |
|
| 1105 | 1100 | } else { |
| 1106 | 1101 | $m = ''; |
| 1107 | 1102 | } |
| 1108 | 1103 | |
| 1109 | - $code = (!$code ? "'$m'" : |
|
| 1110 | - ($m ? "'$m' . $code" : |
|
| 1111 | - ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 1112 | - . (!$l ? '' : (', array(' . implode(",\n", $l) . ')')); |
|
| 1104 | + $code = (!$code ? "'$m'" : ($m ? "'$m' . $code" : ("(strpos(\$x=$code, ':') ? \$x : ('".MODULES_IDIOMES.":' . \$x))"))) |
|
| 1105 | + . (!$l ? '' : (', array('.implode(",\n", $l).')')); |
|
| 1113 | 1106 | $code = "_T($code)"; |
| 1114 | 1107 | if ($p->param) { |
| 1115 | 1108 | $p->id_boucle = $id_boucle; |
@@ -1131,7 +1124,7 @@ discard block |
||
| 1131 | 1124 | $p->type_requete = $type; |
| 1132 | 1125 | |
| 1133 | 1126 | $code = calculer_champ($p); |
| 1134 | - $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 1127 | + $commentaire = '#'.$p->nom_champ.$p->etoile; |
|
| 1135 | 1128 | $avant = calculer_liste( |
| 1136 | 1129 | $p->avant, |
| 1137 | 1130 | $descr, |
@@ -1171,10 +1164,9 @@ discard block |
||
| 1171 | 1164 | if ($code != "''") { |
| 1172 | 1165 | $code = compile_retour($code, $avant, $apres, $altern, $tab, $descr['niv']); |
| 1173 | 1166 | $codes[] = (($mode == 'validation') ? |
| 1174 | - "array($code, '$commentaire', " . $p->ligne . ')' |
|
| 1167 | + "array($code, '$commentaire', ".$p->ligne.')' |
|
| 1175 | 1168 | : (($mode == 'code') ? |
| 1176 | - "\n// $commentaire\n$code" : |
|
| 1177 | - $code)); |
|
| 1169 | + "\n// $commentaire\n$code" : $code)); |
|
| 1178 | 1170 | } |
| 1179 | 1171 | } // foreach |
| 1180 | 1172 | |
@@ -1230,19 +1222,19 @@ discard block |
||
| 1230 | 1222 | $cond = ''; |
| 1231 | 1223 | } elseif (preg_match(_REGEXP_COND_VIDE_NONVIDE, $code, $r)) { |
| 1232 | 1224 | $t = $r[2]; |
| 1233 | - $cond = '!' . $r[1]; |
|
| 1225 | + $cond = '!'.$r[1]; |
|
| 1234 | 1226 | } else { |
| 1235 | 1227 | if (preg_match(_REGEXP_COND_NONVIDE_VIDE, $code, $r)) { |
| 1236 | 1228 | $t = $r[2]; |
| 1237 | 1229 | $cond = $r[1]; |
| 1238 | 1230 | } else { |
| 1239 | - $t = '$t' . $n; |
|
| 1231 | + $t = '$t'.$n; |
|
| 1240 | 1232 | $cond = "($t = $code)!==''"; |
| 1241 | 1233 | } |
| 1242 | 1234 | } |
| 1243 | 1235 | |
| 1244 | - $res = (!$avant ? '' : "$avant . ") . |
|
| 1245 | - $t . |
|
| 1236 | + $res = (!$avant ? '' : "$avant . "). |
|
| 1237 | + $t. |
|
| 1246 | 1238 | (!$apres ? '' : " . $apres"); |
| 1247 | 1239 | |
| 1248 | 1240 | if ($res !== $t) { |
@@ -1293,12 +1285,12 @@ discard block |
||
| 1293 | 1285 | |
| 1294 | 1286 | // rendre inertes les echappements de #[](){}<> |
| 1295 | 1287 | $i = 0; |
| 1296 | - while (false !== strpos($squelette, $inerte = '-INERTE' . $i)) { |
|
| 1288 | + while (false !== strpos($squelette, $inerte = '-INERTE'.$i)) { |
|
| 1297 | 1289 | $i++; |
| 1298 | 1290 | } |
| 1299 | 1291 | $squelette = preg_replace_callback( |
| 1300 | 1292 | ',\\\\([#[()\]{}<>]),', |
| 1301 | - fn($a) => "$inerte-" . ord($a[1]) . '-', |
|
| 1293 | + fn($a) => "$inerte-".ord($a[1]).'-', |
|
| 1302 | 1294 | $squelette, |
| 1303 | 1295 | -1, |
| 1304 | 1296 | $esc |
@@ -1314,7 +1306,7 @@ discard block |
||
| 1314 | 1306 | // Phraser le squelette, selon sa grammaire |
| 1315 | 1307 | |
| 1316 | 1308 | $boucles = []; |
| 1317 | - $f = charger_fonction('phraser_' . $gram, 'public'); |
|
| 1309 | + $f = charger_fonction('phraser_'.$gram, 'public'); |
|
| 1318 | 1310 | |
| 1319 | 1311 | $squelette = $f($squelette, '', $boucles, $descr); |
| 1320 | 1312 | |
@@ -1330,7 +1322,7 @@ discard block |
||
| 1330 | 1322 | ); |
| 1331 | 1323 | $boucles[$i]->descr['squelette'] = preg_replace_callback( |
| 1332 | 1324 | ",$inerte-(\d+)-,", |
| 1333 | - fn($a) => '\\\\' . chr($a[1]), |
|
| 1325 | + fn($a) => '\\\\'.chr($a[1]), |
|
| 1334 | 1326 | $boucle->descr['squelette'] |
| 1335 | 1327 | ); |
| 1336 | 1328 | } |
@@ -1341,19 +1333,19 @@ discard block |
||
| 1341 | 1333 | include_spip('public/decompiler'); |
| 1342 | 1334 | foreach ($boucles as $id => $boucle) { |
| 1343 | 1335 | if ($id) { |
| 1344 | - $decomp = "\n/* BOUCLE " . |
|
| 1345 | - $boucle->type_requete . |
|
| 1346 | - ' ' . |
|
| 1347 | - str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')) . |
|
| 1348 | - ($boucle->debug ? "\n *\n * " . implode("\n * ", $boucle->debug) . "\n" : '') . |
|
| 1336 | + $decomp = "\n/* BOUCLE ". |
|
| 1337 | + $boucle->type_requete. |
|
| 1338 | + ' '. |
|
| 1339 | + str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')). |
|
| 1340 | + ($boucle->debug ? "\n *\n * ".implode("\n * ", $boucle->debug)."\n" : ''). |
|
| 1349 | 1341 | " */\n"; |
| 1350 | 1342 | } else { |
| 1351 | - $decomp = ("\n/*\n" . |
|
| 1343 | + $decomp = ("\n/*\n". |
|
| 1352 | 1344 | str_replace('*/', '* /', public_decompiler($squelette, $gram)) |
| 1353 | 1345 | . "\n*/"); |
| 1354 | 1346 | } |
| 1355 | - $boucles[$id]->return = $decomp . $boucle->return; |
|
| 1356 | - $GLOBALS['debug_objets']['code'][$nom . $id] = $boucle->return; |
|
| 1347 | + $boucles[$id]->return = $decomp.$boucle->return; |
|
| 1348 | + $GLOBALS['debug_objets']['code'][$nom.$id] = $boucle->return; |
|
| 1357 | 1349 | } |
| 1358 | 1350 | } |
| 1359 | 1351 | |
@@ -1376,7 +1368,7 @@ discard block |
||
| 1376 | 1368 | } |
| 1377 | 1369 | } |
| 1378 | 1370 | foreach ($boucles as $id => $boucle) { |
| 1379 | - $GLOBALS['debug_objets']['boucle'][$nom . $id] = $boucle; |
|
| 1371 | + $GLOBALS['debug_objets']['boucle'][$nom.$id] = $boucle; |
|
| 1380 | 1372 | } |
| 1381 | 1373 | $descr['documents'] = compile_inclure_doublons($squelette); |
| 1382 | 1374 | |
@@ -1467,8 +1459,7 @@ discard block |
||
| 1467 | 1459 | } else { |
| 1468 | 1460 | $boucles[$id]->type_requete = false; |
| 1469 | 1461 | $boucle = $boucles[$id]; |
| 1470 | - $x = (!$boucle->sql_serveur ? '' : |
|
| 1471 | - ($boucle->sql_serveur . ':')) . |
|
| 1462 | + $x = (!$boucle->sql_serveur ? '' : ($boucle->sql_serveur.':')). |
|
| 1472 | 1463 | $type; |
| 1473 | 1464 | $msg = [ |
| 1474 | 1465 | 'zbug_table_inconnue', |
@@ -1558,13 +1549,13 @@ discard block |
||
| 1558 | 1549 | if ( |
| 1559 | 1550 | // fonction de boucle avec serveur & table |
| 1560 | 1551 | (!$serveur or |
| 1561 | - ((!function_exists($f = 'boucle_' . $serveur . '_' . $table)) |
|
| 1562 | - and (!function_exists($f = $f . '_dist')) |
|
| 1552 | + ((!function_exists($f = 'boucle_'.$serveur.'_'.$table)) |
|
| 1553 | + and (!function_exists($f = $f.'_dist')) |
|
| 1563 | 1554 | ) |
| 1564 | 1555 | ) |
| 1565 | 1556 | // fonction de boucle avec table |
| 1566 | - and (!function_exists($f = 'boucle_' . $table)) |
|
| 1567 | - and (!function_exists($f = $f . '_dist')) |
|
| 1557 | + and (!function_exists($f = 'boucle_'.$table)) |
|
| 1558 | + and (!function_exists($f = $f.'_dist')) |
|
| 1568 | 1559 | ) { |
| 1569 | 1560 | // fonction de boucle standard |
| 1570 | 1561 | if (!function_exists($f = 'boucle_DEFAUT')) { |
@@ -1572,20 +1563,20 @@ discard block |
||
| 1572 | 1563 | } |
| 1573 | 1564 | } |
| 1574 | 1565 | |
| 1575 | - $req = "\n\n\tstatic \$command = array();\n\t" . |
|
| 1576 | - "static \$connect;\n\t" . |
|
| 1577 | - "\$command['connect'] = \$connect = " . |
|
| 1578 | - _q($boucle->sql_serveur) . |
|
| 1579 | - ';' . |
|
| 1566 | + $req = "\n\n\tstatic \$command = array();\n\t". |
|
| 1567 | + "static \$connect;\n\t". |
|
| 1568 | + "\$command['connect'] = \$connect = ". |
|
| 1569 | + _q($boucle->sql_serveur). |
|
| 1570 | + ';'. |
|
| 1580 | 1571 | $f($id, $boucles); |
| 1581 | 1572 | } else { |
| 1582 | 1573 | $req = ("\n\treturn '';"); |
| 1583 | 1574 | } |
| 1584 | 1575 | |
| 1585 | 1576 | $boucles[$id]->return = |
| 1586 | - "\n\nfunction BOUCLE" . strtr($id, '-', '_') . $nom . |
|
| 1587 | - '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {' . |
|
| 1588 | - $req . |
|
| 1577 | + "\n\nfunction BOUCLE".strtr($id, '-', '_').$nom. |
|
| 1578 | + '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {'. |
|
| 1579 | + $req. |
|
| 1589 | 1580 | "\n}\n"; |
| 1590 | 1581 | } |
| 1591 | 1582 | |
@@ -1595,7 +1586,7 @@ discard block |
||
| 1595 | 1586 | return false; |
| 1596 | 1587 | } |
| 1597 | 1588 | |
| 1598 | - $principal = "\nfunction " . $nom . '($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1589 | + $principal = "\nfunction ".$nom.'($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1599 | 1590 | ' |
| 1600 | 1591 | // reporter de maniere securisee les doublons inclus |
| 1601 | 1592 | . ' |
@@ -1603,15 +1594,15 @@ discard block |
||
| 1603 | 1594 | $doublons = nettoyer_env_doublons($Pile[0]["doublons"]); |
| 1604 | 1595 | |
| 1605 | 1596 | $connect = ' . |
| 1606 | - _q($connect) . '; |
|
| 1597 | + _q($connect).'; |
|
| 1607 | 1598 | $page = ' . |
| 1608 | 1599 | // ATTENTION, le calcul de l'expression $corps affectera $Cache |
| 1609 | 1600 | // c'est pourquoi on l'affecte a la variable auxiliaire $page. |
| 1610 | 1601 | // avant de referencer $Cache |
| 1611 | - $corps . '; |
|
| 1602 | + $corps.'; |
|
| 1612 | 1603 | |
| 1613 | 1604 | return analyse_resultat_skel(' . var_export($nom, true) |
| 1614 | - . ', $Cache, $page, ' . var_export($sourcefile, true) . '); |
|
| 1605 | + . ', $Cache, $page, '.var_export($sourcefile, true).'); |
|
| 1615 | 1606 | }'; |
| 1616 | 1607 | |
| 1617 | 1608 | $secondes = spip_timer('calcul_skel'); |
@@ -1625,10 +1616,10 @@ discard block |
||
| 1625 | 1616 | $code->return = ' |
| 1626 | 1617 | // |
| 1627 | 1618 | // Fonction principale du squelette ' . |
| 1628 | - $sourcefile . |
|
| 1629 | - ($connect ? " pour $connect" : '') . |
|
| 1630 | - (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes") . |
|
| 1631 | - "\n//\n" . |
|
| 1619 | + $sourcefile. |
|
| 1620 | + ($connect ? " pour $connect" : ''). |
|
| 1621 | + (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes"). |
|
| 1622 | + "\n//\n". |
|
| 1632 | 1623 | $principal; |
| 1633 | 1624 | |
| 1634 | 1625 | $boucles[''] = $code; |
@@ -1680,7 +1671,7 @@ discard block |
||
| 1680 | 1671 | **/ |
| 1681 | 1672 | function requeteur_data_dist(&$boucles, &$boucle, &$id) { |
| 1682 | 1673 | include_spip('iterateur/data'); |
| 1683 | - if ($h = charger_fonction($boucle->type_requete . '_to_array', 'inc', true)) { |
|
| 1674 | + if ($h = charger_fonction($boucle->type_requete.'_to_array', 'inc', true)) { |
|
| 1684 | 1675 | $g = charger_fonction('data', 'iterateur'); |
| 1685 | 1676 | $boucles[$id] = $g($boucle); |
| 1686 | 1677 | // from[0] stocke le type de data (rss, yql, ...) |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | $infos['url_voir'] = $infos['type']; |
| 707 | 707 | } |
| 708 | 708 | if (!isset($infos['url_edit'])) { |
| 709 | - $infos['url_edit'] = $infos['url_voir'] . ($infos['editable'] ? '_edit' : ''); |
|
| 709 | + $infos['url_edit'] = $infos['url_voir'].($infos['editable'] ? '_edit' : ''); |
|
| 710 | 710 | } |
| 711 | 711 | if (!isset($infos['icone_objet'])) { |
| 712 | 712 | $infos['icone_objet'] = $infos['type']; |
@@ -718,48 +718,48 @@ discard block |
||
| 718 | 718 | $infos['texte_retour'] = 'icone_retour'; |
| 719 | 719 | } |
| 720 | 720 | if (!isset($infos['texte_modifier'])) { |
| 721 | - $infos['texte_modifier'] = $infos['type'] . ':' . 'icone_modifier_' . $infos['type']; |
|
| 721 | + $infos['texte_modifier'] = $infos['type'].':'.'icone_modifier_'.$infos['type']; |
|
| 722 | 722 | } |
| 723 | 723 | if (!isset($infos['texte_creer'])) { |
| 724 | - $infos['texte_creer'] = $infos['type'] . ':' . 'icone_creer_' . $infos['type']; |
|
| 724 | + $infos['texte_creer'] = $infos['type'].':'.'icone_creer_'.$infos['type']; |
|
| 725 | 725 | } |
| 726 | 726 | if (!isset($infos['texte_creer_associer'])) { |
| 727 | - $infos['texte_creer_associer'] = $infos['type'] . ':' . 'texte_creer_associer_' . $infos['type']; |
|
| 727 | + $infos['texte_creer_associer'] = $infos['type'].':'.'texte_creer_associer_'.$infos['type']; |
|
| 728 | 728 | } |
| 729 | 729 | if (!isset($infos['texte_ajouter'])) { |
| 730 | 730 | // Ajouter un X |
| 731 | - $infos['texte_ajouter'] = $infos['type'] . ':' . 'texte_ajouter_' . $infos['type']; |
|
| 731 | + $infos['texte_ajouter'] = $infos['type'].':'.'texte_ajouter_'.$infos['type']; |
|
| 732 | 732 | } |
| 733 | 733 | if (!isset($infos['texte_objets'])) { |
| 734 | - $infos['texte_objets'] = $infos['type'] . ':' . 'titre_' . $infos['table_objet']; |
|
| 734 | + $infos['texte_objets'] = $infos['type'].':'.'titre_'.$infos['table_objet']; |
|
| 735 | 735 | } |
| 736 | 736 | if (!isset($infos['texte_objet'])) { |
| 737 | - $infos['texte_objet'] = $infos['type'] . ':' . 'titre_' . $infos['type']; |
|
| 737 | + $infos['texte_objet'] = $infos['type'].':'.'titre_'.$infos['type']; |
|
| 738 | 738 | } |
| 739 | 739 | if (!isset($infos['texte_logo_objet'])) { |
| 740 | 740 | // objet:titre_logo_objet "Logo de ce X" |
| 741 | - $infos['texte_logo_objet'] = $infos['type'] . ':' . 'titre_logo_' . $infos['type']; |
|
| 741 | + $infos['texte_logo_objet'] = $infos['type'].':'.'titre_logo_'.$infos['type']; |
|
| 742 | 742 | } |
| 743 | 743 | if (!isset($infos['texte_langue_objet'])) { |
| 744 | 744 | // objet:texte_langue_objet "Langue de ce X" |
| 745 | - $infos['texte_langue_objet'] = $infos['type'] . ':' . 'titre_langue_' . $infos['type']; |
|
| 745 | + $infos['texte_langue_objet'] = $infos['type'].':'.'titre_langue_'.$infos['type']; |
|
| 746 | 746 | } |
| 747 | 747 | if (!isset($infos['texte_definir_comme_traduction_objet'])) { |
| 748 | 748 | // "Ce X est une traduction du X numéro :" |
| 749 | - $infos['texte_definir_comme_traduction_objet'] = $infos['type'] . ':' . 'texte_definir_comme_traduction_' . $infos['type']; |
|
| 749 | + $infos['texte_definir_comme_traduction_objet'] = $infos['type'].':'.'texte_definir_comme_traduction_'.$infos['type']; |
|
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | // objet:info_aucun_objet |
| 753 | 753 | if (!isset($infos['info_aucun_objet'])) { |
| 754 | - $infos['info_aucun_objet'] = $infos['type'] . ':' . 'info_aucun_' . $infos['type']; |
|
| 754 | + $infos['info_aucun_objet'] = $infos['type'].':'.'info_aucun_'.$infos['type']; |
|
| 755 | 755 | } |
| 756 | 756 | // objet:info_1_objet |
| 757 | 757 | if (!isset($infos['info_1_objet'])) { |
| 758 | - $infos['info_1_objet'] = $infos['type'] . ':' . 'info_1_' . $infos['type']; |
|
| 758 | + $infos['info_1_objet'] = $infos['type'].':'.'info_1_'.$infos['type']; |
|
| 759 | 759 | } |
| 760 | 760 | // objet:info_nb_objets |
| 761 | 761 | if (!isset($infos['info_nb_objets'])) { |
| 762 | - $infos['info_nb_objets'] = $infos['type'] . ':' . 'info_nb_' . $infos['table_objet']; |
|
| 762 | + $infos['info_nb_objets'] = $infos['type'].':'.'info_nb_'.$infos['table_objet']; |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | if (!isset($infos['champs_editables'])) { |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | } |
| 960 | 960 | $ts = sql_alltable(null, $serveur); // toutes les tables "spip_" (ou prefixe perso) |
| 961 | 961 | $connexion = $GLOBALS['connexions'][$serveur ?: 0]; |
| 962 | - $spip = $connexion['prefixe'] . '_'; |
|
| 962 | + $spip = $connexion['prefixe'].'_'; |
|
| 963 | 963 | foreach ($ts as $t) { |
| 964 | 964 | $t = substr($t, strlen($spip)); |
| 965 | 965 | $tables[$serveur]["spip_$t"] = $t; |
@@ -1028,10 +1028,10 @@ discard block |
||
| 1028 | 1028 | if ($serveur !== false) { |
| 1029 | 1029 | $t = lister_tables_spip($serveur); |
| 1030 | 1030 | $trouver_table = charger_fonction('trouver_table', 'base'); |
| 1031 | - $typetrim = rtrim($type, 's') . 's'; |
|
| 1031 | + $typetrim = rtrim($type, 's').'s'; |
|
| 1032 | 1032 | if ( |
| 1033 | 1033 | (isset($t[$typetrim]) or in_array($typetrim, $t)) |
| 1034 | - and ($desc = $trouver_table(rtrim($type, 's') . 's', $serveur)) |
|
| 1034 | + and ($desc = $trouver_table(rtrim($type, 's').'s', $serveur)) |
|
| 1035 | 1035 | ) { |
| 1036 | 1036 | return $desc['id_table']; |
| 1037 | 1037 | } elseif ( |
@@ -1041,11 +1041,11 @@ discard block |
||
| 1041 | 1041 | return $desc['id_table']; |
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | - spip_log('table_objet(' . $type . ') calculee sans verification'); |
|
| 1044 | + spip_log('table_objet('.$type.') calculee sans verification'); |
|
| 1045 | 1045 | #spip_log(debug_backtrace(),'db'); |
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | - return rtrim($type, 's') . 's'; # cas historique ne devant plus servir, sauf si $serveur=false |
|
| 1048 | + return rtrim($type, 's').'s'; # cas historique ne devant plus servir, sauf si $serveur=false |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | /** |
@@ -1229,7 +1229,7 @@ discard block |
||
| 1229 | 1229 | function objet_test_si_publie($objet, $id_objet, $serveur = '') { |
| 1230 | 1230 | // voir si une fonction est definie pour faire le boulot |
| 1231 | 1231 | // elle a la priorite dans ce cas |
| 1232 | - if ($f = charger_fonction($objet . '_test_si_publie', 'base', true)) { |
|
| 1232 | + if ($f = charger_fonction($objet.'_test_si_publie', 'base', true)) { |
|
| 1233 | 1233 | return $f($objet, $id_objet, $serveur); |
| 1234 | 1234 | } |
| 1235 | 1235 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | $boucle->sql_serveur = $serveur; |
| 1252 | 1252 | $boucle->select[] = $id_table_objet; |
| 1253 | 1253 | $boucle->from[$table_objet] = table_objet_sql($objet, $serveur); |
| 1254 | - $boucle->where[] = $id_table . '.' . $id_table_objet . '=' . intval($id_objet); |
|
| 1254 | + $boucle->where[] = $id_table.'.'.$id_table_objet.'='.intval($id_objet); |
|
| 1255 | 1255 | |
| 1256 | 1256 | $boucle->descr['nom'] = 'objet_test_si_publie'; // eviter notice php |
| 1257 | 1257 | $boucle->descr['sourcefile'] = 'internal'; |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | ? "{$parent_methode['source_champ']} = $id_objet" |
| 1379 | 1379 | : "$cle_objet = $id_objet"; |
| 1380 | 1380 | if (isset($parent_methode['source_champ_type'])) { |
| 1381 | - $where[] = "{$parent_methode['source_champ_type']} = " . sql_quote($objet); |
|
| 1381 | + $where[] = "{$parent_methode['source_champ_type']} = ".sql_quote($objet); |
|
| 1382 | 1382 | } |
| 1383 | 1383 | // -- Condition supplémentaire sur la détection du parent |
| 1384 | 1384 | if (isset($parent_methode['table_condition'])) { |
@@ -1502,11 +1502,11 @@ discard block |
||
| 1502 | 1502 | $where = []; |
| 1503 | 1503 | // -- L'identifiant du parent |
| 1504 | 1504 | if (isset($_methode_parent['champ'])) { |
| 1505 | - $where[] = $_methode_parent['champ'] . ' = ' . $id_objet; |
|
| 1505 | + $where[] = $_methode_parent['champ'].' = '.$id_objet; |
|
| 1506 | 1506 | } |
| 1507 | 1507 | // -- Si le parent est variable |
| 1508 | 1508 | if (isset($_methode_parent['champ_type'])) { |
| 1509 | - $where[] = $_methode_parent['champ_type'] . ' = ' . sql_quote($objet); |
|
| 1509 | + $where[] = $_methode_parent['champ_type'].' = '.sql_quote($objet); |
|
| 1510 | 1510 | } |
| 1511 | 1511 | |
| 1512 | 1512 | // On détermine la table, le champ id des enfants et on complète éventuellement les conditions |
@@ -64,27 +64,27 @@ discard block |
||
| 64 | 64 | // determiner le dossier de la base : $addr ou _DIR_DB |
| 65 | 65 | $f = _DIR_DB; |
| 66 | 66 | if ($addr and strpos($addr, '/') !== false) { |
| 67 | - $f = rtrim($addr, '/') . '/'; |
|
| 67 | + $f = rtrim($addr, '/').'/'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // un nom de base demande et impossible d'obtenir la base, on s'en va : |
| 71 | 71 | // il faut que la base existe ou que le repertoire parent soit writable |
| 72 | - if ($db and !is_file($f .= $db . '.sqlite') and !is_writable(dirname($f))) { |
|
| 73 | - spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.' . _LOG_HS); |
|
| 72 | + if ($db and !is_file($f .= $db.'.sqlite') and !is_writable(dirname($f))) { |
|
| 73 | + spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.'._LOG_HS); |
|
| 74 | 74 | |
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // charger les modules sqlite au besoin |
| 79 | 79 | if (!_sqlite_charger_version($sqlite_version)) { |
| 80 | - spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.' . _LOG_HS); |
|
| 80 | + spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.'._LOG_HS); |
|
| 81 | 81 | |
| 82 | 82 | return false; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // chargement des constantes |
| 86 | 86 | // il ne faut pas definir les constantes avant d'avoir charge les modules sqlite |
| 87 | - $define = 'spip_sqlite' . $sqlite_version . '_constantes'; |
|
| 87 | + $define = 'spip_sqlite'.$sqlite_version.'_constantes'; |
|
| 88 | 88 | $define(); |
| 89 | 89 | |
| 90 | 90 | $ok = false; |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | // si pas de db -> |
| 93 | 93 | // base temporaire tant qu'on ne connait pas son vrai nom |
| 94 | 94 | // pour tester la connexion |
| 95 | - $db = '_sqlite' . $sqlite_version . '_install'; |
|
| 96 | - $tmp = _DIR_DB . $db . '.sqlite'; |
|
| 95 | + $db = '_sqlite'.$sqlite_version.'_install'; |
|
| 96 | + $tmp = _DIR_DB.$db.'.sqlite'; |
|
| 97 | 97 | $ok = $link = new \PDO("sqlite:$tmp"); |
| 98 | 98 | } else { |
| 99 | 99 | // Ouvrir (eventuellement creer la base) |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | if (!$ok) { |
| 104 | 104 | $e = _sqlite_last_error_from_link($link); |
| 105 | - spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.' . _LOG_HS); |
|
| 105 | + spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.'._LOG_HS); |
|
| 106 | 106 | |
| 107 | 107 | return false; |
| 108 | 108 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $table = $regs[3]; |
| 189 | 189 | $suite = $regs[4]; |
| 190 | 190 | } else { |
| 191 | - spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.' . _LOG_ERREUR); |
|
| 191 | + spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.'._LOG_ERREUR); |
|
| 192 | 192 | |
| 193 | 193 | return false; |
| 194 | 194 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $i = 0; |
| 206 | 206 | $ouverte = false; |
| 207 | 207 | while ($do = array_shift($todo)) { |
| 208 | - $todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do; |
|
| 208 | + $todo2[$i] = isset($todo2[$i]) ? $todo2[$i].','.$do : $do; |
|
| 209 | 209 | $o = (false !== strpos($do, '(')); |
| 210 | 210 | $f = (false !== strpos($do, ')')); |
| 211 | 211 | if ($o and !$f) { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | ) { |
| 232 | 232 | spip_log( |
| 233 | 233 | "SQLite : Probleme de ALTER TABLE, utilisation non reconnue dans : $do \n(requete d'origine : $query)", |
| 234 | - 'sqlite.' . _LOG_ERREUR |
|
| 234 | + 'sqlite.'._LOG_ERREUR |
|
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | 237 | return false; |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | // pas geres en sqlite2 |
| 329 | 329 | case 'RENAME': |
| 330 | - $do = 'RENAME TO' . substr($do, 6); |
|
| 330 | + $do = 'RENAME TO'.substr($do, 6); |
|
| 331 | 331 | case 'RENAME TO': |
| 332 | 332 | if (!spip_sqlite::executer_requete("$debut $do", $serveur)) { |
| 333 | - spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 333 | + spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.'._LOG_ERREUR); |
|
| 334 | 334 | |
| 335 | 335 | return false; |
| 336 | 336 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $colonnes = substr($colonne_origine, 1, -1); |
| 374 | 374 | if (false !== strpos(',', $colonnes)) { |
| 375 | 375 | spip_log('SQLite : Erreur, impossible de creer un index sur plusieurs colonnes' |
| 376 | - . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.' . _LOG_ERREUR); |
|
| 376 | + . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.'._LOG_ERREUR); |
|
| 377 | 377 | break; |
| 378 | 378 | } else { |
| 379 | 379 | $nom_index = $colonnes; |
@@ -388,12 +388,12 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | // pas geres en sqlite2 |
| 390 | 390 | case 'ADD COLUMN': |
| 391 | - $do = 'ADD' . substr($do, 10); |
|
| 391 | + $do = 'ADD'.substr($do, 10); |
|
| 392 | 392 | case 'ADD': |
| 393 | 393 | default: |
| 394 | 394 | if (!preg_match(',primary\s+key,i', $do)) { |
| 395 | 395 | if (!spip_sqlite::executer_requete("$debut $do", $serveur)) { |
| 396 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 396 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 397 | 397 | |
| 398 | 398 | return false; |
| 399 | 399 | } |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | $opts['field'] = [$colonne_ajoutee => $def]; |
| 415 | 415 | if (!_sqlite_modifier_table($table, [$colonne_ajoutee], $opts, $serveur)) { |
| 416 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 416 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 417 | 417 | |
| 418 | 418 | return false; |
| 419 | 419 | } |
@@ -421,10 +421,10 @@ discard block |
||
| 421 | 421 | break; |
| 422 | 422 | } |
| 423 | 423 | // tout est bon, ouf ! |
| 424 | - spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.' . _LOG_INFO); |
|
| 424 | + spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.'._LOG_INFO); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.' . _LOG_INFO); |
|
| 427 | + spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.'._LOG_INFO); |
|
| 428 | 428 | |
| 429 | 429 | return true; |
| 430 | 430 | } |
@@ -493,9 +493,9 @@ discard block |
||
| 493 | 493 | * @return bool true si la base est créee. |
| 494 | 494 | **/ |
| 495 | 495 | function spip_sqlite_create_base($nom, $serveur = '', $option = true) { |
| 496 | - $f = $nom . '.sqlite'; |
|
| 496 | + $f = $nom.'.sqlite'; |
|
| 497 | 497 | if (strpos($nom, '/') === false) { |
| 498 | - $f = _DIR_DB . $f; |
|
| 498 | + $f = _DIR_DB.$f; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | $ok = new \PDO("sqlite:$f"); |
@@ -535,13 +535,13 @@ discard block |
||
| 535 | 535 | if (sql_showtable($nom, false, $serveur)) { |
| 536 | 536 | spip_log( |
| 537 | 537 | "Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", |
| 538 | - 'sqlite.' . _LOG_ERREUR |
|
| 538 | + 'sqlite.'._LOG_ERREUR |
|
| 539 | 539 | ); |
| 540 | 540 | |
| 541 | 541 | return false; |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 544 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 545 | 545 | |
| 546 | 546 | return spip_sqlite_query($query, $serveur, $requeter); |
| 547 | 547 | } |
@@ -567,8 +567,8 @@ discard block |
||
| 567 | 567 | function spip_sqlite_create_index($nom, $table, $champs, $unique = '', $serveur = '', $requeter = true) { |
| 568 | 568 | if (!($nom or $table or $champs)) { |
| 569 | 569 | spip_log( |
| 570 | - "Champ manquant pour creer un index sqlite ($nom, $table, (" . join(',', $champs) . '))', |
|
| 571 | - 'sqlite.' . _LOG_ERREUR |
|
| 570 | + "Champ manquant pour creer un index sqlite ($nom, $table, (".join(',', $champs).'))', |
|
| 571 | + 'sqlite.'._LOG_ERREUR |
|
| 572 | 572 | ); |
| 573 | 573 | |
| 574 | 574 | return false; |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | // SQLite ne differentie pas noms des index en fonction des tables |
| 578 | 578 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 579 | - $nom = $table . '_' . $nom; |
|
| 579 | + $nom = $table.'_'.$nom; |
|
| 580 | 580 | // enlever d'eventuelles parentheses deja presentes sur champs |
| 581 | 581 | if (!is_array($champs)) { |
| 582 | 582 | if ($champs[0] == '(') { |
@@ -598,12 +598,12 @@ discard block |
||
| 598 | 598 | } else { |
| 599 | 599 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 600 | 600 | $a = spip_sqlite_showtable($table, $serveur); |
| 601 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 601 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 602 | 602 | return true; |
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - $query = 'CREATE ' . ($unique ? 'UNIQUE ' : '') . "INDEX$ifnotexists $nom ON $table (" . join(',', $champs) . ')'; |
|
| 606 | + $query = 'CREATE '.($unique ? 'UNIQUE ' : '')."INDEX$ifnotexists $nom ON $table (".join(',', $champs).')'; |
|
| 607 | 607 | $res = spip_sqlite_query($query, $serveur, $requeter); |
| 608 | 608 | if (!$requeter) { |
| 609 | 609 | return $res; |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | $serveur = '', |
| 680 | 680 | $requeter = true |
| 681 | 681 | ) { |
| 682 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 682 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 683 | 683 | $r = spip_sqlite_select( |
| 684 | 684 | "COUNT($c)", |
| 685 | 685 | $from, |
@@ -788,14 +788,14 @@ discard block |
||
| 788 | 788 | */ |
| 789 | 789 | function spip_sqlite_drop_index($nom, $table, $serveur = '', $requeter = true) { |
| 790 | 790 | if (!($nom or $table)) { |
| 791 | - spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.' . _LOG_ERREUR); |
|
| 791 | + spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.'._LOG_ERREUR); |
|
| 792 | 792 | |
| 793 | 793 | return false; |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | // SQLite ne differentie pas noms des index en fonction des tables |
| 797 | 797 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 798 | - $index = $table . '_' . $nom; |
|
| 798 | + $index = $table.'_'.$nom; |
|
| 799 | 799 | $exist = ' IF EXISTS'; |
| 800 | 800 | |
| 801 | 801 | $query = "DROP INDEX$exist $index"; |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | if ($s) { |
| 828 | 828 | $trace = debug_backtrace(); |
| 829 | 829 | if ($trace[0]['function'] != 'spip_sqlite_error') { |
| 830 | - spip_log("$s - $query - " . sql_error_backtrace(), 'sqlite.' . _LOG_ERREUR); |
|
| 830 | + spip_log("$s - $query - ".sql_error_backtrace(), 'sqlite.'._LOG_ERREUR); |
|
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | 833 | |
@@ -874,14 +874,14 @@ discard block |
||
| 874 | 874 | $t = $link->errorInfo(); |
| 875 | 875 | $s = ltrim($t[0], '0'); // 00000 si pas d'erreur |
| 876 | 876 | if ($s) { |
| 877 | - $s .= ' / ' . $t[1]; |
|
| 877 | + $s .= ' / '.$t[1]; |
|
| 878 | 878 | } // ajoute l'erreur du moteur SQLite |
| 879 | 879 | } else { |
| 880 | 880 | $s = ': aucune ressource sqlite (link)'; |
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | if ($s) { |
| 884 | - spip_log("Erreur sqlite $s", 'sqlite.' . _LOG_ERREUR); |
|
| 884 | + spip_log("Erreur sqlite $s", 'sqlite.'._LOG_ERREUR); |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | return $s ? $s : 0; |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | $query = spip_sqlite::traduire_requete($query, $serveur); |
| 908 | - $query = 'EXPLAIN ' . $query; |
|
| 908 | + $query = 'EXPLAIN '.$query; |
|
| 909 | 909 | if (!$requeter) { |
| 910 | 910 | return $query; |
| 911 | 911 | } |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | **/ |
| 1075 | 1075 | function spip_sqlite_insert($table, $champs, $valeurs, $desc = [], $serveur = '', $requeter = true) { |
| 1076 | 1076 | |
| 1077 | - $query = "INSERT INTO $table " . ($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES'); |
|
| 1077 | + $query = "INSERT INTO $table ".($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES'); |
|
| 1078 | 1078 | if ($r = spip_sqlite_query($query, $serveur, $requeter)) { |
| 1079 | 1079 | if (!$requeter) { |
| 1080 | 1080 | return $r; |
@@ -1129,8 +1129,8 @@ discard block |
||
| 1129 | 1129 | |
| 1130 | 1130 | $cles = $valeurs = ''; |
| 1131 | 1131 | if (count($couples)) { |
| 1132 | - $cles = '(' . join(',', array_keys($couples)) . ')'; |
|
| 1133 | - $valeurs = '(' . join(',', $couples) . ')'; |
|
| 1132 | + $cles = '('.join(',', array_keys($couples)).')'; |
|
| 1133 | + $valeurs = '('.join(',', $couples).')'; |
|
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | 1136 | return spip_sqlite_insert($table, $cles, $valeurs, $desc, $serveur, $requeter); |
@@ -1190,11 +1190,11 @@ discard block |
||
| 1190 | 1190 | |
| 1191 | 1191 | $champs = $valeurs = ''; |
| 1192 | 1192 | if (count($couples)) { |
| 1193 | - $champs = '(' . join(',', array_keys($couples)) . ')'; |
|
| 1194 | - $valeurs = '(' . join(',', $couples) . ')'; |
|
| 1195 | - $query = $query_start . "$champs VALUES $valeurs"; |
|
| 1193 | + $champs = '('.join(',', array_keys($couples)).')'; |
|
| 1194 | + $valeurs = '('.join(',', $couples).')'; |
|
| 1195 | + $query = $query_start."$champs VALUES $valeurs"; |
|
| 1196 | 1196 | } else { |
| 1197 | - $query = $query_start . 'DEFAULT VALUES'; |
|
| 1197 | + $query = $query_start.'DEFAULT VALUES'; |
|
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | 1200 | if ($requeter) { |
@@ -1326,7 +1326,7 @@ discard block |
||
| 1326 | 1326 | * @return string Texte de sélection pour la requête |
| 1327 | 1327 | */ |
| 1328 | 1328 | function spip_sqlite_multi($objet, $lang) { |
| 1329 | - $r = 'EXTRAIRE_MULTI(' . $objet . ", '" . $lang . "') AS multi"; |
|
| 1329 | + $r = 'EXTRAIRE_MULTI('.$objet.", '".$lang."') AS multi"; |
|
| 1330 | 1330 | |
| 1331 | 1331 | return $r; |
| 1332 | 1332 | } |
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | function spip_sqlite_date_proche($champ, $interval, $unite) { |
| 1398 | 1398 | $op = (($interval <= 0) ? '>' : '<'); |
| 1399 | 1399 | |
| 1400 | - return "($champ $op datetime('" . date('Y-m-d H:i:s') . "', '$interval $unite'))"; |
|
| 1400 | + return "($champ $op datetime('".date('Y-m-d H:i:s')."', '$interval $unite'))"; |
|
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | |
@@ -1429,7 +1429,7 @@ discard block |
||
| 1429 | 1429 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1430 | 1430 | ) { |
| 1431 | 1431 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur); |
| 1432 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1432 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1433 | 1433 | } |
| 1434 | 1434 | if ( |
| 1435 | 1435 | preg_match(',^(INTEGER),i', $d) |
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1440 | 1440 | ) { |
| 1441 | 1441 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur); |
| 1442 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1442 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1443 | 1443 | } |
| 1444 | 1444 | if ( |
| 1445 | 1445 | preg_match(',^(datetime),i', $d) |
@@ -1449,7 +1449,7 @@ discard block |
||
| 1449 | 1449 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1450 | 1450 | ) { |
| 1451 | 1451 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur); |
| 1452 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1452 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1453 | 1453 | } |
| 1454 | 1454 | } |
| 1455 | 1455 | |
@@ -1500,10 +1500,10 @@ discard block |
||
| 1500 | 1500 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
| 1501 | 1501 | $couples = _sqlite_ajouter_champs_timestamp($table, $couples, $desc, $serveur); |
| 1502 | 1502 | |
| 1503 | - return spip_sqlite_query("REPLACE INTO $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1503 | + return spip_sqlite_query("REPLACE INTO $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1504 | 1504 | ',', |
| 1505 | 1505 | $couples |
| 1506 | - ) . ')', $serveur); |
|
| 1506 | + ).')', $serveur); |
|
| 1507 | 1507 | } |
| 1508 | 1508 | |
| 1509 | 1509 | |
@@ -1589,7 +1589,7 @@ discard block |
||
| 1589 | 1589 | . _sqlite_calculer_expression('WHERE', $where) |
| 1590 | 1590 | . _sqlite_calculer_expression('GROUP BY', $groupby, ',') |
| 1591 | 1591 | . _sqlite_calculer_expression('HAVING', $having) |
| 1592 | - . ($orderby ? ("\nORDER BY " . _sqlite_calculer_order($orderby)) : '') |
|
| 1592 | + . ($orderby ? ("\nORDER BY "._sqlite_calculer_order($orderby)) : '') |
|
| 1593 | 1593 | . ($limit ? "\nLIMIT $limit" : ''); |
| 1594 | 1594 | |
| 1595 | 1595 | // dans un select, on doit renvoyer la requête en cas d'erreur |
@@ -1627,10 +1627,10 @@ discard block |
||
| 1627 | 1627 | // interdire la creation d'une nouvelle base, |
| 1628 | 1628 | // sauf si on est dans l'installation |
| 1629 | 1629 | if ( |
| 1630 | - !is_file($f = _DIR_DB . $db . '.sqlite') |
|
| 1630 | + !is_file($f = _DIR_DB.$db.'.sqlite') |
|
| 1631 | 1631 | && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL) |
| 1632 | 1632 | ) { |
| 1633 | - spip_log("Il est interdit de creer la base $db", 'sqlite.' . _LOG_HS); |
|
| 1633 | + spip_log("Il est interdit de creer la base $db", 'sqlite.'._LOG_HS); |
|
| 1634 | 1634 | |
| 1635 | 1635 | return false; |
| 1636 | 1636 | } |
@@ -1639,12 +1639,12 @@ discard block |
||
| 1639 | 1639 | // avec les identifiants connus |
| 1640 | 1640 | $index = $serveur ? $serveur : 0; |
| 1641 | 1641 | |
| 1642 | - if ($link = spip_connect_db('', '', '', '', '@selectdb@' . $db, $serveur, '', '')) { |
|
| 1642 | + if ($link = spip_connect_db('', '', '', '', '@selectdb@'.$db, $serveur, '', '')) { |
|
| 1643 | 1643 | if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) { |
| 1644 | 1644 | return $db; |
| 1645 | 1645 | } |
| 1646 | 1646 | } else { |
| 1647 | - spip_log("Impossible de selectionner la base $db", 'sqlite.' . _LOG_HS); |
|
| 1647 | + spip_log("Impossible de selectionner la base $db", 'sqlite.'._LOG_HS); |
|
| 1648 | 1648 | |
| 1649 | 1649 | return false; |
| 1650 | 1650 | } |
@@ -1695,7 +1695,7 @@ discard block |
||
| 1695 | 1695 | $match = "^$match$"; |
| 1696 | 1696 | |
| 1697 | 1697 | return spip_sqlite_query( |
| 1698 | - "SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP " . _q($match), |
|
| 1698 | + "SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP "._q($match), |
|
| 1699 | 1699 | $serveur, |
| 1700 | 1700 | $requeter |
| 1701 | 1701 | ); |
@@ -1719,7 +1719,7 @@ discard block |
||
| 1719 | 1719 | $r = spip_sqlite_query( |
| 1720 | 1720 | 'SELECT name FROM sqlite_master WHERE' |
| 1721 | 1721 | . ' type=\'table\'' |
| 1722 | - . ' AND name=' . spip_sqlite_quote($table, 'string') |
|
| 1722 | + . ' AND name='.spip_sqlite_quote($table, 'string') |
|
| 1723 | 1723 | . ' AND name NOT LIKE \'sqlite_%\'', |
| 1724 | 1724 | $serveur, |
| 1725 | 1725 | $requeter |
@@ -1816,7 +1816,7 @@ discard block |
||
| 1816 | 1816 | // s'il y a une parenthèse fermante dans la clé |
| 1817 | 1817 | // ou dans la définition sans qu'il n'y ait une ouverture avant |
| 1818 | 1818 | if (false !== strpos($k, ')') or preg_match('/^[^\(]*\)/', $def)) { |
| 1819 | - $fields[$k_precedent] .= ',' . $k . ' ' . $def; |
|
| 1819 | + $fields[$k_precedent] .= ','.$k.' '.$def; |
|
| 1820 | 1820 | continue; |
| 1821 | 1821 | } |
| 1822 | 1822 | |
@@ -1851,13 +1851,13 @@ discard block |
||
| 1851 | 1851 | . 'ORDER BY substr(type,2,1), name'; |
| 1852 | 1852 | $a = spip_sqlite_query($query, $serveur, $requeter); |
| 1853 | 1853 | while ($r = spip_sqlite_fetch($a, null, $serveur)) { |
| 1854 | - $key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1854 | + $key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1855 | 1855 | $keytype = 'KEY'; |
| 1856 | 1856 | if (strpos($r['sql'], 'UNIQUE INDEX') !== false) { |
| 1857 | 1857 | $keytype = 'UNIQUE KEY'; |
| 1858 | 1858 | } |
| 1859 | 1859 | $colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']); |
| 1860 | - $keys[$keytype . ' ' . $key] = $colonnes; |
|
| 1860 | + $keys[$keytype.' '.$key] = $colonnes; |
|
| 1861 | 1861 | } |
| 1862 | 1862 | } |
| 1863 | 1863 | } // c'est une vue, on liste les champs disponibles simplement |
@@ -1904,7 +1904,7 @@ discard block |
||
| 1904 | 1904 | |
| 1905 | 1905 | $set = []; |
| 1906 | 1906 | foreach ($champs as $champ => $val) { |
| 1907 | - $set[] = $champ . "=$val"; |
|
| 1907 | + $set[] = $champ."=$val"; |
|
| 1908 | 1908 | } |
| 1909 | 1909 | if (!empty($set)) { |
| 1910 | 1910 | return spip_sqlite_query( |
@@ -1957,7 +1957,7 @@ discard block |
||
| 1957 | 1957 | |
| 1958 | 1958 | $set = []; |
| 1959 | 1959 | foreach ($champs as $champ => $val) { |
| 1960 | - $set[$champ] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1960 | + $set[$champ] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1961 | 1961 | } |
| 1962 | 1962 | |
| 1963 | 1963 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
@@ -1965,7 +1965,7 @@ discard block |
||
| 1965 | 1965 | $maj = _sqlite_ajouter_champs_timestamp($table, [], $desc, $serveur); |
| 1966 | 1966 | foreach ($maj as $champ => $val) { |
| 1967 | 1967 | if (!isset($set[$champ])) { |
| 1968 | - $set[$champ] = $champ . '=' . $val; |
|
| 1968 | + $set[$champ] = $champ.'='.$val; |
|
| 1969 | 1969 | } |
| 1970 | 1970 | } |
| 1971 | 1971 | |
@@ -1994,7 +1994,7 @@ discard block |
||
| 1994 | 1994 | */ |
| 1995 | 1995 | function _sqlite_init() { |
| 1996 | 1996 | if (!defined('_DIR_DB')) { |
| 1997 | - define('_DIR_DB', _DIR_ETC . 'bases/'); |
|
| 1997 | + define('_DIR_DB', _DIR_ETC.'bases/'); |
|
| 1998 | 1998 | } |
| 1999 | 1999 | if (!defined('_SQLITE_CHMOD')) { |
| 2000 | 2000 | define('_SQLITE_CHMOD', _SPIP_CHMOD); |
@@ -2104,9 +2104,9 @@ discard block |
||
| 2104 | 2104 | } |
| 2105 | 2105 | |
| 2106 | 2106 | // echapper les ' en '' |
| 2107 | - spip_log('Pas de methode ->quote pour echapper', 'sqlite.' . _LOG_INFO_IMPORTANTE); |
|
| 2107 | + spip_log('Pas de methode ->quote pour echapper', 'sqlite.'._LOG_INFO_IMPORTANTE); |
|
| 2108 | 2108 | |
| 2109 | - return ("'" . str_replace("'", "''", $v) . "'"); |
|
| 2109 | + return ("'".str_replace("'", "''", $v)."'"); |
|
| 2110 | 2110 | } |
| 2111 | 2111 | |
| 2112 | 2112 | |
@@ -2129,12 +2129,12 @@ discard block |
||
| 2129 | 2129 | $exp = "\n$expression "; |
| 2130 | 2130 | |
| 2131 | 2131 | if (!is_array($v)) { |
| 2132 | - return $exp . $v; |
|
| 2132 | + return $exp.$v; |
|
| 2133 | 2133 | } else { |
| 2134 | 2134 | if (strtoupper($join) === 'AND') { |
| 2135 | - return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2135 | + return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2136 | 2136 | } else { |
| 2137 | - return $exp . join($join, $v); |
|
| 2137 | + return $exp.join($join, $v); |
|
| 2138 | 2138 | } |
| 2139 | 2139 | } |
| 2140 | 2140 | } |
@@ -2168,17 +2168,17 @@ discard block |
||
| 2168 | 2168 | if (substr($k, -1) == '@') { |
| 2169 | 2169 | // c'est une jointure qui se refere au from precedent |
| 2170 | 2170 | // pas de virgule |
| 2171 | - $res .= ' ' . $v; |
|
| 2171 | + $res .= ' '.$v; |
|
| 2172 | 2172 | } else { |
| 2173 | 2173 | if (!is_numeric($k)) { |
| 2174 | 2174 | $p = strpos($v, ' '); |
| 2175 | 2175 | if ($p) { |
| 2176 | - $v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p); |
|
| 2176 | + $v = substr($v, 0, $p)." AS '$k'".substr($v, $p); |
|
| 2177 | 2177 | } else { |
| 2178 | 2178 | $v .= " AS '$k'"; |
| 2179 | 2179 | } |
| 2180 | 2180 | } |
| 2181 | - $res .= ', ' . $v; |
|
| 2181 | + $res .= ', '.$v; |
|
| 2182 | 2182 | } |
| 2183 | 2183 | } |
| 2184 | 2184 | |
@@ -2316,13 +2316,13 @@ discard block |
||
| 2316 | 2316 | |
| 2317 | 2317 | $def_origine = sql_showtable($table_origine, false, $serveur); |
| 2318 | 2318 | if (!$def_origine or !isset($def_origine['field'])) { |
| 2319 | - spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR); |
|
| 2319 | + spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR); |
|
| 2320 | 2320 | |
| 2321 | 2321 | return false; |
| 2322 | 2322 | } |
| 2323 | 2323 | |
| 2324 | 2324 | |
| 2325 | - $table_tmp = $table_origine . '_tmp'; |
|
| 2325 | + $table_tmp = $table_origine.'_tmp'; |
|
| 2326 | 2326 | |
| 2327 | 2327 | // 1) creer une table temporaire avec les modifications |
| 2328 | 2328 | // - DROP : suppression de la colonne |
@@ -2409,7 +2409,7 @@ discard block |
||
| 2409 | 2409 | } else { |
| 2410 | 2410 | // enlever KEY |
| 2411 | 2411 | $k = substr($k, 4); |
| 2412 | - $queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)"; |
|
| 2412 | + $queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)"; |
|
| 2413 | 2413 | } |
| 2414 | 2414 | } |
| 2415 | 2415 | |
@@ -2420,7 +2420,7 @@ discard block |
||
| 2420 | 2420 | foreach ($queries as $q) { |
| 2421 | 2421 | if (!spip_sqlite::executer_requete($q, $serveur)) { |
| 2422 | 2422 | spip_log('SQLite : ALTER TABLE table :' |
| 2423 | - . " Erreur a l'execution de la requete : $q", 'sqlite.' . _LOG_ERREUR); |
|
| 2423 | + . " Erreur a l'execution de la requete : $q", 'sqlite.'._LOG_ERREUR); |
|
| 2424 | 2424 | spip_sqlite::annuler_transaction($serveur); |
| 2425 | 2425 | |
| 2426 | 2426 | return false; |
@@ -2510,27 +2510,27 @@ discard block |
||
| 2510 | 2510 | $enum = '(\s*\([^\)]*\))?'; |
| 2511 | 2511 | |
| 2512 | 2512 | $remplace = [ |
| 2513 | - '/enum' . $enum . '/is' => 'VARCHAR(255)', |
|
| 2513 | + '/enum'.$enum.'/is' => 'VARCHAR(255)', |
|
| 2514 | 2514 | '/COLLATE \w+_bin/is' => 'COLLATE BINARY', |
| 2515 | 2515 | '/COLLATE \w+_ci/is' => 'COLLATE NOCASE', |
| 2516 | 2516 | '/auto_increment/is' => '', |
| 2517 | 2517 | '/current_timestamp\(\)/is' => 'CURRENT_TIMESTAMP', // Fix export depuis mariaDB #4374 |
| 2518 | 2518 | '/(timestamp .* )ON .*$/is' => '\\1', |
| 2519 | 2519 | '/character set \w+/is' => '', |
| 2520 | - '/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2520 | + '/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2521 | 2521 | '/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
| 2522 | - '/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2522 | + '/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2523 | 2523 | '/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'", |
| 2524 | 2524 | '/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'", |
| 2525 | 2525 | ]; |
| 2526 | 2526 | |
| 2527 | 2527 | // pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY |
| 2528 | 2528 | $remplace_autocinc = [ |
| 2529 | - '/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER' |
|
| 2529 | + '/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER' |
|
| 2530 | 2530 | ]; |
| 2531 | 2531 | // pour les int non autoincrement, il faut un DEFAULT |
| 2532 | 2532 | $remplace_nonautocinc = [ |
| 2533 | - '/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2533 | + '/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2534 | 2534 | ]; |
| 2535 | 2535 | |
| 2536 | 2536 | if (is_string($query)) { |
@@ -2572,7 +2572,7 @@ discard block |
||
| 2572 | 2572 | return str_ireplace('BINARY', 'COLLATE BINARY', $champ); |
| 2573 | 2573 | } |
| 2574 | 2574 | if (preg_match(',^(char|varchar|(long|small|medium|tiny)?text),i', $champ)) { |
| 2575 | - return $champ . ' COLLATE NOCASE'; |
|
| 2575 | + return $champ.' COLLATE NOCASE'; |
|
| 2576 | 2576 | } |
| 2577 | 2577 | |
| 2578 | 2578 | return $champ; |
@@ -2662,14 +2662,14 @@ discard block |
||
| 2662 | 2662 | } else { |
| 2663 | 2663 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 2664 | 2664 | $a = spip_sqlite_showtable($nom, $serveur); |
| 2665 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 2665 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 2666 | 2666 | return true; |
| 2667 | 2667 | } |
| 2668 | 2668 | } |
| 2669 | 2669 | } |
| 2670 | 2670 | |
| 2671 | 2671 | $temporary = $temporary ? ' TEMPORARY' : ''; |
| 2672 | - $q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n"; |
|
| 2672 | + $q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n"; |
|
| 2673 | 2673 | |
| 2674 | 2674 | return $q; |
| 2675 | 2675 | } |
@@ -2890,7 +2890,7 @@ discard block |
||
| 2890 | 2890 | $this->serveur = strtolower($serveur); |
| 2891 | 2891 | |
| 2892 | 2892 | if (!($this->link = _sqlite_link($this->serveur)) && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)) { |
| 2893 | - spip_log('Aucune connexion sqlite (link)', 'sqlite.' . _LOG_ERREUR); |
|
| 2893 | + spip_log('Aucune connexion sqlite (link)', 'sqlite.'._LOG_ERREUR); |
|
| 2894 | 2894 | |
| 2895 | 2895 | return false; |
| 2896 | 2896 | } |
@@ -2936,7 +2936,7 @@ discard block |
||
| 2936 | 2936 | try { |
| 2937 | 2937 | $r = $this->link->query($query); |
| 2938 | 2938 | } catch (\PDOException $e) { |
| 2939 | - spip_log('PDOException: ' . $e->getMessage(), 'sqlite.' . _LOG_DEBUG); |
|
| 2939 | + spip_log('PDOException: '.$e->getMessage(), 'sqlite.'._LOG_DEBUG); |
|
| 2940 | 2940 | $r = false; |
| 2941 | 2941 | } |
| 2942 | 2942 | |
@@ -2951,11 +2951,11 @@ discard block |
||
| 2951 | 2951 | |
| 2952 | 2952 | // loger les warnings/erreurs eventuels de sqlite remontant dans PHP |
| 2953 | 2953 | if ($e and $e instanceof \PDOException) { |
| 2954 | - $err = strip_tags($e->getMessage()) . ' in ' . $e->getFile() . ' line ' . $e->getLine(); |
|
| 2955 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2954 | + $err = strip_tags($e->getMessage()).' in '.$e->getFile().' line '.$e->getLine(); |
|
| 2955 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2956 | 2956 | } elseif ($err = (function_exists('error_get_last') ? error_get_last() : '') and $err != $last_error) { |
| 2957 | - $err = strip_tags($err['message']) . ' in ' . $err['file'] . ' line ' . $err['line']; |
|
| 2958 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2957 | + $err = strip_tags($err['message']).' in '.$err['file'].' line '.$err['line']; |
|
| 2958 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2959 | 2959 | } else { |
| 2960 | 2960 | $err = ''; |
| 2961 | 2961 | } |
@@ -3033,15 +3033,15 @@ discard block |
||
| 3033 | 3033 | // Correction Create Database |
| 3034 | 3034 | // Create Database -> requete ignoree |
| 3035 | 3035 | if (strpos($this->query, 'CREATE DATABASE') === 0) { |
| 3036 | - spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT); |
|
| 3036 | + spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT); |
|
| 3037 | 3037 | $this->query = 'SELECT 1'; |
| 3038 | 3038 | } |
| 3039 | 3039 | |
| 3040 | 3040 | // Correction Insert Ignore |
| 3041 | 3041 | // INSERT IGNORE -> insert (tout court et pas 'insert or replace') |
| 3042 | 3042 | if (strpos($this->query, 'INSERT IGNORE') === 0) { |
| 3043 | - spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG); |
|
| 3044 | - $this->query = 'INSERT ' . substr($this->query, '13'); |
|
| 3043 | + spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG); |
|
| 3044 | + $this->query = 'INSERT '.substr($this->query, '13'); |
|
| 3045 | 3045 | } |
| 3046 | 3046 | |
| 3047 | 3047 | // Correction des dates avec INTERVAL |
@@ -3069,7 +3069,7 @@ discard block |
||
| 3069 | 3069 | if (($this->sqlite_version == 2) && (strpos($this->query, 'USING') !== false)) { |
| 3070 | 3070 | spip_log( |
| 3071 | 3071 | "'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'", |
| 3072 | - 'sqlite.' . _LOG_ERREUR |
|
| 3072 | + 'sqlite.'._LOG_ERREUR |
|
| 3073 | 3073 | ); |
| 3074 | 3074 | $this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query); |
| 3075 | 3075 | } |
@@ -3092,8 +3092,8 @@ discard block |
||
| 3092 | 3092 | } else { |
| 3093 | 3093 | $suite = ''; |
| 3094 | 3094 | } |
| 3095 | - $pref = ($this->prefixe) ? $this->prefixe . '_' : ''; |
|
| 3096 | - $this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite; |
|
| 3095 | + $pref = ($this->prefixe) ? $this->prefixe.'_' : ''; |
|
| 3096 | + $this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite; |
|
| 3097 | 3097 | |
| 3098 | 3098 | // Correction zero AS x |
| 3099 | 3099 | // pg n'aime pas 0+x AS alias, sqlite, dans le meme style, |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $GLOBALS['debug_objets']['courant'] = $nom; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php'; |
|
| 58 | + $phpfile = sous_repertoire(_DIR_SKELS, '', false, true).$nom.'.php'; |
|
| 59 | 59 | |
| 60 | 60 | // si squelette est deja compile et perenne, le charger |
| 61 | 61 | if (!squelette_obsolete($phpfile, $source)) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | #} |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if (file_exists($lib = $squelette . '_fonctions' . '.php')) { |
|
| 71 | + if (file_exists($lib = $squelette.'_fonctions'.'.php')) { |
|
| 72 | 72 | include_once $lib; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | eval("return true; $f ;"); |
| 97 | 97 | } catch (\ParseError $e) { |
| 98 | 98 | // Code syntaxiquement faux (critere etc mal programme') |
| 99 | - $msg = _T('zbug_erreur_compilation') . ' | Line ' . $e->getLine() . ' : ' . $e->getMessage(); |
|
| 99 | + $msg = _T('zbug_erreur_compilation').' | Line '.$e->getLine().' : '.$e->getMessage(); |
|
| 100 | 100 | erreur_squelette($msg, $boucle); |
| 101 | 101 | // continuer pour trouver d'autres fautes eventuelles |
| 102 | 102 | // mais prevenir que c'est mort |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
| 126 | 126 | // Tracer ce qui vient d'etre compile |
| 127 | - $GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code; |
|
| 127 | + $GLOBALS['debug_objets']['code'][$nom.'tout'] = $code; |
|
| 128 | 128 | |
| 129 | 129 | // si c'est ce que demande le debusqueur, lui passer la main |
| 130 | 130 | if ( |
@@ -148,13 +148,13 @@ discard block |
||
| 148 | 148 | $code = " |
| 149 | 149 | /* |
| 150 | 150 | * Squelette : $sourcefile |
| 151 | - * Date : " . gmdate('D, d M Y H:i:s', @filemtime($sourcefile)) . ' GMT |
|
| 152 | - * Compile : ' . gmdate('D, d M Y H:i:s', time()) . ' GMT |
|
| 153 | - * ' . (!$boucles ? 'Pas de boucle' : ('Boucles : ' . $noms)) . ' |
|
| 151 | + * Date : ".gmdate('D, d M Y H:i:s', @filemtime($sourcefile)).' GMT |
|
| 152 | + * Compile : ' . gmdate('D, d M Y H:i:s', time()).' GMT |
|
| 153 | + * ' . (!$boucles ? 'Pas de boucle' : ('Boucles : '.$noms)).' |
|
| 154 | 154 | */ '; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $code = '<' . "?php\n" . $code . join('', $boucles) . "\n"; |
|
| 157 | + $code = '<'."?php\n".$code.join('', $boucles)."\n"; |
|
| 158 | 158 | if (!defined('_VAR_NOCACHE') or !_VAR_NOCACHE) { |
| 159 | 159 | ecrire_fichier($phpfile, $code); |
| 160 | 160 | } |
@@ -216,18 +216,18 @@ discard block |
||
| 216 | 216 | $j = join('-', array_map('ucwords', explode('-', strtolower($r[2])))); |
| 217 | 217 | |
| 218 | 218 | if ($j == 'X-Spip-Filtre' and isset($headers[$j])) { |
| 219 | - $headers[$j] .= '|' . $r[3]; |
|
| 219 | + $headers[$j] .= '|'.$r[3]; |
|
| 220 | 220 | } else { |
| 221 | - $headers[$j] = str_replace(['\\\\',"\\'",'\\"'], ['\\',"'",'"'], $r[3]); |
|
| 221 | + $headers[$j] = str_replace(['\\\\', "\\'", '\\"'], ['\\', "'", '"'], $r[3]); |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | // S'agit-il d'un resultat constant ou contenant du code php |
| 226 | 226 | $process_ins = ( |
| 227 | - strpos($corps, '<' . '?') === false |
|
| 227 | + strpos($corps, '<'.'?') === false |
|
| 228 | 228 | or |
| 229 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 230 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 229 | + (strpos($corps, '<'.'?xml') !== false and |
|
| 230 | + strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false) |
|
| 231 | 231 | ) |
| 232 | 232 | ? 'html' |
| 233 | 233 | : 'php'; |
@@ -256,10 +256,10 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | if ($process_ins == 'html') { |
| 258 | 258 | $skel['process_ins'] = ( |
| 259 | - strpos($corps, '<' . '?') === false |
|
| 259 | + strpos($corps, '<'.'?') === false |
|
| 260 | 260 | or |
| 261 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 262 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 261 | + (strpos($corps, '<'.'?xml') !== false and |
|
| 262 | + strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false) |
|
| 263 | 263 | ) |
| 264 | 264 | ? 'html' |
| 265 | 265 | : 'php'; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | // |
| 278 | 278 | |
| 279 | 279 | /** Code PHP pour inclure une balise dynamique à l'exécution d'une page */ |
| 280 | -define('CODE_INCLURE_BALISE', '<' . '?php |
|
| 280 | +define('CODE_INCLURE_BALISE', '<'.'?php |
|
| 281 | 281 | include_once("%s"); |
| 282 | 282 | if ($lang_select = "%s") $lang_select = lang_select($lang_select); |
| 283 | 283 | inserer_balise_dynamique(balise_%s_dyn(%s), array(%s)); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | // pas de lien symbolique sous Windows |
| 309 | 309 | and !(stristr(PHP_OS, 'WIN') and strpos($file, ':') !== false) |
| 310 | 310 | ) { |
| 311 | - $file = './" . _DIR_RACINE . "' . $file; |
|
| 311 | + $file = './" . _DIR_RACINE . "'.$file; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $lang = $context_compil[4]; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | $args = array_map('argumenter_squelette', $args); |
| 320 | 320 | if (!empty($context_compil['appel_php_depuis_modele'])) { |
| 321 | - $args[0] = 'arguments_balise_dyn_depuis_modele(' . $args[0] . ')'; |
|
| 321 | + $args[0] = 'arguments_balise_dyn_depuis_modele('.$args[0].')'; |
|
| 322 | 322 | } |
| 323 | 323 | $args = join(', ', $args); |
| 324 | 324 | |
@@ -352,14 +352,14 @@ discard block |
||
| 352 | 352 | if (is_object($v)) { |
| 353 | 353 | return var_export($v, true); |
| 354 | 354 | } elseif (!is_array($v)) { |
| 355 | - return "'" . texte_script((string) $v) . "'"; |
|
| 355 | + return "'".texte_script((string) $v)."'"; |
|
| 356 | 356 | } else { |
| 357 | 357 | $out = []; |
| 358 | 358 | foreach ($v as $k => $val) { |
| 359 | - $out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val); |
|
| 359 | + $out [] = argumenter_squelette($k).'=>'.argumenter_squelette($val); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - return 'array(' . join(', ', $out) . ')'; |
|
| 362 | + return 'array('.join(', ', $out).')'; |
|
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | else { |
| 386 | 386 | $str_args = base64_encode(serialize($args)); |
| 387 | - return "<?" . "php \$_zargs=unserialize(base64_decode('$str_args'));echo executer_balise_dynamique(...\$_zargs); ?".">\n"; |
|
| 387 | + return "<?"."php \$_zargs=unserialize(base64_decode('$str_args'));echo executer_balise_dynamique(...\$_zargs); ?".">\n"; |
|
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | // Y a-t-il une fonction de traitement des arguments ? |
| 465 | - $f = 'balise_' . $nom_balise . '_stat'; |
|
| 465 | + $f = 'balise_'.$nom_balise.'_stat'; |
|
| 466 | 466 | |
| 467 | 467 | $r = !function_exists($f) ? $args : $f($args, $context_compil); |
| 468 | 468 | |
@@ -472,18 +472,18 @@ discard block |
||
| 472 | 472 | |
| 473 | 473 | // verifier que la fonction dyn est la, |
| 474 | 474 | // sinon se replier sur la generique si elle existe |
| 475 | - if (!function_exists('balise_' . $nom_balise . '_dyn')) { |
|
| 475 | + if (!function_exists('balise_'.$nom_balise.'_dyn')) { |
|
| 476 | 476 | if ( |
| 477 | 477 | $balise_generique = chercher_balise_generique($nom) |
| 478 | 478 | and $nom_balise_generique = $balise_generique['nom_generique'] |
| 479 | - and $file = include_spip('balise/' . strtolower($nom_balise_generique)) |
|
| 480 | - and function_exists('balise_' . $nom_balise_generique . '_dyn') |
|
| 479 | + and $file = include_spip('balise/'.strtolower($nom_balise_generique)) |
|
| 480 | + and function_exists('balise_'.$nom_balise_generique.'_dyn') |
|
| 481 | 481 | ) { |
| 482 | 482 | // et lui injecter en premier arg le nom de la balise |
| 483 | 483 | array_unshift($r, $nom); |
| 484 | 484 | $nom_balise = $nom_balise_generique; |
| 485 | 485 | if (!_DIR_RESTREINT) { |
| 486 | - $file = _DIR_RESTREINT_ABS . $file; |
|
| 486 | + $file = _DIR_RESTREINT_ABS.$file; |
|
| 487 | 487 | } |
| 488 | 488 | } else { |
| 489 | 489 | $msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]]; |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | $n = ''; |
| 585 | 585 | foreach (explode(',', $liste) as $val) { |
| 586 | 586 | if ($a = intval($val) and $val === strval($a)) { |
| 587 | - $n .= ',' . $val; |
|
| 587 | + $n .= ','.$val; |
|
| 588 | 588 | } |
| 589 | 589 | } |
| 590 | 590 | if (strlen($n)) { |
@@ -763,8 +763,8 @@ discard block |
||
| 763 | 763 | // on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction |
| 764 | 764 | $i = 0; |
| 765 | 765 | do { |
| 766 | - $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 767 | - [$sous[1] . ' AS id'], |
|
| 766 | + $where[$k] = remplace_sous_requete($w, '('.calculer_select( |
|
| 767 | + [$sous[1].' AS id'], |
|
| 768 | 768 | $from, |
| 769 | 769 | $from_type, |
| 770 | 770 | $wheresub, |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | $id, |
| 778 | 778 | $serveur, |
| 779 | 779 | false |
| 780 | - ) . ')'); |
|
| 780 | + ).')'); |
|
| 781 | 781 | if (!$i) { |
| 782 | 782 | $i = 1; |
| 783 | 783 | $wherestring = calculer_where_to_string($where[$k]); |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | if ($sous[0] == 'SUBSELECT') { |
| 798 | 798 | // c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having) |
| 799 | 799 | array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ? |
| 800 | - $where[$k] = remplace_sous_requete($w, '(' . calculer_select( |
|
| 800 | + $where[$k] = remplace_sous_requete($w, '('.calculer_select( |
|
| 801 | 801 | $sous[1], # select |
| 802 | 802 | $sous[2], #from |
| 803 | 803 | [], #from_type |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | $id, |
| 813 | 813 | $serveur, |
| 814 | 814 | false |
| 815 | - ) . ')'); |
|
| 815 | + ).')'); |
|
| 816 | 816 | } |
| 817 | 817 | array_pop($where_simples); |
| 818 | 818 | } |
@@ -875,15 +875,15 @@ discard block |
||
| 875 | 875 | // sans recours a preg_match |
| 876 | 876 | // un implode(' ',..) est fait dans reinjecte_joint un peu plus bas |
| 877 | 877 | $afrom[$t][$cle] = [ |
| 878 | - "\n" . |
|
| 879 | - ($from_type[$cle] ?? 'INNER') . ' JOIN', |
|
| 878 | + "\n". |
|
| 879 | + ($from_type[$cle] ?? 'INNER').' JOIN', |
|
| 880 | 880 | $from[$cle], |
| 881 | 881 | "AS $cle", |
| 882 | 882 | 'ON (', |
| 883 | 883 | "$cle.$c", |
| 884 | 884 | '=', |
| 885 | 885 | "$t.$carr", |
| 886 | - ($and ? 'AND ' . $and : '') . |
|
| 886 | + ($and ? 'AND '.$and : ''). |
|
| 887 | 887 | ')' |
| 888 | 888 | ]; |
| 889 | 889 | if (isset($afrom[$cle])) { |
@@ -921,7 +921,7 @@ discard block |
||
| 921 | 921 | $t = key($from); |
| 922 | 922 | $c = current($from); |
| 923 | 923 | reset($from); |
| 924 | - $e = '/\b(' . "$t\\." . join('|' . $t . '\.', $equiv) . ')\b/'; |
|
| 924 | + $e = '/\b('."$t\\.".join('|'.$t.'\.', $equiv).')\b/'; |
|
| 925 | 925 | if ( |
| 926 | 926 | !(strpos($t, ' ') or // jointure des le depart cf boucle_doc |
| 927 | 927 | calculer_jointnul($t, $select, $e) or |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | unset($afrom[$t][$nt]); |
| 940 | 940 | $afrom[$nt] = $afrom[$t]; |
| 941 | 941 | unset($afrom[$t]); |
| 942 | - $e = '/\b' . preg_quote($nfrom[6]) . '\b/'; |
|
| 942 | + $e = '/\b'.preg_quote($nfrom[6]).'\b/'; |
|
| 943 | 943 | $t = $nfrom[4]; |
| 944 | 944 | $alias = ''; |
| 945 | 945 | // verifier que les deux cles sont homonymes, sinon installer un alias dans le select |
@@ -950,14 +950,14 @@ discard block |
||
| 950 | 950 | if ($newcle != $oldcle) { |
| 951 | 951 | // si l'ancienne cle etait deja dans le select avec un AS |
| 952 | 952 | // reprendre simplement ce AS |
| 953 | - $as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/'; |
|
| 953 | + $as = '/\b'.preg_quote($nfrom[6]).'\s+(AS\s+\w+)\b/'; |
|
| 954 | 954 | if (preg_match($as, implode(',', $select), $m)) { |
| 955 | 955 | $alias = ''; |
| 956 | 956 | } else { |
| 957 | - $alias = ', ' . $nfrom[4] . " AS $oldcle"; |
|
| 957 | + $alias = ', '.$nfrom[4]." AS $oldcle"; |
|
| 958 | 958 | } |
| 959 | 959 | } |
| 960 | - $select = remplacer_jointnul($t . $alias, $select, $e); |
|
| 960 | + $select = remplacer_jointnul($t.$alias, $select, $e); |
|
| 961 | 961 | $join = remplacer_jointnul($t, $join, $e); |
| 962 | 962 | $where = remplacer_jointnul($t, $where, $e); |
| 963 | 963 | $having = remplacer_jointnul($t, $having, $e); |
@@ -1007,9 +1007,9 @@ discard block |
||
| 1007 | 1007 | } else { |
| 1008 | 1008 | $exp = ''; |
| 1009 | 1009 | if (strtoupper($join) === 'AND') { |
| 1010 | - return $exp . join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 1010 | + return $exp.join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 1011 | 1011 | } else { |
| 1012 | - return $exp . join($join, $v); |
|
| 1012 | + return $exp.join($join, $v); |
|
| 1013 | 1013 | } |
| 1014 | 1014 | } |
| 1015 | 1015 | } |
@@ -1071,6 +1071,6 @@ discard block |
||
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | return $mime_type |
| 1074 | - . (!$connect ? '' : preg_replace('/\W/', '_', $connect)) . '_' |
|
| 1075 | - . md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : '')); |
|
| 1074 | + . (!$connect ? '' : preg_replace('/\W/', '_', $connect)).'_' |
|
| 1075 | + . md5($GLOBALS['spip_version_code'].' * '.$skel.(isset($GLOBALS['marqueur_skel']) ? '*'.$GLOBALS['marqueur_skel'] : '')); |
|
| 1076 | 1076 | } |
@@ -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 | } |
@@ -1135,7 +1134,7 @@ discard block |
||
| 1135 | 1134 | |
| 1136 | 1135 | $_liste = calculer_liste($crit->param[1], [], $boucles, $boucles[$idb]->id_parent); |
| 1137 | 1136 | |
| 1138 | - $order = "'-FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste(array_reverse($_liste),'" . $boucle->sql_serveur . "')) ? \$zl : '0').')'$sens"; |
|
| 1137 | + $order = "'-FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste(array_reverse($_liste),'".$boucle->sql_serveur."')) ? \$zl : '0').')'$sens"; |
|
| 1139 | 1138 | $boucle->order[] = $order; |
| 1140 | 1139 | } |
| 1141 | 1140 | |
@@ -1144,7 +1143,7 @@ discard block |
||
| 1144 | 1143 | $params = $crit->param; |
| 1145 | 1144 | |
| 1146 | 1145 | if ((is_countable($params) ? count($params) : 0) < 1) { |
| 1147 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]; |
|
| 1146 | + return ['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]; |
|
| 1148 | 1147 | } |
| 1149 | 1148 | |
| 1150 | 1149 | $boucle = &$boucles[$idb]; |
@@ -1165,7 +1164,7 @@ discard block |
||
| 1165 | 1164 | if (((is_countable($date) ? count($date) : 0) == 1) and ($date[0]->type == 'texte')) { |
| 1166 | 1165 | $date = $date[0]->texte; |
| 1167 | 1166 | if (!isset($fields[$date])) { |
| 1168 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . ' ' . $date]]; |
|
| 1167 | + return ['zbug_critere_inconnu', ['critere' => $crit->op.' '.$date]]; |
|
| 1169 | 1168 | } |
| 1170 | 1169 | } else { |
| 1171 | 1170 | $a = calculer_liste($date, $idb, $boucles, $parent); |
@@ -1177,38 +1176,38 @@ discard block |
||
| 1177 | 1176 | $date = "'.(($cond)\n?\$a:\"$defaut\").'"; |
| 1178 | 1177 | } |
| 1179 | 1178 | $annee = $params ? array_shift($params) : ''; |
| 1180 | - $annee = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1181 | - calculer_liste($annee, $idb, $boucles, $parent) . |
|
| 1179 | + $annee = "\n".'sprintf("%04d", ($x = '. |
|
| 1180 | + calculer_liste($annee, $idb, $boucles, $parent). |
|
| 1182 | 1181 | ') ? $x : date("Y"))'; |
| 1183 | 1182 | |
| 1184 | 1183 | $mois = $params ? array_shift($params) : ''; |
| 1185 | - $mois = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1186 | - calculer_liste($mois, $idb, $boucles, $parent) . |
|
| 1184 | + $mois = "\n".'sprintf("%02d", ($x = '. |
|
| 1185 | + calculer_liste($mois, $idb, $boucles, $parent). |
|
| 1187 | 1186 | ') ? $x : date("m"))'; |
| 1188 | 1187 | |
| 1189 | 1188 | $jour = $params ? array_shift($params) : ''; |
| 1190 | - $jour = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1191 | - calculer_liste($jour, $idb, $boucles, $parent) . |
|
| 1189 | + $jour = "\n".'sprintf("%02d", ($x = '. |
|
| 1190 | + calculer_liste($jour, $idb, $boucles, $parent). |
|
| 1192 | 1191 | ') ? $x : date("d"))'; |
| 1193 | 1192 | |
| 1194 | 1193 | $annee2 = $params ? array_shift($params) : ''; |
| 1195 | - $annee2 = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1196 | - calculer_liste($annee2, $idb, $boucles, $parent) . |
|
| 1194 | + $annee2 = "\n".'sprintf("%04d", ($x = '. |
|
| 1195 | + calculer_liste($annee2, $idb, $boucles, $parent). |
|
| 1197 | 1196 | ') ? $x : date("Y"))'; |
| 1198 | 1197 | |
| 1199 | 1198 | $mois2 = $params ? array_shift($params) : ''; |
| 1200 | - $mois2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1201 | - calculer_liste($mois2, $idb, $boucles, $parent) . |
|
| 1199 | + $mois2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1200 | + calculer_liste($mois2, $idb, $boucles, $parent). |
|
| 1202 | 1201 | ') ? $x : date("m"))'; |
| 1203 | 1202 | |
| 1204 | 1203 | $jour2 = $params ? array_shift($params) : ''; |
| 1205 | - $jour2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1206 | - calculer_liste($jour2, $idb, $boucles, $parent) . |
|
| 1204 | + $jour2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1205 | + calculer_liste($jour2, $idb, $boucles, $parent). |
|
| 1207 | 1206 | ') ? $x : date("d"))'; |
| 1208 | 1207 | |
| 1209 | - $date = $boucle->id_table . ".$date"; |
|
| 1208 | + $date = $boucle->id_table.".$date"; |
|
| 1210 | 1209 | |
| 1211 | - $quote_end = ",'" . $boucle->sql_serveur . "','text'"; |
|
| 1210 | + $quote_end = ",'".$boucle->sql_serveur."','text'"; |
|
| 1212 | 1211 | if ($type == 'jour') { |
| 1213 | 1212 | $boucle->where[] = [ |
| 1214 | 1213 | "'='", |
@@ -1280,14 +1279,13 @@ discard block |
||
| 1280 | 1279 | [$a21, $a22] = calculer_critere_parties_aux($idb, $boucles, $a2); |
| 1281 | 1280 | |
| 1282 | 1281 | if (($op == ',') && (is_numeric($a11) && (is_numeric($a21)))) { |
| 1283 | - $boucle->limit = $a11 . ',' . $a21; |
|
| 1282 | + $boucle->limit = $a11.','.$a21; |
|
| 1284 | 1283 | } else { |
| 1285 | 1284 | // 3 dans {1/3}, {2,3} ou {1,n-3} |
| 1286 | 1285 | $boucle->total_parties = ($a21 != 'n') ? $a21 : $a22; |
| 1287 | 1286 | // 2 dans {2/3}, {2,5}, {n-2,1} |
| 1288 | 1287 | $partie = ($a11 != 'n') ? $a11 : $a12; |
| 1289 | - $mode = (($op == '/') ? '/' : |
|
| 1290 | - (($a11 == 'n') ? '-' : '+') . (($a21 == 'n') ? '-' : '+')); |
|
| 1288 | + $mode = (($op == '/') ? '/' : (($a11 == 'n') ? '-' : '+').(($a21 == 'n') ? '-' : '+')); |
|
| 1291 | 1289 | // cas simple {0,#ENV{truc}} compilons le en LIMIT : |
| 1292 | 1290 | if ($a11 !== 'n' and $a21 !== 'n' and $mode == '++' and $op == ',') { |
| 1293 | 1291 | $boucle->limit = |
@@ -1333,8 +1331,7 @@ discard block |
||
| 1333 | 1331 | // {1/3} |
| 1334 | 1332 | if ($op1 == '/') { |
| 1335 | 1333 | $pmoins1 = is_numeric($debut) ? ($debut - 1) : "($debut-1)"; |
| 1336 | - $totpos = is_numeric($total_parties) ? ($total_parties) : |
|
| 1337 | - "($total_parties ? $total_parties : 1)"; |
|
| 1334 | + $totpos = is_numeric($total_parties) ? ($total_parties) : "($total_parties ? $total_parties : 1)"; |
|
| 1338 | 1335 | $fin = "ceil(($nombre_boucle * $debut )/$totpos) - 1"; |
| 1339 | 1336 | $debut = !$pmoins1 ? 0 : "ceil(($nombre_boucle * $pmoins1)/$totpos);"; |
| 1340 | 1337 | } else { |
@@ -1345,15 +1342,13 @@ discard block |
||
| 1345 | 1342 | |
| 1346 | 1343 | // cas {x,n-1} |
| 1347 | 1344 | if ($op2 == '-') { |
| 1348 | - $fin = '$debut_boucle + ' . $nombre_boucle . ' - ' |
|
| 1349 | - . (is_numeric($total_parties) ? ($total_parties + 1) : |
|
| 1350 | - ($total_parties . ' - 1')); |
|
| 1345 | + $fin = '$debut_boucle + '.$nombre_boucle.' - ' |
|
| 1346 | + . (is_numeric($total_parties) ? ($total_parties + 1) : ($total_parties.' - 1')); |
|
| 1351 | 1347 | } else { |
| 1352 | 1348 | // {x,1} ou {pagination} |
| 1353 | 1349 | $fin = '$debut_boucle' |
| 1354 | 1350 | . (is_numeric($total_parties) ? |
| 1355 | - (($total_parties == 1) ? '' : (' + ' . ($total_parties - 1))) : |
|
| 1356 | - ('+' . $total_parties . ' - 1')); |
|
| 1351 | + (($total_parties == 1) ? '' : (' + '.($total_parties - 1))) : ('+'.$total_parties.' - 1')); |
|
| 1357 | 1352 | } |
| 1358 | 1353 | |
| 1359 | 1354 | // {pagination}, gerer le debut_xx=-1 pour tout voir |
@@ -1371,11 +1366,11 @@ discard block |
||
| 1371 | 1366 | // Utiliser min pour rabattre $fin_boucle sur total_boucle. |
| 1372 | 1367 | |
| 1373 | 1368 | $boucles[$id_boucle]->mode_partie = "\n\t" |
| 1374 | - . '$debut_boucle = ' . $debut . ";\n " |
|
| 1369 | + . '$debut_boucle = '.$debut.";\n " |
|
| 1375 | 1370 | . "\$debut_boucle = intval(\$debut_boucle);\n " |
| 1376 | - . '$fin_boucle = min(' . $fin . ", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1377 | - . '$Numrows[\'' . $id_boucle . "']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1378 | - . '$Numrows[\'' . $id_boucle . '\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1371 | + . '$fin_boucle = min('.$fin.", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1372 | + . '$Numrows[\''.$id_boucle."']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1373 | + . '$Numrows[\''.$id_boucle.'\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1379 | 1374 | . "\n\tif (\$debut_boucle>0" |
| 1380 | 1375 | . " AND \$debut_boucle < \$Numrows['$id_boucle']['grand_total']" |
| 1381 | 1376 | . " AND \$iter->seek(\$debut_boucle,'continue'))" |
@@ -1460,16 +1455,16 @@ discard block |
||
| 1460 | 1455 | // critere personnalise ? |
| 1461 | 1456 | if ( |
| 1462 | 1457 | (!$serveur or |
| 1463 | - ((!function_exists($f = 'critere_' . $serveur . '_' . $table . '_' . $critere)) |
|
| 1464 | - and (!function_exists($f = $f . '_dist')) |
|
| 1465 | - and (!function_exists($f = 'critere_' . $serveur . '_' . $critere)) |
|
| 1466 | - and (!function_exists($f = $f . '_dist')) |
|
| 1458 | + ((!function_exists($f = 'critere_'.$serveur.'_'.$table.'_'.$critere)) |
|
| 1459 | + and (!function_exists($f = $f.'_dist')) |
|
| 1460 | + and (!function_exists($f = 'critere_'.$serveur.'_'.$critere)) |
|
| 1461 | + and (!function_exists($f = $f.'_dist')) |
|
| 1467 | 1462 | ) |
| 1468 | 1463 | ) |
| 1469 | - and (!function_exists($f = 'critere_' . $table . '_' . $critere)) |
|
| 1470 | - and (!function_exists($f = $f . '_dist')) |
|
| 1471 | - and (!function_exists($f = 'critere_' . $critere)) |
|
| 1472 | - and (!function_exists($f = $f . '_dist')) |
|
| 1464 | + and (!function_exists($f = 'critere_'.$table.'_'.$critere)) |
|
| 1465 | + and (!function_exists($f = $f.'_dist')) |
|
| 1466 | + and (!function_exists($f = 'critere_'.$critere)) |
|
| 1467 | + and (!function_exists($f = $f.'_dist')) |
|
| 1473 | 1468 | ) { |
| 1474 | 1469 | // fonction critere standard |
| 1475 | 1470 | $f = $defaut; |
@@ -1500,9 +1495,9 @@ discard block |
||
| 1500 | 1495 | */ |
| 1501 | 1496 | function kwote($lisp, $serveur = '', $type = '') { |
| 1502 | 1497 | if (preg_match(_CODE_QUOTE, $lisp, $r)) { |
| 1503 | - return $r[1] . '"' . sql_quote(str_replace(["\\'", '\\\\'], ["'", '\\'], $r[2]), $serveur, $type) . '"'; |
|
| 1498 | + return $r[1].'"'.sql_quote(str_replace(["\\'", '\\\\'], ["'", '\\'], $r[2]), $serveur, $type).'"'; |
|
| 1504 | 1499 | } else { |
| 1505 | - return "sql_quote($lisp, '$serveur', '" . str_replace("'", "\\'", $type) . "')"; |
|
| 1500 | + return "sql_quote($lisp, '$serveur', '".str_replace("'", "\\'", $type)."')"; |
|
| 1506 | 1501 | } |
| 1507 | 1502 | } |
| 1508 | 1503 | |
@@ -1524,7 +1519,7 @@ discard block |
||
| 1524 | 1519 | function critere_IN_dist($idb, &$boucles, $crit) { |
| 1525 | 1520 | $r = calculer_critere_infixe($idb, $boucles, $crit); |
| 1526 | 1521 | if (!$r) { |
| 1527 | - return ['zbug_critere_inconnu', ['critere' => $crit->op . ' ?']]; |
|
| 1522 | + return ['zbug_critere_inconnu', ['critere' => $crit->op.' ?']]; |
|
| 1528 | 1523 | } |
| 1529 | 1524 | [$arg, $op, $val, $col, $where_complement] = $r; |
| 1530 | 1525 | |
@@ -1549,8 +1544,8 @@ discard block |
||
| 1549 | 1544 | "'NOT'", |
| 1550 | 1545 | [ |
| 1551 | 1546 | "'IN'", |
| 1552 | - "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", |
|
| 1553 | - ["'SELF'", "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", $where] |
|
| 1547 | + "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", |
|
| 1548 | + ["'SELF'", "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", $where] |
|
| 1554 | 1549 | ] |
| 1555 | 1550 | ]; |
| 1556 | 1551 | } |
@@ -1567,22 +1562,22 @@ discard block |
||
| 1567 | 1562 | $descr = $boucles[$idb]->descr; |
| 1568 | 1563 | $cpt = &$num[$descr['nom']][$descr['gram']][$idb]; |
| 1569 | 1564 | |
| 1570 | - $var = '$in' . $cpt++; |
|
| 1565 | + $var = '$in'.$cpt++; |
|
| 1571 | 1566 | $x = "\n\t$var = array();"; |
| 1572 | 1567 | foreach ($val as $k => $v) { |
| 1573 | 1568 | if (preg_match(",^(\n//.*\n)?'(.*)'$,", $v, $r)) { |
| 1574 | 1569 | // optimiser le traitement des constantes |
| 1575 | 1570 | if (is_numeric($r[2])) { |
| 1576 | - $x .= "\n\t$var" . "[]= $r[2];"; |
|
| 1571 | + $x .= "\n\t$var"."[]= $r[2];"; |
|
| 1577 | 1572 | } else { |
| 1578 | - $x .= "\n\t$var" . '[]= ' . sql_quote($r[2]) . ';'; |
|
| 1573 | + $x .= "\n\t$var".'[]= '.sql_quote($r[2]).';'; |
|
| 1579 | 1574 | } |
| 1580 | 1575 | } else { |
| 1581 | 1576 | // Pour permettre de passer des tableaux de valeurs |
| 1582 | 1577 | // on repere l'utilisation brute de #ENV**{X}, |
| 1583 | 1578 | // c'est-a-dire sa traduction en ($PILE[0][X]). |
| 1584 | 1579 | // et on deballe mais en rajoutant l'anti XSS |
| 1585 | - $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var" . "[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1580 | + $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var"."[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1586 | 1581 | } |
| 1587 | 1582 | } |
| 1588 | 1583 | |
@@ -1596,7 +1591,7 @@ discard block |
||
| 1596 | 1591 | $boucles[$idb]->default_order[] = "((!\$zqv=sql_quote($var) OR \$zqv===\"''\") ? 0 : ('FIELD($arg,' . \$zqv . ')'))"; |
| 1597 | 1592 | } |
| 1598 | 1593 | |
| 1599 | - return "sql_in('$arg', $var" . ($crit2 == 'NOT' ? ",'NOT'" : '') . ')'; |
|
| 1594 | + return "sql_in('$arg', $var".($crit2 == 'NOT' ? ",'NOT'" : '').')'; |
|
| 1600 | 1595 | } |
| 1601 | 1596 | |
| 1602 | 1597 | /** |
@@ -1669,7 +1664,7 @@ discard block |
||
| 1669 | 1664 | $champs = array_diff($champs, array_keys($boucle->modificateur['criteres'])); |
| 1670 | 1665 | } |
| 1671 | 1666 | // nous aider en mode debug. |
| 1672 | - $boucle->debug[] = 'id_ : ' . implode(', ', $champs); |
|
| 1667 | + $boucle->debug[] = 'id_ : '.implode(', ', $champs); |
|
| 1673 | 1668 | $boucle->modificateur['id_'] = $champs; |
| 1674 | 1669 | |
| 1675 | 1670 | // créer un critère {id_xxx?} de chaque champ retenu |
@@ -1921,8 +1916,8 @@ discard block |
||
| 1921 | 1916 | "'NOT'", |
| 1922 | 1917 | [ |
| 1923 | 1918 | "'IN'", |
| 1924 | - "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", |
|
| 1925 | - ["'SELF'", "'" . $boucles[$idb]->id_table . '.' . $boucles[$idb]->primary . "'", $where] |
|
| 1919 | + "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", |
|
| 1920 | + ["'SELF'", "'".$boucles[$idb]->id_table.'.'.$boucles[$idb]->primary."'", $where] |
|
| 1926 | 1921 | ] |
| 1927 | 1922 | ]; |
| 1928 | 1923 | } |
@@ -1933,7 +1928,7 @@ discard block |
||
| 1933 | 1928 | if ($crit->cond) { |
| 1934 | 1929 | $pred = calculer_argument_precedent($idb, $col, $boucles); |
| 1935 | 1930 | if ($col === 'date' or $col === 'date_redac') { |
| 1936 | - if ($pred === "\$Pile[0]['" . $col . "']") { |
|
| 1931 | + if ($pred === "\$Pile[0]['".$col."']") { |
|
| 1937 | 1932 | $pred = "(\$Pile[0]['{$col}_default']?'':$pred)"; |
| 1938 | 1933 | } |
| 1939 | 1934 | } |
@@ -2096,7 +2091,7 @@ discard block |
||
| 2096 | 2091 | // defaire le quote des int et les passer dans sql_quote avec le bon type de champ si on le connait, int sinon |
| 2097 | 2092 | // prendre en compte le debug ou la valeur arrive avec un commentaire PHP en debut |
| 2098 | 2093 | if (preg_match(",^\\A(\s*//.*?$\s*)?\"'(-?\d+)'\"\\z,ms", $val[0], $r)) { |
| 2099 | - $val[0] = $r[1] . '"' . sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote) . '"'; |
|
| 2094 | + $val[0] = $r[1].'"'.sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote).'"'; |
|
| 2100 | 2095 | } |
| 2101 | 2096 | // sinon expliciter les |
| 2102 | 2097 | // sql_quote(truc) en sql_quote(truc,'',type) |
@@ -2112,14 +2107,14 @@ discard block |
||
| 2112 | 2107 | ) { |
| 2113 | 2108 | $r = $r[1] |
| 2114 | 2109 | . ((isset($r[2]) and $r[2]) ? $r[2] : ",''") |
| 2115 | - . ",'" . addslashes($type_cast_quote) . "'"; |
|
| 2110 | + . ",'".addslashes($type_cast_quote)."'"; |
|
| 2116 | 2111 | $val[0] = "sql_quote($r)"; |
| 2117 | 2112 | } |
| 2118 | 2113 | elseif ( |
| 2119 | 2114 | strpos($val[0], '@@defaultcast@@') !== false |
| 2120 | 2115 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r) |
| 2121 | 2116 | ) { |
| 2122 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'" . addslashes($type_cast_quote) . "')"; |
|
| 2117 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'".addslashes($type_cast_quote)."')"; |
|
| 2123 | 2118 | } |
| 2124 | 2119 | } |
| 2125 | 2120 | |
@@ -2127,7 +2122,7 @@ discard block |
||
| 2127 | 2122 | strpos($val[0], '@@defaultcast@@') !== false |
| 2128 | 2123 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r) |
| 2129 | 2124 | ) { |
| 2130 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'char')"; |
|
| 2125 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'char')"; |
|
| 2131 | 2126 | } |
| 2132 | 2127 | |
| 2133 | 2128 | // Indicateur pour permettre aux fonctionx boucle_X de modifier |
@@ -2143,7 +2138,7 @@ discard block |
||
| 2143 | 2138 | // inserer le nom de la table SQL devant le nom du champ |
| 2144 | 2139 | if ($table) { |
| 2145 | 2140 | if ($col[0] == '`') { |
| 2146 | - $arg = "$table." . substr($col, 1, -1); |
|
| 2141 | + $arg = "$table.".substr($col, 1, -1); |
|
| 2147 | 2142 | } else { |
| 2148 | 2143 | $arg = "$table.$col"; |
| 2149 | 2144 | } |
@@ -2277,9 +2272,9 @@ discard block |
||
| 2277 | 2272 | **/ |
| 2278 | 2273 | function primary_doublee($decompose, $table) { |
| 2279 | 2274 | $e1 = reset($decompose); |
| 2280 | - $e2 = "sql_quote('" . end($decompose) . "')"; |
|
| 2275 | + $e2 = "sql_quote('".end($decompose)."')"; |
|
| 2281 | 2276 | |
| 2282 | - return ["'='", "'$table." . $e1 . "'", $e2]; |
|
| 2277 | + return ["'='", "'$table.".$e1."'", $e2]; |
|
| 2283 | 2278 | } |
| 2284 | 2279 | |
| 2285 | 2280 | /** |
@@ -2318,7 +2313,7 @@ discard block |
||
| 2318 | 2313 | $checkarrivee |
| 2319 | 2314 | and is_string($checkarrivee) |
| 2320 | 2315 | and $a = table_objet($checkarrivee) |
| 2321 | - and in_array($a . '_liens', $joints) |
|
| 2316 | + and in_array($a.'_liens', $joints) |
|
| 2322 | 2317 | ) { |
| 2323 | 2318 | if ($res = calculer_lien_externe_init($boucle, $joints, $col, $desc, $cond, $checkarrivee)) { |
| 2324 | 2319 | return $res; |
@@ -2338,12 +2333,12 @@ discard block |
||
| 2338 | 2333 | // la table est déjà dans le FROM, on vérifie si le champ est utilisé. |
| 2339 | 2334 | $joindre = false; |
| 2340 | 2335 | foreach ($cols as $col) { |
| 2341 | - $c = '/\b' . $t . ".$col" . '\b/'; |
|
| 2336 | + $c = '/\b'.$t.".$col".'\b/'; |
|
| 2342 | 2337 | if (trouver_champ($c, $boucle->where)) { |
| 2343 | 2338 | $joindre = true; |
| 2344 | 2339 | } else { |
| 2345 | 2340 | // mais ca peut etre dans le FIELD pour le Having |
| 2346 | - $c = "/FIELD.$t" . ".$col,/"; |
|
| 2341 | + $c = "/FIELD.$t".".$col,/"; |
|
| 2347 | 2342 | if (trouver_champ($c, $boucle->select)) { |
| 2348 | 2343 | $joindre = true; |
| 2349 | 2344 | } |
@@ -2389,7 +2384,7 @@ discard block |
||
| 2389 | 2384 | $primary_arrivee = id_table_objet($checkarrivee); |
| 2390 | 2385 | |
| 2391 | 2386 | // [FIXME] $checkarrivee peut-il arriver avec false ???? |
| 2392 | - $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee . '_liens'); |
|
| 2387 | + $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee.'_liens'); |
|
| 2393 | 2388 | $arrivee = trouver_champ_exterieur($col, $joints, $boucle, $checkarrivee); |
| 2394 | 2389 | |
| 2395 | 2390 | if (!$intermediaire or !$arrivee) { |
@@ -2493,7 +2488,7 @@ discard block |
||
| 2493 | 2488 | } elseif ($crit->cond and ($col == 'date' or $col == 'date_redac')) { |
| 2494 | 2489 | // un critere conditionnel sur date est traite a part |
| 2495 | 2490 | // car la date est mise d'office par SPIP, |
| 2496 | - $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['" . $col . "'])"; |
|
| 2491 | + $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['".$col."'])"; |
|
| 2497 | 2492 | } |
| 2498 | 2493 | |
| 2499 | 2494 | $val = calculer_argument_precedent($idb, $val, $boucles, $defaut); |
@@ -2525,7 +2520,7 @@ discard block |
||
| 2525 | 2520 | and (($p == "'") or ($p == '"')) |
| 2526 | 2521 | and $params[0][1]->type == 'champ' |
| 2527 | 2522 | ) { |
| 2528 | - $val[] = "$p\\$p#" . $params[0][1]->nom_champ . "\\$p$p"; |
|
| 2523 | + $val[] = "$p\\$p#".$params[0][1]->nom_champ."\\$p$p"; |
|
| 2529 | 2524 | } else { |
| 2530 | 2525 | foreach ((($op != 'IN') ? $params : calculer_vieux_in($params)) as $p) { |
| 2531 | 2526 | $a = calculer_liste($p, $idb, $boucles, $parent); |
@@ -2541,7 +2536,7 @@ discard block |
||
| 2541 | 2536 | $fct = $args_sql = ''; |
| 2542 | 2537 | // fonction SQL ? |
| 2543 | 2538 | // chercher FONCTION(champ) tel que CONCAT(titre,descriptif) |
| 2544 | - if (preg_match('/^(.*)' . SQL_ARGS . '$/', $col, $m)) { |
|
| 2539 | + if (preg_match('/^(.*)'.SQL_ARGS.'$/', $col, $m)) { |
|
| 2545 | 2540 | $fct = $m[1]; |
| 2546 | 2541 | preg_match('/^\(([^,]*)(.*)\)$/', $m[2], $a); |
| 2547 | 2542 | $col = $a[1]; |
@@ -2628,7 +2623,7 @@ discard block |
||
| 2628 | 2623 | # Recherche de l'existence du champ date_xxxx, |
| 2629 | 2624 | # si oui choisir ce champ, sinon choisir xxxx |
| 2630 | 2625 | if (isset($table['field']["date$suite"])) { |
| 2631 | - $date_orig = 'date' . $suite; |
|
| 2626 | + $date_orig = 'date'.$suite; |
|
| 2632 | 2627 | } else { |
| 2633 | 2628 | $date_orig = substr($suite, 1); |
| 2634 | 2629 | } |
@@ -2648,12 +2643,12 @@ discard block |
||
| 2648 | 2643 | } |
| 2649 | 2644 | } |
| 2650 | 2645 | |
| 2651 | - $date_compare = "\"' . normaliser_date(" . |
|
| 2652 | - calculer_argument_precedent($idb, $pred, $boucles) . |
|
| 2646 | + $date_compare = "\"' . normaliser_date(". |
|
| 2647 | + calculer_argument_precedent($idb, $pred, $boucles). |
|
| 2653 | 2648 | ") . '\""; |
| 2654 | 2649 | |
| 2655 | 2650 | $col_vraie = $date_orig; |
| 2656 | - $date_orig = $boucle->id_table . '.' . $date_orig; |
|
| 2651 | + $date_orig = $boucle->id_table.'.'.$date_orig; |
|
| 2657 | 2652 | |
| 2658 | 2653 | switch ($col) { |
| 2659 | 2654 | case 'date': |
@@ -2673,26 +2668,26 @@ discard block |
||
| 2673 | 2668 | break; |
| 2674 | 2669 | case 'age': |
| 2675 | 2670 | $col = calculer_param_date("\'' . date('Y-m-d H:i:00') . '\'", $date_orig); |
| 2676 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2671 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2677 | 2672 | break; |
| 2678 | 2673 | case 'age_relatif': |
| 2679 | 2674 | $col = calculer_param_date($date_compare, $date_orig); |
| 2680 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2675 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2681 | 2676 | break; |
| 2682 | 2677 | case 'jour_relatif': |
| 2683 | - $col = '(TO_DAYS(' . $date_compare . ')-TO_DAYS(' . $date_orig . '))'; |
|
| 2684 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2678 | + $col = '(TO_DAYS('.$date_compare.')-TO_DAYS('.$date_orig.'))'; |
|
| 2679 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2685 | 2680 | break; |
| 2686 | 2681 | case 'mois_relatif': |
| 2687 | - $col = 'MONTH(' . $date_compare . ')-MONTH(' . |
|
| 2688 | - $date_orig . ')+12*(YEAR(' . $date_compare . |
|
| 2689 | - ')-YEAR(' . $date_orig . '))'; |
|
| 2690 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2682 | + $col = 'MONTH('.$date_compare.')-MONTH('. |
|
| 2683 | + $date_orig.')+12*(YEAR('.$date_compare. |
|
| 2684 | + ')-YEAR('.$date_orig.'))'; |
|
| 2685 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2691 | 2686 | break; |
| 2692 | 2687 | case 'annee_relatif': |
| 2693 | - $col = 'YEAR(' . $date_compare . ')-YEAR(' . |
|
| 2694 | - $date_orig . ')'; |
|
| 2695 | - $col_vraie = '';// comparer a un int (par defaut) |
|
| 2688 | + $col = 'YEAR('.$date_compare.')-YEAR('. |
|
| 2689 | + $date_orig.')'; |
|
| 2690 | + $col_vraie = ''; // comparer a un int (par defaut) |
|
| 2696 | 2691 | break; |
| 2697 | 2692 | } |
| 2698 | 2693 | |
@@ -2753,10 +2748,10 @@ discard block |
||
| 2753 | 2748 | } |
| 2754 | 2749 | |
| 2755 | 2750 | $boucle->hash .= ' |
| 2756 | - $command[\'sourcemode\'] = ' . array_shift($args) . ";\n"; |
|
| 2751 | + $command[\'sourcemode\'] = ' . array_shift($args).";\n"; |
|
| 2757 | 2752 | |
| 2758 | 2753 | $boucle->hash .= ' |
| 2759 | - $command[\'source\'] = array(' . join(', ', $args) . ");\n"; |
|
| 2754 | + $command[\'source\'] = array(' . join(', ', $args).");\n"; |
|
| 2760 | 2755 | } |
| 2761 | 2756 | |
| 2762 | 2757 | /** |
@@ -2775,7 +2770,7 @@ discard block |
||
| 2775 | 2770 | function critere_DATA_datacache_dist($idb, &$boucles, $crit) { |
| 2776 | 2771 | $boucle = &$boucles[$idb]; |
| 2777 | 2772 | $boucle->hash .= ' |
| 2778 | - $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2773 | + $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2779 | 2774 | } |
| 2780 | 2775 | |
| 2781 | 2776 | |
@@ -2794,7 +2789,7 @@ discard block |
||
| 2794 | 2789 | $boucle->hash .= '$command[\'args\']=array();'; |
| 2795 | 2790 | foreach ($crit->param as $param) { |
| 2796 | 2791 | $boucle->hash .= ' |
| 2797 | - $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2792 | + $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2798 | 2793 | } |
| 2799 | 2794 | } |
| 2800 | 2795 | |
@@ -2813,14 +2808,14 @@ discard block |
||
| 2813 | 2808 | */ |
| 2814 | 2809 | function critere_DATA_liste_dist($idb, &$boucles, $crit) { |
| 2815 | 2810 | $boucle = &$boucles[$idb]; |
| 2816 | - $boucle->hash .= "\n\t" . '$command[\'liste\'] = array();' . "\n"; |
|
| 2811 | + $boucle->hash .= "\n\t".'$command[\'liste\'] = array();'."\n"; |
|
| 2817 | 2812 | foreach ($crit->param as $param) { |
| 2818 | - $boucle->hash .= "\t" . '$command[\'liste\'][] = ' . calculer_liste( |
|
| 2813 | + $boucle->hash .= "\t".'$command[\'liste\'][] = '.calculer_liste( |
|
| 2819 | 2814 | $param, |
| 2820 | 2815 | $idb, |
| 2821 | 2816 | $boucles, |
| 2822 | 2817 | $boucles[$idb]->id_parent |
| 2823 | - ) . ";\n"; |
|
| 2818 | + ).";\n"; |
|
| 2824 | 2819 | } |
| 2825 | 2820 | } |
| 2826 | 2821 | |
@@ -2847,14 +2842,14 @@ discard block |
||
| 2847 | 2842 | */ |
| 2848 | 2843 | function critere_DATA_enum_dist($idb, &$boucles, $crit) { |
| 2849 | 2844 | $boucle = &$boucles[$idb]; |
| 2850 | - $boucle->hash .= "\n\t" . '$command[\'enum\'] = array();' . "\n"; |
|
| 2845 | + $boucle->hash .= "\n\t".'$command[\'enum\'] = array();'."\n"; |
|
| 2851 | 2846 | foreach ($crit->param as $param) { |
| 2852 | - $boucle->hash .= "\t" . '$command[\'enum\'][] = ' . calculer_liste( |
|
| 2847 | + $boucle->hash .= "\t".'$command[\'enum\'][] = '.calculer_liste( |
|
| 2853 | 2848 | $param, |
| 2854 | 2849 | $idb, |
| 2855 | 2850 | $boucles, |
| 2856 | 2851 | $boucles[$idb]->id_parent |
| 2857 | - ) . ";\n"; |
|
| 2852 | + ).";\n"; |
|
| 2858 | 2853 | } |
| 2859 | 2854 | } |
| 2860 | 2855 | |
@@ -2873,7 +2868,7 @@ discard block |
||
| 2873 | 2868 | $boucle = &$boucles[$idb]; |
| 2874 | 2869 | foreach ($crit->param as $param) { |
| 2875 | 2870 | $boucle->hash .= ' |
| 2876 | - $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2871 | + $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2877 | 2872 | } |
| 2878 | 2873 | } |
| 2879 | 2874 | |
@@ -2914,7 +2909,7 @@ discard block |
||
| 2914 | 2909 | if ($crit->param) { |
| 2915 | 2910 | foreach ($crit->param as $param) { |
| 2916 | 2911 | $boucle->hash .= "\t\$command['si'][] = " |
| 2917 | - . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ";\n"; |
|
| 2912 | + . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).";\n"; |
|
| 2918 | 2913 | } |
| 2919 | 2914 | // interdire {si 0} aussi ! |
| 2920 | 2915 | } else { |
@@ -2938,7 +2933,7 @@ discard block |
||
| 2938 | 2933 | function critere_POUR_tableau_dist($idb, &$boucles, $crit) { |
| 2939 | 2934 | $boucle = &$boucles[$idb]; |
| 2940 | 2935 | $boucle->hash .= ' |
| 2941 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2936 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).'); |
|
| 2942 | 2937 | $command[\'sourcemode\'] = \'table\';'; |
| 2943 | 2938 | } |
| 2944 | 2939 | |
@@ -2973,7 +2968,7 @@ discard block |
||
| 2973 | 2968 | $id_parent = $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] ?? 'id_parent'; |
| 2974 | 2969 | |
| 2975 | 2970 | $in = 'IN'; |
| 2976 | - $where = ["'IN'", "'$boucle->id_table." . "$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"]; |
|
| 2971 | + $where = ["'IN'", "'$boucle->id_table."."$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"]; |
|
| 2977 | 2972 | if ($not) { |
| 2978 | 2973 | $where = ["'NOT'", $where]; |
| 2979 | 2974 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | if (!$fonc) { |
| 148 | 148 | $fonc = $GLOBALS['debug_objets']['principal']; |
| 149 | 149 | } |
| 150 | - $titre = !$mode ? $fonc : ($mode . (isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? ' ' . $GLOBALS['debug_objets']['sourcefile'][$fonc] : '')); |
|
| 150 | + $titre = !$mode ? $fonc : ($mode.(isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? ' '.$GLOBALS['debug_objets']['sourcefile'][$fonc] : '')); |
|
| 151 | 151 | } |
| 152 | 152 | if ($message === false) { |
| 153 | 153 | lang_select(); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $fond = $GLOBALS['fond'] ?? ''; |
| 177 | 177 | // une erreur critique sort $message en array |
| 178 | 178 | $debug = is_array($msg) ? $msg[1] : $msg; |
| 179 | - spip_log('Debug: ' . $debug . ' (' . $fond . ')'); |
|
| 179 | + spip_log('Debug: '.$debug.' ('.$fond.')'); |
|
| 180 | 180 | |
| 181 | 181 | return $msg; |
| 182 | 182 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | function debusquer_bandeau($erreurs) { |
| 185 | 185 | |
| 186 | 186 | if (!empty($erreurs)) { |
| 187 | - $n = [(is_countable($erreurs) ? count($erreurs) : 0) . ' ' . _T('zbug_erreur_squelette')]; |
|
| 187 | + $n = [(is_countable($erreurs) ? count($erreurs) : 0).' '._T('zbug_erreur_squelette')]; |
|
| 188 | 188 | |
| 189 | 189 | return debusquer_navigation($erreurs, $n); |
| 190 | 190 | } elseif (!empty($GLOBALS['tableau_des_temps'])) { |
@@ -217,25 +217,25 @@ discard block |
||
| 217 | 217 | $valeur_simple = []; |
| 218 | 218 | foreach ($valeur as $v) { |
| 219 | 219 | if (is_array($v)) { |
| 220 | - $valeur_simple[] = 'array:' . count($v); |
|
| 220 | + $valeur_simple[] = 'array:'.count($v); |
|
| 221 | 221 | } elseif (is_object($v)) { |
| 222 | 222 | $valeur_simple[] = get_class($v); |
| 223 | 223 | } elseif (is_string($v)) { |
| 224 | - $valeur_simple[] = "'" . $v . "'"; |
|
| 224 | + $valeur_simple[] = "'".$v."'"; |
|
| 225 | 225 | } else { |
| 226 | 226 | $valeur_simple[] = $v; |
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | $n = count($valeur); |
| 230 | - $valeur = (($n > 3) ? 'array:' . $n . ' ' : ''); |
|
| 231 | - $valeur .= '[' . join(', ', $valeur_simple) . ']'; |
|
| 230 | + $valeur = (($n > 3) ? 'array:'.$n.' ' : ''); |
|
| 231 | + $valeur .= '['.join(', ', $valeur_simple).']'; |
|
| 232 | 232 | } elseif (is_object($valeur)) { |
| 233 | 233 | $valeur = get_class($valeur); |
| 234 | 234 | } elseif (is_string($valeur)) { |
| 235 | - $valeur = "'" . $valeur . "'"; |
|
| 235 | + $valeur = "'".$valeur."'"; |
|
| 236 | 236 | } |
| 237 | - $res .= "\n<tr><td><strong>" . nl2br((string) entites_html($nom)) |
|
| 238 | - . '</strong></td><td>: ' . nl2br((string) entites_html($valeur)) |
|
| 237 | + $res .= "\n<tr><td><strong>".nl2br((string) entites_html($nom)) |
|
| 238 | + . '</strong></td><td>: '.nl2br((string) entites_html($valeur)) |
|
| 239 | 239 | . "</td></tr>\n"; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | if ($ligne) { |
| 261 | 261 | $msg .= " L$ligne"; |
| 262 | 262 | } |
| 263 | - spip_log($msg, "debusquer" . _LOG_ERREUR); |
|
| 263 | + spip_log($msg, "debusquer"._LOG_ERREUR); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -285,10 +285,10 @@ discard block |
||
| 285 | 285 | $nom_code = $lieu->descr['nom']; |
| 286 | 286 | $skel = $lieu->descr['sourcefile']; |
| 287 | 287 | $h2 = parametre_url($href, 'var_mode_objet', $nom_code); |
| 288 | - $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette') . '#L' . $ligne; |
|
| 288 | + $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette').'#L'.$ligne; |
|
| 289 | 289 | $skel = "<a href='$h3'><b>$skel</b></a>"; |
| 290 | 290 | if ($boucle) { |
| 291 | - $h3 = parametre_url($h2 . $boucle, 'var_mode_affiche', 'boucle'); |
|
| 291 | + $h3 = parametre_url($h2.$boucle, 'var_mode_affiche', 'boucle'); |
|
| 292 | 292 | $boucle = "<a href='$h3'><b>$boucle</b></a>"; |
| 293 | 293 | } |
| 294 | 294 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // Requete erronee |
| 380 | - $err = '<b>' . _T('avis_erreur_mysql') . " $errno</b><br /><tt>\n" |
|
| 380 | + $err = '<b>'._T('avis_erreur_mysql')." $errno</b><br /><tt>\n" |
|
| 381 | 381 | . spip_htmlspecialchars($msg) |
| 382 | 382 | . "\n<br /><span style='color: red'><b>" |
| 383 | 383 | . spip_htmlspecialchars($query) |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | function trouve_boucle_debug($n, $nom, $debut = 0, $boucle = '') { |
| 393 | 393 | |
| 394 | - $id = $nom . $boucle; |
|
| 394 | + $id = $nom.$boucle; |
|
| 395 | 395 | if (is_array($GLOBALS['debug_objets']['sequence'][$id])) { |
| 396 | 396 | foreach ($GLOBALS['debug_objets']['sequence'][$id] as $v) { |
| 397 | 397 | if (!preg_match('/^(.*)(<\?.*\?>)(.*)$/s', $v[0], $r)) { |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | - $incl = ',' . $reg[1] . '[.]\w$,'; |
|
| 440 | + $incl = ','.$reg[1].'[.]\w$,'; |
|
| 441 | 441 | |
| 442 | 442 | foreach ($GLOBALS['debug_objets']['sourcefile'] as $k => $v) { |
| 443 | 443 | if (preg_match($incl, $v)) { |
@@ -452,16 +452,13 @@ discard block |
||
| 452 | 452 | [$skel, $boucle, $ligne] = trouve_boucle_debug($n, $nom); |
| 453 | 453 | |
| 454 | 454 | if (!$boucle) { |
| 455 | - return !$ligne ? '' : |
|
| 456 | - (' (' . |
|
| 457 | - (($nom != $skel) ? _T('squelette_inclus_ligne') : |
|
| 458 | - _T('squelette_ligne')) . |
|
| 455 | + return !$ligne ? '' : (' ('. |
|
| 456 | + (($nom != $skel) ? _T('squelette_inclus_ligne') : _T('squelette_ligne')). |
|
| 459 | 457 | " <a href='$self&var_mode_objet=$skel&var_mode_affiche=squelette&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"); |
| 460 | 458 | } else { |
| 461 | 459 | $self .= "&var_mode_objet=$skel$boucle&var_mode_affiche=boucle"; |
| 462 | 460 | |
| 463 | - return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : |
|
| 464 | - " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 461 | + return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 465 | 462 | } |
| 466 | 463 | } |
| 467 | 464 | |
@@ -483,14 +480,14 @@ discard block |
||
| 483 | 480 | |
| 484 | 481 | $s = preg_replace( |
| 485 | 482 | ',<(\w[^<>]*)>([^<]*)<br />([^<]*)</\1>,', |
| 486 | - '<\1>\2</\1><br />' . "\n" . '<\1>\3</\1>', |
|
| 483 | + '<\1>\2</\1><br />'."\n".'<\1>\3</\1>', |
|
| 487 | 484 | $s |
| 488 | 485 | ); |
| 489 | 486 | |
| 490 | 487 | |
| 491 | 488 | $tableau = explode('<br />', $s); |
| 492 | 489 | |
| 493 | - $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: " . ($nocpt ? 'hidden' : 'visible') . ";%s' href='#T%s' title=\"%s\">%0" . strval(@strlen(count($tableau))) . "d</a></span> %s<br />\n"; |
|
| 490 | + $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: ".($nocpt ? 'hidden' : 'visible').";%s' href='#T%s' title=\"%s\">%0".strval(@strlen(count($tableau)))."d</a></span> %s<br />\n"; |
|
| 494 | 491 | |
| 495 | 492 | $format10 = str_replace('white', 'lightgrey', $format); |
| 496 | 493 | $formaterr = 'color: red;'; |
@@ -534,7 +531,7 @@ discard block |
||
| 534 | 531 | . '" style="cursor: pointer;">' |
| 535 | 532 | . ($nocpt ? '' : _T('info_numero_abbreviation')) |
| 536 | 533 | . '</div> |
| 537 | - ' . $res . "</div>\n"; |
|
| 534 | + ' . $res."</div>\n"; |
|
| 538 | 535 | } |
| 539 | 536 | |
| 540 | 537 | // l'environnement graphique du debuggueur |
@@ -556,14 +553,14 @@ discard block |
||
| 556 | 553 | if (!empty($GLOBALS['debug_objets'][$mode][$fonc])) { |
| 557 | 554 | [$legend, $texte, $res2] = debusquer_source($fonc, $mode); |
| 558 | 555 | $texte .= $res2; |
| 559 | - } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc . 'tout'])) { |
|
| 560 | - $legend = _T('zbug_' . $mode); |
|
| 561 | - $texte = $GLOBALS['debug_objets'][$mode][$fonc . 'tout']; |
|
| 556 | + } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc.'tout'])) { |
|
| 557 | + $legend = _T('zbug_'.$mode); |
|
| 558 | + $texte = $GLOBALS['debug_objets'][$mode][$fonc.'tout']; |
|
| 562 | 559 | $texte = ancre_texte($texte, ['', '']); |
| 563 | 560 | } |
| 564 | 561 | } else { |
| 565 | 562 | if (strlen(trim($res))) { |
| 566 | - return "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 563 | + return "<img src='".chemin_image('debug-xx.svg')."' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 567 | 564 | } else { |
| 568 | 565 | // cas de l'appel sur erreur: montre la page |
| 569 | 566 | return $GLOBALS['debug_objets']['resultat']['tout'] ?? ''; |
@@ -571,7 +568,7 @@ discard block |
||
| 571 | 568 | } |
| 572 | 569 | } else { |
| 573 | 570 | $valider = charger_fonction('valider', 'xml'); |
| 574 | - $val = $valider($GLOBALS['debug_objets']['validation'][$fonc . 'tout']); |
|
| 571 | + $val = $valider($GLOBALS['debug_objets']['validation'][$fonc.'tout']); |
|
| 575 | 572 | // Si erreur, signaler leur nombre dans le formulaire admin |
| 576 | 573 | $GLOBALS['debug_objets']['validation'] = $val->err ? count($val->err) : ''; |
| 577 | 574 | [$texte, $err] = emboite_texte($val, $fonc, $self); |
@@ -582,14 +579,14 @@ discard block |
||
| 582 | 579 | } else { |
| 583 | 580 | $err = ": $err"; |
| 584 | 581 | } |
| 585 | - $legend = _T('validation') . ' ' . $err; |
|
| 582 | + $legend = _T('validation').' '.$err; |
|
| 586 | 583 | $res = $id = ''; |
| 587 | 584 | } |
| 588 | 585 | |
| 589 | 586 | return !trim($texte) ? '' : ( |
| 590 | - "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 587 | + "<img src='".chemin_image('debug-xx.svg')."' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 591 | 588 | . "<div id='debug_boucle'><fieldset$id><legend>" |
| 592 | - . "<a href='" . $self . '#f_' . substr($fonc, 0, 37) . "'> ↑ " |
|
| 589 | + . "<a href='".$self.'#f_'.substr($fonc, 0, 37)."'> ↑ " |
|
| 593 | 590 | . ($legend ?: $mode) |
| 594 | 591 | . '</a></legend>' |
| 595 | 592 | . $texte |
@@ -600,7 +597,7 @@ discard block |
||
| 600 | 597 | |
| 601 | 598 | function emboite_texte($res, $fonc = '', $self = '') { |
| 602 | 599 | $errs = $res->err; |
| 603 | - $texte = $res->entete . ($errs ? '' : $res->page); |
|
| 600 | + $texte = $res->entete.($errs ? '' : $res->page); |
|
| 604 | 601 | |
| 605 | 602 | if (!$texte and !$errs) { |
| 606 | 603 | return [ancre_texte('', ['', '']), false]; |
@@ -656,7 +653,7 @@ discard block |
||
| 656 | 653 | $err = "<h2 style='text-align: center'>" |
| 657 | 654 | . $i |
| 658 | 655 | . "<a href='#fin_err'>" |
| 659 | - . ' ' . _T('erreur_texte') |
|
| 656 | + . ' '._T('erreur_texte') |
|
| 660 | 657 | . "</a></h2><table id='debut_err' style='width: 100%'>" |
| 661 | 658 | . $err |
| 662 | 659 | . " </table><a id='fin_err'></a>"; |
@@ -666,9 +663,9 @@ discard block |
||
| 666 | 663 | [$msg, $fermant, $ouvrant] = $errs[0]; |
| 667 | 664 | $rf = reference_boucle_debug($fermant, $fonc, $self); |
| 668 | 665 | $ro = reference_boucle_debug($ouvrant, $fonc, $self); |
| 669 | - $err = $msg . |
|
| 670 | - "<a href='#L" . $fermant . "'>$fermant</a>$rf<br />" . |
|
| 671 | - "<a href='#L" . $ouvrant . "'>$ouvrant</a>$ro"; |
|
| 666 | + $err = $msg. |
|
| 667 | + "<a href='#L".$fermant."'>$fermant</a>$rf<br />". |
|
| 668 | + "<a href='#L".$ouvrant."'>$ouvrant</a>$ro"; |
|
| 672 | 669 | |
| 673 | 670 | return [ancre_texte($texte, [[$ouvrant], [$fermant]]), $err]; |
| 674 | 671 | } |
@@ -701,7 +698,7 @@ discard block |
||
| 701 | 698 | ['time' => $GLOBALS['debug_objets']['profile'][$sourcefile]] |
| 702 | 699 | ); |
| 703 | 700 | |
| 704 | - $res .= "<fieldset id='f_" . $nom . "'><legend>" |
|
| 701 | + $res .= "<fieldset id='f_".$nom."'><legend>" |
|
| 705 | 702 | . $t_skel |
| 706 | 703 | . ' ' |
| 707 | 704 | . $sourcefile |
@@ -716,7 +713,7 @@ discard block |
||
| 716 | 713 | . "'>" |
| 717 | 714 | . _T('zbug_calcul') |
| 718 | 715 | . '</a></legend>' |
| 719 | - . (!$temps ? '' : ("\n<span style='display:block;float:" . $GLOBALS['spip_lang_right'] . "'>$temps</span><br />")) |
|
| 716 | + . (!$temps ? '' : ("\n<span style='display:block;float:".$GLOBALS['spip_lang_right']."'>$temps</span><br />")) |
|
| 720 | 717 | . debusquer_contexte($contexte[$sourcefile]) |
| 721 | 718 | . (!$nav ? '' : ("<table width='100%'>\n$nav</table>\n")) |
| 722 | 719 | . "</fieldset>\n"; |
@@ -737,33 +734,33 @@ discard block |
||
| 737 | 734 | $nom = $boucle->id_boucle; |
| 738 | 735 | $req = $boucle->type_requete; |
| 739 | 736 | $crit = public_decompiler($boucle, $gram, 0, 'criteres'); |
| 740 | - $self2 = $self . '&var_mode_objet=' . $objet; |
|
| 741 | - |
|
| 742 | - $res .= "\n<tr style='background-color: " . |
|
| 743 | - ($i % 2 ? '#e0e0f0' : '#f8f8ff') . |
|
| 744 | - "'><td align='right'>$i</td><td>\n" . |
|
| 745 | - "<a class='debug_link_boucle' href='" . |
|
| 746 | - $self2 . |
|
| 747 | - "&var_mode_affiche=boucle#f_$nom_skel'>" . |
|
| 748 | - _T('zbug_boucle') . |
|
| 749 | - "</a></td><td>\n<a class='debug_link_boucle' href='" . |
|
| 750 | - $self2 . |
|
| 751 | - "&var_mode_affiche=resultat#f_$nom_skel'>" . |
|
| 752 | - _T('zbug_resultat') . |
|
| 753 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 754 | - $self2 . |
|
| 755 | - "&var_mode_affiche=code#f_$nom_skel'>" . |
|
| 756 | - _T('zbug_code') . |
|
| 757 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 758 | - str_replace('var_mode=', 'var_profile=', $self2) . |
|
| 759 | - "'>" . |
|
| 760 | - _T('zbug_calcul') . |
|
| 761 | - "</a></td><td>\n" . |
|
| 762 | - (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom) . |
|
| 763 | - "</td><td>\n" . |
|
| 764 | - $req . |
|
| 765 | - "</td><td>\n" . |
|
| 766 | - spip_htmlspecialchars($crit) . |
|
| 737 | + $self2 = $self.'&var_mode_objet='.$objet; |
|
| 738 | + |
|
| 739 | + $res .= "\n<tr style='background-color: ". |
|
| 740 | + ($i % 2 ? '#e0e0f0' : '#f8f8ff'). |
|
| 741 | + "'><td align='right'>$i</td><td>\n". |
|
| 742 | + "<a class='debug_link_boucle' href='". |
|
| 743 | + $self2. |
|
| 744 | + "&var_mode_affiche=boucle#f_$nom_skel'>". |
|
| 745 | + _T('zbug_boucle'). |
|
| 746 | + "</a></td><td>\n<a class='debug_link_boucle' href='". |
|
| 747 | + $self2. |
|
| 748 | + "&var_mode_affiche=resultat#f_$nom_skel'>". |
|
| 749 | + _T('zbug_resultat'). |
|
| 750 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 751 | + $self2. |
|
| 752 | + "&var_mode_affiche=code#f_$nom_skel'>". |
|
| 753 | + _T('zbug_code'). |
|
| 754 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 755 | + str_replace('var_mode=', 'var_profile=', $self2). |
|
| 756 | + "'>". |
|
| 757 | + _T('zbug_calcul'). |
|
| 758 | + "</a></td><td>\n". |
|
| 759 | + (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom). |
|
| 760 | + "</td><td>\n". |
|
| 761 | + $req. |
|
| 762 | + "</td><td>\n". |
|
| 763 | + spip_htmlspecialchars($crit). |
|
| 767 | 764 | '</td></tr>'; |
| 768 | 765 | } |
| 769 | 766 | } |
@@ -790,7 +787,7 @@ discard block |
||
| 790 | 787 | } |
| 791 | 788 | // permettre le copier/coller facile |
| 792 | 789 | // $res = ancre_texte($req, array(), true); |
| 793 | - $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n"; |
|
| 790 | + $res = "<div id='T".md5($req)."'>\n<pre>\n".$req."</pre>\n</div>\n"; |
|
| 794 | 791 | // formatage et affichage des resultats bruts de la requete |
| 795 | 792 | $ress_req = spip_query($req); |
| 796 | 793 | $brut_sql = ''; |
@@ -800,10 +797,10 @@ discard block |
||
| 800 | 797 | $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50; |
| 801 | 798 | while ($retours_sql = sql_fetch($ress_req)) { |
| 802 | 799 | if ($num <= $max_aff) { |
| 803 | - $brut_sql .= '<h3>' . ($num == 1 ? $num . ' sur ' . sql_count($ress_req) : $num) . '</h3>'; |
|
| 800 | + $brut_sql .= '<h3>'.($num == 1 ? $num.' sur '.sql_count($ress_req) : $num).'</h3>'; |
|
| 804 | 801 | $brut_sql .= '<p>'; |
| 805 | 802 | foreach ($retours_sql as $key => $val) { |
| 806 | - $brut_sql .= '<strong>' . $key . '</strong> => ' . spip_htmlspecialchars(couper($val, 150)) . "<br />\n"; |
|
| 803 | + $brut_sql .= '<strong>'.$key.'</strong> => '.spip_htmlspecialchars(couper($val, 150))."<br />\n"; |
|
| 807 | 804 | } |
| 808 | 805 | $brut_sql .= '</p>'; |
| 809 | 806 | } |
@@ -814,14 +811,14 @@ discard block |
||
| 814 | 811 | // ne pas afficher les $contexte_inclus |
| 815 | 812 | $view = preg_replace(',<\?php.+\?[>],Uims', '', $view); |
| 816 | 813 | if ($view) { |
| 817 | - $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . '</fieldset>'; |
|
| 814 | + $res2 .= "\n<br /><fieldset>".interdire_scripts($view).'</fieldset>'; |
|
| 818 | 815 | } |
| 819 | 816 | } |
| 820 | 817 | } elseif ($affiche == 'code') { |
| 821 | 818 | $legend = $nom; |
| 822 | - $res = ancre_texte('<' . "?php\n" . $quoi . "\n?" . '>'); |
|
| 819 | + $res = ancre_texte('<'."?php\n".$quoi."\n?".'>'); |
|
| 823 | 820 | } elseif ($affiche == 'boucle') { |
| 824 | - $legend = _T('zbug_boucle') . ' ' . $nom; |
|
| 821 | + $legend = _T('zbug_boucle').' '.$nom; |
|
| 825 | 822 | // Le compilateur prefixe le nom des boucles par l'extension du fichier source. |
| 826 | 823 | $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : ''; |
| 827 | 824 | $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle')); |
@@ -839,23 +836,23 @@ discard block |
||
| 839 | 836 | include_spip('public/assembler'); // pour inclure_balise_dynamique |
| 840 | 837 | include_spip('inc/texte'); // pour corriger_typo |
| 841 | 838 | |
| 842 | - return _DOCTYPE_ECRIRE . |
|
| 843 | - html_lang_attributes() . |
|
| 844 | - "<head>\n<title>" . |
|
| 845 | - ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . |
|
| 846 | - _T('admin_debug') . ' ' . spip_htmlspecialchars($titre) . ' (' . |
|
| 847 | - supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . |
|
| 848 | - ")</title>\n" . |
|
| 849 | - "<meta http-equiv='Content-Type' content='text/html" . |
|
| 850 | - (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . |
|
| 851 | - "' />\n" . |
|
| 839 | + return _DOCTYPE_ECRIRE. |
|
| 840 | + html_lang_attributes(). |
|
| 841 | + "<head>\n<title>". |
|
| 842 | + ('SPIP '.$GLOBALS['spip_version_affichee'].' '. |
|
| 843 | + _T('admin_debug').' '.spip_htmlspecialchars($titre).' ('. |
|
| 844 | + supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))). |
|
| 845 | + ")</title>\n". |
|
| 846 | + "<meta http-equiv='Content-Type' content='text/html". |
|
| 847 | + (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : ''). |
|
| 848 | + "' />\n". |
|
| 852 | 849 | http_script('', 'jquery.js') |
| 853 | - . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) |
|
| 854 | - . "' type='text/css' />" . |
|
| 855 | - "</head>\n" . |
|
| 856 | - "<body style='margin:0 10px;'>\n" . |
|
| 857 | - "<div id='spip-debug-header'>" . |
|
| 858 | - $corps . |
|
| 859 | - inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false) . |
|
| 850 | + . "<link rel='stylesheet' href='".url_absolue(find_in_path('spip_admin.css')) |
|
| 851 | + . "' type='text/css' />". |
|
| 852 | + "</head>\n". |
|
| 853 | + "<body style='margin:0 10px;'>\n". |
|
| 854 | + "<div id='spip-debug-header'>". |
|
| 855 | + $corps. |
|
| 856 | + inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false). |
|
| 860 | 857 | '</div></body></html>'; |
| 861 | 858 | } |
@@ -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 💩 |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $ok = false; |
| 617 | 617 | } |
| 618 | 618 | if (!$ok) { |
| 619 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 619 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | return $ok; |
@@ -706,10 +706,10 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | $character_set = ''; |
| 708 | 708 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 709 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 709 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 710 | 710 | } |
| 711 | 711 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 712 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 712 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | foreach ($champs as $k => $v) { |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | preg_match(',(char|text),i', $defs[1]) |
| 720 | 720 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 721 | 721 | ) { |
| 722 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 722 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | 725 | |
@@ -731,8 +731,8 @@ discard block |
||
| 731 | 731 | $s = ','; |
| 732 | 732 | } |
| 733 | 733 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 734 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ')' |
|
| 735 | - . (defined('_MYSQL_ENGINE') ? ' ENGINE=' . _MYSQL_ENGINE : '') |
|
| 734 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').')' |
|
| 735 | + . (defined('_MYSQL_ENGINE') ? ' ENGINE='._MYSQL_ENGINE : '') |
|
| 736 | 736 | . ($character_set ? " DEFAULT $character_set" : '') |
| 737 | 737 | . "\n"; |
| 738 | 738 | |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | return false; |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 814 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 815 | 815 | |
| 816 | 816 | return spip_mysql_query($query, $serveur, $requeter); |
| 817 | 817 | } |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | * Ressource à utiliser avec sql_fetch() |
| 870 | 870 | **/ |
| 871 | 871 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 872 | - return spip_mysql_query('SHOW TABLES LIKE ' . _q($match), $serveur, $requeter); |
|
| 872 | + return spip_mysql_query('SHOW TABLES LIKE '._q($match), $serveur, $requeter); |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | /** |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | * - true si la requête a réussie, false sinon |
| 886 | 886 | */ |
| 887 | 887 | function spip_mysql_repair($table, $serveur = '', $requeter = true) { |
| 888 | - $table_status = spip_mysql_fetch(spip_mysql_query('SHOW TABLE STATUS WHERE Name = ' . _q($table), $serveur, true)); |
|
| 888 | + $table_status = spip_mysql_fetch(spip_mysql_query('SHOW TABLE STATUS WHERE Name = '._q($table), $serveur, true)); |
|
| 889 | 889 | $engine = $table_status['Engine']; |
| 890 | 890 | if ($engine == 'InnoDB') { |
| 891 | 891 | if (spip_mysql_alter("TABLE $table ENGINE = InnoDB", $serveur, $requeter)) { |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | } elseif ($engine == 'MyISAM') { |
| 895 | 895 | return spip_mysql_query("REPAIR TABLE `$table`", $serveur, $requeter); |
| 896 | 896 | } else { |
| 897 | - spip_log("spip_mysql_repair impossible pour la table $table engine $engine", 'mysql.' . _LOG_DEBUG); |
|
| 897 | + spip_log("spip_mysql_repair impossible pour la table $table engine $engine", 'mysql.'._LOG_DEBUG); |
|
| 898 | 898 | } |
| 899 | 899 | } |
| 900 | 900 | |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | * - string : requete sql, si $requeter = true |
| 914 | 914 | **/ |
| 915 | 915 | function spip_mysql_table_exists(string $table, $serveur = '', $requeter = true) { |
| 916 | - $r = spip_mysql_query('SHOW TABLES LIKE ' . _q($table), $serveur, $requeter); |
|
| 916 | + $r = spip_mysql_query('SHOW TABLES LIKE '._q($table), $serveur, $requeter); |
|
| 917 | 917 | if (!$requeter) { |
| 918 | 918 | return $r; |
| 919 | 919 | } |
@@ -995,22 +995,22 @@ discard block |
||
| 995 | 995 | } |
| 996 | 996 | if ($val['Default'] === '0' || $val['Default']) { |
| 997 | 997 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 998 | - $nfields[$val['Field']] .= ' DEFAULT ' . $val['Default']; |
|
| 998 | + $nfields[$val['Field']] .= ' DEFAULT '.$val['Default']; |
|
| 999 | 999 | } else { |
| 1000 | - $nfields[$val['Field']] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 1000 | + $nfields[$val['Field']] .= " DEFAULT '".$val['Default']."'"; |
|
| 1001 | 1001 | } |
| 1002 | 1002 | } |
| 1003 | 1003 | if ($val['Extra']) { |
| 1004 | - $nfields[$val['Field']] .= ' ' . $val['Extra']; |
|
| 1004 | + $nfields[$val['Field']] .= ' '.$val['Extra']; |
|
| 1005 | 1005 | } |
| 1006 | 1006 | if ($val['Key'] == 'PRI') { |
| 1007 | 1007 | $nkeys['PRIMARY KEY'] = $val['Field']; |
| 1008 | 1008 | } else { |
| 1009 | 1009 | if ($val['Key'] == 'MUL') { |
| 1010 | - $nkeys['KEY ' . $val['Field']] = $val['Field']; |
|
| 1010 | + $nkeys['KEY '.$val['Field']] = $val['Field']; |
|
| 1011 | 1011 | } else { |
| 1012 | 1012 | if ($val['Key'] == 'UNI') { |
| 1013 | - $nkeys['UNIQUE KEY ' . $val['Field']] = $val['Field']; |
|
| 1013 | + $nkeys['UNIQUE KEY '.$val['Field']] = $val['Field']; |
|
| 1014 | 1014 | } |
| 1015 | 1015 | } |
| 1016 | 1016 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | $serveur = '', |
| 1086 | 1086 | $requeter = true |
| 1087 | 1087 | ) { |
| 1088 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1088 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1089 | 1089 | |
| 1090 | 1090 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1091 | 1091 | if (!$requeter) { |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | if ($s) { |
| 1126 | 1126 | $trace = debug_backtrace(); |
| 1127 | 1127 | if ($trace[0]['function'] != 'spip_mysql_error') { |
| 1128 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1128 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1129 | 1129 | } |
| 1130 | 1130 | } |
| 1131 | 1131 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | try { |
| 1252 | 1252 | $insert = mysqli_query($link, $query); |
| 1253 | 1253 | } catch (\mysqli_sql_exception $e) { |
| 1254 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 1254 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 1255 | 1255 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 1256 | 1256 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
| 1257 | 1257 | } |
@@ -1306,8 +1306,8 @@ discard block |
||
| 1306 | 1306 | |
| 1307 | 1307 | return spip_mysql_insert( |
| 1308 | 1308 | $table, |
| 1309 | - '(' . join(',', array_keys($couples)) . ')', |
|
| 1310 | - '(' . join(',', $couples) . ')', |
|
| 1309 | + '('.join(',', array_keys($couples)).')', |
|
| 1310 | + '('.join(',', $couples).')', |
|
| 1311 | 1311 | $desc, |
| 1312 | 1312 | $serveur, |
| 1313 | 1313 | $requeter |
@@ -1344,7 +1344,7 @@ discard block |
||
| 1344 | 1344 | } |
| 1345 | 1345 | $fields = $desc['field'] ?? []; |
| 1346 | 1346 | |
| 1347 | - $cles = '(' . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1347 | + $cles = '('.join(',', array_keys(reset($tab_couples))).')'; |
|
| 1348 | 1348 | $valeurs = []; |
| 1349 | 1349 | $r = false; |
| 1350 | 1350 | |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | foreach ($couples as $champ => $val) { |
| 1354 | 1354 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1355 | 1355 | } |
| 1356 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1356 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1357 | 1357 | if (count($valeurs) >= 100) { |
| 1358 | 1358 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1359 | 1359 | $valeurs = []; |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | function spip_mysql_update($table, $champs, $where = '', $desc = [], $serveur = '', $requeter = true) { |
| 1391 | 1391 | $set = []; |
| 1392 | 1392 | foreach ($champs as $champ => $val) { |
| 1393 | - $set[] = $champ . "=$val"; |
|
| 1393 | + $set[] = $champ."=$val"; |
|
| 1394 | 1394 | } |
| 1395 | 1395 | if (!empty($set)) { |
| 1396 | 1396 | return spip_mysql_query( |
@@ -1446,7 +1446,7 @@ discard block |
||
| 1446 | 1446 | } |
| 1447 | 1447 | $set = []; |
| 1448 | 1448 | foreach ($champs as $champ => $val) { |
| 1449 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1449 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | return spip_mysql_query( |
@@ -1515,10 +1515,10 @@ discard block |
||
| 1515 | 1515 | * - False en cas d'erreur. |
| 1516 | 1516 | **/ |
| 1517 | 1517 | function spip_mysql_replace($table, $couples, $desc = [], $serveur = '', $requeter = true) { |
| 1518 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1518 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1519 | 1519 | ',', |
| 1520 | 1520 | array_map('_q', $couples) |
| 1521 | - ) . ')', $serveur, $requeter); |
|
| 1521 | + ).')', $serveur, $requeter); |
|
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | |
@@ -1547,10 +1547,10 @@ discard block |
||
| 1547 | 1547 | * - False en cas d'erreur. |
| 1548 | 1548 | **/ |
| 1549 | 1549 | function spip_mysql_replace_multi($table, $tab_couples, $desc = [], $serveur = '', $requeter = true) { |
| 1550 | - $cles = '(' . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1550 | + $cles = '('.join(',', array_keys($tab_couples[0])).')'; |
|
| 1551 | 1551 | $valeurs = []; |
| 1552 | 1552 | foreach ($tab_couples as $couples) { |
| 1553 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1553 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1554 | 1554 | } |
| 1555 | 1555 | $valeurs = implode(', ', $valeurs); |
| 1556 | 1556 | |
@@ -1570,28 +1570,28 @@ discard block |
||
| 1570 | 1570 | */ |
| 1571 | 1571 | function spip_mysql_multi($objet, $lang) { |
| 1572 | 1572 | $lengthlang = strlen("[$lang]"); |
| 1573 | - $posmulti = 'INSTR(' . $objet . ", '<multi>')"; |
|
| 1574 | - $posfinmulti = 'INSTR(' . $objet . ", '</multi>')"; |
|
| 1575 | - $debutchaine = 'LEFT(' . $objet . ", $posmulti-1)"; |
|
| 1576 | - $finchaine = 'RIGHT(' . $objet . ', CHAR_LENGTH(' . $objet . ") -(7+$posfinmulti))"; |
|
| 1577 | - $chainemulti = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1578 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1573 | + $posmulti = 'INSTR('.$objet.", '<multi>')"; |
|
| 1574 | + $posfinmulti = 'INSTR('.$objet.", '</multi>')"; |
|
| 1575 | + $debutchaine = 'LEFT('.$objet.", $posmulti-1)"; |
|
| 1576 | + $finchaine = 'RIGHT('.$objet.', CHAR_LENGTH('.$objet.") -(7+$posfinmulti))"; |
|
| 1577 | + $chainemulti = 'TRIM(SUBSTRING('.$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1578 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1579 | 1579 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1580 | - $chainelang = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1581 | - $posfinlang = 'INSTR(' . $chainelang . ", '[')"; |
|
| 1580 | + $chainelang = 'TRIM(SUBSTRING('.$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1581 | + $posfinlang = 'INSTR('.$chainelang.", '[')"; |
|
| 1582 | 1582 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1583 | 1583 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1584 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1585 | - ' TRIM(' . $objet . '), ' . |
|
| 1586 | - ' CONCAT( ' . |
|
| 1587 | - " $debutchaine, " . |
|
| 1588 | - ' IF( ' . |
|
| 1589 | - " $poslang = 0, " . |
|
| 1590 | - " $chainemulti, " . |
|
| 1591 | - " $chainelang" . |
|
| 1592 | - ' ), ' . |
|
| 1593 | - " $finchaine" . |
|
| 1594 | - ' ) ' . |
|
| 1584 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1585 | + ' TRIM('.$objet.'), '. |
|
| 1586 | + ' CONCAT( '. |
|
| 1587 | + " $debutchaine, ". |
|
| 1588 | + ' IF( '. |
|
| 1589 | + " $poslang = 0, ". |
|
| 1590 | + " $chainemulti, ". |
|
| 1591 | + " $chainelang". |
|
| 1592 | + ' ), '. |
|
| 1593 | + " $finchaine". |
|
| 1594 | + ' ) '. |
|
| 1595 | 1595 | '))) AS multi'; |
| 1596 | 1596 | |
| 1597 | 1597 | return $retour; |
@@ -1608,7 +1608,7 @@ discard block |
||
| 1608 | 1608 | * Valeur hexadécimale pour MySQL |
| 1609 | 1609 | **/ |
| 1610 | 1610 | function spip_mysql_hex($v) { |
| 1611 | - return '0x' . $v; |
|
| 1611 | + return '0x'.$v; |
|
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | 1614 | /** |
@@ -1648,7 +1648,7 @@ discard block |
||
| 1648 | 1648 | * Expression SQL |
| 1649 | 1649 | **/ |
| 1650 | 1650 | function spip_mysql_date_proche($champ, $interval, $unite) { |
| 1651 | - $use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false ); |
|
| 1651 | + $use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false); |
|
| 1652 | 1652 | return '(' |
| 1653 | 1653 | . $champ |
| 1654 | 1654 | . (($interval <= 0) ? '>' : '<') |
@@ -1703,7 +1703,7 @@ discard block |
||
| 1703 | 1703 | } elseif ($v === null) { |
| 1704 | 1704 | return "''"; |
| 1705 | 1705 | } |
| 1706 | - return "'" . addslashes($v) . "'"; |
|
| 1706 | + return "'".addslashes($v)."'"; |
|
| 1707 | 1707 | } |
| 1708 | 1708 | |
| 1709 | 1709 | if ($v === null) { |
@@ -1727,7 +1727,7 @@ discard block |
||
| 1727 | 1727 | } |
| 1728 | 1728 | } |
| 1729 | 1729 | |
| 1730 | - return ("'" . addslashes($v) . "'"); |
|
| 1730 | + return ("'".addslashes($v)."'"); |
|
| 1731 | 1731 | } |
| 1732 | 1732 | |
| 1733 | 1733 | /** |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | } else { |
| 1762 | 1762 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1763 | 1763 | |
| 1764 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1764 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1765 | 1765 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1766 | 1766 | } |
| 1767 | 1767 | } |