OXIESEC PANEL
- Current Dir:
/
/
usr
/
share
/
php
/
Composer
/
Util
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
07/20/2024 06:32:22 AM
rwxr-xr-x
📄
AuthHelper.php
1.66 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
Bitbucket.php
8.38 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
ComposerMirror.php
1.75 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
ConfigValidator.php
5.45 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
ErrorHandler.php
2.24 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
Filesystem.php
21.29 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
Git.php
14.3 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
GitHub.php
4.52 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
GitLab.php
5.42 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
IniHelper.php
1.91 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
NoProxyPattern.php
4.07 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
Perforce.php
16.72 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
Platform.php
2.54 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
ProcessExecutor.php
5.49 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
RemoteFilesystem.php
41.17 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
Silencer.php
2.12 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
SpdxLicense.php
570 bytes
01/31/2018 03:28:18 PM
rw-r--r--
📄
StreamContextFactory.php
7.13 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
Svn.php
9.31 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
TlsHelper.php
6.51 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
Url.php
2.86 KB
01/31/2018 03:28:18 PM
rw-r--r--
Editing: Url.php
Close
<?php /* * This file is part of Composer. * * (c) Nils Adermann <naderman@naderman.de> * Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Util; use Composer\Config; use Composer\IO\IOInterface; /** * @author Jordi Boggiano <j.boggiano@seld.be> */ class Url { public static function updateDistReference(Config $config, $url, $ref) { $host = parse_url($url, PHP_URL_HOST); if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') { if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) { // update legacy github archives to API calls with the proper reference $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref; } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) { // update current github web archives to API calls with the proper reference $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref; } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) { // update api archives to the proper reference $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref; } } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') { if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) { // update Bitbucket archives to the proper reference $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4]; } } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') { if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) { // update Gitlab archives to the proper reference $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref; } } elseif (in_array($host, $config->get('github-domains'), true)) { $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url); } elseif (in_array($host, $config->get('gitlab-domains'), true)) { $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url); } return $url; } }