From b04c17301ec17397f858fb8cca7cb0043c16d4d5 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Tue, 30 Oct 2012 15:40:38 +0100 Subject: Add phpbb4 plugin (for trunk of phpBB) --- plugins/phpbb4/JabberAuthPhpBB4.php | 38 +++++++++++++++++++++++++++ plugins/phpbb4/noweb_user.php | 17 +++++++++++++ plugins/phpbb4/phpbb4.module | 10 ++++++++ plugins/phpbb4/phpbb4_bootstrap.php | 51 +++++++++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 plugins/phpbb4/JabberAuthPhpBB4.php create mode 100644 plugins/phpbb4/noweb_user.php create mode 100644 plugins/phpbb4/phpbb4.module create mode 100644 plugins/phpbb4/phpbb4_bootstrap.php (limited to 'plugins/phpbb4') diff --git a/plugins/phpbb4/JabberAuthPhpBB4.php b/plugins/phpbb4/JabberAuthPhpBB4.php new file mode 100644 index 0000000..e60cbae --- /dev/null +++ b/plugins/phpbb4/JabberAuthPhpBB4.php @@ -0,0 +1,38 @@ +logpath = $logpath; + parent::init(); + $this->auth = $auth; + $this->db = $db; + } + + function isuser($username, $server) { + $username_clean = utf8_clean_string($username); + $row = $this->db->sql_fetchrow($this->db->sql_query('SELECT username FROM ' . USERS_TABLE . ' WHERE username_clean = ' . "'" . $this->db->sql_escape($username_clean) . "'" . ';')); + return !empty($row); + } + + function auth($username, $server, $password) { + $result = $this->auth->login($username, $password); + return $result['status'] == LOGIN_SUCCESS; + } + + // The following functions are disabled. This script will not change the phpBB user database. + + function setpass($username, $server, $password) { + return FALSE; + } + + function tryregister($username, $server, $password) { + return FALSE; + } + + function removeuser($username, $server) { + return FALSE; + } +} diff --git a/plugins/phpbb4/noweb_user.php b/plugins/phpbb4/noweb_user.php new file mode 100644 index 0000000..3291222 --- /dev/null +++ b/plugins/phpbb4/noweb_user.php @@ -0,0 +1,17 @@ +load('services.yml'); + +$processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx); +$processor->process($phpbb_container); + +// Setup class loader first +$phpbb_class_loader = $phpbb_container->get('class_loader'); +$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); + +// Instantiate some basic classes +$user = new noweb_user; +$auth = $phpbb_container->get('auth'); +$db = $phpbb_container->get('dbal.conn'); + +// Grab global variables, re-cache if necessary +$config = $phpbb_container->get('config'); +set_config(null, null, null, $config); +set_config_count(null, null, null, $config); -- cgit v1.1