403Webshell
Server IP : 43.141.49.107  /  Your IP : 113.219.202.173
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-vip-redeem/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/www.ucppt.com/wp-content/plugins/wpcom-vip-redeem/includes/class-admin.php
<?php
defined( 'ABSPATH' ) || exit;

class WVRD_Admin {

    public function __construct() {
        add_action( 'admin_menu', array( $this, 'register_menu' ) );
        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
        add_action( 'admin_init', array( $this, 'handle_row_action' ) );
        add_action( 'admin_post_wvrd_generate', array( $this, 'handle_generate' ) );
        add_action( 'admin_post_wvrd_export', array( $this, 'handle_export' ) );
        add_action( 'admin_post_wvrd_save_desc', array( $this, 'handle_save_desc' ) );
        add_action( 'admin_post_wvrd_bulk_delete', array( $this, 'handle_bulk_delete' ) );
        add_action( 'admin_post_wvrd_bulk_disable', array( $this, 'handle_bulk_disable' ) );
        add_action( 'admin_post_wvrd_bulk_enable', array( $this, 'handle_bulk_enable' ) );
    }

    public function handle_row_action() {
        if ( ! isset( $_GET['page'], $_GET['action'], $_GET['id'], $_GET['_wpnonce'] ) ) return;
        if ( $_GET['page'] !== 'wvrd-codes' ) return;
        if ( ! current_user_can( 'manage_options' ) ) return;

        $action = sanitize_text_field( $_GET['action'] );
        $id     = intval( $_GET['id'] );

        if ( ! in_array( $action, array( 'disable', 'enable', 'delete' ) ) ) return;
        if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'wvrd_action_' . $id ) ) return;

        if ( $action === 'disable' ) WVRD_Redeem::update_status( $id, 2 );
        if ( $action === 'enable' )  WVRD_Redeem::update_status( $id, 0 );
        if ( $action === 'delete' )  WVRD_Redeem::delete_code( $id );

        wp_redirect( admin_url( 'admin.php?page=wvrd-codes&updated=1' ) );
        exit;
    }

    public function register_menu() {
        add_submenu_page(
            'wpcom-member-pro',
            '兑换码管理',
            '兑换码管理',
            'manage_options',
            'wvrd-codes',
            array( $this, 'page_codes' )
        );
    }

    public function enqueue_assets( $hook ) {
        if ( strpos( $hook, 'wvrd-codes' ) === false ) return;
        wp_enqueue_style( 'wvrd-admin', WVRD_URL . 'assets/admin.css', array(), WVRD_VERSION );
        wp_enqueue_script( 'wvrd-admin', WVRD_URL . 'assets/admin.js', array( 'jquery' ), WVRD_VERSION, true );
    }

    public function page_codes() {
        $vip_types = \WPCOM\Member\VIP::get_vip_types();
        $lifetimes = WVRD_Redeem::$lifetimes;

        $search   = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
        $status   = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : 'all';
        $page     = isset( $_GET['paged'] ) ? intval( $_GET['paged'] ) : 1;
        $result   = WVRD_Redeem::get_codes( array( 'search' => $search, 'status' => $status, 'page' => $page, 'per_page' => 20 ) );
        $items    = $result['items'];
        $total    = $result['total'];
        $pages    = ceil( $total / 20 );

        $status_labels = array( 'all' => '全部', '0' => '未使用', '1' => '已使用', '2' => '已禁用' );
        include WVRD_PATH . 'templates/admin-page.php';
    }

    public function handle_generate() {
        check_admin_referer( 'wvrd_generate' );
        if ( ! current_user_can( 'manage_options' ) ) wp_die( '权限不足' );

        $vip_type    = sanitize_text_field( $_POST['vip_type'] );
        $vip_lifetime = sanitize_text_field( $_POST['vip_lifetime'] );
        $count       = min( 500, max( 1, intval( $_POST['count'] ) ) );
        $expired_at  = sanitize_text_field( $_POST['expired_at'] );
        $remark      = sanitize_text_field( $_POST['remark'] );

        WVRD_Redeem::generate_codes( $vip_type, $vip_lifetime, $count, $expired_at, $remark );
        wp_redirect( admin_url( 'admin.php?page=wvrd-codes&generated=' . $count ) );
        exit;
    }

    public function handle_bulk_enable() {
        check_admin_referer( 'wvrd_bulk_delete' );
        if ( ! current_user_can( 'manage_options' ) ) wp_die( '权限不足' );

        $ids = isset( $_POST['ids'] ) ? array_map( 'intval', (array) $_POST['ids'] ) : array();
        foreach ( $ids as $id ) {
            if ( $id > 0 ) WVRD_Redeem::update_status( $id, 0 );
        }
        wp_redirect( admin_url( 'admin.php?page=wvrd-codes&updated=1' ) );
        exit;
    }

    public function handle_bulk_disable() {
        check_admin_referer( 'wvrd_bulk_delete' );
        if ( ! current_user_can( 'manage_options' ) ) wp_die( '权限不足' );

        $ids = isset( $_POST['ids'] ) ? array_map( 'intval', (array) $_POST['ids'] ) : array();
        foreach ( $ids as $id ) {
            if ( $id > 0 ) WVRD_Redeem::update_status( $id, 2 );
        }
        wp_redirect( admin_url( 'admin.php?page=wvrd-codes&updated=1' ) );
        exit;
    }

    public function handle_bulk_delete() {
        check_admin_referer( 'wvrd_bulk_delete' );
        if ( ! current_user_can( 'manage_options' ) ) wp_die( '权限不足' );

        $ids = isset( $_POST['ids'] ) ? array_map( 'intval', (array) $_POST['ids'] ) : array();
        $count = 0;
        foreach ( $ids as $id ) {
            if ( $id > 0 ) {
                WVRD_Redeem::delete_code( $id );
                $count++;
            }
        }
        wp_redirect( admin_url( 'admin.php?page=wvrd-codes&deleted=' . $count ) );
        exit;
    }

    public function handle_save_desc() {
        check_admin_referer( 'wvrd_save_desc' );
        if ( ! current_user_can( 'manage_options' ) ) wp_die( '权限不足' );
        update_option( 'wvrd_redeem_desc', wp_kses_post( $_POST['wvrd_redeem_desc'] ) );
        wp_redirect( admin_url( 'admin.php?page=wvrd-codes&desc_saved=1' ) );
        exit;
    }
}


Youez - 2016 - github.com/yon3zu
LinuXploit