summaryrefslogtreecommitdiff
path: root/main.php
diff options
context:
space:
mode:
Diffstat (limited to 'main.php')
-rwxr-xr-xmain.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/main.php b/main.php
index ba63f7d..4df895e 100755
--- a/main.php
+++ b/main.php
@@ -10,18 +10,25 @@ main();
function main() {
require_once ROOT . 'config.php';
$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']);
- }
- else {
+ if (!file_exists(ROOT . $plugin_file)) {
return fwrite(STDERR, "Plugin <{$plugin_file}> not found.\n");
}
+
+ require_once ROOT . $plugin_file;
+ $function = $config['plugin'] . '_init';
+ $bridge = $function($config['plugin_conf']);
+
if (!empty($config['session'])) {
require_once 'plugins/session/session.module';
$session = session_init($config['session']);
}
else $session = NULL;
- (new EjabberdAuth($config, $bridge, $session))->run();
+
+ $main = new EjabberdAuth($config, $bridge, $session);
+ if ($_SERVER['argc'] > 1) {
+ $result = $main->execute(array_slice($_SERVER['argv'], 1));
+ print(($result ? 1 : 0) . "\n");
+ exit($result ? 0 : 1);
+ }
+ $main->run();
}