summaryrefslogtreecommitdiff
path: root/plugins/session/main.php
diff options
context:
space:
mode:
authorChristoph Burschka2014-01-17 16:10:10 +0100
committerChristoph Burschka2014-01-17 16:10:10 +0100
commit045012f9b7619d441d8c5b5800519cb7ac6891b6 (patch)
tree4db383cb85c40b1fdc1b4b8c4413950d9134cedf /plugins/session/main.php
parentApparently that didn't need to be encoded. (diff)
downloadejabberd-auth-php-045012f9b7619d441d8c5b5800519cb7ac6891b6.tar.gz
Okay, the last patch was actually rubbish.
It turns out that you can't hope to bootstrap more than one PHP-based software without messing stuff up, particularly because they rely on global variables without exception. If it is risky and unpredictable for different systems, it is completely impossible with multiple instances of the same. Therefore, the ability to use multiple plugins (and the accompanying config.php structure) has been removed. The only plugin that can be used in conjunction with another is session.
Diffstat (limited to 'plugins/session/main.php')
-rw-r--r--plugins/session/main.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/session/main.php b/plugins/session/main.php
index 18bacd8..49973a7 100644
--- a/plugins/session/main.php
+++ b/plugins/session/main.php
@@ -5,17 +5,17 @@ define('ROOT', __DIR__ . '/../../');
require_once ROOT . 'plugins/session/session.module';
function create_key($salt) {
- require_once __DIR__ . '/config.php';
- $db = session_db($config['mysql']);
+ require_once ROOT . '/config.php';
+ $db = session_db($config['session']['mysql']);
$plugin = $config['plugin'];
- $plugin_conf = $config['config'];
+ $plugin_conf = $config['plugin_conf'];
require_once ROOT . 'plugins/' . $plugin . '/' . $plugin . '.module';
$function = $plugin . '_session';
$username = function_exists($function) ? $function($plugin_conf) : NULL;
if ($username) {
$entry = ['user' => $username, 'secret' => sha1($salt . time() . mt_rand()), 'time' => time()];
- $query = $db->prepare(sprintf('INSERT INTO `%s` (`username`, `secret`, `created`) VALUES (:user, :secret, :time);', $config['mysql']['tablename']));
+ $query = $db->prepare(sprintf('INSERT INTO `%s` (`username`, `secret`, `created`) VALUES (:user, :secret, :time);', $config['session']['mysql']['tablename']));
$query->execute([':user' => $entry['user'], ':secret' => $entry['secret'], ':time' => $entry['time']]);
return $entry;
}