From 1a1ec38c95a25143bea1e3da38c65a60437d7883 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Thu, 1 Nov 2012 00:01:08 +0100 Subject: Huge overhaul to deal with the global variables more cleanly. Avoid globals wherever possible, to avoid collisions with CMS systems. --- main.php | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) mode change 100644 => 100755 main.php (limited to 'main.php') diff --git a/main.php b/main.php old mode 100644 new mode 100755 index 2388e8f..5d6c9dd --- a/main.php +++ b/main.php @@ -1,23 +1,28 @@ #!/usr/bin/php run(); +function main() { + require_once ROOT . 'config.php'; + $err = fopen('php://stderr', 'w'); + 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'; + $auth = new EjabberdAuth($config, $function($config[$config['plugin']])); + $auth->run(); + } + else { + fwrite($err, "Plugin <{$plugin_file}> not found.\n"); + } } else { - fwrite($err, "Plugin <{$plugin_file}> not found.\n"); + fwrite($err, 'Incomplete configuration: $config[\'plugin\'] must be set to , and $config[] populated.' . "\n"); } -} -else { - fwrite($err, 'Incomplete configuration: $config[\'plugin\'] must be set to , and $config[] populated.' . "\n"); -} +} \ No newline at end of file -- cgit v1.1