From 1a1ec38c95a25143bea1e3da38c65a60437d7883 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Thu, 1 Nov 2012 00:01:08 +0100 Subject: Huge overhaul to deal with the global variables more cleanly. Avoid globals wherever possible, to avoid collisions with CMS systems. --- core/EjabberdAuth.php | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'core/EjabberdAuth.php') diff --git a/core/EjabberdAuth.php b/core/EjabberdAuth.php index 3e9d4df..d9b9776 100644 --- a/core/EjabberdAuth.php +++ b/core/EjabberdAuth.php @@ -1,20 +1,16 @@ stdin = fopen('php://stdin', 'r'); $this->stdout = fopen('php://stdout', 'w'); + $this->bridge = $bridge; if (!empty($config['log_path']) && is_dir($config['log_path']) && is_writable($config['log_path'])) { $this->logfile = fopen($config['log_path'] . 'activity-' . date('Y-m-d') . '.log', 'a'); } @@ -74,22 +70,22 @@ abstract class JabberAuth { switch ($command) { case 'isuser': list($username, $server) = $args; - return $this->isuser($username, $server); + return $this->bridge->isuser($username, $server); case 'auth': list($username, $server, $password) = $args; - return $this->auth($username, $server, $password); + return $this->bridge->auth($username, $server, $password); case 'setpass': list($username, $server, $password) = $args; - return $this->setpass($username, $server, $password); + return $this->bridge->setpass($username, $server, $password); case 'tryregister': list($username, $server, $password) = $args; - return $this->tryregister($username, $server, $password); + return $this->bridge->tryregister($username, $server, $password); case 'removeuser': list($username, $server) = $args; - return $this->removeuser($username, $server); + return $this->bridge->removeuser($username, $server); case 'removeuser3': list($username, $server, $password) = $args; - return $this->auth($username, $server, $password) && $this->removeuser($username, $password); + return $this->bridge->auth($username, $server, $password) && $this->bridge->removeuser($username, $password); default: $this->stop(); } -- cgit v1.1