!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/sms.picotech.app/public_html/vendor/laminas/laminas-diactoros/src/Response/   drwxr-xr-x
Free 26.58 GB of 117.98 GB (22.53%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

declare(strict_types=1);

namespace 
Laminas\Diactoros\Response;

use 
JsonException;
use 
Laminas\Diactoros\Exception;
use 
Laminas\Diactoros\Response;
use 
Laminas\Diactoros\Stream;

use function 
is_object;
use function 
is_resource;
use function 
json_encode;
use function 
sprintf;

use const 
JSON_HEX_AMP;
use const 
JSON_HEX_APOS;
use const 
JSON_HEX_QUOT;
use const 
JSON_HEX_TAG;
use const 
JSON_THROW_ON_ERROR;
use const 
JSON_UNESCAPED_SLASHES;

/**
 * JSON response.
 *
 * Allows creating a response by passing data to the constructor; by default,
 * serializes the data to JSON, sets a status code of 200 and sets the
 * Content-Type header to application/json.
 */
class JsonResponse extends Response
{
    use 
InjectContentTypeTrait;

    
/**
     * Default flags for json_encode
     *
     * @const int
     */
    
public const DEFAULT_JSON_FLAGS JSON_HEX_TAG
        
JSON_HEX_APOS
        
JSON_HEX_AMP
        
JSON_HEX_QUOT
        
JSON_UNESCAPED_SLASHES;

    
/** @var mixed */
    
private $payload;

    
/**
     * Create a JSON response with the given data.
     *
     * Default JSON encoding is performed with the following options, which
     * produces RFC4627-compliant JSON, capable of embedding into HTML.
     *
     * - JSON_HEX_TAG
     * - JSON_HEX_APOS
     * - JSON_HEX_AMP
     * - JSON_HEX_QUOT
     * - JSON_UNESCAPED_SLASHES
     *
     * @param mixed $data Data to convert to JSON.
     * @param int $status Integer status code for the response; 200 by default.
     * @param array $headers Array of headers to use at initialization.
     * @param int $encodingOptions JSON encoding options to use.
     * @throws Exception\InvalidArgumentException If unable to encode the $data to JSON.
     */
    
public function __construct(
        
$data,
        
int $status 200,
        array 
$headers = [],
        private 
int $encodingOptions self::DEFAULT_JSON_FLAGS
    
) {
        
$this->setPayload($data);

        
$json $this->jsonEncode($data$this->encodingOptions);
        
$body $this->createBodyFromJson($json);

        
$headers $this->injectContentType('application/json'$headers);

        
parent::__construct($body$status$headers);
    }

    
/**
     * @return mixed
     */
    
public function getPayload()
    {
        return 
$this->payload;
    }

    public function 
withPayload(mixed $data): JsonResponse
    
{
        
$new = clone $this;
        
$new->setPayload($data);
        return 
$this->updateBodyFor($new);
    }

    public function 
getEncodingOptions(): int
    
{
        return 
$this->encodingOptions;
    }

    public function 
withEncodingOptions(int $encodingOptions): JsonResponse
    
{
        
$new                  = clone $this;
        
$new->encodingOptions $encodingOptions;
        return 
$this->updateBodyFor($new);
    }

    private function 
createBodyFromJson(string $json): Stream
    
{
        
$body = new Stream('php://temp''wb+');
        
$body->write($json);
        
$body->rewind();

        return 
$body;
    }

    
/**
     * Encode the provided data to JSON.
     *
     * @throws Exception\InvalidArgumentException If unable to encode the $data to JSON.
     */
    
private function jsonEncode(mixed $dataint $encodingOptions): string
    
{
        if (
is_resource($data)) {
            throw new 
Exception\InvalidArgumentException('Cannot JSON encode resources');
        }

        
// Clear json_last_error()
        
json_encode(null);

        try {
            return 
json_encode($data$encodingOptions JSON_THROW_ON_ERROR);
        } catch (
JsonException $e) {
            throw new 
Exception\InvalidArgumentException(sprintf(
                
'Unable to encode data to JSON in %s: %s',
                
self::class,
                
$e->getMessage()
            ), 
0$e);
        }
    }

    private function 
setPayload(mixed $data): void
    
{
        if (
is_object($data)) {
            
$data = clone $data;
        }

        
$this->payload $data;
    }

    
/**
     * Update the response body for the given instance.
     *
     * @param self $toUpdate Instance to update.
     * @return JsonResponse Returns a new instance with an updated body.
     */
    
private function updateBodyFor(JsonResponse $toUpdate): JsonResponse
    
{
        
$json $this->jsonEncode($toUpdate->payload$toUpdate->encodingOptions);
        
$body $this->createBodyFromJson($json);
        return 
$toUpdate->withBody($body);
    }
}

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