[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.21.105.222: ~ $
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing

namespace MailPoet\API\JSON;

if (!defined('ABSPATH')) exit;


use MailPoet\API\JSON\v1\RedirectResponse;
use MailPoet\Config\AccessControl;

abstract class Endpoint {
  const TYPE_POST = 'POST';
  const TYPE_GET = 'GET';

  public $permissions = [
    'global' => AccessControl::PERMISSION_MANAGE_SETTINGS,
    'methods' => [],
  ];

  protected static $getMethods = [];

  public function successResponse(
    $data = [], $meta = [], $status = Response::STATUS_OK
  ) {
    return new SuccessResponse($data, $meta, $status);
  }

  public function errorResponse(
    $errors = [], $meta = [], $status = Response::STATUS_NOT_FOUND
  ) {
    if (empty($errors)) {
      $errors = [
        Error::UNKNOWN => __('An unknown error occurred.', 'mailpoet'),
      ];
    }
    return new ErrorResponse($errors, $meta, $status);
  }

  public function badRequest($errors = [], $meta = []) {
    if (empty($errors)) {
      $errors = [
        Error::BAD_REQUEST => __('Invalid request parameters', 'mailpoet'),
      ];
    }
    return new ErrorResponse($errors, $meta, Response::STATUS_BAD_REQUEST);
  }

  public function redirectResponse($url) {
    return new RedirectResponse($url);
  }

  public function isMethodAllowed($name, $type) {
    // Block GET requests on POST endpoints, but allow POST requests on GET endpoints (some plugins
    // change REQUEST_METHOD to POST on GET requests, which caused them to be blocked)
    if ($type === self::TYPE_GET && !in_array($name, static::$getMethods)) {
      return false;
    }
    return true;
  }
}

Filemanager

Name Type Size Permission Actions
ResponseBuilders Folder 0755
v1 Folder 0755
API.php File 10.11 KB 0644
Endpoint.php File 1.61 KB 0644
Error.php File 445 B 0644
ErrorHandler.php File 740 B 0644
ErrorResponse.php File 921 B 0644
Response.php File 1.31 KB 0644
SuccessResponse.php File 519 B 0644
index.php File 6 B 0644