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/dom-schastya.ru/wp-content/plugins/optinmonster/OMAPI/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dom-schastya.ru/wp-content/plugins/optinmonster/OMAPI//ApiAuth.php
<?php
/**
 * Api Auth class.
 *
 * @since 2.6.5
 *
 * @package OMAPI
 * @author  Justin Sternberg
 */

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

/**
 * Api Auth class.
 *
 * @since 2.6.5
 */
class OMAPI_ApiAuth {

	/**
	 * Get the auth token from the DB..
	 *
	 * @since 2.6.5
	 *
	 * @return array  Auth token array.
	 */
	public static function get_token() {
		return get_option(
			'optinmonster_site_token',
			array(
				'expires' => 0,
				'tt'      => '',
			)
		);
	}

	/**
	 * Check if token exists in DB.
	 *
	 * @since 2.6.5
	 *
	 * @return boolean Whether it exists.
	 */
	public static function has_token() {
		$token = self::get_token();

		return ! empty( $token['expires'] ) && ! empty( $token['tt'] );
	}

	/**
	 * Get the tt value from the auth token (or generate the auth token).
	 *
	 * @since 2.6.5
	 *
	 * @return string  The tt value from the auth token.
	 */
	public static function get_tt() {
		$token = self::get_token();

		if ( empty( $token['tt'] ) ) {

			// if TT is empty, generate a new one, save it and then return it.
			$token = array(
				'expires' => time() + ( 2 * MINUTE_IN_SECONDS ),
				'tt'      => self::generate_tt(),
			);
			update_option( 'optinmonster_site_token', $token );
		}

		return $token['tt'];
	}

	/**
	 * Generate the tt value (long random string).
	 *
	 * @since 2.6.5
	 *
	 * @return string  Tt value.
	 */
	public static function generate_tt() {
		return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( '', true ) );
	}

	/**
	 * Validate whether given tt value matches auth token tt value,
	 * and whether the auth token has expired.
	 *
	 * @since 2.6.5
	 *
	 * @param  string $passed_tt The tt value to validate.
	 *
	 * @return bool              Whether tt value is validated with the token.
	 */
	public static function validate_token( $passed_tt = '' ) {
		if ( empty( $passed_tt ) ) {
			return false;
		}

		$token = self::get_token();
		if ( empty( $token ) ) {
			return false;
		}

		$expired = ! empty( $token['expires'] ) ? $token['expires'] < time() : true;
		$tt      = ! empty( $token['tt'] ) ? $token['tt'] : '';
		$matches = hash_equals( $tt, $passed_tt );

		return $matches && ! $expired;
	}

	/**
	 * Delete the auth token.
	 *
	 * @since 2.6.5
	 *
	 * @return bool True if the option was deleted, false otherwise.
	 */
	public static function delete_token() {
		return delete_option( 'optinmonster_site_token' );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit