!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/apex_tdfonline/php/lib/rest/http/   drwxr-xr-x
Free 13.34 GB of 61.93 GB (21.54%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


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

namespace rest\http;

use 
rest\lib\rest_error;

/**
 * Configuraciones comunes de respuestas para REST
 */
class respuesta_rest extends respuesta
{
    protected static 
$not_found_message 'No se pudo encontrar el recurso en el servidor';

    
/**
     * GET de un recurso - Devuelve 200 si es existoso.
     * Si es falso retorna un error 404 Not Found
     * @param mixed $data Array si es exitoso, o false en caso de que no exista el recurso
     * @throws \rest\lib\rest_error
     * @return $this
     */
    
public function get($data)
    {
        if (
$data !== false){
            
$this->get_list($data);
        } else {
            
$this->not_found();
        }
        return 
$this;
    }

    
/**
     * GET a una lista - A diferencia del get(), siempre es exitoso, ya que una lista vacia es valida.
     */
    
public function get_list($data)
    {
        
$this->data $data;
        
$this->status 200;
        return 
$this;
    }

    
/**
     * POST a la lista. Data contiene un arreglo con el identificador del nuevo recurso
     */
    
public function post($data)
    {
        
$this->data $data;
        
$this->status 201//created
        
return $this;
        
//se podria incluir un header con un Location, pero hay que hacer una api para URLs primero
    
}

    
/**
     * PUT a un recurso. Retorna 204 sin contenido en caso de exito,
     * Si el recurso no existía, enviar un not_found()
     * @return $this
     */
    
public function put()
    {
        
$this->status 204//sin contenido
        
return $this;
    }

    
/**
     * Retorna un 204 si es exitoso.
     * Si el recurso no existía, enviar un not_found()
     * @internal param $exito
     */
    
public function delete()
    {
        
$this->put();
    }

    
/**
     * Ocurrió un error de negocio- validacion, falta de datos, datos incorrectos,
     * se adjunta un mensaje con indicaciones para corregir el mensaje.
     */
    
public function error_negocio($errores$status 400){
        
$this->data $errores;
        
$this->status $status//
        
return $this;
    }

    
/**
     * NO se encontró el recurso en el servidor
     */
    
public function not_found($mensaje ''$errores = array())
    {
        if (
$mensaje == '') {
            
$mensaje self::$not_found_message;
        }
        throw new 
rest_error(404$mensaje$errores);
    }

    
/**
     * Redirect
     */
    
public function redirect($url$status 302)
    {
        
$this->set_status($status);
        
$this->headers['Location'] = $url;
        return 
$this;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.6063 ]--