summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Burschka2012-11-03 02:05:17 +0100
committerChristoph Burschka2012-11-03 02:05:17 +0100
commit3737af402b845edd8b691375bccf966e6795766a (patch)
treeb961ae0e8f5204090b8708f7342386238a93df8f
parentNew Drupal 8 plugin. (diff)
downloadejabberd-auth-php-3737af402b845edd8b691375bccf966e6795766a.tar.gz
New Drupal 7 plugin.
-rw-r--r--plugins/drupal7/BridgeDrupal7.php23
-rw-r--r--plugins/drupal7/drupal7.module14
2 files changed, 37 insertions, 0 deletions
diff --git a/plugins/drupal7/BridgeDrupal7.php b/plugins/drupal7/BridgeDrupal7.php
new file mode 100644
index 0000000..3f7ef67
--- /dev/null
+++ b/plugins/drupal7/BridgeDrupal7.php
@@ -0,0 +1,23 @@
+<?php
+
+class BridgeDrupal7 extends EjabberdAuthBridge {
+ function isuser($username, $server) {
+ return user_load_by_name($username) !== FALSE;
+ }
+
+ function auth($username, $server, $password) {
+ return user_authenticate($username, $password) !== FALSE;
+ }
+
+ function setpass($username, $server, $password) {
+ return FALSE;
+ }
+
+ function tryregister($username, $server, $password) {
+ return FALSE;
+ }
+
+ function removeuser($username, $server) {
+ return FALSE;
+ }
+}
diff --git a/plugins/drupal7/drupal7.module b/plugins/drupal7/drupal7.module
new file mode 100644
index 0000000..0c593cd
--- /dev/null
+++ b/plugins/drupal7/drupal7.module
@@ -0,0 +1,14 @@
+<?php
+
+use Drupal\Core\DrupalKernel;
+
+function drupal7_init($config) {
+ define('DRUPAL_ROOT', $config['root_path']);
+ $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
+ require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
+ //require_once DRUPAL_ROOT . '/core/includes/common.inc';
+ require_once __DIR__ . '/BridgeDrupal7.php';
+ drupal_static('conf_path', "sites/{$config['site']}");
+ drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+ return new BridgeDrupal7();
+} \ No newline at end of file