X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnoscrape.php;h=3a8abe2290928e62c40eeb0cda12a389c042af21;hb=db0b848ae30983b394847a5597c3f7c7332cfe7c;hp=20936929ddd6672787d7dce4e3860f86dde557c6;hpb=c66c09d5fd86e74ac6f1b877143e8cf55e3a0340;p=friendica.git diff --git a/mod/noscrape.php b/mod/noscrape.php index 20936929dd..3a8abe2290 100644 --- a/mod/noscrape.php +++ b/mod/noscrape.php @@ -2,9 +2,12 @@ /** * @file mod/noscrape.php */ + use Friendica\App; +use Friendica\Core\Protocol; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; +use Friendica\Model\Contact; use Friendica\Model\Profile; function noscrape_init(App $a) @@ -29,7 +32,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']) { @@ -43,7 +46,7 @@ function noscrape_init(App $a) $keywords = str_replace(['#',',',' ',',,'], ['',' ',',',','], $keywords); $keywords = explode(',', $keywords); - $contactPhoto = dba::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]); + $contactPhoto = DBA::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]); $json_info['fn'] = $a->profile['name']; $json_info['photo'] = $contactPhoto["photo"]; @@ -53,18 +56,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(Protocol::DFRN), + DBA::escape(Protocol::DIASPORA), + DBA::escape(Protocol::OSTATUS) ); - if (DBM::is_result($r)) { + if (DBA::isResult($r)) { $json_info["contacts"] = intval($r[0]['total']); } } @@ -72,14 +75,14 @@ function noscrape_init(App $a) // We display the last activity (post or login), reduced to year and week number $last_active = 0; $condition = ['uid' => $a->profile['uid'], 'self' => true]; - $contact = dba::selectFirst('contact', ['last-item'], $condition); - if (DBM::is_result($contact)) { + $contact = DBA::selectFirst('contact', ['last-item'], $condition); + 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)) { + $user = DBA::selectFirst('user', ['login_date'], $condition); + if (DBA::isResult($user)) { if ($last_active < strtotime($user['login_date'])) { $last_active = strtotime($user['login_date']); }