summaryrefslogtreecommitdiff
path: root/main.php
diff options
context:
space:
mode:
authorChristoph Burschka2014-01-17 16:10:10 +0100
committerChristoph Burschka2014-01-17 16:10:10 +0100
commit045012f9b7619d441d8c5b5800519cb7ac6891b6 (patch)
tree4db383cb85c40b1fdc1b4b8c4413950d9134cedf /main.php
parentApparently that didn't need to be encoded. (diff)
downloadejabberd-auth-php-045012f9b7619d441d8c5b5800519cb7ac6891b6.tar.gz
Okay, the last patch was actually rubbish.
It turns out that you can't hope to bootstrap more than one PHP-based software without messing stuff up, particularly because they rely on global variables without exception. If it is risky and unpredictable for different systems, it is completely impossible with multiple instances of the same. Therefore, the ability to use multiple plugins (and the accompanying config.php structure) has been removed. The only plugin that can be used in conjunction with another is session.
Diffstat (limited to 'main.php')
-rwxr-xr-xmain.php29
1 files changed, 14 insertions, 15 deletions
diff --git a/main.php b/main.php
index 57e20eb..ba63f7d 100755
--- a/main.php
+++ b/main.php
@@ -9,20 +9,19 @@ main();
function main() {
require_once ROOT . 'config.php';
- $bridges = [];
- foreach ($config as $domain => $plugins) {
- $bridges[$domain] = [];
- foreach ($plugins as $settings) {
- $plugin_file = 'plugins/' . $settings['plugin'] . '/' . $settings['plugin'] . '.module';
- if (file_exists(ROOT . $plugin_file)) {
- require_once ROOT . $plugin_file;
- $function = $settings['plugin'] . '_init';
- $bridges[$domain][] = $function($settings['config']);
- }
- else {
- return fwrite(STDERR, "Plugin <{$plugin_file}> not found.\n");
- }
- }
+ $plugin_file = 'plugins/' . $config['plugin'] . '/' . $config['plugin'] . '.module';
+ if (file_exists(ROOT . $plugin_file)) {
+ require_once ROOT . $plugin_file;
+ $function = $config['plugin'] . '_init';
+ $bridge = $function($config['plugin_conf']);
}
- (new EjabberdAuth($meta, $bridges))->run();
+ else {
+ return fwrite(STDERR, "Plugin <{$plugin_file}> not found.\n");
+ }
+ if (!empty($config['session'])) {
+ require_once 'plugins/session/session.module';
+ $session = session_init($config['session']);
+ }
+ else $session = NULL;
+ (new EjabberdAuth($config, $bridge, $session))->run();
}