summaryrefslogtreecommitdiff
path: root/plugins/drupal7
diff options
context:
space:
mode:
authorChristoph Burschka2014-01-18 13:03:11 +0100
committerChristoph Burschka2014-01-18 13:03:11 +0100
commitf21a9fdffe2c7d72a50533ae2466938de5a0a8ee (patch)
treec1a441eb56de395880424d1172d55a5d55012c49 /plugins/drupal7
parentOkay, the last patch was actually rubbish. (diff)
downloadejabberd-auth-php-f21a9fdffe2c7d72a50533ae2466938de5a0a8ee.tar.gz
Implement session auth for Drupal.
Diffstat (limited to 'plugins/drupal7')
-rw-r--r--plugins/drupal7/drupal7.module13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/drupal7/drupal7.module b/plugins/drupal7/drupal7.module
index 0c593cd..e1cd857 100644
--- a/plugins/drupal7/drupal7.module
+++ b/plugins/drupal7/drupal7.module
@@ -2,7 +2,7 @@
use Drupal\Core\DrupalKernel;
-function drupal7_init($config) {
+function drupal7_bootstrap($config) {
define('DRUPAL_ROOT', $config['root_path']);
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
@@ -10,5 +10,14 @@ function drupal7_init($config) {
require_once __DIR__ . '/BridgeDrupal7.php';
drupal_static('conf_path', "sites/{$config['site']}");
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+}
+
+function drupal7_init($config) {
+ drupal7_bootstrap($config);
return new BridgeDrupal7();
-} \ No newline at end of file
+}
+
+function drupal7_session($config) {
+ drupal7_bootstrap($config);
+ return user_is_logged_in() ? $GLOBALS['user']->name : FALSE;
+}