@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } else { |
| 44 | 44 | # Attention GD sait lire le gif mais pas forcement l'ecrire |
| 45 | 45 | if (function_exists('ImageCreateFromGIF')) { |
| 46 | - $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . "test.gif"); |
|
| 46 | + $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK."test.gif"); |
|
| 47 | 47 | if ($srcImage) { |
| 48 | 48 | $gd_formats_read_gif = ",gif"; |
| 49 | 49 | ImageDestroy($srcImage); |
@@ -67,28 +67,28 @@ discard block |
||
| 67 | 67 | # les formats disponibles en ecriture... (cf. inc_logos) |
| 68 | 68 | |
| 69 | 69 | if (function_exists('ImageCreateFromJPEG')) { |
| 70 | - $srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK . "test.jpg"); |
|
| 70 | + $srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK."test.jpg"); |
|
| 71 | 71 | if ($srcImage) { |
| 72 | 72 | $gd_formats[] = "jpg"; |
| 73 | 73 | ImageDestroy($srcImage); |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | if (function_exists('ImageCreateFromGIF')) { |
| 77 | - $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . "test.gif"); |
|
| 77 | + $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK."test.gif"); |
|
| 78 | 78 | if ($srcImage) { |
| 79 | 79 | $gd_formats[] = "gif"; |
| 80 | 80 | ImageDestroy($srcImage); |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | if (function_exists('ImageCreateFromPNG')) { |
| 84 | - $srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK . "test.png"); |
|
| 84 | + $srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK."test.png"); |
|
| 85 | 85 | if ($srcImage) { |
| 86 | 86 | $gd_formats[] = "png"; |
| 87 | 87 | ImageDestroy($srcImage); |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | if (function_exists('ImageCreateFromWEBP')) { |
| 91 | - $srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK . "test.webp"); |
|
| 91 | + $srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK."test.webp"); |
|
| 92 | 92 | if ($srcImage) { |
| 93 | 93 | $gd_formats[] = "webp"; |
| 94 | 94 | ImageDestroy($srcImage); |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if (! empty($gd_formats)) { |
|
| 99 | + if (!empty($gd_formats)) { |
|
| 100 | 100 | $gd_formats = join(",", $gd_formats); |
| 101 | 101 | } |
| 102 | - ecrire_meta("gd_formats_read", $gd_formats . $gd_formats_read_gif); |
|
| 102 | + ecrire_meta("gd_formats_read", $gd_formats.$gd_formats_read_gif); |
|
| 103 | 103 | ecrire_meta("gd_formats", $gd_formats); |
| 104 | 104 | } // verifier les formats netpbm |
| 105 | 105 | else { |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | $pnmtojpeg_command = str_replace("pnmscale", |
| 118 | 118 | "pnmtojpeg", _PNMSCALE_COMMAND); |
| 119 | 119 | |
| 120 | - $vignette = _ROOT_IMG_PACK . "test.jpg"; |
|
| 121 | - $dest = _DIR_VAR . "test-jpg.jpg"; |
|
| 122 | - $commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 120 | + $vignette = _ROOT_IMG_PACK."test.jpg"; |
|
| 121 | + $dest = _DIR_VAR."test-jpg.jpg"; |
|
| 122 | + $commande = "$jpegtopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest"; |
|
| 123 | 123 | spip_log($commande); |
| 124 | 124 | exec($commande); |
| 125 | 125 | if ($taille = @getimagesize($dest)) { |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | $giftopnm_command = str_replace("pnmscale", "giftopnm", _PNMSCALE_COMMAND); |
| 131 | 131 | $pnmtojpeg_command = str_replace("pnmscale", "pnmtojpeg", _PNMSCALE_COMMAND); |
| 132 | - $vignette = _ROOT_IMG_PACK . "test.gif"; |
|
| 133 | - $dest = _DIR_VAR . "test-gif.jpg"; |
|
| 134 | - $commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 132 | + $vignette = _ROOT_IMG_PACK."test.gif"; |
|
| 133 | + $dest = _DIR_VAR."test-gif.jpg"; |
|
| 134 | + $commande = "$giftopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest"; |
|
| 135 | 135 | spip_log($commande); |
| 136 | 136 | exec($commande); |
| 137 | 137 | if ($taille = @getimagesize($dest)) { |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $pngtopnm_command = str_replace("pnmscale", "pngtopnm", _PNMSCALE_COMMAND); |
| 144 | - $vignette = _ROOT_IMG_PACK . "test.png"; |
|
| 145 | - $dest = _DIR_VAR . "test-gif.jpg"; |
|
| 146 | - $commande = "$pngtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 144 | + $vignette = _ROOT_IMG_PACK."test.png"; |
|
| 145 | + $dest = _DIR_VAR."test-gif.jpg"; |
|
| 146 | + $commande = "$pngtopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest"; |
|
| 147 | 147 | spip_log($commande); |
| 148 | 148 | exec($commande); |
| 149 | 149 | if ($taille = @getimagesize($dest)) { |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | include_spip('inc/filtres'); |
| 168 | 168 | include_spip('inc/filtres_images_mini'); |
| 169 | 169 | $taille_preview = 150; |
| 170 | - $image = _image_valeurs_trans(_DIR_IMG_PACK . 'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg'); |
|
| 170 | + $image = _image_valeurs_trans(_DIR_IMG_PACK.'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg'); |
|
| 171 | 171 | |
| 172 | - $image['fichier_dest'] = _DIR_VAR . "test_$arg"; |
|
| 172 | + $image['fichier_dest'] = _DIR_VAR."test_$arg"; |
|
| 173 | 173 | |
| 174 | 174 | if ($preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true) |
| 175 | 175 | and ($preview['width'] * $preview['height'] > 0) |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | $blue = dechex($blue); |
| 45 | 45 | |
| 46 | 46 | if (strlen($red) == 1) { |
| 47 | - $red = "0" . $red; |
|
| 47 | + $red = "0".$red; |
|
| 48 | 48 | } |
| 49 | 49 | if (strlen($green) == 1) { |
| 50 | - $green = "0" . $green; |
|
| 50 | + $green = "0".$green; |
|
| 51 | 51 | } |
| 52 | 52 | if (strlen($blue) == 1) { |
| 53 | - $blue = "0" . $blue; |
|
| 53 | + $blue = "0".$blue; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return "$red$green$blue"; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $couleur = couleur_html_to_hex($couleur); |
| 69 | 69 | $couleur = ltrim($couleur, '#'); |
| 70 | 70 | if (strlen($couleur) === 3) { |
| 71 | - $couleur = $couleur[0] . $couleur[0] . $couleur[1] . $couleur[1] . $couleur[2] . $couleur[2]; |
|
| 71 | + $couleur = $couleur[0].$couleur[0].$couleur[1].$couleur[1].$couleur[2].$couleur[2]; |
|
| 72 | 72 | } |
| 73 | 73 | $retour["red"] = hexdec(substr($couleur, 0, 2)); |
| 74 | 74 | $retour["green"] = hexdec(substr($couleur, 2, 2)); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | and $extension = _image_trouver_extension_depuis_mime("image/".$regs[1]) |
| 160 | 160 | and in_array($extension, _image_extensions_acceptees_en_entree()) |
| 161 | 161 | ) { |
| 162 | - $local = sous_repertoire(_DIR_VAR, 'image-data') . md5($regs[2]) . '.' . _image_extension_normalisee($extension); |
|
| 162 | + $local = sous_repertoire(_DIR_VAR, 'image-data').md5($regs[2]).'.'._image_extension_normalisee($extension); |
|
| 163 | 163 | if (!file_exists($local)) { |
| 164 | 164 | ecrire_fichier($local, base64_decode($regs[2])); |
| 165 | 165 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | // les protocoles web prennent au moins 3 lettres |
| 174 | 174 | if (tester_url_absolue($source)) { |
| 175 | 175 | include_spip('inc/distant'); |
| 176 | - $fichier = _DIR_RACINE . copie_locale($source); |
|
| 176 | + $fichier = _DIR_RACINE.copie_locale($source); |
|
| 177 | 177 | if (!$fichier) { |
| 178 | 178 | return ""; |
| 179 | 179 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | if ($forcer_format !== false |
| 200 | 200 | // ignorer forcer_format si on a une image svg, que le filtre appelant ne supporte pas SVG, et que le forcage est un autre format image |
| 201 | - and ($terminaison_dest !== 'svg' or $support_svg or !in_array($forcer_format,_image_extensions_acceptees_en_sortie()))) { |
|
| 201 | + and ($terminaison_dest !== 'svg' or $support_svg or !in_array($forcer_format, _image_extensions_acceptees_en_sortie()))) { |
|
| 202 | 202 | $terminaison_dest = $forcer_format; |
| 203 | 203 | } |
| 204 | 204 | |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | // on garde la terminaison initiale car image simplement copiee |
| 261 | 261 | // et on postfixe son nom avec un md5 du path |
| 262 | 262 | $terminaison_dest = $terminaison; |
| 263 | - $fichier_dest .= '-' . substr(md5("$identifiant"), 0, 5); |
|
| 263 | + $fichier_dest .= '-'.substr(md5("$identifiant"), 0, 5); |
|
| 264 | 264 | } else { |
| 265 | - $fichier_dest .= '-' . substr(md5("$identifiant-$effet"), 0, 5); |
|
| 265 | + $fichier_dest .= '-'.substr(md5("$identifiant-$effet"), 0, 5); |
|
| 266 | 266 | } |
| 267 | 267 | $cache = sous_repertoire(_DIR_VAR, $cache); |
| 268 | 268 | $cache = sous_repertoire($cache, $effet); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $fichier_dest = substr($fichier_dest, 2); |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - $fichier_dest = $cache . $fichier_dest . "." . $terminaison_dest; |
|
| 276 | + $fichier_dest = $cache.$fichier_dest.".".$terminaison_dest; |
|
| 277 | 277 | |
| 278 | 278 | $GLOBALS["images_calculees"][] = $fichier_dest; |
| 279 | 279 | |
@@ -309,14 +309,14 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | if ($creer) { |
| 312 | - spip_log("filtre image " . ($fonction_creation ? reset($fonction_creation) : '') . "[$effet] sur $fichier", |
|
| 313 | - "images" . _LOG_DEBUG); |
|
| 312 | + spip_log("filtre image ".($fonction_creation ? reset($fonction_creation) : '')."[$effet] sur $fichier", |
|
| 313 | + "images"._LOG_DEBUG); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | $term_fonction = _image_trouver_extension_pertinente($fichier); |
| 317 | - $ret["fonction_imagecreatefrom"] = "_imagecreatefrom" . $term_fonction; |
|
| 317 | + $ret["fonction_imagecreatefrom"] = "_imagecreatefrom".$term_fonction; |
|
| 318 | 318 | $ret["fichier"] = $fichier; |
| 319 | - $ret["fonction_image"] = "_image_image" . $terminaison_dest; |
|
| 319 | + $ret["fonction_image"] = "_image_image".$terminaison_dest; |
|
| 320 | 320 | $ret["fichier_dest"] = $fichier_dest; |
| 321 | 321 | $ret["format_source"] = _image_extension_normalisee($terminaison); |
| 322 | 322 | $ret["format_dest"] = $terminaison_dest; |
@@ -389,9 +389,9 @@ discard block |
||
| 389 | 389 | /** |
| 390 | 390 | * @return array|string[]|null |
| 391 | 391 | */ |
| 392 | -function _image_extensions_acceptees_en_sortie(){ |
|
| 392 | +function _image_extensions_acceptees_en_sortie() { |
|
| 393 | 393 | static $extensions = null; |
| 394 | - if (empty($extensions)){ |
|
| 394 | + if (empty($extensions)) { |
|
| 395 | 395 | $extensions = _image_extensions_acceptees_en_entree(); |
| 396 | 396 | $extensions = array_diff($extensions, ['jpeg']); |
| 397 | 397 | if (in_array('gif', $extensions) and !function_exists('imagegif')) { |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | return $extensions; |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | -function _image_extension_normalisee($extension){ |
|
| 408 | +function _image_extension_normalisee($extension) { |
|
| 409 | 409 | $extension = strtolower($extension); |
| 410 | 410 | if ($extension === 'jpeg') { |
| 411 | 411 | $extension = 'jpg'; |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | return $extension; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | -function _image_extensions_conservent_transparence(){ |
|
| 416 | +function _image_extensions_conservent_transparence() { |
|
| 417 | 417 | return ['png', 'webp']; |
| 418 | 418 | } |
| 419 | 419 | |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | |
| 464 | 464 | $_terminaison = _image_trouver_extension_depuis_mime($mime); |
| 465 | 465 | if ($_terminaison and $_terminaison !== $terminaison) { |
| 466 | - spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", "images." . _LOG_INFO_IMPORTANTE); |
|
| 466 | + spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", "images."._LOG_INFO_IMPORTANTE); |
|
| 467 | 467 | $terminaison = $_terminaison; |
| 468 | 468 | } |
| 469 | 469 | return $terminaison; |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | if (!function_exists('imagepng')) { |
| 614 | 614 | return false; |
| 615 | 615 | } |
| 616 | - $tmp = $fichier . ".tmp"; |
|
| 616 | + $tmp = $fichier.".tmp"; |
|
| 617 | 617 | $ret = imagepng($img, $tmp); |
| 618 | 618 | if (file_exists($tmp)) { |
| 619 | 619 | $taille_test = getimagesize($tmp); |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | if (!function_exists('imagegif')) { |
| 649 | 649 | return false; |
| 650 | 650 | } |
| 651 | - $tmp = $fichier . ".tmp"; |
|
| 651 | + $tmp = $fichier.".tmp"; |
|
| 652 | 652 | $ret = imagegif($img, $tmp); |
| 653 | 653 | if (file_exists($tmp)) { |
| 654 | 654 | $taille_test = getimagesize($tmp); |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | if (!function_exists('imagejpeg')) { |
| 689 | 689 | return false; |
| 690 | 690 | } |
| 691 | - $tmp = $fichier . ".tmp"; |
|
| 691 | + $tmp = $fichier.".tmp"; |
|
| 692 | 692 | |
| 693 | 693 | // Enable interlancing |
| 694 | 694 | imageinterlace($img, true); |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | if (!function_exists('imagewebp')) { |
| 750 | 750 | return false; |
| 751 | 751 | } |
| 752 | - $tmp = $fichier . ".tmp"; |
|
| 752 | + $tmp = $fichier.".tmp"; |
|
| 753 | 753 | $ret = imagewebp($img, $tmp, $qualite); |
| 754 | 754 | if (file_exists($tmp)) { |
| 755 | 755 | $taille_test = getimagesize($tmp); |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | */ |
| 784 | 784 | function _image_imagesvg($img, $fichier) { |
| 785 | 785 | |
| 786 | - $tmp = $fichier . ".tmp"; |
|
| 786 | + $tmp = $fichier.".tmp"; |
|
| 787 | 787 | if (strpos($img, "<") === false) { |
| 788 | 788 | $img = supprimer_timestamp($img); |
| 789 | 789 | if (!file_exists($img)) { |
@@ -839,12 +839,12 @@ discard block |
||
| 839 | 839 | * - false sinon. |
| 840 | 840 | */ |
| 841 | 841 | function _image_gd_output($img, $valeurs, $qualite = _IMG_GD_QUALITE) { |
| 842 | - $fonction = "_image_image" . $valeurs['format_dest']; |
|
| 842 | + $fonction = "_image_image".$valeurs['format_dest']; |
|
| 843 | 843 | $ret = false; |
| 844 | 844 | #un flag pour reperer les images gravees |
| 845 | 845 | $lock = |
| 846 | 846 | !statut_effacer_images_temporaires('get') // si la fonction n'a pas ete activee, on grave tout |
| 847 | - or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'] . '.src')); |
|
| 847 | + or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'].'.src')); |
|
| 848 | 848 | if ( |
| 849 | 849 | function_exists($fonction) |
| 850 | 850 | && ($ret = $fonction($img, $valeurs['fichier_dest'], $qualite)) # on a reussi a creer l'image |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | // dans tous les cas mettre a jour la taille de l'image finale |
| 856 | 856 | list($valeurs["hauteur_dest"], $valeurs["largeur_dest"]) = taille_image($valeurs['fichier_dest']); |
| 857 | 857 | $valeurs['date'] = @filemtime($valeurs['fichier_dest']); // pour la retrouver apres disparition |
| 858 | - ecrire_fichier($valeurs['fichier_dest'] . '.src', serialize($valeurs), true); |
|
| 858 | + ecrire_fichier($valeurs['fichier_dest'].'.src', serialize($valeurs), true); |
|
| 859 | 859 | } |
| 860 | 860 | } |
| 861 | 861 | |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | function reconstruire_image_intermediaire($fichier_manquant) { |
| 875 | 875 | $reconstruire = array(); |
| 876 | 876 | $fichier = $fichier_manquant; |
| 877 | - while (strpos($fichier,"://")===false |
|
| 877 | + while (strpos($fichier, "://") === false |
|
| 878 | 878 | and !@file_exists($fichier) |
| 879 | 879 | and lire_fichier($src = "$fichier.src", $source) |
| 880 | 880 | and $valeurs = unserialize($source) |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | * Chemin du fichier d'image calculé |
| 912 | 912 | **/ |
| 913 | 913 | function ramasse_miettes($fichier) { |
| 914 | - if (strpos($fichier,"://")!==false |
|
| 914 | + if (strpos($fichier, "://") !== false |
|
| 915 | 915 | or !lire_fichier($src = "$fichier.src", $source) |
| 916 | 916 | or !$valeurs = unserialize($source) |
| 917 | 917 | ) { |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | } |
| 968 | 968 | # si jamais le fichier final n'a pas ete calcule car suppose temporaire |
| 969 | 969 | # et qu'il ne s'agit pas d'une URL |
| 970 | - if (strpos($fichier,"://")===false and !@file_exists($fichier)) { |
|
| 970 | + if (strpos($fichier, "://") === false and !@file_exists($fichier)) { |
|
| 971 | 971 | reconstruire_image_intermediaire($fichier); |
| 972 | 972 | } |
| 973 | 973 | ramasse_miettes($fichier); |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | |
| 1065 | 1065 | // attributs deprecies. Transformer en CSS |
| 1066 | 1066 | if ($espace = extraire_attribut($tag, 'hspace')) { |
| 1067 | - $style = "margin:${espace}px;" . $style; |
|
| 1067 | + $style = "margin:${espace}px;".$style; |
|
| 1068 | 1068 | $tag = inserer_attribut($tag, 'hspace', ''); |
| 1069 | 1069 | } |
| 1070 | 1070 | |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | $image = $valeurs['fichier']; |
| 1189 | 1189 | $format = $valeurs['format_source']; |
| 1190 | 1190 | $destdir = dirname($valeurs['fichier_dest']); |
| 1191 | - $destfile = basename($valeurs['fichier_dest'], "." . $valeurs["format_dest"]); |
|
| 1191 | + $destfile = basename($valeurs['fichier_dest'], ".".$valeurs["format_dest"]); |
|
| 1192 | 1192 | |
| 1193 | 1193 | $format_sortie = $valeurs['format_dest']; |
| 1194 | 1194 | |
@@ -1220,14 +1220,14 @@ discard block |
||
| 1220 | 1220 | |
| 1221 | 1221 | // Si l'image est de la taille demandee (ou plus petite), simplement la retourner |
| 1222 | 1222 | if ($srcWidth and $srcWidth <= $maxWidth and $srcHeight <= $maxHeight) { |
| 1223 | - $vignette = $destination . '.' . $format; |
|
| 1223 | + $vignette = $destination.'.'.$format; |
|
| 1224 | 1224 | @copy($image, $vignette); |
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | 1227 | elseif ($valeurs["format_source"] === 'svg') { |
| 1228 | - if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)){ |
|
| 1228 | + if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)) { |
|
| 1229 | 1229 | $format_sortie = 'svg'; |
| 1230 | - $vignette = $destination . "." . $format_sortie; |
|
| 1230 | + $vignette = $destination.".".$format_sortie; |
|
| 1231 | 1231 | $valeurs['fichier_dest'] = $vignette; |
| 1232 | 1232 | _image_gd_output($svg, $valeurs); |
| 1233 | 1233 | } |
@@ -1239,9 +1239,9 @@ discard block |
||
| 1239 | 1239 | define('_CONVERT_COMMAND', 'convert'); |
| 1240 | 1240 | } // Securite : mes_options.php peut preciser le chemin absolu |
| 1241 | 1241 | if (!defined('_RESIZE_COMMAND')) { |
| 1242 | - define('_RESIZE_COMMAND', _CONVERT_COMMAND . ' -quality ' . _IMG_CONVERT_QUALITE . ' -resize %xx%y! %src %dest'); |
|
| 1242 | + define('_RESIZE_COMMAND', _CONVERT_COMMAND.' -quality '._IMG_CONVERT_QUALITE.' -resize %xx%y! %src %dest'); |
|
| 1243 | 1243 | } |
| 1244 | - $vignette = $destination . "." . $format_sortie; |
|
| 1244 | + $vignette = $destination.".".$format_sortie; |
|
| 1245 | 1245 | $commande = str_replace( |
| 1246 | 1246 | array('%x', '%y', '%src', '%dest'), |
| 1247 | 1247 | array( |
@@ -1256,13 +1256,13 @@ discard block |
||
| 1256 | 1256 | if (!@file_exists($vignette)) { |
| 1257 | 1257 | spip_log("echec convert sur $vignette"); |
| 1258 | 1258 | |
| 1259 | - return; // echec commande |
|
| 1259 | + return; // echec commande |
|
| 1260 | 1260 | } |
| 1261 | 1261 | } |
| 1262 | 1262 | |
| 1263 | 1263 | // php5 imagemagick |
| 1264 | 1264 | elseif ($process == 'imagick') { |
| 1265 | - $vignette = "$destination." . $format_sortie; |
|
| 1265 | + $vignette = "$destination.".$format_sortie; |
|
| 1266 | 1266 | |
| 1267 | 1267 | if (!class_exists('Imagick')) { |
| 1268 | 1268 | spip_log("Classe Imagick absente !", _LOG_ERREUR); |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | $imagick = new Imagick(); |
| 1273 | 1273 | $imagick->readImage($image); |
| 1274 | 1274 | $imagick->resizeImage($destWidth, $destHeight, Imagick::FILTER_LANCZOS, |
| 1275 | - 1);//, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100); |
|
| 1275 | + 1); //, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100); |
|
| 1276 | 1276 | $imagick->writeImage($vignette); |
| 1277 | 1277 | |
| 1278 | 1278 | if (!@file_exists($vignette)) { |
@@ -1290,12 +1290,12 @@ discard block |
||
| 1290 | 1290 | if (_PNMSCALE_COMMAND == '') { |
| 1291 | 1291 | return; |
| 1292 | 1292 | } |
| 1293 | - $vignette = $destination . "." . $format_sortie; |
|
| 1293 | + $vignette = $destination.".".$format_sortie; |
|
| 1294 | 1294 | $pnmtojpeg_command = str_replace("pnmscale", "pnmtojpeg", _PNMSCALE_COMMAND); |
| 1295 | 1295 | if ($format == "jpg") { |
| 1296 | 1296 | |
| 1297 | 1297 | $jpegtopnm_command = str_replace("pnmscale", "jpegtopnm", _PNMSCALE_COMMAND); |
| 1298 | - exec("$jpegtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1298 | + exec("$jpegtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1299 | 1299 | if (!($s = @filesize($vignette))) { |
| 1300 | 1300 | spip_unlink($vignette); |
| 1301 | 1301 | } |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | } else { |
| 1308 | 1308 | if ($format == "gif") { |
| 1309 | 1309 | $giftopnm_command = str_replace("pnmscale", "giftopnm", _PNMSCALE_COMMAND); |
| 1310 | - exec("$giftopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1310 | + exec("$giftopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1311 | 1311 | if (!($s = @filesize($vignette))) { |
| 1312 | 1312 | spip_unlink($vignette); |
| 1313 | 1313 | } |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | } else { |
| 1320 | 1320 | if ($format == "png") { |
| 1321 | 1321 | $pngtopnm_command = str_replace("pnmscale", "pngtopnm", _PNMSCALE_COMMAND); |
| 1322 | - exec("$pngtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1322 | + exec("$pngtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1323 | 1323 | if (!($s = @filesize($vignette))) { |
| 1324 | 1324 | spip_unlink($vignette); |
| 1325 | 1325 | } |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | return; |
| 1342 | 1342 | } |
| 1343 | 1343 | if (_IMG_GD_MAX_PIXELS && $srcWidth * $srcHeight > _IMG_GD_MAX_PIXELS) { |
| 1344 | - spip_log("vignette gd1/gd2 impossible : " . $srcWidth * $srcHeight . "pixels"); |
|
| 1344 | + spip_log("vignette gd1/gd2 impossible : ".$srcWidth * $srcHeight."pixels"); |
|
| 1345 | 1345 | |
| 1346 | 1346 | return; |
| 1347 | 1347 | } |
@@ -1646,7 +1646,7 @@ discard block |
||
| 1646 | 1646 | // de l'image, de facon a tromper le cache du navigateur |
| 1647 | 1647 | // quand on fait supprimer/reuploader un logo |
| 1648 | 1648 | // (pas de filemtime si SAFE MODE) |
| 1649 | - $date = test_espace_prive() ? ('?' . $date) : ''; |
|
| 1649 | + $date = test_espace_prive() ? ('?'.$date) : ''; |
|
| 1650 | 1650 | |
| 1651 | 1651 | return _image_ecrire_tag($image, array('src' => "$logo$date", 'width' => $destWidth, 'height' => $destHeight)); |
| 1652 | 1652 | } |
@@ -1693,7 +1693,7 @@ discard block |
||
| 1693 | 1693 | public static function LittleEndian2String($number, $minbytes = 1) { |
| 1694 | 1694 | $intstring = ''; |
| 1695 | 1695 | while ($number > 0) { |
| 1696 | - $intstring = $intstring . chr($number & 255); |
|
| 1696 | + $intstring = $intstring.chr($number & 255); |
|
| 1697 | 1697 | $number >>= 8; |
| 1698 | 1698 | } |
| 1699 | 1699 | |
@@ -1726,9 +1726,9 @@ discard block |
||
| 1726 | 1726 | $b = $argb['blue']; |
| 1727 | 1727 | |
| 1728 | 1728 | if ($bpp[$key] == 32) { |
| 1729 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r) . chr($a); |
|
| 1729 | + $icXOR[$key] .= chr($b).chr($g).chr($r).chr($a); |
|
| 1730 | 1730 | } elseif ($bpp[$key] == 24) { |
| 1731 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r); |
|
| 1731 | + $icXOR[$key] .= chr($b).chr($g).chr($r); |
|
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | 1734 | if ($a < 128) { |
@@ -1756,44 +1756,44 @@ discard block |
||
| 1756 | 1756 | |
| 1757 | 1757 | // BITMAPINFOHEADER - 40 bytes |
| 1758 | 1758 | $BitmapInfoHeader[$key] = ''; |
| 1759 | - $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
| 1760 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
| 1759 | + $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
| 1760 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
| 1761 | 1761 | // The biHeight member specifies the combined |
| 1762 | 1762 | // height of the XOR and AND masks. |
| 1763 | 1763 | $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4); // LONG biHeight; |
| 1764 | - $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
| 1765 | - $BitmapInfoHeader[$key] .= chr($bpp[$key]) . "\x00"; // wBitCount; |
|
| 1766 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
| 1767 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
| 1768 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
| 1769 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
| 1770 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
| 1771 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
| 1764 | + $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
| 1765 | + $BitmapInfoHeader[$key] .= chr($bpp[$key])."\x00"; // wBitCount; |
|
| 1766 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
| 1767 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
| 1768 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
| 1769 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
| 1770 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
| 1771 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
| 1772 | 1772 | } |
| 1773 | 1773 | |
| 1774 | 1774 | |
| 1775 | - $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
| 1776 | - $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
| 1777 | - $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
| 1775 | + $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
| 1776 | + $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
| 1777 | + $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
| 1778 | 1778 | |
| 1779 | 1779 | $dwImageOffset = 6 + (count($gd_image_array) * 16); |
| 1780 | 1780 | foreach ($gd_image_array as $key => $gd_image) { |
| 1781 | 1781 | // ICONDIRENTRY idEntries[1]; // An entry for each image (idCount of 'em) |
| 1782 | 1782 | |
| 1783 | - $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
| 1784 | - $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
| 1785 | - $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
| 1786 | - $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
| 1783 | + $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
| 1784 | + $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
| 1785 | + $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
| 1786 | + $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
| 1787 | 1787 | |
| 1788 | - $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
| 1789 | - $icondata .= chr($bpp[$key]) . "\x00"; // wBitCount; // Bits per pixel |
|
| 1788 | + $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
| 1789 | + $icondata .= chr($bpp[$key])."\x00"; // wBitCount; // Bits per pixel |
|
| 1790 | 1790 | |
| 1791 | 1791 | $dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]); |
| 1792 | 1792 | $icondata .= phpthumb_functions::LittleEndian2String($dwBytesInRes, |
| 1793 | - 4); // dwBytesInRes; // How many bytes in this resource? |
|
| 1793 | + 4); // dwBytesInRes; // How many bytes in this resource? |
|
| 1794 | 1794 | |
| 1795 | 1795 | $icondata .= phpthumb_functions::LittleEndian2String($dwImageOffset, |
| 1796 | - 4); // dwImageOffset; // Where in the file is this image? |
|
| 1796 | + 4); // dwImageOffset; // Where in the file is this image? |
|
| 1797 | 1797 | $dwImageOffset += strlen($BitmapInfoHeader[$key]); |
| 1798 | 1798 | $dwImageOffset += strlen($icXOR[$key]); |
| 1799 | 1799 | $dwImageOffset += strlen($icAND[$key]); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | define('_INC_DISTANT_CONTENT_ENCODING', 'gzip'); |
| 27 | 27 | } |
| 28 | 28 | if (!defined('_INC_DISTANT_USER_AGENT')) { |
| 29 | - define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')'); |
|
| 29 | + define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')'); |
|
| 30 | 30 | } |
| 31 | 31 | if (!defined('_INC_DISTANT_MAX_SIZE')) { |
| 32 | 32 | define('_INC_DISTANT_MAX_SIZE', 2097152); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | define('_INC_DISTANT_CONNECT_TIMEOUT', 10); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -define('_REGEXP_COPIE_LOCALE', ',' . |
|
| 38 | +define('_REGEXP_COPIE_LOCALE', ','. |
|
| 39 | 39 | preg_replace( |
| 40 | 40 | '@^https?:@', |
| 41 | 41 | 'https?:', |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // si c'est la protection de soi-meme, retourner le path |
| 72 | 72 | if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) { |
| 73 | - $source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]); |
|
| 73 | + $source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]); |
|
| 74 | 74 | |
| 75 | 75 | return @file_exists($source) ? $source : false; |
| 76 | 76 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $localrac = _DIR_RACINE . $local; |
|
| 93 | + $localrac = _DIR_RACINE.$local; |
|
| 94 | 94 | $t = ($mode == 'force') ? false : @file_exists($localrac); |
| 95 | 95 | |
| 96 | 96 | // test d'existence du fichier |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | array('file' => $localrac, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : '') |
| 116 | 116 | ); |
| 117 | 117 | if (!$res or (!$res['length'] and $res['status'] != 304)) { |
| 118 | - spip_log("copie_locale : Echec recuperation $source sur $localrac status : " . $res['status'], 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 118 | + spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".$res['status'], 'distant'._LOG_INFO_IMPORTANTE); |
|
| 119 | 119 | } |
| 120 | 120 | if (!$res['length']) { |
| 121 | 121 | // si $t c'est sans doute juste un not-modified-since |
| 122 | 122 | return $t ? $local : false; |
| 123 | 123 | } |
| 124 | - spip_log("copie_locale : recuperation $source sur $localrac taille " . $res['length'] . ' OK', 'distant'); |
|
| 124 | + spip_log("copie_locale : recuperation $source sur $localrac taille ".$res['length'].' OK', 'distant'); |
|
| 125 | 125 | |
| 126 | 126 | // pour une eventuelle indexation |
| 127 | 127 | pipeline( |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * url ou false en cas d'echec |
| 154 | 154 | */ |
| 155 | 155 | function valider_url_distante($url, $known_hosts = array()) { |
| 156 | - if (!function_exists('protocole_verifier')){ |
|
| 156 | + if (!function_exists('protocole_verifier')) { |
|
| 157 | 157 | include_spip('inc/filtres_mini'); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $parsed_url = parse_url($url); |
| 165 | - if (!$parsed_url or empty($parsed_url['host']) ) { |
|
| 165 | + if (!$parsed_url or empty($parsed_url['host'])) { |
|
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | if ($ip) { |
| 206 | - $parts = array_map('intval', explode( '.', $ip )); |
|
| 206 | + $parts = array_map('intval', explode('.', $ip)); |
|
| 207 | 207 | if (127 === $parts[0] or 10 === $parts[0] or 0 === $parts[0] |
| 208 | - or ( 172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1] ) |
|
| 209 | - or ( 192 === $parts[0] && 168 === $parts[1] ) |
|
| 208 | + or (172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1]) |
|
| 209 | + or (192 === $parts[0] && 168 === $parts[1]) |
|
| 210 | 210 | ) { |
| 211 | 211 | return false; |
| 212 | 212 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $port = $parsed_url['port']; |
| 221 | - if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 221 | + if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 222 | 222 | return $url; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | if ($taille > 500) { |
| 288 | - $boundary = substr(md5(rand() . 'spip'), 0, 8); |
|
| 288 | + $boundary = substr(md5(rand().'spip'), 0, 8); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -313,16 +313,16 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | } else { |
| 315 | 315 | // fabrique une chaine HTTP simple pour un POST |
| 316 | - $entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; |
|
| 316 | + $entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n"; |
|
| 317 | 317 | $chaine = array(); |
| 318 | 318 | if (is_array($donnees)) { |
| 319 | 319 | foreach ($donnees as $cle => $valeur) { |
| 320 | 320 | if (is_array($valeur)) { |
| 321 | 321 | foreach ($valeur as $val2) { |
| 322 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2); |
|
| 322 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2); |
|
| 323 | 323 | } |
| 324 | 324 | } else { |
| 325 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur); |
|
| 325 | + $chaine[] = rawurlencode($cle).'='.rawurlencode($valeur); |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | $chaine = implode('&', $chaine); |
@@ -423,9 +423,9 @@ discard block |
||
| 423 | 423 | if (!empty($options['datas'])) { |
| 424 | 424 | list($head, $postdata) = prepare_donnees_post($options['datas'], $options['boundary']); |
| 425 | 425 | if (stripos($head, 'Content-Length:') === false) { |
| 426 | - $head .= 'Content-Length: ' . strlen($postdata); |
|
| 426 | + $head .= 'Content-Length: '.strlen($postdata); |
|
| 427 | 427 | } |
| 428 | - $options['datas'] = $head . "\r\n\r\n" . $postdata; |
|
| 428 | + $options['datas'] = $head."\r\n\r\n".$postdata; |
|
| 429 | 429 | if (strlen($postdata)) { |
| 430 | 430 | $options['methode'] = 'POST'; |
| 431 | 431 | } |
@@ -434,9 +434,9 @@ discard block |
||
| 434 | 434 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 435 | 435 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 436 | 436 | if (!tester_url_absolue($url)) { |
| 437 | - $url = 'http://' . $url; |
|
| 437 | + $url = 'http://'.$url; |
|
| 438 | 438 | } elseif (strncmp($url, '//', 2) == 0) { |
| 439 | - $url = 'http:' . $url; |
|
| 439 | + $url = 'http:'.$url; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | $url = url_to_ascii($url); |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | $options['if_modified_since'] |
| 466 | 466 | ); |
| 467 | 467 | if (!$handle) { |
| 468 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 468 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 469 | 469 | |
| 470 | 470 | return false; |
| 471 | 471 | } |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | 'status' => 200, |
| 495 | 495 | ); |
| 496 | 496 | } else { |
| 497 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 497 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 498 | 498 | return false; |
| 499 | 499 | } |
| 500 | 500 | } elseif ($res['location'] and $options['follow_location']) { |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | return recuperer_url($url, $options); |
| 508 | 508 | } elseif ($res['status'] !== 200) { |
| 509 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 509 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 510 | 510 | } |
| 511 | 511 | $result['status'] = $res['status']; |
| 512 | 512 | if (isset($res['headers'])) { |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | |
| 532 | 532 | $gz = false; |
| 533 | 533 | if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) { |
| 534 | - $gz = (_DIR_TMP . md5(uniqid(mt_rand())) . '.tmp.gz'); |
|
| 534 | + $gz = (_DIR_TMP.md5(uniqid(mt_rand())).'.tmp.gz'); |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | $sig['url'] = $url; |
| 618 | 618 | |
| 619 | 619 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 620 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 620 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 621 | 621 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 622 | 622 | $cache = "$sub$cache"; |
| 623 | 623 | |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | return false; |
| 727 | 727 | } |
| 728 | 728 | if ($get_headers) { |
| 729 | - return $res['headers'] . "\n" . $res['page']; |
|
| 729 | + return $res['headers']."\n".$res['page']; |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | return $res['page']; |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | $fp = false; |
| 831 | 831 | if ($fichier) { |
| 832 | 832 | include_spip('inc/acces'); |
| 833 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 833 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 834 | 834 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 835 | 835 | if (!$fp and file_exists($fichier)) { |
| 836 | 836 | return filesize($fichier); |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | } |
| 890 | 890 | $result['status'] = intval($r[1]); |
| 891 | 891 | while ($s = trim(fgets($handle, 16384))) { |
| 892 | - $result['headers'][] = $s . "\n"; |
|
| 892 | + $result['headers'][] = $s."\n"; |
|
| 893 | 893 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 894 | 894 | list(, $d, $v) = $r; |
| 895 | 895 | if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) { |
@@ -972,13 +972,13 @@ discard block |
||
| 972 | 972 | |
| 973 | 973 | // on se place tout le temps comme si on etait a la racine |
| 974 | 974 | if (_DIR_RACINE) { |
| 975 | - $d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d); |
|
| 975 | + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); |
|
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | $m = md5($source); |
| 979 | 979 | |
| 980 | 980 | return $d |
| 981 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 981 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 982 | 982 | . substr($m, 0, 4) |
| 983 | 983 | . ".$extension"; |
| 984 | 984 | } |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | // Si c'est deja local pas de souci |
| 1002 | 1002 | if (!tester_url_absolue($source)) { |
| 1003 | 1003 | if (_DIR_RACINE) { |
| 1004 | - $source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source); |
|
| 1004 | + $source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source); |
|
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | return $source; |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | if ($ext |
| 1019 | 1019 | and preg_match(',^\w+$,', $ext) // pas de php?truc=1&... |
| 1020 | 1020 | and $f = nom_fichier_copie_locale($source, $ext) |
| 1021 | - and file_exists(_DIR_RACINE . $f) |
|
| 1021 | + and file_exists(_DIR_RACINE.$f) |
|
| 1022 | 1022 | ) { |
| 1023 | 1023 | return $f; |
| 1024 | 1024 | } |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | |
| 1027 | 1027 | // Si c'est deja dans la table des documents, |
| 1028 | 1028 | // ramener le nom de sa copie potentielle |
| 1029 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 1029 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 1030 | 1030 | |
| 1031 | 1031 | if ($ext) { |
| 1032 | 1032 | return nom_fichier_copie_locale($source, $ext); |
@@ -1037,9 +1037,9 @@ discard block |
||
| 1037 | 1037 | |
| 1038 | 1038 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 1039 | 1039 | |
| 1040 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 1040 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 1041 | 1041 | $f = nom_fichier_copie_locale($source, $ext); |
| 1042 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 1042 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 1043 | 1043 | return $f; |
| 1044 | 1044 | } |
| 1045 | 1045 | } |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | // Ping pour voir si son extension est connue et autorisee |
| 1048 | 1048 | // avec mise en cache du resultat du ping |
| 1049 | 1049 | |
| 1050 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 1050 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 1051 | 1051 | if (!@file_exists($cache) |
| 1052 | 1052 | or !$path_parts = @unserialize(spip_file_get_contents($cache)) |
| 1053 | 1053 | or _request('var_mode') == 'recalcul' |
@@ -1056,10 +1056,10 @@ discard block |
||
| 1056 | 1056 | ecrire_fichier($cache, serialize($path_parts)); |
| 1057 | 1057 | } |
| 1058 | 1058 | $ext = !empty($path_parts['extension']) ? $path_parts['extension'] : ''; |
| 1059 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 1059 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 1060 | 1060 | return nom_fichier_copie_locale($source, $ext); |
| 1061 | 1061 | } |
| 1062 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 1062 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | |
@@ -1124,19 +1124,19 @@ discard block |
||
| 1124 | 1124 | if (!$t |
| 1125 | 1125 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1126 | 1126 | ) { |
| 1127 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1127 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1128 | 1128 | } |
| 1129 | 1129 | if (!$t |
| 1130 | 1130 | and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1131 | 1131 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1132 | 1132 | ) { |
| 1133 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1133 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1134 | 1134 | } |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1138 | 1138 | if (!$t) { |
| 1139 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1139 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1146,11 +1146,11 @@ discard block |
||
| 1146 | 1146 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1147 | 1147 | ) { |
| 1148 | 1148 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1149 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1149 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | if ($t) { |
| 1153 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 1153 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 1154 | 1154 | $a['extension'] = $t['extension']; |
| 1155 | 1155 | } else { |
| 1156 | 1156 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | } else { |
| 1193 | 1193 | if ($a['body']) { |
| 1194 | 1194 | $a['extension'] = $extension; |
| 1195 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 1195 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 1196 | 1196 | ecrire_fichier($a['fichier'], $a['body']); |
| 1197 | 1197 | $size_image = @spip_getimagesize($a['fichier']); |
| 1198 | 1198 | $a['largeur'] = intval($size_image[0]); |
@@ -1317,7 +1317,7 @@ discard block |
||
| 1317 | 1317 | } |
| 1318 | 1318 | } else { |
| 1319 | 1319 | $scheme = $t['scheme']; |
| 1320 | - $noproxy = $scheme . '://'; |
|
| 1320 | + $noproxy = $scheme.'://'; |
|
| 1321 | 1321 | } |
| 1322 | 1322 | if (isset($t['user'])) { |
| 1323 | 1323 | $user = array($t['user'], $t['pass']); |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | 1333 | if (!empty($t['query'])) { |
| 1334 | - $path .= '?' . $t['query']; |
|
| 1334 | + $path .= '?'.$t['query']; |
|
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1404,20 +1404,20 @@ discard block |
||
| 1404 | 1404 | $proxy_user = ''; |
| 1405 | 1405 | $http_proxy = need_proxy($host); |
| 1406 | 1406 | if ($user) { |
| 1407 | - $user = urlencode($user[0]) . ':' . urlencode($user[1]); |
|
| 1407 | + $user = urlencode($user[0]).':'.urlencode($user[1]); |
|
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | $connect = ''; |
| 1411 | 1411 | if ($http_proxy) { |
| 1412 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme , array('tls','ssl'))) { |
|
| 1413 | - $path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : ''); |
|
| 1414 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1412 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, array('tls', 'ssl'))) { |
|
| 1413 | + $path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : ''); |
|
| 1414 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1415 | 1415 | . "Host: $path_host\r\n" |
| 1416 | 1416 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1417 | 1417 | } else { |
| 1418 | - $path = (in_array($scheme , array('tls','ssl')) ? 'https://' : "$scheme://") |
|
| 1418 | + $path = (in_array($scheme, array('tls', 'ssl')) ? 'https://' : "$scheme://") |
|
| 1419 | 1419 | . (!$user ? '' : "$user@") |
| 1420 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1420 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1421 | 1421 | } |
| 1422 | 1422 | $t2 = @parse_url($http_proxy); |
| 1423 | 1423 | $first_host = $t2['host']; |
@@ -1425,10 +1425,10 @@ discard block |
||
| 1425 | 1425 | $port = 80; |
| 1426 | 1426 | } |
| 1427 | 1427 | if ($t2['user']) { |
| 1428 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1428 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1429 | 1429 | } |
| 1430 | 1430 | } else { |
| 1431 | - $first_host = $noproxy . $host; |
|
| 1431 | + $first_host = $noproxy.$host; |
|
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | 1434 | if ($connect) { |
@@ -1453,7 +1453,7 @@ discard block |
||
| 1453 | 1453 | ); |
| 1454 | 1454 | spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect'); |
| 1455 | 1455 | if (!$f) { |
| 1456 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1456 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1457 | 1457 | return $errno; |
| 1458 | 1458 | } |
| 1459 | 1459 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1465,7 +1465,7 @@ discard block |
||
| 1465 | 1465 | or !count($res = explode(' ', $res)) |
| 1466 | 1466 | or $res[1] !== '200' |
| 1467 | 1467 | ) { |
| 1468 | - spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1468 | + spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1469 | 1469 | fclose($f); |
| 1470 | 1470 | |
| 1471 | 1471 | return false; |
@@ -1482,7 +1482,7 @@ discard block |
||
| 1482 | 1482 | } while (!$f and $ntry-- and $errno !== 110 and sleep(1)); |
| 1483 | 1483 | spip_log("Recuperer $path sur $first_host:$port par $f"); |
| 1484 | 1484 | if (!$f) { |
| 1485 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1485 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1486 | 1486 | |
| 1487 | 1487 | return $errno; |
| 1488 | 1488 | } |
@@ -1492,16 +1492,16 @@ discard block |
||
| 1492 | 1492 | $site = isset($GLOBALS['meta']['adresse_site']) ? $GLOBALS['meta']['adresse_site'] : ''; |
| 1493 | 1493 | |
| 1494 | 1494 | $host_port = $host; |
| 1495 | - if ($port != (in_array($scheme , array('tls','ssl')) ? 443 : 80)) { |
|
| 1495 | + if ($port != (in_array($scheme, array('tls', 'ssl')) ? 443 : 80)) { |
|
| 1496 | 1496 | $host_port .= ":$port"; |
| 1497 | 1497 | } |
| 1498 | 1498 | $req = "$method $path $vers\r\n" |
| 1499 | 1499 | . "Host: $host_port\r\n" |
| 1500 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1501 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1500 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1501 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1502 | 1502 | . (!$site ? '' : "Referer: $site/$referer\r\n") |
| 1503 | - . (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n")) |
|
| 1504 | - . (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n")) |
|
| 1503 | + . (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n")) |
|
| 1504 | + . (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n")) |
|
| 1505 | 1505 | . (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n") |
| 1506 | 1506 | . (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n"); |
| 1507 | 1507 | |