summaryrefslogtreecommitdiff
path: root/plugins/drupal8
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/drupal8
parentOkay, the last patch was actually rubbish. (diff)
downloadejabberd-auth-php-f21a9fdffe2c7d72a50533ae2466938de5a0a8ee.tar.gz
Implement session auth for Drupal.
Diffstat (limited to 'plugins/drupal8')
-rw-r--r--plugins/drupal8/drupal8.module13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/drupal8/drupal8.module b/plugins/drupal8/drupal8.module
index 390b678..193ddb8 100644
--- a/plugins/drupal8/drupal8.module
+++ b/plugins/drupal8/drupal8.module
@@ -2,7 +2,7 @@
use Drupal\Core\DrupalKernel;
-function drupal8_init($config) {
+function drupal8_bootstrap($config) {
define('DRUPAL_ROOT', $config['root_path']);
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
@@ -12,5 +12,14 @@ function drupal8_init($config) {
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
$kernel = new DrupalKernel('prod', FALSE, NULL, cache('bootstrap'));
$kernel->boot();
+}
+
+function drupal8_init($config) {
+ drupal8_bootstrap($config);
return new BridgeDrupal8();
-} \ No newline at end of file
+}
+
+function drupal8_session($config) {
+ drupal8_bootstrap($config);
+ return user_is_logged_in() ? $GLOBALS['user']->name : FALSE;
+}