I`m trying to make a solution for common login for phpbb and October. When the user login to phpbb he login to October too.
I used a plugin and function boot() in Plugin.php.
For login I use:
Event::listen('rainlab.user.beforeAuthenticate', function ($credentials) {
//code
});
But I need to include phpbb core file before Event::listen(), at the start of boot() :
public function boot()
{
define('IN_PHPBB', true);
$phpbb_root_path = './phpbb/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
When I do ‘include’ I get 500 error.
LOGS:
local.ERROR: Symfony\Component\ErrorHandler\Error\FatalError: Cannot redeclare redirect() (previously declared in C:\xampp\htdocs\octobercms\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php:661) in C:\xampp\htdocs\octobercms\phpbb\includes\functions.php:1708
I tried to do add if(!function_exists(“redirect”)) { to phpbb and got other error:
local.ERROR: Symfony\Component\ErrorHandler\Error\FatalError: Declaration of Symfony\Component\DependencyInjection\ContainerInterface::has($id) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in C:\xampp\htdocs\octobercms\phpbb\vendor\symfony\dependency-injection\ContainerInterface.php:62
How to avoid there repeating functions in both systems?