summaryrefslogtreecommitdiff
path: root/main.php
diff options
context:
space:
mode:
Diffstat (limited to 'main.php')
-rwxr-xr-x[-rw-r--r--]main.php35
1 files changed, 20 insertions, 15 deletions
diff --git a/main.php b/main.php
index 2388e8f..5d6c9dd 100644..100755
--- a/main.php
+++ b/main.php
@@ -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