blob: 4df895ef80fbd07a50292bf1826df6c77f4b5ffc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/php
<?php
define('ROOT', __DIR__ . '/');
require_once ROOT . 'core/EjabberdAuth.php';
require_once ROOT . 'core/EjabberdAuthBridge.php';
main();
function main() {
require_once ROOT . 'config.php';
$plugin_file = 'plugins/' . $config['plugin'] . '/' . $config['plugin'] . '.module';
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;
$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();
}
|