403Webshell
Server IP : 104.21.14.103  /  Your IP : 18.220.203.200
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Subscription/Captcha/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Subscription/Captcha/CaptchaPhrase.php
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing

namespace MailPoet\Subscription\Captcha;

if (!defined('ABSPATH')) exit;


use MailPoetVendor\Gregwar\Captcha\PhraseBuilder;

class CaptchaPhrase {


  /** @var CaptchaSession  */
  private $session;

  /** @var PhraseBuilder  */
  private $phraseBuilder;

  public function __construct(
    CaptchaSession $session,
    PhraseBuilder $phraseBuilder = null
  ) {
    $this->session = $session;
    $this->phraseBuilder = $phraseBuilder ? $phraseBuilder : new PhraseBuilder();
  }

  public function getPhrase(): ?string {
    $storage = $this->session->getCaptchaHash();
    return (isset($storage['phrase']) && is_string($storage['phrase'])) ? $storage['phrase'] : null;
  }

  public function resetPhrase() {
    $this->session->setCaptchaHash(null);
  }

  public function getPhraseForType(string $type, string $sessionId = null): string {
    $this->session->init($sessionId);
    $storage = $this->session->getCaptchaHash();
    if (!$storage) {
      $storage = [
        'phrase' => $this->phraseBuilder->build(),
        'total_loaded' => 1,
        'loaded_by_types' => [],
      ];
    }
    if (!isset($storage['loaded_by_types'][$type])) {
      $storage['loaded_by_types'][$type] = 0;
    }

    if ($this->needsToRegenerateCaptcha($storage, $type)) {
      $storage['phrase'] = $this->phraseBuilder->build();
      $storage['total_loaded']++;
    }
    $storage['loaded_by_types'][$type]++;

    $this->session->setCaptchaHash($storage);
    return $storage['phrase'];
  }

  private function needsToRegenerateCaptcha(array $storage, string $type): bool {
    return $storage['loaded_by_types'][$type] === $storage['total_loaded'];
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit