!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/OTapi/otapiphpclient-master/src/   drwxr-xr-x
Free 12.92 GB of 57.97 GB (22.29%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     OtClientBulk.php (7.9 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace OtApiClient;

use 
JsonMachine\JsonMachine;
use 
JsonException;
use 
OtApiClient\ValuesObject\OtParameters;
use 
OtApiClient\ValuesObject\OtXmlItemParameters;

/**
 * Class OtClientBulk
 * @package OtapiClient
 */
class OtClientBulk extends OtApiClient
{
    
/*** @var bool */
    
private bool $returnWihoutCheck FALSE;
    
/*** @var bool */
    
private bool $returnItems FALSE;

    
/**
     * @param string|null $categoryId
     * @return string|null
     * @throws OtException
     */
    
public function getBriefCatalog(string $categoryId NULL): ?string
    
{
        
$data OtApi::request('GetBriefCatalog');
        if (
$data && $categoryId) {
            try {
                
$decoded json_decode($dataTRUE512JSON_THROW_ON_ERROR);
                if (isset(
$decoded['Result']['Roots'])) {
                    
$category                   $this->getBriefCatalogId($decoded['Result']['Roots'], $categoryId);
                    
$decoded['Result']['Roots'] = [=> $category];
                    
$data                       json_encode($decodedJSON_THROW_ON_ERROR);
                }
            } catch (
JsonException $e) {
                throw new 
OtException('answer decoded error');
            }
        }
        return 
$data;
    }

    
/**
     * @param array  $childs
     * @param string $categoryId
     * @return array|string|null
     * @throws OtException
     */
    
private function getBriefCatalogId(array $childsstring $categoryId): ?array
    {
        foreach (
$childs as $child) {
            if (
$child['Id'] === $categoryId) {
                return 
$child;
            }
            if (isset(
$child['Children'])) {
                
$findId $this->getBriefCatalogId($child['Children'], $categoryId);
                if (
$findId !== NULL) {
                    return 
$findId;
                }
            }
        }
        return 
NULL;
    }

    
/**
     * @param OtParameters        $parameters
     * @param OtXmlItemParameters $xmlParameters
     * @return string|null
     * @throws OtException
     */
    
public function runBulkSearchItems(OtParameters $parametersOtXmlItemParameters $xmlParameters): ?string
    
{
        
$data Otapi::request('RunBulkSearchItems'$parameters$xmlParameters);
        if (
$data) {
            try {
                
$decoded json_decode($dataTRUE512JSON_THROW_ON_ERROR);
                if (isset(
$decoded['ErrorCode']) && $decoded['ErrorCode'] === 'Ok') {
                    
$decoded['Result']['activityId'] = $decoded['Result']['Id']['Value'];
                    
$data                            json_encode($decodedJSON_THROW_ON_ERROR);
                }
            } catch (
JsonException $e) {
                throw new 
OtException('answer decoded error');
            }
        }
        return 
$data;
    }

    
/**
     * @param OtParameters        $parameters
     * @param OtXmlItemParameters $xmlParameters
     * @param bool                $asStream
     * @return string|NULL
     * @throws OtException
     */
    
public function getBulkSearch(OtParameters $parametersOtXmlItemParameters $xmlParametersbool $asStream FALSE): ?string
    
{
        
$data $this->runBulkSearchItems($parameters$xmlParameters);
        if (
$data) {
            try {
                
$decoded json_decode($dataTRUE512JSON_THROW_ON_ERROR);
                if (isset(
$decoded['ErrorCode']) && $decoded['ErrorCode'] === 'Ok') {
                    
$activityId $decoded['Result']['Id']['Value'];
                    
$bulkDone   FALSE;
                    while (
$bulkDone === FALSE) {
                        
$resultData $this->getBulkSearchItemsResult($activityId$asStream);
                        if (
$resultData === NULL) {
                            throw new 
OtException('bulk search failed');
                        }
                        if (
$this->returnItems === TRUE) {
                            return 
$resultData;
                        }
                        if ( ! 
str_contains($resultData'Result":{"IsFinished":false')) {
                            return 
$resultData;
                        }
                    }
                }
            } catch (
JsonException $e) {
                throw new 
OtException('answer decoded error');
            }
        }
        return 
NULL;
    }

    
/**
     * @param int                 $frameSize
     * @param OtXmlItemParameters $xmlParameters
     * @param bool                $asSteam
     * @return JsonMachine
     * @throws OtException
     */
    
public function getBulkSearchDecoded(int $frameSizeOtXmlItemParameters $xmlParametersbool $asSteam FALSE): JsonMachine
    
{
        
$parameters = new OtParameters();
        
$parameters->setFrameSize($frameSize);
        
$parameters->setFramePosition(0);
        
$this->returnWihoutCheck TRUE;
        
$this->returnItems       FALSE;
        if (
$asSteam) {
            
$stream $this->getBulkSearch($parameters$xmlParametersTRUE);
            
$items  JsonMachine::fromStream($stream'/Result/Items');;
        } else {
            
$items JsonMachine::fromString($this->getBulkSearch($parameters$xmlParameters), '/Result/Items');;
        }
        
$this->returnWihoutCheck FALSE;
        return 
$items;
    }

    
/**
     * @param string $activityId
     * @param bool   $asStream
     * @return string|resource|null
     * @throws OtException
     */
    
public function getBulkSearchItemsResult(string $activityIdbool $asStream FALSE)
    {
        
$params = new OtParameters();
        
$params->setActivityId($activityId);
        
$params->setGetResult(FALSE);
        
$data Otapi::request('GetBulkSearchItemsResult'$params);
        if (
$data !== NULL && str_contains($data'Result":{"IsFinished":true')) {
            
$params->setGetResult(TRUE);
            
$this->returnItems TRUE;
            return 
Otapi::request('GetBulkSearchItemsResult'$paramsNULL$asStream);
        }
        return 
$data;
    }

    
/**
     * @param array $itemIds
     * @return string|null
     * @throws OtException
     */
    
public function runBulkItems(array $itemIds): ?string
    
{
        
$params = new OtParameters();
        
$params->setIds($itemIds);
        
$data Otapi::request('RunBulkItems'$params);
        if (
$data) {
            try {
                
$decoded json_decode($dataTRUE512JSON_THROW_ON_ERROR);
                if (isset(
$decoded['ErrorCode']) && $decoded['ErrorCode'] === 'Ok') {
                    
$decoded['Result']['activityId'] = $decoded['Result']['Id']['Value'];
                    
$data                            json_encode($decodedJSON_THROW_ON_ERROR);
                }
            } catch (
JsonException $e) {
                throw new 
OtException('answer decoded error');
            }
        }
        return 
$data;
    }

    
/**
     * @param string $activityId
     * @param bool   $asSteam
     * @return string|resource|null
     * @throws OtException
     */
    
public function getBulkItemsResult(string $activityIdbool $asSteam FALSE)
    {
        
$params = new OtParameters();
        
$params->setActivityId($activityId);
        
$params->setGetResult(FALSE);
        
$data Otapi::request('GetBulkItemsResult'$params);
        if (
$data !== NULL && str_contains($data'Result":{"IsFinished":true')) {
            
$params->setGetResult(TRUE);
            
$this->returnItems TRUE;
            return 
Otapi::request('GetBulkItemsResult'$paramsNULL$asSteam);
        }
        return 
$data;
    }

    
/**
     * @param array $itemIds
     * @param bool  $asSteam
     * @return string|resource||null
     * @throws OtException
     */
    
public function getBulkItemsAtOnce(array $itemIdsbool $asSteam FALSE)
    {
        
$data $this->runBulkItems($itemIds);
        if (
$data) {
            try {
                
$decoded json_decode($dataTRUE512JSON_THROW_ON_ERROR);
                if (isset(
$decoded['ErrorCode']) && $decoded['ErrorCode'] === 'Ok') {
                    
$activityId $decoded['Result']['Id']['Value'];
                    
$bulkDone   FALSE;
                    while (
$bulkDone === FALSE) {
                        
$resultData $this->getBulkItemsResult($activityId$asSteam);
                        if (
$this->returnItems === TRUE) {
                            return 
$resultData;
                        }
                        if (
$resultData === NULL) {
                            throw new 
OtException('bulk items failed');
                        }
                        if ( ! 
str_contains($resultData'Result":{"IsFinished":false')) {
                            return 
$resultData;
                        }
                    }
                }
            } catch (
JsonException $e) {
                throw new 
OtException('answer decoded error');
            }
        }
        return 
NULL;
    }

    
/**
     * @param array $itemIds
     * @param bool  $asSteam
     * @return JsonMachine
     * @throws OtException
     */
    
public function getBulkItemsDecoded(array $itemIdsbool $asSteam FALSE): JsonMachine
    
{
        
$this->returnWihoutCheck TRUE;
        
$this->returnItems       FALSE;
        if (
$asSteam) {
            
$stream $this->getBulkItemsAtOnce($itemIdsTRUE);
            
$items  JsonMachine::fromStream($stream'/Result/Items');;
        } else {
            
$items JsonMachine::fromString($this->getBulkItemsAtOnce($itemIds), '/Result/Items');
        }
        
$this->returnWihoutCheck FALSE;
        return 
$items;
    }

}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0058 ]--