Browse Source

build: Remplacer idna_convert.class.php par sa lib d'origine

remotes/checkIfPRContentChanged-1664374821295033898/issue_5056_composer_road
JamesRezo 12 months ago committed by Matthieu Marcillaud
parent
commit
32fbb2bd97
  1. 3
      composer.json
  2. 95
      composer.lock
  3. 10
      ecrire/inc/distant.php
  4. 3465
      ecrire/inc/idna_convert.class.php
  5. 1
      phpcs.xml.dist
  6. 2
      phpstan.neon.dist

3
composer.json

@ -7,7 +7,8 @@
"ext-zip": "*",
"symfony/polyfill-mbstring": "^1.24",
"symfony/polyfill-php80": "^1.24",
"symfony/polyfill-php81": "^1.24"
"symfony/polyfill-php81": "^1.24",
"algo26-matthias/idna-convert": "^3.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",

95
composer.lock generated

@ -4,8 +4,101 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "33d2e63c996f6f5730d45d5cf7624bd7",
"content-hash": "d565933cafd101e9e55b56371df6dc42",
"packages": [
{
"name": "algo26-matthias/idna-convert",
"version": "v3.0.5",
"source": {
"type": "git",
"url": "https://github.com/algo26-matthias/idna-convert.git",
"reference": "9cbcfa17ecfed54387ca2ed29acb2773f1870a5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/algo26-matthias/idna-convert/zipball/9cbcfa17ecfed54387ca2ed29acb2773f1870a5e",
"reference": "9cbcfa17ecfed54387ca2ed29acb2773f1870a5e",
"shasum": ""
},
"require": {
"ext-pcre": "*",
"jakeasmith/http_build_url": "^1",
"php": ">=7.2.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0 || ^9.0"
},
"suggest": {
"ext-iconv": "Install ext/iconv for using input / output other than UTF-8 or ISO-8859-1",
"ext-mbstring": "Install ext/mbstring for using input / output other than UTF-8 or ISO-8859-1"
},
"type": "library",
"autoload": {
"psr-4": {
"Algo26\\IdnaConvert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1+"
],
"authors": [
{
"name": "Matthias Sommerfeld",
"email": "matthias.sommerfeld@algo26.de",
"role": "Developer"
}
],
"description": "A library for encoding and decoding internationalized domain names",
"homepage": "http://idnaconv.net/",
"keywords": [
"idn",
"idna",
"php"
],
"support": {
"issues": "https://github.com/algo26-matthias/idna-convert/issues",
"source": "https://github.com/algo26-matthias/idna-convert/tree/v3.0.5"
},
"time": "2020-10-05T05:49:30+00:00"
},
{
"name": "jakeasmith/http_build_url",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/jakeasmith/http_build_url.git",
"reference": "93c273e77cb1edead0cf8bcf8cd2003428e74e37"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jakeasmith/http_build_url/zipball/93c273e77cb1edead0cf8bcf8cd2003428e74e37",
"reference": "93c273e77cb1edead0cf8bcf8cd2003428e74e37",
"shasum": ""
},
"type": "library",
"autoload": {
"files": [
"src/http_build_url.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jake A. Smith",
"email": "theman@jakeasmith.com"
}
],
"description": "Provides functionality for http_build_url() to environments without pecl_http.",
"support": {
"issues": "https://github.com/jakeasmith/http_build_url/issues",
"source": "https://github.com/jakeasmith/http_build_url"
},
"time": "2017-05-01T15:36:40+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.25.0",

10
ecrire/inc/distant.php

@ -10,6 +10,8 @@
* Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne. *
\***************************************************************************/
use Algo26\IdnaConvert\ToIdn;
/**
* Ce fichier gère l'obtention de données distantes
*
@ -381,9 +383,6 @@ function prepare_donnees_post($donnees, $boundary = '') {
/**
* Convertir une URL dont le host est en utf8 en ascii
* Utilise la librairie https://github.com/phlylabs/idna-convert/tree/v0.9.1
* dans sa derniere version compatible toutes version PHP 5
* La fonction PHP idn_to_ascii depend d'un package php5-intl et est rarement disponible
*
* @param string $url_idn
* @return array|string
@ -393,9 +392,8 @@ function url_to_ascii($url_idn) {
if ($parts = parse_url($url_idn)) {
$host = $parts['host'];
if (!preg_match(',^[a-z0-9_\.\-]+$,i', $host)) {
include_spip('inc/idna_convert.class');
$IDN = new idna_convert();
$host_ascii = $IDN->encode($host);
$converter = new ToIdn();
$host_ascii = $converter->convert($host);
$url_idn = explode($host, $url_idn, 2);
$url_idn = implode($host_ascii, $url_idn);
}

3465
ecrire/inc/idna_convert.class.php

File diff suppressed because it is too large Load Diff

1
phpcs.xml.dist

@ -3,7 +3,6 @@
<file>./ecrire</file>
<file>./prive</file>
<exclude-pattern>ecrire/lang/*</exclude-pattern>
<exclude-pattern>ecrire/inc/idna_convert.class.php</exclude-pattern>
<rule ref="SPIP41"/>

2
phpstan.neon.dist

@ -8,6 +8,4 @@ parameters:
excludePaths:
analyseAndScan:
- ecrire/lang
analyse:
- ecrire/inc/idna_convert.class.php
level: 0

Loading…
Cancel
Save