diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/smf2/BridgeSMF2.php | 32 | ||||
-rw-r--r-- | plugins/smf2/smf2.module | 14 |
2 files changed, 46 insertions, 0 deletions
diff --git a/plugins/smf2/BridgeSMF2.php b/plugins/smf2/BridgeSMF2.php new file mode 100644 index 0000000..cddcf36 --- /dev/null +++ b/plugins/smf2/BridgeSMF2.php @@ -0,0 +1,32 @@ +<?php + +/** + * Implements EjabberdAuthBridge. + */ +class BridgeSMF2 extends EjabberdAuthBridge { + function isuser($username, $server) { + $query_where = 'member_name = {string:name}'; + + $query_where_params = array( + 'name' => $name, + ); + + return 1 == count(ssi_queryMembers($query_where, $query_where_params, 1, 'id_member DESC', NULL)); + } + + function auth($username, $server, $password) { + return ssi_checkPassword($username, $password, TRUE); + } + + function setpass($username, $server, $password) { + return FALSE; + } + + function tryregister($username, $server, $password) { + return FALSE; + } + + function removeuser($username, $server) { + return FALSE; + } +} diff --git a/plugins/smf2/smf2.module b/plugins/smf2/smf2.module new file mode 100644 index 0000000..b2060f1 --- /dev/null +++ b/plugins/smf2/smf2.module @@ -0,0 +1,14 @@ +<?php + +function smf2_init($config) { + $smf_root_path = $config['root_path']; + if (file_exists($smf_root_path . 'SSI.php')) { + include_once $smf_root_path . 'SSI.php'; + } + else { + file_put_contents('php://stderr', "SMF not found at <{$smf_root_path}>.\n"); + exit; + } + require_once __DIR__ . '/BridgeSMF2.php'; + return new BridgeSMF2(); +} |