summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Burschka2013-12-30 02:45:00 +0100
committerChristoph Burschka2013-12-30 02:45:00 +0100
commitd753992668c1a3c3bd55328c05a4e24a05d6d0b3 (patch)
tree388ed2718f77cb535b14afed84de4ba77d17d72d
parentExplain how the class methods work. (diff)
downloadejabberd-auth-php-d753992668c1a3c3bd55328c05a4e24a05d6d0b3.tar.gz
New SMF2 plugin
-rw-r--r--plugins/smf2/BridgeSMF2.php32
-rw-r--r--plugins/smf2/smf2.module14
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();
+}