]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/GlobalContact.php
Review
[friendica.git] / src / Model / GlobalContact.php
index 44fbd64b6d1eb20c1163849b2ab335c098560adc..6ec1101775df0f636f838a7e6c29499fce4166ce 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
 use Friendica\Network\Probe;
+use Friendica\Object\Contact;
 use Friendica\Object\Profile;
 use Friendica\Protocol\PortableContact;
 use dba;
@@ -18,7 +19,6 @@ use Exception;
 require_once 'include/datetime.php';
 require_once 'include/network.php';
 require_once 'include/html2bbcode.php';
-require_once 'include/Photo.php';
 
 /**
  * @brief This class handles GlobalContact related functions
@@ -881,7 +881,7 @@ class GlobalContact
                        if (DBM::is_result($r)) {
                                logger("Update public contact ".$r[0]["id"], LOGGER_DEBUG);
 
-                               update_contact_avatar($contact["photo"], 0, $r[0]["id"]);
+                               Contact::updateAvatar($contact["photo"], 0, $r[0]["id"]);
 
                                $fields = array('name', 'nick', 'addr',
                                                'network', 'bd', 'gender',
@@ -1054,15 +1054,23 @@ class GlobalContact
                }
        }
 
-       public static function getRandomUrl() {
-               $r = q("SELECT `url` FROM `gcontact` WHERE `network` = '%s'
+       /**
+        * @return string
+        */
+       public static function getRandomUrl()
+       {
+               $r = q(
+                       "SELECT `url` FROM `gcontact` WHERE `network` = '%s'
                                        AND `last_contact` >= `last_failure`
                                        AND `updated` > UTC_TIMESTAMP - INTERVAL 1 MONTH
                                ORDER BY rand() LIMIT 1",
-                       dbesc(NETWORK_DFRN));
+                       dbesc(NETWORK_DFRN)
+               );
 
-               if (DBM::is_result($r))
+               if (DBM::is_result($r)) {
                        return dirname($r[0]['url']);
+               }
+
                return '';
        }
 }