]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
Facebook and App.net is removed from nearly all places (#5581)
[friendica.git] / include / text.php
index a7984a6146bd6153a02f60d9538c94bbd54f6fe3..7c86326435cd04733b0877b617e637bc93aa8ba9 100644 (file)
@@ -13,16 +13,15 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\DBM;
+use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Model\Event;
 use Friendica\Model\Item;
-use Friendica\Model\Profile;
 use Friendica\Render\FriendicaSmarty;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Map;
+use Friendica\Util\Proxy as ProxyUtils;
 
-require_once "mod/proxy.php";
 require_once "include/conversation.php";
 
 /**
@@ -756,11 +755,11 @@ function contact_block() {
                                AND NOT `pending` AND NOT `hidden` AND NOT `archive`
                                AND `network` IN ('%s', '%s', '%s')",
                        intval($a->profile['uid']),
-                       dbesc(NETWORK_DFRN),
-                       dbesc(NETWORK_OSTATUS),
-                       dbesc(NETWORK_DIASPORA)
+                       DBA::escape(NETWORK_DFRN),
+                       DBA::escape(NETWORK_OSTATUS),
+                       DBA::escape(NETWORK_DIASPORA)
        );
-       if (DBM::is_result($r)) {
+       if (DBA::isResult($r)) {
                $total = intval($r[0]['total']);
        }
        if (!$total) {
@@ -774,20 +773,20 @@ function contact_block() {
                                        AND `network` IN ('%s', '%s', '%s')
                                ORDER BY RAND() LIMIT %d",
                                intval($a->profile['uid']),
-                               dbesc(NETWORK_DFRN),
-                               dbesc(NETWORK_OSTATUS),
-                               dbesc(NETWORK_DIASPORA),
+                               DBA::escape(NETWORK_DFRN),
+                               DBA::escape(NETWORK_OSTATUS),
+                               DBA::escape(NETWORK_DIASPORA),
                                intval($shown)
                );
-               if (DBM::is_result($r)) {
+               if (DBA::isResult($r)) {
                        $contacts = [];
                        foreach ($r AS $contact) {
                                $contacts[] = $contact["id"];
                        }
                        $r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `thumb`, `network` FROM `contact` WHERE `id` IN (%s)",
-                               dbesc(implode(",", $contacts)));
+                               DBA::escape(implode(",", $contacts)));
 
-                       if (DBM::is_result($r)) {
+                       if (DBA::isResult($r)) {
                                $contacts = L10n::tt('%d Contact', '%d Contacts', $total);
                                $micropro = [];
                                foreach ($r as $rr) {
@@ -859,7 +858,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
                '$click' => defaults($contact, 'click', ''),
                '$class' => $class,
                '$url' => $url,
-               '$photo' => proxy_url($contact['thumb'], false, PROXY_SIZE_THUMB),
+               '$photo' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB),
                '$name' => $contact['name'],
                'title' => $contact['name'] . ' [' . $contact['addr'] . ']',
                '$parkle' => $sparkle,
@@ -1468,9 +1467,9 @@ function generate_user_guid() {
        do {
                $guid = System::createGUID(32);
                $x = q("SELECT `uid` FROM `user` WHERE `guid` = '%s' LIMIT 1",
-                       dbesc($guid)
+                       DBA::escape($guid)
                );
-               if (!DBM::is_result($x)) {
+               if (!DBA::isResult($x)) {
                        $found = false;
                }
        } while ($found == true);
@@ -1660,7 +1659,7 @@ function file_tag_file_query($table,$s,$type = 'file') {
        } else {
                $str = preg_quote('<' . str_replace('%', '%%', file_tag_encode($s)) . '>');
        }
-       return " AND " . (($table) ? dbesc($table) . '.' : '') . "file regexp '" . dbesc($str) . "' ";
+       return " AND " . (($table) ? DBA::escape($table) . '.' : '') . "file regexp '" . DBA::escape($str) . "' ";
 }
 
 // ex. given music,video return <music><video> or [music][video]
@@ -1754,12 +1753,12 @@ function file_tag_update_pconfig($uid, $file_old, $file_new, $type = 'file') {
 
                foreach ($deleted_tags as $key => $tag) {
                        $r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d",
-                               dbesc($tag),
+                               DBA::escape($tag),
                                intval(TERM_OBJ_POST),
                                intval($termtype),
                                intval($uid));
 
-                       if (DBM::is_result($r)) {
+                       if (DBA::isResult($r)) {
                                unset($deleted_tags[$key]);
                        } else {
                                $filetags_updated = str_replace($lbracket . file_tag_encode($tag) . $rbracket,'',$filetags_updated);
@@ -1783,7 +1782,7 @@ function file_tag_save_file($uid, $item_id, $file)
        }
 
        $item = Item::selectFirst(['file'], ['id' => $item_id, 'uid' => $uid]);
-       if (DBM::is_result($item)) {
+       if (DBA::isResult($item)) {
                if (!stristr($item['file'],'[' . file_tag_encode($file) . ']')) {
                        $fields = ['file' => $item['file'] . '[' . file_tag_encode($file) . ']'];
                        Item::update($fields, ['id' => $item_id]);
@@ -1812,7 +1811,7 @@ function file_tag_unsave_file($uid, $item_id, $file, $cat = false)
        }
 
        $item = Item::selectFirst(['file'], ['id' => $item_id, 'uid' => $uid]);
-       if (!DBM::is_result($item)) {
+       if (!DBA::isResult($item)) {
                return false;
        }
 
@@ -1820,12 +1819,12 @@ function file_tag_unsave_file($uid, $item_id, $file, $cat = false)
        Item::update($fields, ['id' => $item_id]);
 
        $r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d",
-               dbesc($file),
+               DBA::escape($file),
                intval(TERM_OBJ_POST),
                intval($termtype),
                intval($uid)
        );
-       if (!DBM::is_result($r)) {
+       if (!DBA::isResult($r)) {
                $saved = PConfig::get($uid, 'system', 'filetags');
                PConfig::set($uid, 'system', 'filetags', str_replace($pattern, '', $saved));
        }