with phpBB 3.0, I used phpBB as a login provider for another system (a DokuWiki instance). That is, in order to enable users to log into DokuWiki using their phpBB username and password, I used (in a DokuWiki plugin) code like this:
Code: Select all
define('IN_PHPBB', true);
$phpbb_root_path = $conf['auth']['phpbb']['root_path']; // from DokuWiki config
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include $phpbb_root_path . 'config.php';
include $phpbb_root_path . 'includes/functions.php';
// ...
return phpbb_check_hash($provided_cleartext_password, $hash_from_database) ;
phpbb_check_hash()
is now in includes/functions_compatibility.php
, defined like this:Code: Select all
function phpbb_check_hash($password, $hash)
{
global $phpbb_container;
$passwords_manager = $phpbb_container->get('passwords.manager');
return $passwords_manager->check($password, $hash);
}
$phpbb_container
is not known, but we need it in order to obtain $passwords_manager
. Therefore, I now include common.php
, obtaining this result:Code: Select all
// ... as before
include $phpbb_root_path . 'config.php';
include $phpbb_root_path . 'common.php'; // for $phpbb_container
// ...
gobal $phpbb_container;
$passwords_manager = $phpbb_container->get('passwords.manager');
return $passwords_manager->check($provided_cleartext_password, $hash_from_database);
common.php
seems to define many global variables and functions that collide with DokuWiki.Therefore, I would like to avoid including
common.php
, and instead include only the minimal amount of code that is necessary. For my purpose, at a minimum it is apparently necessary to create an instance of passwords manager, but unfortunately I'm not safe enough in phpBB code (and php in general) to see how I could achieve that.Thus, can you please help me with this?
How can a passwords manager be instantiated with a minimum of include dependencies?
Best regards,
Carsten