From 1a1ec38c95a25143bea1e3da38c65a60437d7883 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Thu, 1 Nov 2012 00:01:08 +0100 Subject: Huge overhaul to deal with the global variables more cleanly. Avoid globals wherever possible, to avoid collisions with CMS systems. --- plugins/phpbb3/BridgePhpBB3.php | 36 +++++++++++++++++++++++++++++++++++ plugins/phpbb3/JabberAuthPhpBB3.php | 38 ------------------------------------- plugins/phpbb3/phpbb3.module | 5 +++-- plugins/phpbb3/phpbb3_bootstrap.php | 7 ++++++- 4 files changed, 45 insertions(+), 41 deletions(-) create mode 100644 plugins/phpbb3/BridgePhpBB3.php delete mode 100644 plugins/phpbb3/JabberAuthPhpBB3.php (limited to 'plugins/phpbb3') diff --git a/plugins/phpbb3/BridgePhpBB3.php b/plugins/phpbb3/BridgePhpBB3.php new file mode 100644 index 0000000..bc7d8c8 --- /dev/null +++ b/plugins/phpbb3/BridgePhpBB3.php @@ -0,0 +1,36 @@ +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/phpbb3/JabberAuthPhpBB3.php b/plugins/phpbb3/JabberAuthPhpBB3.php deleted file mode 100644 index e60cbae..0000000 --- a/plugins/phpbb3/JabberAuthPhpBB3.php +++ /dev/null @@ -1,38 +0,0 @@ -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/phpbb3/phpbb3.module b/plugins/phpbb3/phpbb3.module index 4c58762..7502094 100644 --- a/plugins/phpbb3/phpbb3.module +++ b/plugins/phpbb3/phpbb3.module @@ -1,10 +1,11 @@ .\n"); + exit; +} require($phpbb_root_path . 'includes/startup.' . $phpEx); if (file_exists($phpbb_root_path . 'config.' . $phpEx)) @@ -30,7 +35,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Instantiate some basic classes $user = new noweb_user(); $auth = new auth(); -$db = new $sql_db(); +$db = new $sql_db(); $cache = new cache(); // Connect to DB -- cgit v1.1