!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.17 GB of 57.97 GB (22.73%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     Replace.php (4.8 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\Cell\DataType;
use 
PhpOffice\PhpSpreadsheet\Shared\StringHelper;

class 
Replace
{
    use 
ArrayEnabled;

    
/**
     * REPLACE.
     *
     * @param mixed $oldText The text string value to modify
     *                         Or can be an array of values
     * @param mixed $start Integer offset for start character of the replacement
     *                         Or can be an array of values
     * @param mixed $chars Integer number of characters to replace from the start offset
     *                         Or can be an array of values
     * @param mixed $newText String to replace in the defined position
     *                         Or can be an array of values
     *
     * @return array|string
     *         If an array of values is passed for either of the arguments, then the returned result
     *            will also be an array with matching dimensions
     */
    
public static function replace($oldText$start$chars$newText)
    {
        if (
is_array($oldText) || is_array($start) || is_array($chars) || is_array($newText)) {
            return 
self::evaluateArrayArguments([self::class, __FUNCTION__], $oldText$start$chars$newText);
        }

        try {
            
$start Helpers::extractInt($start10true);
            
$chars Helpers::extractInt($chars00true);
            
$oldText Helpers::extractString($oldTexttrue);
            
$newText Helpers::extractString($newTexttrue);
            
$left StringHelper::substring($oldText0$start 1);

            
$right StringHelper::substring($oldText$start $chars 1null);
        } catch (
CalcExp $e) {
            return 
$e->getMessage();
        }
        
$returnValue $left $newText $right;
        if (
StringHelper::countCharacters($returnValue) > DataType::MAX_STRING_LENGTH) {
            
$returnValue ExcelError::VALUE();
        }

        return 
$returnValue;
    }

    
/**
     * SUBSTITUTE.
     *
     * @param mixed $text The text string value to modify
     *                         Or can be an array of values
     * @param mixed $fromText The string value that we want to replace in $text
     *                         Or can be an array of values
     * @param mixed $toText The string value that we want to replace with in $text
     *                         Or can be an array of values
     * @param mixed $instance Integer instance Number for the occurrence of frmText to change
     *                         Or can be an array of values
     *
     * @return array|string
     *         If an array of values is passed for either of the arguments, then the returned result
     *            will also be an array with matching dimensions
     */
    
public static function substitute($text ''$fromText ''$toText ''$instance null)
    {
        if (
is_array($text) || is_array($fromText) || is_array($toText) || is_array($instance)) {
            return 
self::evaluateArrayArguments([self::class, __FUNCTION__], $text$fromText$toText$instance);
        }

        try {
            
$text Helpers::extractString($texttrue);
            
$fromText Helpers::extractString($fromTexttrue);
            
$toText Helpers::extractString($toTexttrue);
            if (
$instance === null) {
                
$returnValue str_replace($fromText$toText$text);
            } else {
                if (
is_bool($instance)) {
                    if (
$instance === false || Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_OPENOFFICE) {
                        return 
ExcelError::Value();
                    }
                    
$instance 1;
                }
                
$instance Helpers::extractInt($instance10true);
                
$returnValue self::executeSubstitution($text$fromText$toText$instance);
            }
        } catch (
CalcExp $e) {
            return 
$e->getMessage();
        }
        if (
StringHelper::countCharacters($returnValue) > DataType::MAX_STRING_LENGTH) {
            
$returnValue ExcelError::VALUE();
        }

        return 
$returnValue;
    }

    private static function 
executeSubstitution(string $textstring $fromTextstring $toTextint $instance): string
    
{
        
$pos = -1;
        while (
$instance 0) {
            
$pos mb_strpos($text$fromText$pos 1'UTF-8');
            if (
$pos === false) {
                return 
$text;
            }
            --
$instance;
        }

        return 
Functions::scalar(self::REPLACE($text, ++$posStringHelper::countCharacters($fromText), $toText));
    }
}

:: 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.0059 ]--