X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fsalmon.php;h=8bdfdefeee1663ba2d9c72bd3644f7848787dda0;hb=578549df13dac667b7386a2b74f3fe2a1dd7f254;hp=22da151cf8e1c93f44d3478fee2c1b0e23c6e129;hpb=88353ce56f0e5da6352af2d999a58bd0c9b375f7;p=friendica.git diff --git a/mod/salmon.php b/mod/salmon.php index 22da151cf8..8bdfdefeee 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -4,8 +4,9 @@ */ use Friendica\App; use Friendica\Core\PConfig; +use Friendica\Core\Protocol; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Protocol\OStatus; use Friendica\Protocol\Salmon; @@ -25,9 +26,9 @@ function salmon_post(App $a, $xml = '') { $mentions = (($a->argc > 2 && $a->argv[2] === 'mention') ? true : false); $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1", - dbesc($nick) + DBA::escape($nick) ); - if (! DBM::is_result($r)) { + if (! DBA::isResult($r)) { System::httpExit(500); } @@ -145,23 +146,23 @@ function salmon_post(App $a, $xml = '') { $r = q("SELECT * FROM `contact` WHERE `network` IN ('%s', '%s') AND (`nurl` = '%s' OR `alias` = '%s' OR `alias` = '%s') AND `uid` = %d LIMIT 1", - dbesc(NETWORK_OSTATUS), - dbesc(NETWORK_DFRN), - dbesc(normalise_link($author_link)), - dbesc($author_link), - dbesc(normalise_link($author_link)), + DBA::escape(Protocol::OSTATUS), + DBA::escape(Protocol::DFRN), + DBA::escape(normalise_link($author_link)), + DBA::escape($author_link), + DBA::escape(normalise_link($author_link)), intval($importer['uid']) ); - if (! DBM::is_result($r)) { + if (! DBA::isResult($r)) { logger('Author ' . $author_link . ' unknown to user ' . $importer['uid'] . '.'); if(PConfig::get($importer['uid'],'system','ostatus_autofriend')) { $result = Contact::createFromProbe($importer['uid'], $author_link); if($result['success']) { $r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s') AND `uid` = %d LIMIT 1", - dbesc(NETWORK_OSTATUS), - dbesc($author_link), - dbesc($author_link), + DBA::escape(Protocol::OSTATUS), + DBA::escape($author_link), + DBA::escape($author_link), intval($importer['uid']) ); } @@ -171,8 +172,8 @@ function salmon_post(App $a, $xml = '') { // Have we ignored the person? // If so we can not accept this post. - //if((DBM::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) { - if (DBM::is_result($r) && $r[0]['blocked']) { + //if((DBA::isResult($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == Contact::FOLLOWER) || ($r[0]['blocked']))) { + if (DBA::isResult($r) && $r[0]['blocked']) { logger('Ignoring this author.'); System::httpExit(202); // NOTREACHED @@ -181,7 +182,7 @@ function salmon_post(App $a, $xml = '') { // Placeholder for hub discovery. $hub = ''; - $contact_rec = ((DBM::is_result($r)) ? $r[0] : null); + $contact_rec = ((DBA::isResult($r)) ? $r[0] : null); OStatus::import($data, $importer, $contact_rec, $hub);