mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/17415] Start adding legacy wrapper for old captchas
PHPBB-17415
This commit is contained in:
parent
b828c56dc9
commit
1b89184489
3 changed files with 105 additions and 1 deletions
82
phpBB/phpbb/captcha/plugins/legacy_wrapper.php
Normal file
82
phpBB/phpbb/captcha/plugins/legacy_wrapper.php
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\captcha\plugins;
|
||||||
|
|
||||||
|
class legacy_wrapper implements plugin_interface
|
||||||
|
{
|
||||||
|
private $legacy_captcha;
|
||||||
|
|
||||||
|
public function __construct($legacy_captcha)
|
||||||
|
{
|
||||||
|
$this->legacy_captcha = $legacy_captcha;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the plugin is available
|
||||||
|
* @return bool True if the plugin is available, false if not
|
||||||
|
*/
|
||||||
|
public function is_available(): bool
|
||||||
|
{
|
||||||
|
if (method_exists($this->legacy_captcha, 'is_available'))
|
||||||
|
{
|
||||||
|
return $this->legacy_captcha->is_available();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the plugin has a configuration
|
||||||
|
*
|
||||||
|
* @return bool True if the plugin has a configuration, false if not
|
||||||
|
*/
|
||||||
|
public function has_config(): bool
|
||||||
|
{
|
||||||
|
if (method_exists($this->legacy_captcha, 'has_config'))
|
||||||
|
{
|
||||||
|
return $this->legacy_captcha->has_config();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the plugin, should be language variable
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_name(): string
|
||||||
|
{
|
||||||
|
if (method_exists($this->legacy_captcha, 'get_name'))
|
||||||
|
{
|
||||||
|
return $this->legacy_captcha->has_config();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the captcha for the specified type
|
||||||
|
*
|
||||||
|
* @param int $type Type of captcha, should be one of the CONFIRMATION_* constants
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function show(int $type): void
|
||||||
|
{
|
||||||
|
if (method_exists($this->legacy_captcha, 'init'))
|
||||||
|
{
|
||||||
|
$this->legacy_captcha->init($type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
namespace phpbb\captcha\plugins;
|
namespace phpbb\captcha\plugins;
|
||||||
|
|
||||||
|
@ -30,7 +41,7 @@ interface plugin_interface
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function get_name(): string;
|
public function get_name(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the captcha for the specified type
|
* Display the captcha for the specified type
|
||||||
|
|
|
@ -1,4 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
namespace phpbb\captcha\plugins;
|
namespace phpbb\captcha\plugins;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue