summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorChristoph Burschka2012-11-01 00:01:08 +0100
committerChristoph Burschka2012-11-01 00:01:08 +0100
commit1a1ec38c95a25143bea1e3da38c65a60437d7883 (patch)
tree4784357112e6fce315bef1fc21848df7a1b50154 /plugins
parentHuge overhaul to deal with the global variables more cleanly. Avoid globals w... (diff)
downloadejabberd-auth-php-1a1ec38c95a25143bea1e3da38c65a60437d7883.tar.gz
Huge overhaul to deal with the global variables more cleanly. Avoid globals wherever possible, to avoid collisions with CMS systems.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/phpbb3/BridgePhpBB3.php (renamed from plugins/phpbb3/JabberAuthPhpBB3.php)6
-rw-r--r--plugins/phpbb3/phpbb3.module5
-rw-r--r--plugins/phpbb3/phpbb3_bootstrap.php7
-rw-r--r--plugins/phpbb4/phpbb4_bootstrap.php5
4 files changed, 16 insertions, 7 deletions
diff --git a/plugins/phpbb3/JabberAuthPhpBB3.php b/plugins/phpbb3/BridgePhpBB3.php
index e60cbae..bc7d8c8 100644
--- a/plugins/phpbb3/JabberAuthPhpBB3.php
+++ b/plugins/phpbb3/BridgePhpBB3.php
@@ -1,12 +1,10 @@
<?php
-class JabberAuthPhpBB extends JabberAuth {
+class BridgePhpBB3 extends EjabberdAuthBridge {
var $auth;
var $db;
- function __construct($auth, $db, $logpath) {
- $this->logpath = $logpath;
- parent::init();
+ function __construct($auth, $db) {
$this->auth = $auth;
$this->db = $db;
}
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 @@
<?php
function phpbb3_init($config) {
+ global $phpbb_root_path;
$phpbb_root_path = $config['root_path'];
// Bootstrap the phpBB system.
require_once __DIR__ . '/phpbb3_bootstrap.php';
// Load the plugin.
- require_once __DIR__ . '/JabberAuthPhpBB3.php';
- return new JabberAuthPhpBB3($config['auth'], $config['db']);
+ require_once __DIR__ . '/BridgePhpBB3.php';
+ return new BridgePhpBB3($auth, $db);
}
diff --git a/plugins/phpbb3/phpbb3_bootstrap.php b/plugins/phpbb3/phpbb3_bootstrap.php
index 4ede950..55c973f 100644
--- a/plugins/phpbb3/phpbb3_bootstrap.php
+++ b/plugins/phpbb3/phpbb3_bootstrap.php
@@ -1,7 +1,12 @@
<?php
define('IN_PHPBB', TRUE);
+global $phpEx, $db, $cache, $user, $config;
$phpEx = 'php';
+if (!file_exists($phpbb_root_path . 'includes/startup.' . $phpEx)) {
+ file_put_contents('php://stderr', "phpBB not found at <{$phpbb_root_path}>.\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
diff --git a/plugins/phpbb4/phpbb4_bootstrap.php b/plugins/phpbb4/phpbb4_bootstrap.php
index 3f7dee5..740f230 100644
--- a/plugins/phpbb4/phpbb4_bootstrap.php
+++ b/plugins/phpbb4/phpbb4_bootstrap.php
@@ -6,6 +6,11 @@ use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
+if (!file_exists($phpbb_root_path . 'includes/startup.' . $phpEx)) {
+ file_put_contents('php://stderr', "phpBB not found at <{$phpbb_root_path}>.\n");
+ exit;
+}
+
require($phpbb_root_path . 'includes/startup.' . $phpEx);
require_once __DIR__ . '/noweb_user.php';