@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | renouvelle_alea(); |
| 65 | 65 | $new = false; |
| 66 | 66 | } else { |
| 67 | - spip_log("impossible d'ecrire dans " . $cache); |
|
| 67 | + spip_log("impossible d'ecrire dans ".$cache); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | // et refaire le cache si on a du lire en base |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | if (!isset($touch[$table])) { |
| 165 | 165 | touch_meta($antidate, $table); |
| 166 | 166 | } |
| 167 | - sql_delete('spip_' . $table, "nom='$nom'", '', 'continue'); |
|
| 167 | + sql_delete('spip_'.$table, "nom='$nom'", '', 'continue'); |
|
| 168 | 168 | unset($GLOBALS[$table][$nom]); |
| 169 | 169 | if (!isset($touch[$table])) { |
| 170 | 170 | touch_meta($antidate, $table); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | return; |
| 197 | 197 | } |
| 198 | 198 | include_spip('base/abstract_sql'); |
| 199 | - $res = sql_select('*', 'spip_' . $table, 'nom=' . sql_quote($nom), '', '', '', '', '', 'continue'); |
|
| 199 | + $res = sql_select('*', 'spip_'.$table, 'nom='.sql_quote($nom), '', '', '', '', '', 'continue'); |
|
| 200 | 200 | // table pas encore installee, travailler en php seulement |
| 201 | 201 | if (!$res) { |
| 202 | 202 | $GLOBALS[$table][$nom] = $valeur; |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | $r['impt'] = sql_quote($importable, '', 'text'); |
| 232 | 232 | } |
| 233 | 233 | if ($row) { |
| 234 | - sql_update('spip_' . $table, $r, 'nom=' . sql_quote($nom)); |
|
| 234 | + sql_update('spip_'.$table, $r, 'nom='.sql_quote($nom)); |
|
| 235 | 235 | } else { |
| 236 | - sql_insert('spip_' . $table, '(' . implode(',', array_keys($r)) . ')', '(' . implode(',', array_values($r)) . ')'); |
|
| 236 | + sql_insert('spip_'.$table, '('.implode(',', array_keys($r)).')', '('.implode(',', array_values($r)).')'); |
|
| 237 | 237 | } |
| 238 | 238 | if (!isset($touch[$table])) { |
| 239 | 239 | touch_meta($antidate, $table); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * Nom du fichier cache |
| 251 | 251 | **/ |
| 252 | 252 | function cache_meta($table = 'meta') { |
| 253 | - return ($table == 'meta') ? _FILE_META : (_DIR_CACHE . $table . '.php'); |
|
| 253 | + return ($table == 'meta') ? _FILE_META : (_DIR_CACHE.$table.'.php'); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | $blue = dechex($blue); |
| 43 | 43 | |
| 44 | 44 | if (strlen($red) == 1) { |
| 45 | - $red = '0' . $red; |
|
| 45 | + $red = '0'.$red; |
|
| 46 | 46 | } |
| 47 | 47 | if (strlen($green) == 1) { |
| 48 | - $green = '0' . $green; |
|
| 48 | + $green = '0'.$green; |
|
| 49 | 49 | } |
| 50 | 50 | if (strlen($blue) == 1) { |
| 51 | - $blue = '0' . $blue; |
|
| 51 | + $blue = '0'.$blue; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | 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 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | function _couleur_hsl_to_rgb($H, $S, $L) { |
| 187 | 187 | // helper |
| 188 | - $hue_2_rgb = function ($v1, $v2, $vH) { |
|
| 188 | + $hue_2_rgb = function($v1, $v2, $vH) { |
|
| 189 | 189 | if ($vH < 0) { |
| 190 | 190 | $vH += 1; |
| 191 | 191 | } |
@@ -319,11 +319,11 @@ discard block |
||
| 319 | 319 | } |
| 320 | 320 | } elseif ( |
| 321 | 321 | preg_match('@^data:image/([^;]*);base64,(.*)$@isS', $source, $regs) |
| 322 | - && ($extension = _image_trouver_extension_depuis_mime('image/' . $regs[1])) |
|
| 322 | + && ($extension = _image_trouver_extension_depuis_mime('image/'.$regs[1])) |
|
| 323 | 323 | && in_array($extension, _image_extensions_acceptees_en_entree()) |
| 324 | 324 | ) { |
| 325 | 325 | # gerer img src="data:....base64" |
| 326 | - $local = sous_repertoire(_DIR_VAR, 'image-data') . md5($regs[2]) . '.' . _image_extension_normalisee($extension); |
|
| 326 | + $local = sous_repertoire(_DIR_VAR, 'image-data').md5($regs[2]).'.'._image_extension_normalisee($extension); |
|
| 327 | 327 | if (!file_exists($local)) { |
| 328 | 328 | ecrire_fichier($local, base64_decode($regs[2])); |
| 329 | 329 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | // les protocoles web prennent au moins 3 lettres |
| 341 | 341 | if (tester_url_absolue($source)) { |
| 342 | 342 | include_spip('inc/distant'); |
| 343 | - $fichier = _DIR_RACINE . copie_locale($source); |
|
| 343 | + $fichier = _DIR_RACINE.copie_locale($source); |
|
| 344 | 344 | if (!$fichier) { |
| 345 | 345 | return ''; |
| 346 | 346 | } |
@@ -442,9 +442,9 @@ discard block |
||
| 442 | 442 | // on garde la terminaison initiale car image simplement copiee |
| 443 | 443 | // et on postfixe son nom avec un md5 du path |
| 444 | 444 | $terminaison_dest = $terminaison; |
| 445 | - $fichier_dest .= '-' . substr(md5("$identifiant"), 0, 5); |
|
| 445 | + $fichier_dest .= '-'.substr(md5("$identifiant"), 0, 5); |
|
| 446 | 446 | } else { |
| 447 | - $fichier_dest .= '-' . substr(md5("$identifiant-$effet"), 0, 5); |
|
| 447 | + $fichier_dest .= '-'.substr(md5("$identifiant-$effet"), 0, 5); |
|
| 448 | 448 | } |
| 449 | 449 | $cache = sous_repertoire(_DIR_VAR, $cache); |
| 450 | 450 | $cache = sous_repertoire($cache, $effet); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | $fichier_dest = substr($fichier_dest, 2); |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - $fichier_dest = $cache . $fichier_dest . '.' . $terminaison_dest; |
|
| 458 | + $fichier_dest = $cache.$fichier_dest.'.'.$terminaison_dest; |
|
| 459 | 459 | |
| 460 | 460 | $GLOBALS['images_calculees'][] = $fichier_dest; |
| 461 | 461 | |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | } |
| 482 | 482 | if ($creer && !@file_exists($fichier)) { |
| 483 | 483 | if (!@file_exists("$fichier.src")) { |
| 484 | - spip_log("Image absente : $fichier", 'images' . _LOG_ERREUR); |
|
| 484 | + spip_log("Image absente : $fichier", 'images'._LOG_ERREUR); |
|
| 485 | 485 | |
| 486 | 486 | return false; |
| 487 | 487 | } |
@@ -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; |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | |
| 643 | 643 | $_terminaison = _image_trouver_extension_depuis_mime($mime); |
| 644 | 644 | if ($_terminaison && $_terminaison !== $terminaison) { |
| 645 | - spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", 'images.' . _LOG_INFO_IMPORTANTE); |
|
| 645 | + spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", 'images.'._LOG_INFO_IMPORTANTE); |
|
| 646 | 646 | $terminaison = $_terminaison; |
| 647 | 647 | } |
| 648 | 648 | return $terminaison; |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | if (!function_exists('imagepng')) { |
| 778 | 778 | return false; |
| 779 | 779 | } |
| 780 | - $tmp = $fichier . '.tmp'; |
|
| 780 | + $tmp = $fichier.'.tmp'; |
|
| 781 | 781 | $ret = imagepng($img, $tmp); |
| 782 | 782 | if (file_exists($tmp)) { |
| 783 | 783 | $taille_test = @getimagesize($tmp); |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | if (!function_exists('imagegif')) { |
| 813 | 813 | return false; |
| 814 | 814 | } |
| 815 | - $tmp = $fichier . '.tmp'; |
|
| 815 | + $tmp = $fichier.'.tmp'; |
|
| 816 | 816 | $ret = imagegif($img, $tmp); |
| 817 | 817 | if (file_exists($tmp)) { |
| 818 | 818 | $taille_test = @getimagesize($tmp); |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | if (!function_exists('imagejpeg')) { |
| 853 | 853 | return false; |
| 854 | 854 | } |
| 855 | - $tmp = $fichier . '.tmp'; |
|
| 855 | + $tmp = $fichier.'.tmp'; |
|
| 856 | 856 | |
| 857 | 857 | // Enable interlancing |
| 858 | 858 | imageinterlace($img, true); |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | if (!function_exists('imagewebp')) { |
| 914 | 914 | return false; |
| 915 | 915 | } |
| 916 | - $tmp = $fichier . '.tmp'; |
|
| 916 | + $tmp = $fichier.'.tmp'; |
|
| 917 | 917 | $ret = imagewebp($img, $tmp, $qualite); |
| 918 | 918 | if (file_exists($tmp)) { |
| 919 | 919 | $taille_test = @getimagesize($tmp); |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | */ |
| 948 | 948 | function _image_imagesvg($img, $fichier) { |
| 949 | 949 | |
| 950 | - $tmp = $fichier . '.tmp'; |
|
| 950 | + $tmp = $fichier.'.tmp'; |
|
| 951 | 951 | if (!str_contains($img, '<')) { |
| 952 | 952 | $img = supprimer_timestamp($img); |
| 953 | 953 | if (!file_exists($img)) { |
@@ -1004,14 +1004,14 @@ discard block |
||
| 1004 | 1004 | */ |
| 1005 | 1005 | function _image_gd_output($img, $valeurs, $qualite = _IMG_GD_QUALITE, $fonction = null) { |
| 1006 | 1006 | if (is_null($fonction)) { |
| 1007 | - $fonction = '_image_image' . $valeurs['format_dest']; |
|
| 1007 | + $fonction = '_image_image'.$valeurs['format_dest']; |
|
| 1008 | 1008 | } |
| 1009 | 1009 | $ret = false; |
| 1010 | 1010 | #un flag pour reperer les images gravees |
| 1011 | 1011 | $lock = ( |
| 1012 | 1012 | !statut_effacer_images_temporaires('get') |
| 1013 | 1013 | || @file_exists($valeurs['fichier_dest']) |
| 1014 | - && !@file_exists($valeurs['fichier_dest'] . '.src') |
|
| 1014 | + && !@file_exists($valeurs['fichier_dest'].'.src') |
|
| 1015 | 1015 | ); |
| 1016 | 1016 | if ( |
| 1017 | 1017 | function_exists($fonction) |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | [$valeurs['hauteur_dest'], $valeurs['largeur_dest']] = taille_image($valeurs['fichier_dest']); |
| 1024 | 1024 | $valeurs['date'] = @filemtime($valeurs['fichier_dest']); |
| 1025 | 1025 | // pour la retrouver apres disparition |
| 1026 | - ecrire_fichier($valeurs['fichier_dest'] . '.src', serialize($valeurs), true); |
|
| 1026 | + ecrire_fichier($valeurs['fichier_dest'].'.src', serialize($valeurs), true); |
|
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | return $ret; |
@@ -1198,7 +1198,7 @@ discard block |
||
| 1198 | 1198 | |
| 1199 | 1199 | // attributs deprecies. Transformer en CSS |
| 1200 | 1200 | if ($espace = extraire_attribut($tag, 'hspace')) { |
| 1201 | - $style = "margin:{$espace}px;" . $style; |
|
| 1201 | + $style = "margin:{$espace}px;".$style; |
|
| 1202 | 1202 | $tag = inserer_attribut($tag, 'hspace', ''); |
| 1203 | 1203 | } |
| 1204 | 1204 | |
@@ -1321,7 +1321,7 @@ discard block |
||
| 1321 | 1321 | $image = $valeurs['fichier']; |
| 1322 | 1322 | $format = $valeurs['format_source']; |
| 1323 | 1323 | $destdir = dirname((string) $valeurs['fichier_dest']); |
| 1324 | - $destfile = basename((string) $valeurs['fichier_dest'], '.' . $valeurs['format_dest']); |
|
| 1324 | + $destfile = basename((string) $valeurs['fichier_dest'], '.'.$valeurs['format_dest']); |
|
| 1325 | 1325 | |
| 1326 | 1326 | $format_sortie = $valeurs['format_dest']; |
| 1327 | 1327 | |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | |
| 1354 | 1354 | // Si l'image est de la taille demandee (ou plus petite), simplement la retourner |
| 1355 | 1355 | if ($srcWidth && $srcWidth <= $maxWidth && $srcHeight <= $maxHeight) { |
| 1356 | - $vignette = $destination . '.' . $format; |
|
| 1356 | + $vignette = $destination.'.'.$format; |
|
| 1357 | 1357 | @copy($image, $vignette); |
| 1358 | 1358 | } |
| 1359 | 1359 | |
@@ -1361,7 +1361,7 @@ discard block |
||
| 1361 | 1361 | include_spip('inc/svg'); |
| 1362 | 1362 | if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)) { |
| 1363 | 1363 | $format_sortie = 'svg'; |
| 1364 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1364 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1365 | 1365 | $valeurs['fichier_dest'] = $vignette; |
| 1366 | 1366 | _image_gd_output($svg, $valeurs); |
| 1367 | 1367 | } |
@@ -1373,9 +1373,9 @@ discard block |
||
| 1373 | 1373 | define('_CONVERT_COMMAND', 'convert'); |
| 1374 | 1374 | } // Securite : mes_options.php peut preciser le chemin absolu |
| 1375 | 1375 | if (!defined('_RESIZE_COMMAND')) { |
| 1376 | - define('_RESIZE_COMMAND', _CONVERT_COMMAND . ' -quality ' . _IMG_CONVERT_QUALITE . ' -orient Undefined -resize %xx%y! %src %dest'); |
|
| 1376 | + define('_RESIZE_COMMAND', _CONVERT_COMMAND.' -quality '._IMG_CONVERT_QUALITE.' -orient Undefined -resize %xx%y! %src %dest'); |
|
| 1377 | 1377 | } |
| 1378 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1378 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1379 | 1379 | $commande = str_replace( |
| 1380 | 1380 | ['%x', '%y', '%src', '%dest'], |
| 1381 | 1381 | [ |
@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | if (!@file_exists($vignette)) { |
| 1392 | 1392 | spip_log("echec convert sur $vignette"); |
| 1393 | 1393 | |
| 1394 | - return; // echec commande |
|
| 1394 | + return; // echec commande |
|
| 1395 | 1395 | } |
| 1396 | 1396 | } |
| 1397 | 1397 | |
@@ -1408,7 +1408,7 @@ discard block |
||
| 1408 | 1408 | if (!$output) { |
| 1409 | 1409 | return; |
| 1410 | 1410 | } |
| 1411 | - $vignette = $output . DIRECTORY_SEPARATOR . basename($destination) . '.' . $format_sortie; |
|
| 1411 | + $vignette = $output.DIRECTORY_SEPARATOR.basename($destination).'.'.$format_sortie; |
|
| 1412 | 1412 | |
| 1413 | 1413 | $imagick = new Imagick(); |
| 1414 | 1414 | $imagick->readImage(realpath($image)); |
@@ -1417,7 +1417,7 @@ discard block |
||
| 1417 | 1417 | $destHeight, |
| 1418 | 1418 | Imagick::FILTER_LANCZOS, |
| 1419 | 1419 | 1 |
| 1420 | - );//, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100); |
|
| 1420 | + ); //, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100); |
|
| 1421 | 1421 | $imagick->writeImage($vignette); |
| 1422 | 1422 | |
| 1423 | 1423 | if (!@file_exists($vignette)) { |
@@ -1426,7 +1426,7 @@ discard block |
||
| 1426 | 1426 | return; |
| 1427 | 1427 | } |
| 1428 | 1428 | // remettre le chemin relatif car c'est ce qu'attend SPIP pour la suite (en particlier action/tester) |
| 1429 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1429 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1430 | 1430 | } |
| 1431 | 1431 | |
| 1432 | 1432 | // netpbm |
@@ -1437,11 +1437,11 @@ discard block |
||
| 1437 | 1437 | if (_PNMSCALE_COMMAND == '') { |
| 1438 | 1438 | return; |
| 1439 | 1439 | } |
| 1440 | - $vignette = $destination . '.' . $format_sortie; |
|
| 1440 | + $vignette = $destination.'.'.$format_sortie; |
|
| 1441 | 1441 | $pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', (string) _PNMSCALE_COMMAND); |
| 1442 | 1442 | if ($format == 'jpg') { |
| 1443 | 1443 | $jpegtopnm_command = str_replace('pnmscale', 'jpegtopnm', (string) _PNMSCALE_COMMAND); |
| 1444 | - exec("$jpegtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1444 | + exec("$jpegtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1445 | 1445 | if (!($s = @filesize($vignette))) { |
| 1446 | 1446 | spip_unlink($vignette); |
| 1447 | 1447 | } |
@@ -1453,7 +1453,7 @@ discard block |
||
| 1453 | 1453 | } else { |
| 1454 | 1454 | if ($format == 'gif') { |
| 1455 | 1455 | $giftopnm_command = str_replace('pnmscale', 'giftopnm', (string) _PNMSCALE_COMMAND); |
| 1456 | - exec("$giftopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1456 | + exec("$giftopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1457 | 1457 | if (!($s = @filesize($vignette))) { |
| 1458 | 1458 | spip_unlink($vignette); |
| 1459 | 1459 | } |
@@ -1465,7 +1465,7 @@ discard block |
||
| 1465 | 1465 | } else { |
| 1466 | 1466 | if ($format == 'png') { |
| 1467 | 1467 | $pngtopnm_command = str_replace('pnmscale', 'pngtopnm', (string) _PNMSCALE_COMMAND); |
| 1468 | - exec("$pngtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1468 | + exec("$pngtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1469 | 1469 | if (!($s = @filesize($vignette))) { |
| 1470 | 1470 | spip_unlink($vignette); |
| 1471 | 1471 | } |
@@ -1487,7 +1487,7 @@ discard block |
||
| 1487 | 1487 | return; |
| 1488 | 1488 | } |
| 1489 | 1489 | if (_IMG_GD_MAX_PIXELS && $srcWidth * $srcHeight > _IMG_GD_MAX_PIXELS) { |
| 1490 | - spip_log('vignette gd2 impossible : ' . $srcWidth * $srcHeight . 'pixels'); |
|
| 1490 | + spip_log('vignette gd2 impossible : '.$srcWidth * $srcHeight.'pixels'); |
|
| 1491 | 1491 | |
| 1492 | 1492 | return; |
| 1493 | 1493 | } |
@@ -1790,7 +1790,7 @@ discard block |
||
| 1790 | 1790 | // de l'image, de facon a tromper le cache du navigateur |
| 1791 | 1791 | // quand on fait supprimer/reuploader un logo |
| 1792 | 1792 | // (pas de filemtime si SAFE MODE) |
| 1793 | - $date = test_espace_prive() ? ('?' . $date) : ''; |
|
| 1793 | + $date = test_espace_prive() ? ('?'.$date) : ''; |
|
| 1794 | 1794 | |
| 1795 | 1795 | return _image_ecrire_tag($image, ['src' => "$logo$date", 'width' => $destWidth, 'height' => $destHeight]); |
| 1796 | 1796 | } |
@@ -1868,9 +1868,9 @@ discard block |
||
| 1868 | 1868 | $b = $argb['blue']; |
| 1869 | 1869 | |
| 1870 | 1870 | if ($bpp[$key] == 32) { |
| 1871 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r) . chr($a); |
|
| 1871 | + $icXOR[$key] .= chr($b).chr($g).chr($r).chr($a); |
|
| 1872 | 1872 | } elseif ($bpp[$key] === 24) { |
| 1873 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r); |
|
| 1873 | + $icXOR[$key] .= chr($b).chr($g).chr($r); |
|
| 1874 | 1874 | } |
| 1875 | 1875 | |
| 1876 | 1876 | if ($a < 128) { |
@@ -1897,48 +1897,48 @@ discard block |
||
| 1897 | 1897 | |
| 1898 | 1898 | // BITMAPINFOHEADER - 40 bytes |
| 1899 | 1899 | $BitmapInfoHeader[$key] = ''; |
| 1900 | - $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
| 1901 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
| 1900 | + $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
| 1901 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
| 1902 | 1902 | // The biHeight member specifies the combined |
| 1903 | 1903 | // height of the XOR and AND masks. |
| 1904 | 1904 | $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4); // LONG biHeight; |
| 1905 | - $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
| 1906 | - $BitmapInfoHeader[$key] .= chr($bpp[$key]) . "\x00"; // wBitCount; |
|
| 1907 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
| 1908 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
| 1909 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
| 1910 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
| 1911 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
| 1912 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
| 1905 | + $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
| 1906 | + $BitmapInfoHeader[$key] .= chr($bpp[$key])."\x00"; // wBitCount; |
|
| 1907 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
| 1908 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
| 1909 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
| 1910 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
| 1911 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
| 1912 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
| 1913 | 1913 | } |
| 1914 | 1914 | |
| 1915 | 1915 | |
| 1916 | - $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
| 1917 | - $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
| 1918 | - $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
| 1916 | + $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
| 1917 | + $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
| 1918 | + $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
| 1919 | 1919 | |
| 1920 | 1920 | $dwImageOffset = 6 + (count($gd_image_array) * 16); |
| 1921 | 1921 | foreach (array_keys($gd_image_array) as $key) { |
| 1922 | 1922 | // ICONDIRENTRY idEntries[1]; // An entry for each image (idCount of 'em) |
| 1923 | 1923 | |
| 1924 | - $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
| 1925 | - $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
| 1926 | - $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
| 1927 | - $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
| 1924 | + $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
| 1925 | + $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
| 1926 | + $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
| 1927 | + $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
| 1928 | 1928 | |
| 1929 | - $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
| 1930 | - $icondata .= chr($bpp[$key]) . "\x00"; // wBitCount; // Bits per pixel |
|
| 1929 | + $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
| 1930 | + $icondata .= chr($bpp[$key])."\x00"; // wBitCount; // Bits per pixel |
|
| 1931 | 1931 | |
| 1932 | 1932 | $dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]); |
| 1933 | 1933 | $icondata .= phpthumb_functions::LittleEndian2String( |
| 1934 | 1934 | $dwBytesInRes, |
| 1935 | 1935 | 4 |
| 1936 | - ); // dwBytesInRes; // How many bytes in this resource? |
|
| 1936 | + ); // dwBytesInRes; // How many bytes in this resource? |
|
| 1937 | 1937 | |
| 1938 | 1938 | $icondata .= phpthumb_functions::LittleEndian2String( |
| 1939 | 1939 | $dwImageOffset, |
| 1940 | 1940 | 4 |
| 1941 | - ); // dwImageOffset; // Where in the file is this image? |
|
| 1941 | + ); // dwImageOffset; // Where in the file is this image? |
|
| 1942 | 1942 | $dwImageOffset += strlen($BitmapInfoHeader[$key]); |
| 1943 | 1943 | $dwImageOffset += strlen($icXOR[$key]); |
| 1944 | 1944 | $dwImageOffset += strlen($icAND[$key]); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | if ($res) { |
| 55 | 55 | return $res; |
| 56 | 56 | } |
| 57 | - spip_log("meta: $script " . print_r($_POST, true)); |
|
| 57 | + spip_log("meta: $script ".print_r($_POST, true)); |
|
| 58 | 58 | ecrire_meta($script, serialize($_POST)); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | // on pourrait statuer automatiquement les webmestres a l'init d'une action auth par ftp ... ? |
| 126 | 126 | |
| 127 | - spip_log("admin $pref" . ($valeur ? ' (reprise)' : ' (init)'), $journal); |
|
| 127 | + spip_log("admin $pref".($valeur ? ' (reprise)' : ' (init)'), $journal); |
|
| 128 | 128 | |
| 129 | 129 | return ''; |
| 130 | 130 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | if (autoriser('configurer')) { |
| 143 | 143 | return _DIR_TMP; |
| 144 | 144 | } else { |
| 145 | - return _DIR_TRANSFERT . $GLOBALS['visiteur_session']['login'] . '/'; |
|
| 145 | + return _DIR_TRANSFERT.$GLOBALS['visiteur_session']['login'].'/'; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | * Nom du fichier |
| 161 | 161 | **/ |
| 162 | 162 | function fichier_admin($action, $pref = 'admin_') { |
| 163 | - return $pref . |
|
| 164 | - substr(md5($action . (time() & ~2047) . $GLOBALS['visiteur_session']['login']), 0, 10); |
|
| 163 | + return $pref. |
|
| 164 | + substr(md5($action.(time() & ~2047).$GLOBALS['visiteur_session']['login']), 0, 10); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } else { |
| 198 | 198 | $dir = dir_admin(); |
| 199 | 199 | $signal = fichier_admin($script); |
| 200 | - if (@file_exists($dir . $signal)) { |
|
| 200 | + if (@file_exists($dir.$signal)) { |
|
| 201 | 201 | spip_log("Action admin: $action"); |
| 202 | 202 | |
| 203 | 203 | return ''; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | return ''; |
| 217 | 217 | } |
| 218 | - $corps .= '<input type="hidden" name="validation_admin" value="' . $signal . '" />'; |
|
| 218 | + $corps .= '<input type="hidden" name="validation_admin" value="'.$signal.'" />'; |
|
| 219 | 219 | $suivant = _T('bouton_valider'); |
| 220 | 220 | $js = ''; |
| 221 | 221 | } else { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | . "</legend>\n<label for='fichier'>" |
| 231 | 231 | . _T('info_creer_repertoire') |
| 232 | 232 | . "</label>\n" |
| 233 | - . "<span id='signal' class='formo'>" . $signal . '</span>' |
|
| 233 | + . "<span id='signal' class='formo'>".$signal.'</span>' |
|
| 234 | 234 | . "<input type='hidden' id='fichier' name='fichier' value='" |
| 235 | 235 | . $signal |
| 236 | 236 | . "' />" |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * Nom de l'action (en base) qui a été exécutée |
| 268 | 268 | **/ |
| 269 | 269 | function fin_admin($action) { |
| 270 | - $signal = dir_admin() . fichier_admin($action); |
|
| 270 | + $signal = dir_admin().fichier_admin($action); |
|
| 271 | 271 | spip_unlink($signal); |
| 272 | 272 | if ($action != 'delete_all') { |
| 273 | 273 | effacer_meta($action); |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | include_spip('inc/filtres'); |
| 296 | 296 | foreach ([...$_POST, ...$_GET] as $n => $c) { |
| 297 | 297 | if (!in_array($n, ['fichier', 'exec', 'validation_admin']) && !is_array($c)) { |
| 298 | - $suite .= "\n<input type='hidden' name='" . spip_htmlspecialchars($n) . "' value='" . |
|
| 299 | - entites_html($c) . |
|
| 298 | + $suite .= "\n<input type='hidden' name='".spip_htmlspecialchars($n)."' value='". |
|
| 299 | + entites_html($c). |
|
| 300 | 300 | "' />"; |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $res['message_ok'] = _T('info_modification_enregistree'); |
| 100 | 100 | if ($retour) { |
| 101 | 101 | if (str_starts_with($retour, 'javascript:')) { |
| 102 | - $res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>'; |
|
| 102 | + $res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/'.substr($retour, 11).'/*]]>*/</script>'; |
|
| 103 | 103 | $res['editable'] = true; |
| 104 | 104 | } else { |
| 105 | 105 | $res['redirect'] = parametre_url($retour, $id_table_objet, $id); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | if (!isset($erreurs[$champ])) { |
| 140 | 140 | $erreurs[$champ] = ''; |
| 141 | 141 | } |
| 142 | - $erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>'; |
|
| 142 | + $erreurs[$champ] .= _T('alerte_modif_info_concourante')."<br /><textarea readonly='readonly' class='forml'>".entites_html($conflit['base']).'</textarea>'; |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | if ( |
| 220 | 220 | $config_fonc |
| 221 | 221 | && !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config']) |
| 222 | - && $config_fonc !== $table_objet . '_edit_config' |
|
| 222 | + && $config_fonc !== $table_objet.'_edit_config' |
|
| 223 | 223 | && ($args = test_formulaire_inclus_par_modele()) |
| 224 | 224 | && in_array($config_fonc, $args) |
| 225 | 225 | ) { |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | // Appel direct dans un squelette |
| 232 | 232 | if (!$row) { |
| 233 | 233 | if (!$new || $lier_trad) { |
| 234 | - if ($select = charger_fonction('precharger_' . $type, 'inc', true)) { |
|
| 234 | + if ($select = charger_fonction('precharger_'.$type, 'inc', true)) { |
|
| 235 | 235 | $row = $select($id, $id_parent, $lier_trad); |
| 236 | 236 | // si on a une fonction precharger, elle pu faire un reglage de langue |
| 237 | 237 | $lang_default = (empty($row['lang']) ? null : $row['lang']); |
| 238 | 238 | } else { |
| 239 | - $row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . (int) $id); |
|
| 239 | + $row = sql_fetsel('*', $table_objet_sql, $id_table_objet.'='.(int) $id); |
|
| 240 | 240 | } |
| 241 | 241 | if (!$new) { |
| 242 | 242 | $md5 = controles_md5($row ?: []); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | if ($config_fonc) { |
| 287 | 287 | $contexte['config'] = $config = $config_fonc($contexte); |
| 288 | 288 | if (!$lang_default) { |
| 289 | - $lang_default = $config['langue'] ?? session_get('lang') ; |
|
| 289 | + $lang_default = $config['langue'] ?? session_get('lang'); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | $config += [ |
@@ -310,13 +310,13 @@ discard block |
||
| 310 | 310 | unset($contexte['lang']); |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - $contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" . |
|
| 313 | + $contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n". |
|
| 314 | 314 | ($lier_trad |
| 315 | - ? "\n<input type='hidden' name='lier_trad' value='" . |
|
| 316 | - $lier_trad . |
|
| 317 | - "' />" . |
|
| 318 | - "\n<input type='hidden' name='changer_lang' value='" . |
|
| 319 | - $lang_default . |
|
| 315 | + ? "\n<input type='hidden' name='lier_trad' value='". |
|
| 316 | + $lier_trad. |
|
| 317 | + "' />". |
|
| 318 | + "\n<input type='hidden' name='changer_lang' value='". |
|
| 319 | + $lang_default. |
|
| 320 | 320 | "' />" |
| 321 | 321 | : '') |
| 322 | 322 | . $hidden |
@@ -357,14 +357,14 @@ discard block |
||
| 357 | 357 | $aider = charger_fonction('aider', 'inc'); |
| 358 | 358 | if (strlen($texte) > 28 * 1024) { |
| 359 | 359 | $texte = str_replace("\r\n", "\n", $texte); |
| 360 | - $pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko |
|
| 360 | + $pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko |
|
| 361 | 361 | if ($pos > 0 && $pos < 32 * 1024) { |
| 362 | - $debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n"; |
|
| 362 | + $debut = substr($texte, 0, $pos)."\n\n<!--SPIP-->\n"; |
|
| 363 | 363 | $suite = substr($texte, $pos + 2); |
| 364 | 364 | } else { |
| 365 | - $pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace |
|
| 365 | + $pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace |
|
| 366 | 366 | if (!($pos > 0 && $pos < 32 * 1024)) { |
| 367 | - $pos = 28 * 1024; // au pire (pas d'espace trouv'e) |
|
| 367 | + $pos = 28 * 1024; // au pire (pas d'espace trouv'e) |
|
| 368 | 368 | $decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere |
| 369 | 369 | } else { |
| 370 | 370 | $decalage = 1; |
@@ -395,13 +395,13 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | include_spip('inc/barre'); |
| 398 | - $textes_supplement = "<br /><span style='color: red'>" . _T('info_texte_long') . "</span>\n"; |
|
| 398 | + $textes_supplement = "<br /><span style='color: red'>"._T('info_texte_long')."</span>\n"; |
|
| 399 | 399 | $nombre = 0; |
| 400 | 400 | |
| 401 | 401 | while (strlen((string) $texte) > 29 * 1024) { |
| 402 | 402 | $nombre++; |
| 403 | 403 | [$texte1, $texte] = coupe_trop_long($texte); |
| 404 | - $textes_supplement .= '<br />' . |
|
| 404 | + $textes_supplement .= '<br />'. |
|
| 405 | 405 | "<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n"; |
| 406 | 406 | } |
| 407 | 407 | |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | $ctr = []; |
| 481 | 481 | foreach ($data as $key => $val) { |
| 482 | 482 | $m = md5($val ?? ''); |
| 483 | - $k = $prefixe . $key; |
|
| 483 | + $k = $prefixe.$key; |
|
| 484 | 484 | |
| 485 | 485 | $ctr[$k] = match ($format) { |
| 486 | 486 | 'html' => "<input type='hidden' value='$m' name='$k' />", |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | if ($format === 'html') { |
| 492 | - return "\n\n<!-- controles md5 -->\n" . implode("\n", $ctr) . "\n\n"; |
|
| 492 | + return "\n\n<!-- controles md5 -->\n".implode("\n", $ctr)."\n\n"; |
|
| 493 | 493 | } else { |
| 494 | 494 | return $ctr; |
| 495 | 495 | } |
@@ -642,8 +642,8 @@ discard block |
||
| 642 | 642 | // potentiellement modifiees entre temps par un autre utilisateur) |
| 643 | 643 | foreach ($champs as $key => $val) { |
| 644 | 644 | if ( |
| 645 | - isset($ctr[$prefix . $key]) |
|
| 646 | - && ($m = $ctr[$prefix . $key]) |
|
| 645 | + isset($ctr[$prefix.$key]) |
|
| 646 | + && ($m = $ctr[$prefix.$key]) |
|
| 647 | 647 | && (is_scalar($val) && $m == md5($val)) |
| 648 | 648 | ) { |
| 649 | 649 | unset($champs[$key]); |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | // de conflit. |
| 673 | 673 | $ctrh = $ctrq = $conflits = []; |
| 674 | 674 | foreach (array_keys($champs) as $key) { |
| 675 | - if (isset($ctr[$prefix . $key]) && ($m = $ctr[$prefix . $key])) { |
|
| 675 | + if (isset($ctr[$prefix.$key]) && ($m = $ctr[$prefix.$key])) { |
|
| 676 | 676 | $ctrh[$key] = $m; |
| 677 | 677 | $ctrq[] = $key; |
| 678 | 678 | } |
@@ -706,8 +706,8 @@ discard block |
||
| 706 | 706 | */ |
| 707 | 707 | function display_conflit_champ($x) { |
| 708 | 708 | if (strstr($x, "\n") || strlen($x) > 80) { |
| 709 | - return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n"; |
|
| 709 | + return "<textarea style='width:99%; height:10em;'>".entites_html($x)."</textarea>\n"; |
|
| 710 | 710 | } else { |
| 711 | - return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n"; |
|
| 711 | + return "<input type='text' size='40' style='width:99%' value=\"".entites_html($x)."\" />\n"; |
|
| 712 | 712 | } |
| 713 | 713 | } |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | if ($query) { |
| 47 | - $url .= '?' . $query; |
|
| 47 | + $url .= '?'.$query; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - return '/' . preg_replace(',^/,S', '', (string) $url); |
|
| 50 | + return '/'.preg_replace(',^/,S', '', (string) $url); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | if (preg_match(';^((?:[a-z]{3,33}:)?//.*?)(/.*)?$;iS', $lien, $r)) { |
| 78 | 78 | $r = array_pad($r, 3, ''); |
| 79 | 79 | |
| 80 | - return $r[1] . resolve_path($r[2]); |
|
| 80 | + return $r[1].resolve_path($r[2]); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | # L'url site spip est un lien absolu aussi |
@@ -97,10 +97,10 @@ discard block |
||
| 97 | 97 | $hash = $regs[5] ?? ''; |
| 98 | 98 | } |
| 99 | 99 | return match (substr($lien, 0, 1)) { |
| 100 | - '/' => $debut . resolve_path($lien), |
|
| 101 | - '#' => $debut . resolve_path($dir . $mot . $get . $lien), |
|
| 102 | - '' => $debut . resolve_path($dir . $mot . $get . $hash), |
|
| 103 | - default => $debut . resolve_path($dir . $lien), |
|
| 100 | + '/' => $debut.resolve_path($lien), |
|
| 101 | + '#' => $debut.resolve_path($dir.$mot.$get.$lien), |
|
| 102 | + '' => $debut.resolve_path($dir.$mot.$get.$hash), |
|
| 103 | + default => $debut.resolve_path($dir.$lien), |
|
| 104 | 104 | }; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | return ''; |
| 130 | 130 | } |
| 131 | 131 | if (!$base) { |
| 132 | - $base = url_de_base() . (_DIR_RACINE ? _DIR_RESTREINT_ABS : ''); |
|
| 132 | + $base = url_de_base().(_DIR_RACINE ? _DIR_RESTREINT_ABS : ''); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | return suivre_lien($base, $url); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @param array $protocoles_autorises |
| 153 | 153 | * @return bool |
| 154 | 154 | */ |
| 155 | -function protocole_verifier($url_absolue, $protocoles_autorises = ['http','https']) { |
|
| 155 | +function protocole_verifier($url_absolue, $protocoles_autorises = ['http', 'https']) { |
|
| 156 | 156 | |
| 157 | 157 | if (preg_match(';^([a-z]{3,7})://;i', $url_absolue, $m)) { |
| 158 | 158 | $protocole = $m[1]; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | function surligner_mots($page, $surcharge_surligne = '') { |
| 37 | 37 | $surlignejs_engines = [ |
| 38 | 38 | [ |
| 39 | - ',' . str_replace(['/', '.'], ['\/', '\.'], (string) $GLOBALS['meta']['adresse_site']) . ',i', |
|
| 39 | + ','.str_replace(['/', '.'], ['\/', '\.'], (string) $GLOBALS['meta']['adresse_site']).',i', |
|
| 40 | 40 | ',recherche=([^&]+),i' |
| 41 | 41 | ], //SPIP |
| 42 | 42 | [',^http://(www\.)?google\.,i', ',q=([^&]+),i'], // Google |
@@ -71,19 +71,19 @@ discard block |
||
| 71 | 71 | //good referrer found or var_recherche is not null |
| 72 | 72 | include_spip('inc/filtres'); |
| 73 | 73 | $script = " |
| 74 | - <script type='text/javascript' src='" . url_absolue(find_in_path('javascript/SearchHighlight.js')) . "'></script> |
|
| 74 | + <script type='text/javascript' src='" . url_absolue(find_in_path('javascript/SearchHighlight.js'))."'></script> |
|
| 75 | 75 | <script type='text/javascript'> |
| 76 | 76 | var highlighter = function() { |
| 77 | 77 | jQuery(this).SearchHighlight({ |
| 78 | - tag_name:'" . (html5_permis() ? 'mark' : 'span') . "', |
|
| 78 | + tag_name:'" . (html5_permis() ? 'mark' : 'span')."', |
|
| 79 | 79 | style_name:'spip_surligne', |
| 80 | 80 | exact:'whole', |
| 81 | 81 | style_name_suffix:false, |
| 82 | - engines:[/^" . str_replace(['/', '.'], ['\/', '\.'], (string) $GLOBALS['meta']['adresse_site']) . "/i,/recherche=([^&]+)/i], |
|
| 82 | + engines:[/^" . str_replace(['/', '.'], ['\/', '\.'], (string) $GLOBALS['meta']['adresse_site'])."/i,/recherche=([^&]+)/i], |
|
| 83 | 83 | highlight:'.surlignable', |
| 84 | 84 | nohighlight:'.pas_surlignable'" . |
| 85 | 85 | ($surcharge_surligne ? ", |
| 86 | - keys:'$surcharge_surligne'" : '') . ', |
|
| 86 | + keys:'$surcharge_surligne'" : '').', |
|
| 87 | 87 | min_length: 3 |
| 88 | 88 | }); |
| 89 | 89 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | // si l'objet existe deja, on retourne simplement ses valeurs |
| 52 | 52 | if (is_numeric($id_objet)) { |
| 53 | - return sql_fetsel('*', $table, "$_id_objet=" . (int) $id_objet); |
|
| 53 | + return sql_fetsel('*', $table, "$_id_objet=".(int) $id_objet); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // ici, on demande une creation. |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | // si demande de traduction |
| 65 | 65 | // on recupere les valeurs de la traduction |
| 66 | 66 | if ($lier_trad) { |
| 67 | - if ($select = charger_fonction('precharger_traduction_' . $type, 'inc', true)) { |
|
| 67 | + if ($select = charger_fonction('precharger_traduction_'.$type, 'inc', true)) { |
|
| 68 | 68 | $row = $select($id_objet, $id_rubrique, $lier_trad); |
| 69 | 69 | } else { |
| 70 | 70 | $row = precharger_traduction_objet($type, $id_objet, $id_rubrique, $lier_trad, $champ_titre); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // recuperer le secteur, pour affecter les bons champs extras |
| 101 | 101 | if ($id_rubrique && $is_secteur && !$row['id_secteur']) { |
| 102 | - $row_rub = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . sql_quote($id_rubrique)); |
|
| 102 | + $row_rub = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.sql_quote($id_rubrique)); |
|
| 103 | 103 | $row['id_secteur'] = $row_rub; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | $_id_objet = id_table_objet($table); |
| 130 | 130 | |
| 131 | 131 | // Recuperer les donnees de l'objet original |
| 132 | - $row = sql_fetsel('*', $table, "$_id_objet=" . (int) $lier_trad); |
|
| 132 | + $row = sql_fetsel('*', $table, "$_id_objet=".(int) $lier_trad); |
|
| 133 | 133 | if ($row) { |
| 134 | 134 | include_spip('inc/filtres'); |
| 135 | - $row[$champ_titre] = filtrer_entites(objet_T($type, 'info_nouvelle_traduction')) . ' ' . $row[$champ_titre]; |
|
| 135 | + $row[$champ_titre] = filtrer_entites(objet_T($type, 'info_nouvelle_traduction')).' '.$row[$champ_titre]; |
|
| 136 | 136 | } else { |
| 137 | 137 | $row = []; |
| 138 | 138 | } |
@@ -182,14 +182,14 @@ discard block |
||
| 182 | 182 | $id_parent = 0; |
| 183 | 183 | } else { |
| 184 | 184 | // on cherche une rubrique soeur dans la bonne langue |
| 185 | - $row_rub = sql_fetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . (int) $id_rubrique); |
|
| 185 | + $row_rub = sql_fetsel('id_parent', 'spip_rubriques', 'id_rubrique='.(int) $id_rubrique); |
|
| 186 | 186 | $id_parent = $row_rub['id_parent']; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $row_rub = sql_fetsel( |
| 190 | 190 | 'id_rubrique', |
| 191 | 191 | 'spip_rubriques', |
| 192 | - "lang='" . $GLOBALS['spip_lang'] . "' AND id_parent=" . (int) $id_parent |
|
| 192 | + "lang='".$GLOBALS['spip_lang']."' AND id_parent=".(int) $id_parent |
|
| 193 | 193 | ); |
| 194 | 194 | if ($row_rub) { |
| 195 | 195 | $row['id_rubrique'] = $row_rub['id_rubrique']; |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | $p !== false |
| 137 | 137 | && ($morceau = substr($txt, $d, $p - $d)) |
| 138 | 138 | && ($nopen += preg_match_all( |
| 139 | - '{<' . preg_quote((string) $closing_tag) . '(\s*>|\s[^>]*[^/>]>)}is', |
|
| 139 | + '{<'.preg_quote((string) $closing_tag).'(\s*>|\s[^>]*[^/>]>)}is', |
|
| 140 | 140 | $morceau, |
| 141 | 141 | $matches, |
| 142 | 142 | PREG_SET_ORDER |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | define('_INC_DISTANT_CONTENT_ENCODING', 'gzip'); |
| 28 | 28 | } |
| 29 | 29 | if (!defined('_INC_DISTANT_USER_AGENT')) { |
| 30 | - define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')'); |
|
| 30 | + define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')'); |
|
| 31 | 31 | } |
| 32 | 32 | if (!defined('_INC_DISTANT_MAX_SIZE')) { |
| 33 | 33 | define('_INC_DISTANT_MAX_SIZE', 2_097_152); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | define('_INC_DISTANT_CONNECT_TIMEOUT', 10); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | -define('_REGEXP_COPIE_LOCALE', ',' . |
|
| 39 | +define('_REGEXP_COPIE_LOCALE', ','. |
|
| 40 | 40 | preg_replace( |
| 41 | 41 | '@^https?:@', |
| 42 | 42 | 'https?:', |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // si c'est la protection de soi-meme, retourner le path |
| 75 | 75 | if ($mode !== 'force' && preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) { |
| 76 | - $source = substr((string) _DIR_IMG, strlen((string) _DIR_RACINE)) . urldecode($match[1]); |
|
| 76 | + $source = substr((string) _DIR_IMG, strlen((string) _DIR_RACINE)).urldecode($match[1]); |
|
| 77 | 77 | |
| 78 | 78 | return @file_exists($source) ? $source : false; |
| 79 | 79 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return false; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $localrac = _DIR_RACINE . $local; |
|
| 96 | + $localrac = _DIR_RACINE.$local; |
|
| 97 | 97 | $t = ($mode === 'force') ? false : @file_exists($localrac); |
| 98 | 98 | |
| 99 | 99 | // test d'existence du fichier |
@@ -113,18 +113,18 @@ discard block |
||
| 113 | 113 | if (!$taille_max) { |
| 114 | 114 | $taille_max = _COPIE_LOCALE_MAX_SIZE; |
| 115 | 115 | } |
| 116 | - $localrac_tmp = $localrac . '.tmp'; |
|
| 116 | + $localrac_tmp = $localrac.'.tmp'; |
|
| 117 | 117 | $res = recuperer_url( |
| 118 | 118 | $source, |
| 119 | 119 | ['file' => $localrac_tmp, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : ''] |
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | 122 | if (!$res || !$res['length'] && $res['status'] != 304) { |
| 123 | - spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : " . ($res ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 123 | + spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE); |
|
| 124 | 124 | @unlink($localrac_tmp); |
| 125 | 125 | } |
| 126 | 126 | else { |
| 127 | - spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant'); |
|
| 127 | + spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille ".$res['length'].' status '.$res['status'], 'distant'); |
|
| 128 | 128 | } |
| 129 | 129 | if (!$res || !$res['length']) { |
| 130 | 130 | // si $t c'est sans doute juste un not-modified-since |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | && is_callable($callback_valider_url) |
| 138 | 138 | && !$callback_valider_url($res['url']) |
| 139 | 139 | ) { |
| 140 | - spip_log('copie_locale : url finale ' . $res['url'] . " non valide, on refuse le fichier $localrac_tmp", 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 140 | + spip_log('copie_locale : url finale '.$res['url']." non valide, on refuse le fichier $localrac_tmp", 'distant'._LOG_INFO_IMPORTANTE); |
|
| 141 | 141 | @unlink($localrac_tmp); |
| 142 | 142 | return $t ? $local : false; |
| 143 | 143 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | if (!$is_known_host) { |
| 229 | 229 | $host = trim($parsed_url['host'], '.'); |
| 230 | - if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 230 | + if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 231 | 231 | $ip = gethostbyname($host); |
| 232 | 232 | if ($ip === $host) { |
| 233 | 233 | // Error condition for gethostbyname() |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $ip = false; |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | - if ($ip && ! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 250 | + if ($ip && !filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 251 | 251 | return false; |
| 252 | 252 | } |
| 253 | 253 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | if ($taille > 500) { |
| 331 | - $boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8); |
|
| 331 | + $boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8); |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
@@ -361,10 +361,10 @@ discard block |
||
| 361 | 361 | foreach ($donnees as $cle => $valeur) { |
| 362 | 362 | if (is_array($valeur)) { |
| 363 | 363 | foreach ($valeur as $val2) { |
| 364 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode((string) $val2); |
|
| 364 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode((string) $val2); |
|
| 365 | 365 | } |
| 366 | 366 | } else { |
| 367 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode((string) $valeur); |
|
| 367 | + $chaine[] = rawurlencode($cle).'='.rawurlencode((string) $valeur); |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | $chaine = implode('&', $chaine); |
@@ -465,13 +465,13 @@ discard block |
||
| 465 | 465 | $options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE; |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - spip_log('recuperer_url ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG); |
|
| 468 | + spip_log('recuperer_url '.$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 469 | 469 | |
| 470 | 470 | // Ajout des en-têtes spécifiques si besoin |
| 471 | 471 | $formatted_data = ''; |
| 472 | 472 | if (!empty($options['headers'])) { |
| 473 | 473 | foreach ($options['headers'] as $champ => $valeur) { |
| 474 | - $formatted_data .= $champ . ': ' . $valeur . "\r\n"; |
|
| 474 | + $formatted_data .= $champ.': '.$valeur."\r\n"; |
|
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
@@ -479,9 +479,9 @@ discard block |
||
| 479 | 479 | [$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']); |
| 480 | 480 | $head .= $formatted_data; |
| 481 | 481 | if (stripos($head, 'Content-Length:') === false) { |
| 482 | - $head .= 'Content-Length: ' . strlen((string) $postdata) . "\r\n"; |
|
| 482 | + $head .= 'Content-Length: '.strlen((string) $postdata)."\r\n"; |
|
| 483 | 483 | } |
| 484 | - $formatted_data = $head . "\r\n" . $postdata; |
|
| 484 | + $formatted_data = $head."\r\n".$postdata; |
|
| 485 | 485 | if ( |
| 486 | 486 | strlen((string) $postdata) && !$methode_demandee |
| 487 | 487 | ) { |
@@ -494,9 +494,9 @@ discard block |
||
| 494 | 494 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 495 | 495 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 496 | 496 | if (!tester_url_absolue($url)) { |
| 497 | - $url = 'http://' . $url; |
|
| 497 | + $url = 'http://'.$url; |
|
| 498 | 498 | } elseif (str_starts_with($url, '//')) { |
| 499 | - $url = 'http:' . $url; |
|
| 499 | + $url = 'http:'.$url; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | $url = url_to_ascii($url); |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | $options['if_modified_since'] |
| 526 | 526 | ); |
| 527 | 527 | if (!$handle) { |
| 528 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 528 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 529 | 529 | |
| 530 | 530 | return false; |
| 531 | 531 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | 'status' => 200, |
| 556 | 556 | ]; |
| 557 | 557 | } else { |
| 558 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 558 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 559 | 559 | return false; |
| 560 | 560 | } |
| 561 | 561 | } elseif ($res['location'] && $options['follow_location']) { |
@@ -572,11 +572,11 @@ discard block |
||
| 572 | 572 | $options['methode'] = 'GET'; |
| 573 | 573 | $options['datas'] = ''; |
| 574 | 574 | } |
| 575 | - spip_log('recuperer_url recommence ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG); |
|
| 575 | + spip_log('recuperer_url recommence '.$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 576 | 576 | |
| 577 | 577 | return recuperer_url($url, $options); |
| 578 | 578 | } elseif ($res['status'] !== 200) { |
| 579 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 579 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 580 | 580 | } |
| 581 | 581 | $result['status'] = $res['status']; |
| 582 | 582 | if (isset($res['headers'])) { |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | // on ne veut que les entetes |
| 594 | 594 | if (!$options['taille_max'] || $options['methode'] == 'HEAD' || $result['status'] == '304') { |
| 595 | - spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($result, JSON_THROW_ON_ERROR), 'distant' . _LOG_DEBUG); |
|
| 595 | + spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($result, JSON_THROW_ON_ERROR), 'distant'._LOG_DEBUG); |
|
| 596 | 596 | return $result; |
| 597 | 597 | } |
| 598 | 598 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | $gz = false; |
| 604 | 604 | if (preg_match(",\bContent-Encoding: .*gzip,is", (string) $result['headers'])) { |
| 605 | - $gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz'); |
|
| 605 | + $gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz'); |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | |
| 639 | 639 | $trace = json_decode(json_encode($result, JSON_THROW_ON_ERROR), true, 512, JSON_THROW_ON_ERROR); |
| 640 | 640 | $trace['page'] = '...'; |
| 641 | - spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($trace, JSON_THROW_ON_ERROR), 'distant' . _LOG_DEBUG); |
|
| 641 | + spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($trace, JSON_THROW_ON_ERROR), 'distant'._LOG_DEBUG); |
|
| 642 | 642 | |
| 643 | 643 | return $result; |
| 644 | 644 | } |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | $sig['url'] = $url; |
| 693 | 693 | |
| 694 | 694 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 695 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 695 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 696 | 696 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 697 | 697 | $cache = "$sub$cache"; |
| 698 | 698 | |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | $fp = false; |
| 747 | 747 | if ($fichier) { |
| 748 | 748 | include_spip('inc/acces'); |
| 749 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 749 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 750 | 750 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 751 | 751 | if (!$fp && file_exists($fichier)) { |
| 752 | 752 | return filesize($fichier); |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | } |
| 806 | 806 | $result['status'] = (int) $r[1]; |
| 807 | 807 | while ($s = trim(fgets($handle, 16384))) { |
| 808 | - $result['headers'][] = $s . "\n"; |
|
| 808 | + $result['headers'][] = $s."\n"; |
|
| 809 | 809 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 810 | 810 | [, $d, $v] = $r; |
| 811 | 811 | if (strtolower(trim($d)) == 'location' && $result['status'] >= 300 && $result['status'] < 400) { |
@@ -854,13 +854,13 @@ discard block |
||
| 854 | 854 | |
| 855 | 855 | // on se place tout le temps comme si on etait a la racine |
| 856 | 856 | if (_DIR_RACINE) { |
| 857 | - $d = preg_replace(',^' . preg_quote((string) _DIR_RACINE, ',') . ',', '', (string) $d); |
|
| 857 | + $d = preg_replace(',^'.preg_quote((string) _DIR_RACINE, ',').',', '', (string) $d); |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | $m = md5($source); |
| 861 | 861 | |
| 862 | 862 | return $d |
| 863 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 863 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 864 | 864 | . substr($m, 0, 4) |
| 865 | 865 | . ".$extension"; |
| 866 | 866 | } |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | // Si c'est deja local pas de souci |
| 885 | 885 | if (!tester_url_absolue($source)) { |
| 886 | 886 | if (_DIR_RACINE) { |
| 887 | - $source = preg_replace(',^' . preg_quote((string) _DIR_RACINE, ',') . ',', '', $source); |
|
| 887 | + $source = preg_replace(',^'.preg_quote((string) _DIR_RACINE, ',').',', '', $source); |
|
| 888 | 888 | } |
| 889 | 889 | |
| 890 | 890 | return $source; |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | $ext |
| 903 | 903 | && preg_match(',^\w+$,', $ext) |
| 904 | 904 | && ($f = nom_fichier_copie_locale($source, $ext)) |
| 905 | - && file_exists(_DIR_RACINE . $f) |
|
| 905 | + && file_exists(_DIR_RACINE.$f) |
|
| 906 | 906 | ) { |
| 907 | 907 | return $f; |
| 908 | 908 | } |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | |
| 911 | 911 | // Si c'est deja dans la table des documents, |
| 912 | 912 | // ramener le nom de sa copie potentielle |
| 913 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 913 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 914 | 914 | |
| 915 | 915 | if ($ext) { |
| 916 | 916 | return nom_fichier_copie_locale($source, $ext); |
@@ -921,9 +921,9 @@ discard block |
||
| 921 | 921 | |
| 922 | 922 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 923 | 923 | |
| 924 | - if ($ext && sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 924 | + if ($ext && sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 925 | 925 | $f = nom_fichier_copie_locale($source, $ext); |
| 926 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 926 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 927 | 927 | return $f; |
| 928 | 928 | } |
| 929 | 929 | } |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | // Ping pour voir si son extension est connue et autorisee |
| 932 | 932 | // avec mise en cache du resultat du ping |
| 933 | 933 | |
| 934 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 934 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 935 | 935 | if ( |
| 936 | 936 | !@file_exists($cache) |
| 937 | 937 | || !($path_parts = @unserialize(spip_file_get_contents($cache))) |
@@ -941,11 +941,11 @@ discard block |
||
| 941 | 941 | ecrire_fichier($cache, serialize($path_parts)); |
| 942 | 942 | } |
| 943 | 943 | $ext = empty($path_parts['extension']) ? '' : $path_parts['extension']; |
| 944 | - if ($ext && sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 944 | + if ($ext && sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 945 | 945 | return nom_fichier_copie_locale($source, $ext); |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 948 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 949 | 949 | return null; |
| 950 | 950 | } |
| 951 | 951 | |
@@ -1044,7 +1044,7 @@ discard block |
||
| 1044 | 1044 | } else { |
| 1045 | 1045 | if ($a['body']) { |
| 1046 | 1046 | $a['extension'] = $extension; |
| 1047 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 1047 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 1048 | 1048 | ecrire_fichier($a['fichier'], $a['body']); |
| 1049 | 1049 | $size_image = @spip_getimagesize($a['fichier']); |
| 1050 | 1050 | $a['largeur'] = (int) $size_image[0]; |
@@ -1107,20 +1107,20 @@ discard block |
||
| 1107 | 1107 | $t = null; |
| 1108 | 1108 | if (in_array($mime_type, ['text/plain', '', 'application/octet-stream'])) { |
| 1109 | 1109 | if (!$t && preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)) { |
| 1110 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1110 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1111 | 1111 | } |
| 1112 | 1112 | if ( |
| 1113 | 1113 | !$t |
| 1114 | 1114 | && preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1115 | 1115 | && preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1116 | 1116 | ) { |
| 1117 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1117 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1118 | 1118 | } |
| 1119 | 1119 | } |
| 1120 | 1120 | |
| 1121 | 1121 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1122 | 1122 | if (!$t) { |
| 1123 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1123 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | 1126 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1131,11 +1131,11 @@ discard block |
||
| 1131 | 1131 | && preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1132 | 1132 | ) { |
| 1133 | 1133 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1134 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1134 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | if ($t) { |
| 1138 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 1138 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 1139 | 1139 | return $t['extension']; |
| 1140 | 1140 | } else { |
| 1141 | 1141 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1238,7 +1238,7 @@ discard block |
||
| 1238 | 1238 | } |
| 1239 | 1239 | } else { |
| 1240 | 1240 | $scheme = $t['scheme']; |
| 1241 | - $noproxy = $scheme . '://'; |
|
| 1241 | + $noproxy = $scheme.'://'; |
|
| 1242 | 1242 | } |
| 1243 | 1243 | if (isset($t['user'])) { |
| 1244 | 1244 | $user = [$t['user'], $t['pass']]; |
@@ -1252,7 +1252,7 @@ discard block |
||
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | 1254 | if (!empty($t['query'])) { |
| 1255 | - $path .= '?' . $t['query']; |
|
| 1255 | + $path .= '?'.$t['query']; |
|
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1326,29 +1326,29 @@ discard block |
||
| 1326 | 1326 | $proxy_user = ''; |
| 1327 | 1327 | $http_proxy = need_proxy($host); |
| 1328 | 1328 | if ($user) { |
| 1329 | - $user = urlencode((string) $user[0]) . ':' . urlencode((string) $user[1]); |
|
| 1329 | + $user = urlencode((string) $user[0]).':'.urlencode((string) $user[1]); |
|
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | 1332 | $connect = ''; |
| 1333 | 1333 | if ($http_proxy) { |
| 1334 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') && in_array($scheme, ['tls','ssl'])) { |
|
| 1335 | - $path_host = ($user ? "$user@" : '') . $host . (($port != 80) ? ":$port" : ''); |
|
| 1336 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1334 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') && in_array($scheme, ['tls', 'ssl'])) { |
|
| 1335 | + $path_host = ($user ? "$user@" : '').$host.(($port != 80) ? ":$port" : ''); |
|
| 1336 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1337 | 1337 | . "Host: $path_host\r\n" |
| 1338 | 1338 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1339 | 1339 | } else { |
| 1340 | - $path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://") |
|
| 1340 | + $path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://") |
|
| 1341 | 1341 | . ($user ? "$user@" : '') |
| 1342 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1342 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1343 | 1343 | } |
| 1344 | 1344 | $t2 = @parse_url($http_proxy); |
| 1345 | 1345 | $first_host = $t2['host']; |
| 1346 | 1346 | $first_port = ($t2['port'] ?? null) ?: 80; |
| 1347 | 1347 | if ($t2['user'] ?? null) { |
| 1348 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1348 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1349 | 1349 | } |
| 1350 | 1350 | } else { |
| 1351 | - $first_host = $noproxy . $host; |
|
| 1351 | + $first_host = $noproxy.$host; |
|
| 1352 | 1352 | $first_port = $port; |
| 1353 | 1353 | } |
| 1354 | 1354 | |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | ); |
| 1372 | 1372 | spip_log("Recuperer $path sur $first_host:$first_port par $f (via CONNECT)", 'connect'); |
| 1373 | 1373 | if (!$f) { |
| 1374 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1374 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1375 | 1375 | return $errno; |
| 1376 | 1376 | } |
| 1377 | 1377 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | || ($res = explode(' ', $res)) === [] |
| 1385 | 1385 | || $res[1] !== '200' |
| 1386 | 1386 | ) { |
| 1387 | - spip_log("Echec CONNECT sur $first_host:$first_port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1387 | + spip_log("Echec CONNECT sur $first_host:$first_port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1388 | 1388 | fclose($f); |
| 1389 | 1389 | |
| 1390 | 1390 | return false; |
@@ -1401,7 +1401,7 @@ discard block |
||
| 1401 | 1401 | } while (!$f && $ntry-- && $errno !== 110 && sleep(1)); |
| 1402 | 1402 | spip_log("Recuperer $path sur $first_host:$first_port par $f"); |
| 1403 | 1403 | if (!$f) { |
| 1404 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1404 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1405 | 1405 | |
| 1406 | 1406 | return $errno; |
| 1407 | 1407 | } |
@@ -1411,16 +1411,16 @@ discard block |
||
| 1411 | 1411 | $site = $GLOBALS['meta']['adresse_site'] ?? ''; |
| 1412 | 1412 | |
| 1413 | 1413 | $host_port = $host; |
| 1414 | - if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) { |
|
| 1414 | + if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) { |
|
| 1415 | 1415 | $host_port .= ":$port"; |
| 1416 | 1416 | } |
| 1417 | 1417 | $req = "$method $path $vers\r\n" |
| 1418 | 1418 | . "Host: $host_port\r\n" |
| 1419 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1420 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1419 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1420 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1421 | 1421 | . ($site ? "Referer: $site/$referer\r\n" : '') |
| 1422 | - . ($date ? 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n") : '') |
|
| 1423 | - . ($user ? 'Authorization: Basic ' . base64_encode($user) . "\r\n" : '') |
|
| 1422 | + . ($date ? 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n") : '') |
|
| 1423 | + . ($user ? 'Authorization: Basic '.base64_encode($user)."\r\n" : '') |
|
| 1424 | 1424 | . ($proxy_user ? "Proxy-Authorization: Basic $proxy_user\r\n" : '') |
| 1425 | 1425 | . (strpos($vers, '1.1') ? "Keep-Alive: 300\r\nConnection: keep-alive\r\n" : ''); |
| 1426 | 1426 | |