403Webshell
Server IP : 45.77.68.45  /  Your IP : 127.0.0.100
Web Server : PHPix/0.2.2 (Caddy compatible)
System : wasi wasmer.sh 0.0.0 0.0.0 wasm32
User :  ( 1)
PHP Version : 8.3.21
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /app/wp-content/plugins/wp-wasmer/wasmer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /app/wp-content/plugins/wp-wasmer/wasmer/admin.php
<?php

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly.
}

function wasmer_icon() {
    $svg_icon = '<svg viewBox="0 0 29 34" height="1em" width="1em"  fill="currentColor" style="vertical-align:middle;">
                        <g clip-path="url(#prefix__clip0_1268_12249)">
                            <path d="M0 12.3582C0 10.4725 0 9.52973 0.507307 9.23683C1.01461 8.94394 1.83111 9.41534 3.46411 10.3581L10.784 14.5843C12.417 15.5271 13.2335 15.9985 13.7408 16.8771C14.2481 17.7558 14.2481 18.6986 14.2481 20.5843V29.0364C14.2481 30.9221 14.2481 31.8649 13.7408 32.1578C13.2335 32.4507 12.417 31.9793 10.784 31.0365L3.4641 26.8103C1.83111 25.8675 1.01461 25.3961 0.507307 24.5175C0 23.6388 0 22.696 0 20.8103V12.3582Z"></path>
                            <path fill-rule="evenodd" clip-rule="evenodd" d="M7.46147 5.14203C6.95416 5.43492 6.95416 6.37773 6.95416 8.26335V9.18177L13.9688 13.2317C15.6018 14.1745 16.4183 14.6459 16.9256 15.5246C17.433 16.4032 17.433 17.346 17.433 19.2317V26.7654L17.7382 26.9416C19.3711 27.8845 20.1876 28.3559 20.695 28.063C21.2023 27.7701 21.2023 26.8273 21.2023 24.9416V16.4894C21.2023 14.6038 21.2023 13.661 20.695 12.7823C20.1876 11.9037 19.3711 11.4323 17.7382 10.4895L10.4183 6.26334C8.78527 5.32054 7.96878 4.84914 7.46147 5.14203Z"></path>
                            <path fill-rule="evenodd" clip-rule="evenodd" d="M14.5533 1.05023C14.046 1.34313 14.046 2.28594 14.046 4.17156V5.09003L21.0607 9.13993C22.6937 10.0827 23.5102 10.5541 24.0175 11.4328C24.5248 12.3115 24.5248 13.2543 24.5248 15.1399V22.6736L24.83 22.8499C26.463 23.7927 27.2795 24.2641 27.7868 23.9712C28.2941 23.6783 28.2941 22.7355 28.2941 20.8498V12.3976C28.2941 10.512 28.2941 9.56922 27.7868 8.69054C27.2795 7.81187 26.463 7.34046 24.83 6.39766L17.5101 2.17155C15.8771 1.22874 15.0606 0.757338 14.5533 1.05023Z"></path>
                        </g>
                        <defs>
                            <clipPath id="prefix__clip0_1268_12249">
                                <path fill="#fff" d="M0 0h29v36H0z"></path>
                            </clipPath>
                        </defs>
                    </svg>';
    return $svg_icon;
}

function wasmer_app_dashboard_url($app_id) {
    return wasmer_base_url().'/id/'.$app_id;
}

function wasmer_app_dashboard_wp_settings_url($app_id) {
    return wasmer_app_dashboard_url($app_id) . '/settings/wordpress';
}

function wasmer_claim_app_url($app_id) {
    return wasmer_base_url().'/apps/claim/'.$app_id;
}

function get_perishable_time() {
    if (!WASMER_PERISHABLE_TIMESTAMP) {
        return null;
    }
    if (is_numeric(WASMER_PERISHABLE_TIMESTAMP)) {
        return intval(WASMER_PERISHABLE_TIMESTAMP);
    }
    $datetime = new DateTimeImmutable(WASMER_PERISHABLE_TIMESTAMP);
    if ($datetime) {
        return $datetime->getTimestamp();
    }
    return null;
}

function get_perishable_time_left() {
    $perishable_time = get_perishable_time();
    if (!$perishable_time) {
        return null;
    }
    $current_time = time();
    $time_left = $perishable_time - $current_time;
    if ($time_left > 0) {
        $time_left_text = '';
        if ($time_left > 86400) { // More than a day
            $days = floor($time_left / 86400);
            $time_left_text = $days . ' day' . ($days > 1 ? 's' : '');
        } elseif ($time_left >= 3600-60) { // More than an hour
            $hours = floor($time_left / 3600);
            $time_left_text = $hours . ' hour' . ($hours > 1 ? 's' : '');
        } elseif ($time_left > 60-10) { // More than a minute
            $minutes = floor($time_left / 60);
            $time_left_text = $minutes . ' minute' . ($minutes > 1 ? 's' : '');
        } else {
            $time_left_text = 'seconds';
        }
        return $time_left_text;
    }
    return null;
}

