]> git.mxchange.org Git - friendica.git/blobdiff - include/api.php
[WIP] Rewrite to Proxy class: (#5507)
[friendica.git] / include / api.php
index 35e2c480ccb0e49a41d04692823302cc0da82441..4fbbc37779ecf0f5d177268e62ec98f1c521194e 100644 (file)
@@ -40,6 +40,7 @@ use Friendica\Object\Image;
 use Friendica\Protocol\Diaspora;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
+use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\XML;
 
 require_once 'include/conversation.php';
@@ -47,7 +48,6 @@ require_once 'mod/share.php';
 require_once 'mod/item.php';
 require_once 'include/security.php';
 require_once 'mod/wall_upload.php';
-require_once 'mod/proxy.php';
 
 define('API_METHOD_ANY', '*');
 define('API_METHOD_GET', 'GET');
@@ -753,7 +753,7 @@ function api_get_user(App $a, $contact_id = null)
                'contributors_enabled' => false,
                'is_translator' => false,
                'is_translation_enabled' => false,
-               'following' => (($uinfo[0]['rel'] == CONTACT_IS_FOLLOWER) || ($uinfo[0]['rel'] == CONTACT_IS_FRIEND)),
+               'following' => (($uinfo[0]['rel'] == Contact::FOLLOWER) || ($uinfo[0]['rel'] == Contact::FRIEND)),
                'follow_request_sent' => false,
                'statusnet_blocking' => false,
                'notifications' => false,
@@ -2518,7 +2518,7 @@ function api_get_entitities(&$text, $bbcode)
                preg_match_all("/\[img](.*?)\[\/img\]/ism", $bbcode, $images);
 
                foreach ($images[1] as $image) {
-                       $replace = proxy_url($image);
+                       $replace = ProxyUtils::proxifyUrl($image);
                        $text = str_replace($image, $replace, $text);
                }
                return [];
@@ -2627,7 +2627,7 @@ function api_get_entitities(&$text, $bbcode)
                                // If image cache is activated, then use the following sizes:
                                // thumb  (150), small (340), medium (600) and large (1024)
                                if (!Config::get("system", "proxy_disabled")) {
-                                       $media_url = proxy_url($url);
+                                       $media_url = ProxyUtils::proxifyUrl($url);
 
                                        $sizes = [];
                                        $scale = Image::getScalingDimensions($image[0], $image[1], 150);
@@ -3186,9 +3186,9 @@ function api_statuses_f($qtype)
 
        $sql_extra = '';
        if ($qtype == 'friends') {
-               $sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
+               $sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(Contact::SHARING), intval(Contact::FRIEND));
        } elseif ($qtype == 'followers') {
-               $sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FRIEND));
+               $sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(Contact::FOLLOWER), intval(Contact::FRIEND));
        }
 
        // friends and followers only for self