]> git.mxchange.org Git - friendica.git/blobdiff - include/auth_ejabberd.php
Issue 3857: There is the possibility of a bad handling of dislikes
[friendica.git] / include / auth_ejabberd.php
index 9211c5baf091b782119b5da50382ad3e8f7a16b6..14f5dcfe0c797271ab5d09720223c2a8675d82a8 100755 (executable)
@@ -47,18 +47,16 @@ $directory = realpath($directory."/..");
 chdir($directory);
 require_once("boot.php");
 
-global $a, $db;
+global $a;
 
-if (is_null($a)) {
+if (empty($a)) {
        $a = new App(dirname(__DIR__));
 }
 
-if (is_null($db)) {
-       @include(".htconfig.php");
-       require_once("include/dba.php");
-       $db = new dba($db_host, $db_user, $db_pass, $db_data);
-       unset($db_host, $db_user, $db_pass, $db_data);
-};
+@include(".htconfig.php");
+require_once("include/dba.php");
+dba::connect($db_host, $db_user, $db_pass, $db_data);
+unset($db_host, $db_user, $db_pass, $db_data);
 
 // the logfile to which to write, should be writeable by the user which is running the server
 $sLogFile = get_config('jabber','logfile');
@@ -81,22 +79,20 @@ class exAuth {
         * @param boolean $bDebug Debug mode
         */
        public function __construct($sLogFile, $bDebug) {
-               global $db;
-
                // setter
                $this->sLogFile         = $sLogFile;
                $this->bDebug           = $bDebug;
 
                // Open the logfile if the logfile name is defined
                if ($this->sLogFile != '')
-                       $this->rLogFile = fopen($this->sLogFile, "a") or die("Error opening log file: ". $this->sLogFile);
+                       $this->rLogFile = fopen($this->sLogFile, "a") || die("Error opening log file: ". $this->sLogFile);
 
                $this->writeLog("[exAuth] start");
 
                // We are connected to the SQL server and are having a log file.
                do {
                        // Quit if the database connection went down
-                       if (!$db->connected()) {
+                       if (!dba::connected()) {
                                $this->writeDebugLog("[debug] the database connection went down");
                                return;
                        }