]> git.mxchange.org Git - friendica.git/blobdiff - mod/salmon.php
Renamed functions
[friendica.git] / mod / salmon.php
index d1f9cf9a31e6934e4f7440c81b9cf89f26f9c9ca..bd4b3773cb7a4de2a81d1618115f9f885d177226 100644 (file)
@@ -4,6 +4,7 @@
  */
 use Friendica\App;
 use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
@@ -40,14 +41,14 @@ function salmon_post(App $a, $xml = '') {
        $base = null;
 
        // figure out where in the DOM tree our data is hiding
-       if($dom->provenance->data)
+       if (!empty($dom->provenance->data))
                $base = $dom->provenance;
-       elseif($dom->env->data)
+       elseif (!empty($dom->env->data))
                $base = $dom->env;
-       elseif($dom->data)
+       elseif (!empty($dom->data))
                $base = $dom;
 
-       if(! $base) {
+       if (empty($base)) {
                logger('unable to locate salmon data in xml ');
                System::httpExit(400);
        }
@@ -145,21 +146,24 @@ 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",
-               DBA::escape(NETWORK_OSTATUS),
-               DBA::escape(NETWORK_DFRN),
+               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 (! DBA::isResult($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",
-                                       DBA::escape(NETWORK_OSTATUS),
+                                       DBA::escape(Protocol::OSTATUS),
                                        DBA::escape($author_link),
                                        DBA::escape($author_link),
                                        intval($importer['uid'])