summaryrefslogtreecommitdiff
path: root/main.php
diff options
context:
space:
mode:
authorChristoph Burschka2012-10-30 15:28:52 +0100
committerChristoph Burschka2012-10-30 15:28:52 +0100
commit12f6c2acb29cbea6f41d1152eb27affa358c196f (patch)
treede6a06f62967f9a98db3e8e254cae457536001cd /main.php
parentA version compatible with the stable phpBB3 (diff)
downloadejabberd-auth-php-12f6c2acb29cbea6f41d1152eb27affa358c196f.tar.gz
Refactor to a general, flexible and extensible architecture.
Diffstat (limited to 'main.php')
-rw-r--r--main.php27
1 files changed, 17 insertions, 10 deletions
diff --git a/main.php b/main.php
index fee0f33..2388e8f 100644
--- a/main.php
+++ b/main.php
@@ -2,15 +2,22 @@
<?php
// by Aran, October 2012
-// Bootstrap the phpBB system.
-define('ROOT', __DIR__);
-require_once __DIR__ . '/config.php';
-require_once __DIR__ . '/phpbb-bridge/phpbb_bootstrap.php';
-// Load the classes.
-require_once __DIR__ . '/classes/JabberAuth.php';
-require_once __DIR__ . '/classes/JabberAuthPhpBB.php';
+define('ROOT', __DIR__ . '/');
+require_once ROOT . 'config.php';
+$err = fopen('php://stderr', 'w');
-// Launch the script.
-$main = new JabberAuthPhpBB($auth, $db, $log_path);
-$main->run();
+if (!empty($config['plugin']) && !empty($config[$config['plugin']])) {
+ $plugin_file = 'plugins/' . $config['plugin'] . '/' . $config['plugin'] . '.module';
+ if (file_exists(ROOT . $plugin_file)) {
+ require_once ROOT . $plugin_file;
+ $function = $config['plugin'] . '_init';
+ $function($config[$config['plugin']])->run();
+ }
+ else {
+ fwrite($err, "Plugin <{$plugin_file}> not found.\n");
+ }
+}
+else {
+ fwrite($err, 'Incomplete configuration: $config[\'plugin\'] must be set to <name>, and $config[<name>] populated.' . "\n");
+}