404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.118.37.224: ~ $
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;

/**
 * Converts Guzzle streams into PHP stream resources.
 *
 * @see https://www.php.net/streamwrapper
 */
final class StreamWrapper
{
    /** @var resource */
    public $context;

    /** @var StreamInterface */
    private $stream;

    /** @var string r, r+, or w */
    private $mode;

    /**
     * Returns a resource representing the stream.
     *
     * @param StreamInterface $stream The stream to get a resource for
     *
     * @return resource
     *
     * @throws \InvalidArgumentException if stream is not readable or writable
     */
    public static function getResource(StreamInterface $stream)
    {
        self::register();

        if ($stream->isReadable()) {
            $mode = $stream->isWritable() ? 'r+' : 'r';
        } elseif ($stream->isWritable()) {
            $mode = 'w';
        } else {
            throw new \InvalidArgumentException('The stream must be readable, '
                . 'writable, or both.');
        }

        return fopen('guzzle://stream', $mode, false, self::createStreamContext($stream));
    }

    /**
     * Creates a stream context that can be used to open a stream as a php stream resource.
     *
     * @return resource
     */
    public static function createStreamContext(StreamInterface $stream)
    {
        return stream_context_create([
            'guzzle' => ['stream' => $stream]
        ]);
    }

    /**
     * Registers the stream wrapper if needed
     */
    public static function register(): void
    {
        if (!in_array('guzzle', stream_get_wrappers())) {
            stream_wrapper_register('guzzle', __CLASS__);
        }
    }

    public function stream_open(string $path, string $mode, int $options, string &$opened_path = null): bool
    {
        $options = stream_context_get_options($this->context);

        if (!isset($options['guzzle']['stream'])) {
            return false;
        }

        $this->mode = $mode;
        $this->stream = $options['guzzle']['stream'];

        return true;
    }

    public function stream_read(int $count): string
    {
        return $this->stream->read($count);
    }

    public function stream_write(string $data): int
    {
        return $this->stream->write($data);
    }

    public function stream_tell(): int
    {
        return $this->stream->tell();
    }

    public function stream_eof(): bool
    {
        return $this->stream->eof();
    }

    public function stream_seek(int $offset, int $whence): bool
    {
        $this->stream->seek($offset, $whence);

        return true;
    }

    /**
     * @return resource|false
     */
    public function stream_cast(int $cast_as)
    {
        $stream = clone($this->stream);
        $resource = $stream->detach();

        return $resource ?? false;
    }

    /**
     * @return array<int|string, int>
     */
    public function stream_stat(): array
    {
        static $modeMap = [
            'r'  => 33060,
            'rb' => 33060,
            'r+' => 33206,
            'w'  => 33188,
            'wb' => 33188
        ];

        return [
            'dev'     => 0,
            'ino'     => 0,
            'mode'    => $modeMap[$this->mode],
            'nlink'   => 0,
            'uid'     => 0,
            'gid'     => 0,
            'rdev'    => 0,
            'size'    => $this->stream->getSize() ?: 0,
            'atime'   => 0,
            'mtime'   => 0,
            'ctime'   => 0,
            'blksize' => 0,
            'blocks'  => 0
        ];
    }

    /**
     * @return array<int|string, int>
     */
    public function url_stat(string $path, int $flags): array
    {
        return [
            'dev'     => 0,
            'ino'     => 0,
            'mode'    => 0,
            'nlink'   => 0,
            'uid'     => 0,
            'gid'     => 0,
            'rdev'    => 0,
            'size'    => 0,
            'atime'   => 0,
            'mtime'   => 0,
            'ctime'   => 0,
            'blksize' => 0,
            'blocks'  => 0
        ];
    }
}

Filemanager

Name Type Size Permission Actions
Exception Folder 0755
AppendStream.php File 5.84 KB 0755
BufferStream.php File 3.17 KB 0755
CachingStream.php File 4.42 KB 0755
DroppingStream.php File 1.12 KB 0755
FnStream.php File 4.38 KB 0755
Header.php File 2.04 KB 0755
HttpFactory.php File 3.02 KB 0755
InflateStream.php File 1.3 KB 0755
LazyOpenStream.php File 899 B 0755
LimitStream.php File 4.14 KB 0755
Message.php File 8.01 KB 0755
MessageTrait.php File 6.46 KB 0755
MimeType.php File 4.2 KB 0755
MultipartStream.php File 4.67 KB 0755
NoSeekStream.php File 470 B 0755
PumpStream.php File 4.5 KB 0755
Query.php File 3.55 KB 0755
Request.php File 3.81 KB 0755
Response.php File 4.79 KB 0755
Rfc7230.php File 665 B 0755
ServerRequest.php File 9.36 KB 0755
Stream.php File 7.12 KB 0755
StreamDecoratorTrait.php File 3.28 KB 0755
StreamWrapper.php File 4.01 KB 0755
UploadedFile.php File 4.75 KB 0755
Uri.php File 21.33 KB 0755
UriNormalizer.php File 8.22 KB 0755
UriResolver.php File 8.36 KB 0755
Utils.php File 13.91 KB 0755