]> git.mxchange.org Git - friendica.git/blobdiff - include/network.php
Merge pull request #3792 from annando/dead-contacts
[friendica.git] / include / network.php
index 08c038ec7d909df259bff92cc8d15aba8f25f8c0..11a0fffbe671a827c3e524e10ed0bc7b76def26c 100644 (file)
@@ -150,6 +150,10 @@ function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = array()) {
                }
        }
 
+       if (Config::get('system', 'ipv4_resolve', false)) {
+               curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
+       }
+
        if ($binary) {
                @curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
        }
@@ -278,6 +282,10 @@ function post_url($url, $params, $headers = null, &$redirects = 0, $timeout = 0)
        curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
        curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
 
+       if (Config::get('system', 'ipv4_resolve', false)) {
+               curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
+       }
+
        if (intval($timeout)) {
                curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
        } else {
@@ -612,7 +620,7 @@ function avatar_img($email) {
        call_hooks('avatar_lookup', $avatar);
 
        if (! $avatar['success']) {
-               $avatar['url'] = App::get_baseurl() . '/images/person-175.jpg';
+               $avatar['url'] = System::baseUrl() . '/images/person-175.jpg';
        }
 
        logger('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], LOGGER_DEBUG);
@@ -620,20 +628,15 @@ function avatar_img($email) {
 }
 
 
-function parse_xml_string($s,$strict = true) {
+function parse_xml_string($s, $strict = true) {
+       // the "strict" parameter is deactivated
+
        /// @todo Move this function to the xml class
-       if ($strict) {
-               if (! strstr($s,'<?xml'))
-                       return false;
-               $s2 = substr($s,strpos($s,'<?xml'));
-       }
-       else
-               $s2 = $s;
        libxml_use_internal_errors(true);
 
-       $x = @simplexml_load_string($s2);
-       if (! $x) {
-               logger('libxml: parse: error: ' . $s2, LOGGER_DATA);
+       $x = @simplexml_load_string($s);
+       if (!$x) {
+               logger('libxml: parse: error: ' . $s, LOGGER_DATA);
                foreach (libxml_get_errors() as $err) {
                        logger('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, LOGGER_DATA);
                }
@@ -661,7 +664,7 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
                foreach ($matches as $mtch) {
                        logger('scale_external_image: ' . $mtch[1]);
 
-                       $hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3));
+                       $hostname = str_replace('www.','',substr(System::baseUrl(),strpos(System::baseUrl(),'://')+3));
                        if (stristr($mtch[1],$hostname)) {
                                continue;
                        }
@@ -737,7 +740,10 @@ function fix_contact_ssl_policy(&$contact,$new_policy) {
        }
 
        if ($ssl_changed) {
-               dba::update('contact', $contact, array('id' => $contact['id']));
+               $fields = array('url' => $contact['url'], 'request' => $contact['request'],
+                               'notify' => $contact['notify'], 'poll' => $contact['poll'],
+                               'confirm' => $contact['confirm'], 'poco' => $contact['poco']);
+               dba::update('contact', $fields, array('id' => $contact['id']));
        }
 }