]> git.mxchange.org Git - friendica.git/blobdiff - mod/noscrape.php
Adjusted implementation to a better one (thanks to Michael Vogel)
[friendica.git] / mod / noscrape.php
index e9ced2518c3b50f893f381b6c5d163d2562516d4..a948bee4f38807530c25610bd007843899f0ce09 100644 (file)
@@ -6,7 +6,7 @@
 use Friendica\App;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
-use Friendica\Database\DBM;
+use Friendica\Model\Contact;
 use Friendica\Model\Profile;
 
 function noscrape_init(App $a)
@@ -31,7 +31,7 @@ function noscrape_init(App $a)
                'guid'     => $a->profile['guid'],
                'key'      => $a->profile['pubkey'],
                'homepage' => System::baseUrl()."/profile/{$which}",
-               'comm'     => ($a->profile['account-type'] == ACCOUNT_TYPE_COMMUNITY),
+               'comm'     => ($a->profile['account-type'] == Contact::ACCOUNT_TYPE_COMMUNITY),
        ];
 
        if (!$a->profile['net-publish'] || $a->profile['hidewall']) {
@@ -55,18 +55,18 @@ function noscrape_init(App $a)
                /// @todo What should this value tell us?
                $r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
                        intval($a->profile['uid']));
-               if (DBM::is_result($r)) {
+               if (DBA::isResult($r)) {
                        $json_info["updated"] =  date("c", strtotime($r[0]['updated']));
                }
 
                $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0
                                AND `network` IN ('%s', '%s', '%s', '')",
                        intval($a->profile['uid']),
-                       dbesc(NETWORK_DFRN),
-                       dbesc(NETWORK_DIASPORA),
-                       dbesc(NETWORK_OSTATUS)
+                       DBA::escape(NETWORK_DFRN),
+                       DBA::escape(NETWORK_DIASPORA),
+                       DBA::escape(NETWORK_OSTATUS)
                );
-               if (DBM::is_result($r)) {
+               if (DBA::isResult($r)) {
                        $json_info["contacts"] = intval($r[0]['total']);
                }
        }
@@ -75,13 +75,13 @@ function noscrape_init(App $a)
        $last_active = 0;
        $condition = ['uid' => $a->profile['uid'], 'self' => true];
        $contact = DBA::selectFirst('contact', ['last-item'], $condition);
-       if (DBM::is_result($contact)) {
+       if (DBA::isResult($contact)) {
                $last_active = strtotime($contact['last-item']);
        }
 
        $condition = ['uid' => $a->profile['uid']];
        $user = DBA::selectFirst('user', ['login_date'], $condition);
-       if (DBM::is_result($user)) {
+       if (DBA::isResult($user)) {
                if ($last_active < strtotime($user['login_date'])) {
                        $last_active = strtotime($user['login_date']);
                }