403Webshell
Server IP : 43.141.49.119  /  Your IP : 113.219.202.44
Web Server : Apache
System : Linux VM-8-5-opencloudos 6.6.34-9.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 19 19:35:45 CST 2024 x86_64
User : www ( 1000)
PHP Version : 8.1.27
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 : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/wwwroot/www.ucppt.com/wp-content/plugins/wpcom-member-pro/payment/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/www.ucppt.com/wp-content/plugins/wpcom-member-pro/payment/wallet.php
<?php
namespace WPCOM\Member\Payments;
use WPCOM\Member\Order;

defined('ABSPATH') || exit;

class Wallet extends Payment{
    public $balance;
    public function __construct() {
        $this->id = 'wallet';
        $this->title = '钱包余额';
        $this->modal = true;
        $this->icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 18"><path d="M20.005 3h-7a6 6 0 1 0 0 12h7v2a1 1 0 0 1-1 1h-18a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v2zm-7 2h8v8h-8a4 4 0 1 1 0-8zm0 3v2h3V8h-3z"/></svg>';
        $this->color = 'var(--member-color,var(--theme-color,#206be7))';

        add_action('wp_ajax_wpcom_wallet_pay', array($this, 'paynow'));
        add_action('wp_ajax_nopriv_wpcom_wallet_pay', array($this, 'paynow'));
        parent::__construct();
    }

    function add_gateway($methods) {
        $user = wp_get_current_user();
        if($this->id && $user && isset($user->ID) && $user->ID){
            $methods[$this->id] = $this;
        }
        return $methods;
    }

    public function process_payment($order_id) {
        $url = Order::get_checkout_payment_url($order_id);
        return array(
            'result' => 'success',
            'redirect' =>  $url,
            'height' => '320px',
            'modal-size' => 'modal-sm'
        );
    }

    public function receipt_page($order_id) {
        $order = Order::get_order($order_id);
        if (!$order || $order->status === 'paid') return;
        $user = wp_get_current_user();
        if($user && isset($user->ID) && $user->ID){
            $balance = $this->get_balance();
            if(is_numeric($balance)){
                $price = $order->price;
                if(is_numeric($price) && $price > 0){
                    if($balance >= $price){ ?>
                        <div style="color: #666;font-size: 14px;line-height: 1;">可用余额<span style="display: block;margin-top: 6px;font-size: 24px;font-weight:500;color: #f76142;">¥<?php echo $balance;?></span></div>
                        <button type="button" class="btn btn-view btn-pay">立即支付</button>
                        <script src="<?php echo includes_url('js/jquery/jquery.min.js'); ?>"></script>
                        <script>
                            _ajax_url = "<?php echo admin_url( 'admin-ajax.php');?>";
                            _nonce = "<?php echo wp_create_nonce('wpcom_wallet_receipt_page');?>";
                            jQuery(function ($) {
                                $(document.body).on('click', '.btn', function(){
                                    var $btn = $(this);
                                    if($btn.hasClass('loading')) return false;
                                    $btn.addClass('loading').html('支付中,请稍候...');
                                    jQuery.ajax({
                                        type: 'POST',
                                        url: _ajax_url,
                                        dataType: 'json',
                                        data: {
                                            order_id: <?php echo $order_id; ?>,
                                            action: 'wpcom_wallet_pay',
                                            nonce: _nonce
                                        }
                                    }).done(function (data) {
                                        $btn.removeClass('loading').html('立即支付');
                                        if (data && data.redirect) {
                                            location.href = data.redirect;
                                            if(window.parent) window.parent.document.getElementById('wpcom-pay-iframe').style.height = '460px'
                                        } else {
                                            alert('支付异常,请稍候再试或者联系管理员获取帮助');
                                        }
                                    });
                                });
                            })
                        </script>
                    <?php }else{
                        $wallet_url = wpcom_subpage_url('wallet');
                        echo '<div class="text-center" style="color:#f66;"><p style="margin-bottom: .3em;">钱包余额不足!</p>请先充值或者使用用其他支付方式进行支付。</div><a class="btn btn-view" target="_blank" href="' . esc_url($wallet_url) . '">进入我的钱包充值 <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5742" width="128" height="128"><path d="M690.005333 469.333333l-228.864-228.864 60.330667-60.330666L853.333333 512l-331.861333 331.861333-60.330667-60.330666L690.005333 554.666667H170.666667v-85.333334z" p-id="5743"></path></svg></a>';
                    }
                }else{
                    echo '<div class="text-center" style="color:#f66;">订单价格异常</div>';
                }
            }else{
                echo '<div class="text-center" style="color:#f66;">余额获取失败</div>';
            }
        }else{
            echo '<div class="text-center" style="color:#f66;">请登录后再试</div>';
        }
    }

    function paynow(){
        $res = array('result' => -1);
        $order_id = isset($_POST['order_id']) && $_POST['order_id'] ? $_POST['order_id'] : '';
        $nonce = isset($_POST['nonce']) && $_POST['nonce'] ? $_POST['nonce'] : '';
        if($nonce && wp_verify_nonce($nonce, 'wpcom_wallet_receipt_page')){
            $order = $order_id ? Order::get_order($order_id) : '';
            $user_id = get_current_user_id();
            if ($order && isset($order->ID)) {
                $res['redirect'] = Order::get_checkout_return_url($order->ID, $this->id);
                self::add_log('#'.$order->number.' 提交余额支付请求', $this->id);
            }
            if($user_id && $order && isset($order->ID) && $order->number && (int) $order->user === $user_id){
                $balance = $this->get_balance();
                if(is_numeric($balance)){
                    $price = $order->price;
                    if(is_numeric($price) && $price > 0 && $balance >= $price && $order->status === 'unpaid'){
                        $title = $this->get_order_title($order);
                        $use_balance = \WPCOM\Member\Wallet::use_balance(-($price), $user_id, $title);
                        if($use_balance){
                            $res['result'] = 0;
                            Order::payment_complete($order->ID,  $this->id);
                            self::add_log('#'.$order->number.' 订单支付完成!', $this->id);
                        }
                    }
                }
            }
        }
        wp_send_json($res);
    }

    function get_balance(){
        $user = wp_get_current_user();
        if($user && isset($user->ID) && $user->ID){
            $balance = get_user_option( '_wpcom_balance', $user->ID );
            if($balance === '' || $balance === false) $balance = '0.00';
            return $balance;
        }
    }
}

new Wallet();

Youez - 2016 - github.com/yon3zu
LinuXploit