]> git.mxchange.org Git - friendica.git/blobdiff - include/socgraph.php
Fix wrong class name case
[friendica.git] / include / socgraph.php
index 642d03d8911a6bf8b204f40ce9915bd092fbacbc..c8a2fdaf1d055653f204636dfaf921ffb2e46333 100644 (file)
@@ -1,12 +1,15 @@
 <?php
 /**
  * @file include/socgraph.php
- * 
+ *
  * @todo Move GNU Social URL schemata (http://server.tld/user/number) to http://server.tld/username
  * @todo Fetch profile data from profile page for Redmatrix users
  * @todo Detect if it is a forum
  */
 
+use Friendica\App;
+use Friendica\Core\Config;
+
 require_once('include/datetime.php');
 require_once("include/Scrape.php");
 require_once("include/network.php");
@@ -1428,7 +1431,7 @@ function common_friends_zcid($uid,$zcid,$start = 0, $limit = 9999,$shuffle = fal
        $r = q("SELECT `gcontact`.*
                FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
                where `glink`.`zcid` = %d
-               and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) 
+               and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 )
                $sql_extra limit %d, %d",
                intval($zcid),
                intval($uid),
@@ -1656,6 +1659,20 @@ function poco_discover_federation() {
                }
        }
 
+       // Disvover Mastodon servers
+       if (!Config::get('system','ostatus_disabled')) {
+               $serverdata = fetch_url("https://instances.mastodon.xyz/instances.json");
+
+               if ($serverdata) {
+                       $servers = json_decode($serverdata);
+
+                       foreach ($servers AS $server) {
+                               $url = (is_null($server->https_score) ? 'http' : 'https').'://'.$server->name;
+                               proc_run(PRIORITY_LOW, "include/discover_poco.php", "server", base64_encode($url));
+                       }
+               }
+       }
+
        // Currently disabled, since the service isn't available anymore.
        // It is not removed since I hope that there will be a successor.
        // Discover GNU Social Servers.
@@ -2096,7 +2113,7 @@ function update_gcontact($contact) {
        fix_alternate_contact_address($contact);
 
        if (!isset($contact["updated"]))
-               $contact["updated"] = datetime_convert();
+               $contact["updated"] = dbm::date();
 
        if ($contact["server_url"] == "") {
                $server_url = $contact["url"];
@@ -2151,7 +2168,7 @@ function update_gcontact($contact) {
                        dbesc($contact["gender"]), dbesc($contact["keywords"]), intval($contact["hide"]),
                        intval($contact["nsfw"]), intval($contact["contact-type"]), dbesc($contact["alias"]),
                        dbesc($contact["notify"]), dbesc($contact["url"]), dbesc($contact["location"]),
-                       dbesc($contact["about"]), intval($contact["generation"]), dbesc($contact["updated"]),
+                       dbesc($contact["about"]), intval($contact["generation"]), dbesc(dbm::date($contact["updated"])),
                        dbesc($contact["server_url"]), dbesc($contact["connect"]),
                        dbesc(normalise_link($contact["url"])), intval($contact["generation"]));