diff options
author | Christoph Burschka | 2012-10-30 15:28:52 +0100 |
---|---|---|
committer | Christoph Burschka | 2012-10-30 15:28:52 +0100 |
commit | 12f6c2acb29cbea6f41d1152eb27affa358c196f (patch) | |
tree | de6a06f62967f9a98db3e8e254cae457536001cd /main.php | |
parent | A version compatible with the stable phpBB3 (diff) | |
download | ejabberd-auth-php-12f6c2acb29cbea6f41d1152eb27affa358c196f.tar.gz |
Refactor to a general, flexible and extensible architecture.
Diffstat (limited to 'main.php')
-rw-r--r-- | main.php | 27 |
1 files changed, 17 insertions, 10 deletions
@@ -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"); +} |