]> git.mxchange.org Git - friendica.git/blobdiff - include/network.php
Merge branch 'develop' into rewrites/dbm_is_result
[friendica.git] / include / network.php
index 419a96020e9a27f7c0d1409f5a74fd13f1f59964..7a662e4cbf08585a3a1bed493c060ab0418a600a 100644 (file)
@@ -388,32 +388,23 @@ function http_status_exit($val, $description = array()) {
  * @return boolean True if it's a valid URL, fals if something wrong with it
  */
 function validate_url(&$url) {
-       logger(sprintf('[%s:%d]: url=%s - CALLED!', __FUNCTION__, __LINE__, $url), LOGGER_TRACE);
-
        if(get_config('system','disable_url_validation'))
-               logger(sprintf('[%s:%d]: URL validation disabled, returning TRUE - EXIT!', __FUNCTION__, __LINE__), LOGGER_TRACE);
                return true;
 
        // no naked subdomains (allow localhost for tests)
        if(strpos($url,'.') === false && strpos($url,'/localhost/') === false)
-               logger(sprintf('[%s:%d]: URL is not complete, returning FALSE - EXIT!', __FUNCTION__, __LINE__), LOGGER_TRACE);
                return false;
 
-       if(substr($url,0,4) != 'http' && substr($url,0,5) != 'https')
+       if(substr($url,0,4) != 'http')
                $url = 'http://' . $url;
 
-       logger(sprintf('[%s:%d]: url=%s - before parse_url() ...', __FUNCTION__, __LINE__, $url), LOGGER_DEBUG);
-
+       /// @TODO Really supress function outcomes? Why not find them + debug them?
        $h = @parse_url($url);
 
-       logger(sprintf('[%s:%d]: h[]=%s', __FUNCTION__, __LINE__, gettype($h)), LOGGER_DEBUG);
-
        if((is_array($h)) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) {
-               logger(sprintf('[%s:%d]: URL %s validated. - EXIT!', __FUNCTION__, __LINE__, $url), LOGGER_TRACE);
                return true;
        }
 
-       logger(sprintf('[%s:%d]: URL %s maybe not valid - EXIT!', __FUNCTION__, __LINE__, $url), LOGGER_TRACE);
        return false;
 }
 
@@ -522,8 +513,6 @@ function allowed_email($email) {
 
 function avatar_img($email) {
 
-       $a = get_app();
-
        $avatar['size'] = 175;
        $avatar['email'] = $email;
        $avatar['url'] = '';
@@ -531,8 +520,9 @@ function avatar_img($email) {
 
        call_hooks('avatar_lookup', $avatar);
 
-       if(! $avatar['success'])
-               $avatar['url'] = $a->get_baseurl() . '/images/person-175.jpg';
+       if (! $avatar['success']) {
+               $avatar['url'] = App::get_baseurl() . '/images/person-175.jpg';
+       }
 
        logger('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], LOGGER_DEBUG);
        return $avatar['url'];
@@ -578,7 +568,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($a->get_baseurl(),strpos($a->get_baseurl(),'://')+3));
+                       $hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3));
                        if(stristr($mtch[1],$hostname))
                                continue;