????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.191 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 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 : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/www.astacus.eu/wp-content/themes/Avada/includes/ |
Upload File : |
<?php
// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
exit( 'Direct script access denied.' );
}
/**
* Remote installer for premium plugins.
* This only works with our custom server plugin.
*
* @since 5.0.0
*/
class Avada_Remote_installer {
/**
* The remote API URL.
*
* @access private
* @var string
*/
private $api_url = 'http://updates.theme-fusion.com/';
/**
* The constructor.
*
* @access public
*/
public function __construct() {
$this->api_url = trailingslashit( $this->api_url );
}
/**
* Checks token against API
*
* @access private
* @param string $download The name of the download..
* @param string $token The token.
* @return false|string Returns false if invalid.
* If valid, then returns a nonce from the remote server.
*/
private function _get_nonce( $download, $token ) {
// Get any existing copy of our transient data.
if ( false === ( $saved_nonce = get_transient( 'avada_ri_' . $download . $token ) ) ) {
// It wasn't there, so regenerate the data and save the transient.
$url = $this->api_url . '?avada_action=request_download&item_name=' . urlencode( $download ) . '&token=' . $token;
$response = wp_remote_get( $url );
$body = wp_remote_retrieve_body( $response );
// Check for errors.
$error_responses = array(
'Product not defined' => 'download-undefined',
'Invalid Token' => 'invalid-token',
);
foreach ( $error_responses as $key => $value ) {
if ( false !== strpos( $body, $key ) ) {
return false;
}
}
$trimmed = trim( $body );
$parts = explode( '|', $body );
$saved_nonce = array();
if ( 2 === count( $parts ) ) {
$saved_nonce = array(
esc_attr( $parts[0] ),
esc_attr( $parts[1] ),
);
}
set_transient( 'avada_ri_' . $download . $token, $saved_nonce, 600 );
}
return $saved_nonce;
}
/**
* Gets the download URL for a plugin.
*
* @access public
* @since 5.0.0
* @param string $download The plugin to download.
* @return string|false
*/
public function get_package( $download ) {
// Try to get a cached response.
$download_src = get_transient( 'avada_remote_installer_package_' . $download );
// If we've got it cached, then return it.
if ( false !== $download_src ) {
return $download_src;
}
// Source is not cached, retrieve it and cache it.
// Check for token and then install if it's valid.
$nonces = $this->_get_nonce( $download, Avada()->registration->get_token() );
if ( false !== $nonces && Avada()->registration->is_registered() ) {
$api_args = array(
'avada_action' => 'get_download',
'item_name' => urlencode( $download ),
'nonce' => isset( $nonces[0] ) ? $nonces[0] : '',
't' => isset( $nonces[1] ) ? $nonces[1] : '',
);
$download_src = add_query_arg( $api_args, $this->api_url );
set_transient( 'avada_remote_installer_package_' . $download, $download_src, 300 );
return $download_src;
}
// Something went wrong, return false.
return false;
}
}