]> git.mxchange.org Git - friendica.git/blobdiff - include/network.php
Update functions and calls
[friendica.git] / include / network.php
index bd64ab3508c45c2bb1222a6897907fa990c78483..413048d5b8057992d731b5e489b7ba8bfb8be02a 100644 (file)
@@ -232,8 +232,6 @@ function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = array())
        $a->set_curl_code($http_code);
        $a->set_curl_content_type($curl_info['content_type']);
 
-       $body = substr($s, strlen($header));
-
        $rc = intval($http_code);
        $ret['return_code'] = $rc;
        $ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false);
@@ -611,11 +609,15 @@ function blocked_url($url)
 function allowed_email($email)
 {
        $domain = strtolower(substr($email, strpos($email, '@') + 1));
-       if (! $domain) {
+       if (!$domain) {
                return false;
        }
 
        $str_allowed = Config::get('system', 'allowed_email', '');
+       if (!x($str_allowed)) {
+               return true;
+       }
+
        $allowed = explode(',', $str_allowed);
 
        return allowed_domain($domain, $allowed);
@@ -624,29 +626,23 @@ function allowed_email($email)
 /**
  * Checks for the existence of a domain in a domain list
  *
- * If strict is not set, an empty domain list counts as found
- *
  * @brief Checks for the existence of a domain in a domain list
  * @param string $domain
- * @param array $domain_list
- * @param bool   $strict
+ * @param array  $domain_list
  * @return boolean
  */
-function allowed_domain($domain, array $domain_list, $strict = false)
+function allowed_domain($domain, array $domain_list)
 {
        $found = false;
 
-       if (count($domain_list)) {
-               foreach ($domain_list as $item) {
-                       $pat = strtolower(trim($item));
-                       if (fnmatch($pat, $domain) || ($pat == $domain)) {
-                               $found = true;
-                               break;
-                       }
+       foreach ($domain_list as $item) {
+               $pat = strtolower(trim($item));
+               if (fnmatch($pat, $domain) || ($pat == $domain)) {
+                       $found = true;
+                       break;
                }
-       } elseif(!$strict) {
-               $found = true;
        }
+
        return $found;
 }
 
@@ -693,8 +689,6 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
                $include_link = false;
        }
 
-       $a = get_app();
-
        // Picture addresses can contain special characters
        $s = htmlspecialchars_decode($srctext);
 
@@ -868,7 +862,6 @@ function original_url($url, $depth = 1, $fetchbody = false)
 
        $stamp1 = microtime(true);
 
-       $siteinfo = array();
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 1);
@@ -877,7 +870,7 @@ function original_url($url, $depth = 1, $fetchbody = false)
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
 
-       $header = curl_exec($ch);
+       curl_exec($ch);
        $curl_info = @curl_getinfo($ch);
        $http_code = $curl_info['http_code'];
        curl_close($ch);
@@ -949,7 +942,6 @@ function original_url($url, $depth = 1, $fetchbody = false)
                if (@$attr["http-equiv"] == 'refresh') {
                        $path = $attr["content"];
                        $pathinfo = explode(";", $path);
-                       $content = "";
                        foreach ($pathinfo as $value) {
                                if (substr(strtolower($value), 0, 4) == "url=") {
                                        return(original_url(substr($value, 4), ++$depth));
@@ -958,7 +950,7 @@ function original_url($url, $depth = 1, $fetchbody = false)
                }
        }
 
-       return($url);
+       return $url;
 }
 
 function short_link($url)