function wasmer_add_top_bar_menu($admin_bar) {
    if (!is_user_logged_in() || !is_admin()) {
        return;
    }

    // Calculate time left based on WASMER_PERISHABLE_TIMESTAMP
    $notification_preview = '';
    $notification_html = '';
    $time_left = get_perishable_time_left();
    if ($time_left) {
        $notification_preview = ' <span class="awaiting-mod" style="display: inline-block; vertical-align: middle; margin: -2px 0 0 2px; padding: 0 5px; min-width: 7px; height: 17px; border-radius: 11px; background-color: #d63638; color: #fff; font-size: 9px; line-height: 17px; text-align: center; z-index: 26;">!</span>';
        $notification_html = ' <span class="awaiting-mod" style="display: inline-block; vertical-align: middle; margin: -2px 0 0 2px; padding: 0 5px; min-width: 7px; height: 17px; border-radius: 11px; background-color: #d63638; color: #fff; font-size: 9px; line-height: 17px; text-align: center; z-index: 26;">App expiring in ' . $time_left . '</span>';
    }

    // Add the main Wasmer menu
    $admin_bar->add_menu(array(
        'id'    => 'wasmer-top-menu',
        'title' => wasmer_icon() . ' Wasmer' . $notification_preview, // Display the SVG icon with the menu title and notification
        // 'href'  => admin_url('admin.php?page=wasmer-dashboard'), // Link to the Wasmer Dashboard
        'meta'  => array(
            'title' => 'Wasmer Dashboard', // Tooltip
            // 'html'  => $svg_icon,         // Custom HTML for icon
        ),
    ));

    // Add a submenu
    // $admin_bar->add_menu(array(
    //     'id'     => 'wasmer-dashboard-submenu',
    //     'parent' => 'wasmer-top-menu', // Attach to the main Wasmer menu
    //     'title'  => 'Dashboard',
    //     'href'   => admin_url('admin.php?page=wasmer-dashboard'),
    //     'meta'   => array(
    //         'title' => 'Go to Wasmer Dashboard', // Tooltip
    //     ),
    // ));

    if ($time_left) {
        $admin_bar->add_menu(array(
            'id'     => 'wasmer-dashboard-claim',
            'parent' => 'wasmer-top-menu', // Attach to the main Wasmer menu
            'title'  => 'Claim app ' . $notification_html,
            'href'   => wasmer_claim_app_url(WASMER_APP_ID),
            'meta'   => array(
                'title' => 'Claim App to prevent expiration', // Updated tooltip with more information
            ),
        ));
    }

    // Add a submenu
    $admin_bar->add_menu(array(
        'id'     => 'wasmer-dashboard-external',
        'parent' => 'wasmer-top-menu', // Attach to the main Wasmer menu
        'title'  => 'Wasmer Control Panel',
        'href'   => wasmer_app_dashboard_url(WASMER_APP_ID),
        'meta'   => array(
            'title' => 'Go to Wasmer Control Panel', // Tooltip
            'rel' => 'noopener noreferrer',
        ),
    ));
}

// Function to add the menu and submenu
function wasmer_add_admin_menu() {
    global $submenu;

    $svg_icon = 'data:image/svg+xml;base64,' . base64_encode(wasmer_icon());

    add_menu_page(
        'Wasmer Dashboard', // Page title
        'Wasmer',           // Menu title
        'manage_options',   // Capability
        'wasmer-dashboard', // Menu slug
        'wasmer_dashboard_page', // Callback function
        $svg_icon,  // Icon (dashicons or URL to a custom icon)
        0                   // Position in menu
    );

    add_submenu_page(
        'wasmer-dashboard', // Parent slug
        'Dashboard',        // Page title
        'Dashboard',        // Submenu title
        'manage_options',   // Capability
        'wasmer-dashboard', // Menu slug
        'wasmer_dashboard_page' // Callback function
    );


    if (WASMER_APP_ID) {
        $submenu["wasmer-dashboard"][] = array('Wasmer Control Panel', 'manage_options', wasmer_app_dashboard_url(WASMER_APP_ID));
    }

    // Add a submenu linking to Wasmer.io
    // add_submenu_page(
    //     'wasmer-dashboard', // Parent slug
    //     'Visit Wasmer.io',  // Page title
    //     'Visit Wasmer.io', // Custom HTML in the submenu title
    //     'manage_options',   // Capability
    //     'wasmer-external',  // Menu slug
    //     'wasmer_external_link_page' // Callback function (for redirect)
    // );
}

