summaryrefslogtreecommitdiff
path: root/plugins/session/BridgeSession.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/session/BridgeSession.php')
-rw-r--r--plugins/session/BridgeSession.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/session/BridgeSession.php b/plugins/session/BridgeSession.php
index 700d545..58e2208 100644
--- a/plugins/session/BridgeSession.php
+++ b/plugins/session/BridgeSession.php
@@ -4,12 +4,12 @@
* Implements EjabberdAuthBridge.
*/
class BridgeSession extends EjabberdAuthBridge {
- function __const($pdo, $config) {
+ function __construct($pdo, $config) {
$this->db = $pdo;
$this->timeout = $config['timeout'];
- $this->table = mysqli::escape_string($config['mysql'['tablename']);
+ $this->table = $config['mysql']['tablename'];
$this->_isuser = $this->db->prepare(sprintf('SELECT COUNT(*) FROM `%s` WHERE `username` = :user AND `created` >= :limit;', $this->table));
- $this->_auth = $this->db->prepare(sprintf('DELETE COUNT(*) FROM `%s` WHERE `username` = :user AND `secret` = :secret AND `created` >= :limit;', $this->table));
+ $this->_auth = $this->db->prepare(sprintf('DELETE FROM `%s` WHERE `username` = :user AND `secret` = :secret AND `created` >= :limit;', $this->table));
$this->_prune = $this->db->prepare(sprintf('DELETE COUNT(*) FROM `%s` WHERE `created` < :limit;', $this->table));
$this->_create = $this->db->prepare(sprintf('INSERT INTO `%s` (`username`, `secret`, `created`) VALUES (:user, :secret, :time);', $this->table));
}
@@ -24,12 +24,14 @@ class BridgeSession extends EjabberdAuthBridge {
function isuser($username, $server) {
$this->prune();
- return $this->_isuser->execute([':user' => $username, ':limit' => time() - $this->timeout])->fetch()[0] > 0;
+ $this->_isuser->execute([':user' => $username, ':limit' => time() - $this->timeout]);
+ return $this->_isuser->fetch()[0] > 0;
}
function auth($username, $server, $password) {
$this->prune();
- return $this->_auth->execute([[':useer' => $username, ':secret' => $password, ':limit' => time() - $this->timeout])->rowCount() > 0;
+ $this->_auth->execute([':user' => $username, ':secret' => $password, ':limit' => time() - $this->timeout]);
+ return $this->_auth->rowCount() > 0;
}
function setpass($username, $server, $password) {