diff options
Diffstat (limited to 'main.php')
-rwxr-xr-x[-rw-r--r--] | main.php | 35 |
1 files changed, 20 insertions, 15 deletions
@@ -1,23 +1,28 @@ #!/usr/bin/php <?php -// by Aran, October 2012 - define('ROOT', __DIR__ . '/'); -require_once ROOT . 'config.php'; -$err = fopen('php://stderr', 'w'); +require_once ROOT . 'core/EjabberdAuth.php'; +require_once ROOT . 'core/EjabberdAuthBridge.php'; + +main(); -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(); +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 <name>, and $config[<name>] populated.' . "\n"); } -} -else { - fwrite($err, 'Incomplete configuration: $config[\'plugin\'] must be set to <name>, and $config[<name>] populated.' . "\n"); -} +}
\ No newline at end of file |