function wasmer_add_dashboard_widget() {
    global $wp_meta_boxes;

    if (!WASMER_APP_ID) {
        return;
    }

    wp_add_dashboard_widget(
        'wasmer_manage_dashboard_widget',
        'Manage on Wasmer',
        'wasmer_dashboard_widget_display'
    );

    if (isset($wp_meta_boxes['dashboard']['normal']['core']['wasmer_manage_dashboard_widget'])) {
        $wasmer_widget = $wp_meta_boxes['dashboard']['normal']['core']['wasmer_manage_dashboard_widget'];
        unset($wp_meta_boxes['dashboard']['normal']['core']['wasmer_manage_dashboard_widget']);
        $wp_meta_boxes['dashboard']['normal']['core'] =
            array_merge(array('wasmer_manage_dashboard_widget' => $wasmer_widget), $wp_meta_boxes['dashboard']['normal']['core']);
    }
}

function wasmer_get_64_bit_required_plugins() {
    return [
        [
            'slug' => 'google-listings-and-ads',
            'label' => 'Google for WooCommerce',
            'names' => [
                'Google for WooCommerce',
                'Google Listings and Ads',
                'Google Listings & Ads',
            ],
        ],
        [
            'slug' => 'all-in-one-wp-migration',
            'label' => 'All-in-One WP Migration',
            'names' => [
                'All-in-One WP Migration',
            ],
        ],
        [
            'slug' => 'all-in-one-wp-migration-unlimited-extension',
            'label' => 'All-in-One WP Migration Unlimited Extension',
            'names' => [
                'All-in-One WP Migration Unlimited Extension',
            ],
        ],
        [
            'slug' => 'duplicator',
            'label' => 'Duplicator',
            'names' => [
                'Duplicator',
            ],
        ],
        [
            'slug' => 'backwpup',
            'label' => 'BackWPup',
            'names' => [
                'BackWPup',
            ],
        ],
    ];
}

function wasmer_get_active_64_bit_required_plugins() {
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }

    $required = wasmer_get_64_bit_required_plugins();
    $plugins = get_plugins();
    $matches = [];

    foreach ($plugins as $path => $plugin) {
        if (!is_plugin_active($path)) {
            continue;
        }
        $slug = dirname($path);
        if ($slug === '.') {
            $slug = basename($path, '.php');
        }
        $name = $plugin['Name'] ?? '';

        foreach ($required as $required_plugin) {
            $slug_match = $slug === $required_plugin['slug']
                || $path === $required_plugin['slug']
                || str_starts_with($path, $required_plugin['slug'] . '/');
            $name_match = in_array($name, $required_plugin['names'], true);
            if ($slug_match || $name_match) {
                $matches[] = $required_plugin['label'];
                break;
            }
        }
    }

    return array_values(array_unique($matches));
}

function wasmer_dashboard_widget_display() {
    $dashboard_url = wasmer_app_dashboard_url(WASMER_APP_ID);
    $wp_dashboard_url = $dashboard_url . "/settings/wordpress";
    $svg_icon = wasmer_icon();
    $wasmer_settings_url = wasmer_app_dashboard_wp_settings_url(WASMER_APP_ID);
    $claim_app_url = wasmer_claim_app_url(WASMER_APP_ID);
    $requires_64_bit = wasmer_get_active_64_bit_required_plugins();
    $time_left = get_perishable_time_left();
    ?>
    <?php if ($time_left) : ?>
        <div class="notice notice-error inline">
            <p>
                <strong>App expiring in <?= $time_left ?>.</strong>
                <a href="<?= esc_url($claim_app_url) ?>" rel="noopener noreferrer">Claim App to prevent expiration</a>.
            </p>
        </div>
    <?php endif; ?>
    <?php if (PHP_INT_SIZE !== 8 && !empty($requires_64_bit)) : ?>
        <div class="notice notice-warning inline">
            <p>
                <strong>64-bit PHP required.</strong>
                The following active plugins require 64-bit PHP:
                <?= esc_html(implode(', ', $requires_64_bit)) ?>.
                Please update your PHP version in the
                <a href="<?= esc_url($wasmer_settings_url) ?>" rel="noopener noreferrer">Wasmer WordPress Settings</a>.
            </p>
        </div>
    <?php endif; ?>
    <p>Manage this WordPress app from your Wasmer Control Panel.</p>
    <p>Update the WordPress and PHP version used, and the WordPress definitions from the <a href="<?= esc_url($wp_dashboard_url) ?>" rel="noopener noreferrer">Wasmer WordPress Settings</a>.</p>
    <p>
        <a class="button button-primary" href="<?= esc_url($dashboard_url) ?>" rel="noopener noreferrer">
            <?= $svg_icon ?> Wasmer Control Panel
        </a>
    </p>
    <?php
}

// Callback function for the external link submenu
function wasmer_external_link_page() {
    // Redirect to the Wasmer.io site
    wp_redirect('https://wasmer.io/');
    exit;
}


// Callback function for the dashboard page
function wasmer_dashboard_page() {
    if (!current_user_can('manage_options')) {
        return;
    }
    $svg_icon = wasmer_icon();
    ?>
    <div class="wrap">
        <h1><?= $svg_icon ?> Wasmer Dashboard</h1>
        <p>Welcome to the Wasmer plugin! Customize this dashboard as needed.</p>
    </div>
    <?php
}

Youez - 2016 - github.com/yon3zu
LinuXploit