From 045012f9b7619d441d8c5b5800519cb7ac6891b6 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Fri, 17 Jan 2014 16:10:10 +0100 Subject: 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. --- main.php | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'main.php') 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(); } -- cgit v1.1