summaryrefslogtreecommitdiff
path: root/plugins/smf2/smf2.module
diff options
context:
space:
mode:
authorChristoph Burschka2014-01-16 04:25:51 +0100
committerChristoph Burschka2014-01-16 04:25:51 +0100
commit86a4fd69d53b61a624dfc332c7a0e70b9a79218a (patch)
tree4f9c652f7ea30737b29a0864ac1806919cbc1314 /plugins/smf2/smf2.module
parentFormatting of README headings. (diff)
downloadejabberd-auth-php-86a4fd69d53b61a624dfc332c7a0e70b9a79218a.tar.gz
Implement smf2_session and finish RPC code. (#1)
This patch should be ready for testing with SMF. (cburschka/cadence/#31)
Diffstat (limited to 'plugins/smf2/smf2.module')
-rw-r--r--plugins/smf2/smf2.module12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/smf2/smf2.module b/plugins/smf2/smf2.module
index 8274318..066780e 100644
--- a/plugins/smf2/smf2.module
+++ b/plugins/smf2/smf2.module
@@ -1,6 +1,6 @@
<?php
-function smf2_init($config) {
+function smf2_bootstrap($config) {
$smf_root_path = $config['root_path'];
if (file_exists($smf_root_path . 'SSI.php')) {
include_once $smf_root_path . 'SSI.php';
@@ -9,10 +9,20 @@ function smf2_init($config) {
file_put_contents('php://stderr', "SMF not found at <{$smf_root_path}>.\n");
exit;
}
+}
+
+function smf2_init($config) {
+ smf2_bootstap($config);
require_once __DIR__ . '/BridgeSMF2.php';
return new BridgeSMF2();
}
+function smf2_session($config) {
+ smf2_bootstap($config);
+ $user = smf_ssi('welcome', NULL);
+ return (empty($user['is_guest']) && !empty($user['name'])) ? $user['name'] : FALSE;
+}
+
function smf_ssi($function) {
$args = func_get_args();
array_shift($args);