403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.145
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/inetpub/wwwroot/AIWEBSTATION/wp-content/plugins/fluent-crm/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/inetpub/wwwroot/AIWEBSTATION/wp-content/plugins/fluent-crm/app/Http/Controllers/Controller.php
<?php

namespace FluentCrm\App\Http\Controllers;

use FluentCrm\App\App;
use FluentCrm\Framework\Validator\ValidationException;
use FluentCrm\Framework\Validator\Validator;

/**
 *  abstract REST API Controller Class
 *
 *  REST API Handler
 *
 * @package FluentCrm\App\Http
 *
 * @version 1.0.0
 */
abstract class Controller
{
    /**
     * @var \FluentCrm\App\App
     */
    protected $app = null;

    /**
     * @var \FluentCrm\Framework\Http\Request\Request
     */
    protected $request = null;

    /**
     * @var \FluentCrm\Framework\Http\Response\Response
     */
    protected $response = null;

    public function __construct()
    {
        $this->app = App::getInstance();
        $this->request = $this->app['request'];
        $this->response = $this->app['response'];
    }

    public function validate($data, $rules, $messages = [])
    {
        $validator = new Validator($data, $rules, $messages);

        if ($validator->validate()->fails()) {
            // Sanitize validation error messages before returning them
            $errors = $validator->errors();
            if (is_array($errors)) {
                array_walk_recursive($errors, function (&$value) {
                    if (is_string($value)) {
                        $value = sanitize_text_field($value);
                    }
                });
            }

            // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- Sanitization is already done above
            throw new ValidationException(
                esc_html__('Unprocessable Entity!', 'fluent-crm'),
                422,
                null,
                $errors
            );
        }

        return $data;
    }

    public function send($data = null, $code = 200)
    {
        return $this->response->send($data, $code);
    }

    public function sendSuccess($data = null, $code = 200)
    {
        return $this->response->sendSuccess($data, $code);
    }

    public function sendError($data = null, $code = 422)
    {
        return $this->response->sendError($data, $code);
    }

    public function validationErrors($data = null, $code = 422)
    {
        if ($data instanceof ValidationException) {
            $data = $data->errors();
        }

        // Sanitize error payload before sending the response to prevent unescaped output
        if (is_array($data)) {
            array_walk_recursive($data, function (&$value) {
                if (is_string($value)) {
                    $value = sanitize_text_field($value);
                }
            });
        } elseif (is_string($data)) {
            $data = sanitize_text_field($data);
        }

        return $this->sendError($data, $code);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit