]> git.mxchange.org Git - friendica.git/blobdiff - mod/poco.php
Merge pull request #5750 from MrPetovan/bug/5723-frio-fix-new-event-acl
[friendica.git] / mod / poco.php
index fe81f98d3b2c5a4e562573a7cf84f40c892977df..a16495326009eed93b10ac60968a874e541d7ffa 100644 (file)
@@ -8,6 +8,7 @@ use Friendica\App;
 use Friendica\Content\Text\BBCode;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
+use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Protocol\PortableContact;
@@ -25,7 +26,7 @@ function poco_init(App $a) {
        }
        if (empty($user)) {
                $c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
-               if (!DBA::is_result($c)) {
+               if (!DBA::isResult($c)) {
                        System::httpExit(401);
                }
                $system_mode = true;
@@ -65,9 +66,9 @@ function poco_init(App $a) {
        if (! $system_mode && ! $global) {
                $users = q("SELECT `user`.*,`profile`.`hide-friends` from user left join profile on `user`.`uid` = `profile`.`uid`
                        where `user`.`nickname` = '%s' and `profile`.`is-default` = 1 limit 1",
-                       dbesc($user)
+                       DBA::escape($user)
                );
-               if (! DBA::is_result($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) {
+               if (! DBA::isResult($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) {
                        System::httpExit(404);
                }
 
@@ -88,10 +89,10 @@ function poco_init(App $a) {
        }
        if ($global) {
                $contacts = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `updated` >= `last_failure` AND NOT `hide` AND `network` IN ('%s', '%s', '%s')",
-                       dbesc($update_limit),
-                       dbesc(NETWORK_DFRN),
-                       dbesc(NETWORK_DIASPORA),
-                       dbesc(NETWORK_OSTATUS)
+                       DBA::escape($update_limit),
+                       DBA::escape(Protocol::DFRN),
+                       DBA::escape(Protocol::DIASPORA),
+                       DBA::escape(Protocol::OSTATUS)
                );
        } elseif ($system_mode) {
                $contacts = q("SELECT count(*) AS `total` FROM `contact` WHERE `self` = 1
@@ -101,13 +102,13 @@ function poco_init(App $a) {
                        AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
                        AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra",
                        intval($user['uid']),
-                       dbesc(NETWORK_DFRN),
-                       dbesc(NETWORK_DIASPORA),
-                       dbesc(NETWORK_OSTATUS),
-                       dbesc(NETWORK_STATUSNET)
+                       DBA::escape(Protocol::DFRN),
+                       DBA::escape(Protocol::DIASPORA),
+                       DBA::escape(Protocol::OSTATUS),
+                       DBA::escape(Protocol::STATUSNET)
                );
        }
-       if (DBA::is_result($contacts)) {
+       if (DBA::isResult($contacts)) {
                $totalResults = intval($contacts[0]['total']);
        } else {
                $totalResults = 0;
@@ -123,10 +124,10 @@ function poco_init(App $a) {
                logger("Start global query", LOGGER_DEBUG);
                $contacts = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND NOT `hide` AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
                        ORDER BY `updated` DESC LIMIT %d, %d",
-                       dbesc($update_limit),
-                       dbesc(NETWORK_DFRN),
-                       dbesc(NETWORK_DIASPORA),
-                       dbesc(NETWORK_OSTATUS),
+                       DBA::escape($update_limit),
+                       DBA::escape(Protocol::DFRN),
+                       DBA::escape(Protocol::DIASPORA),
+                       DBA::escape(Protocol::OSTATUS),
                        intval($startIndex),
                        intval($itemsPerPage)
                );
@@ -148,10 +149,10 @@ function poco_init(App $a) {
                        AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
                        AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra LIMIT %d, %d",
                        intval($user['uid']),
-                       dbesc(NETWORK_DFRN),
-                       dbesc(NETWORK_DIASPORA),
-                       dbesc(NETWORK_OSTATUS),
-                       dbesc(NETWORK_STATUSNET),
+                       DBA::escape(Protocol::DFRN),
+                       DBA::escape(Protocol::DIASPORA),
+                       DBA::escape(Protocol::OSTATUS),
+                       DBA::escape(Protocol::STATUSNET),
                        intval($startIndex),
                        intval($itemsPerPage)
                );
@@ -203,7 +204,7 @@ function poco_init(App $a) {
        }
 
        if (is_array($contacts)) {
-               if (DBA::is_result($contacts)) {
+               if (DBA::isResult($contacts)) {
                        foreach ($contacts as $contact) {
                                if (!isset($contact['updated'])) {
                                        $contact['updated'] = '';
@@ -257,7 +258,7 @@ function poco_init(App $a) {
                                }
 
                                // Non connected persons can only see the keywords of a Diaspora account
-                               if ($contact['network'] == NETWORK_DIASPORA) {
+                               if ($contact['network'] == Protocol::DIASPORA) {
                                        $contact['location'] = "";
                                        $about = "";
                                        $contact['gender'] = "";
@@ -284,7 +285,7 @@ function poco_init(App $a) {
                                }
                                if ($fields_ret['urls']) {
                                        $entry['urls'] = [['value' => $contact['url'], 'type' => 'profile']];
-                                       if ($contact['addr'] && ($contact['network'] !== NETWORK_MAIL)) {
+                                       if ($contact['addr'] && ($contact['network'] !== Protocol::MAIL)) {
                                                $entry['urls'][] = ['value' => 'acct:' . $contact['addr'], 'type' => 'webfinger'];
                                        }
                                }
@@ -314,11 +315,11 @@ function poco_init(App $a) {
                                }
                                if ($fields_ret['network']) {
                                        $entry['network'] = $contact['network'];
-                                       if ($entry['network'] == NETWORK_STATUSNET) {
-                                               $entry['network'] = NETWORK_OSTATUS;
+                                       if ($entry['network'] == Protocol::STATUSNET) {
+                                               $entry['network'] = Protocol::OSTATUS;
                                        }
                                        if (($entry['network'] == "") && ($contact['self'])) {
-                                               $entry['network'] = NETWORK_DFRN;
+                                               $entry['network'] = Protocol::DFRN;
                                        }
                                }
                                if ($fields_ret['tags']) {