X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fsalmon.php;h=d07b06004d130f863cae45daec499fc2c95f3b53;hb=807ad145218ab6d4c57b6d200f4c89f63620502f;hp=22da151cf8e1c93f44d3478fee2c1b0e23c6e129;hpb=c598bf7d8f5075526fadcfd329f6dd448533dfad;p=friendica.git diff --git a/mod/salmon.php b/mod/salmon.php index 22da151cf8..d07b06004d 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,26 @@ 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')) { + + if (PConfig::get($importer['uid'], 'system', 'ostatus_autofriend')) { $result = Contact::createFromProbe($importer['uid'], $author_link); - if($result['success']) { + + 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 +175,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 +185,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);