X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fnetwork.php;h=0e1a63792f5a04676cf3f23b00123c5cd7aad12b;hb=f6818ab2438f2274c5d820bc9b1f90ff7476c0b7;hp=d69454899a7438673d301c552644fc273aae54e3;hpb=47c48aa438e30573a4df7ade39ecaacb804f7710;p=friendica.git diff --git a/include/network.php b/include/network.php index d69454899a..0e1a63792f 100644 --- a/include/network.php +++ b/include/network.php @@ -605,6 +605,9 @@ function validate_url(&$url) { if(! function_exists('validate_email')) { function validate_email($addr) { + if(get_config('system','disable_email_validation')) + return true; + if(! strpos($addr,'@')) return false; $h = substr($addr,strpos($addr,'@') + 1); @@ -799,7 +802,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) $s = htmlspecialchars_decode($s); $matches = null; - $c = preg_match_all('/\[img\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER); + $c = preg_match_all('/\[img.*?\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER); if($c) { require_once('include/Photo.php'); foreach($matches as $mtch) { @@ -820,6 +823,12 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) $scaled = $mtch[1]; $i = fetch_url($scaled); + $cache = get_config('system','itemcache'); + if (($cache != '') and is_dir($cache)) { + $cachefile = $cache."/".hash("md5", $scaled); + file_put_contents($cachefile, $i); + } + // guess mimetype from headers or filename $type = guess_image_type($mtch[1],true); @@ -845,6 +854,10 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) } } } + + // replace the special char encoding + + $s = htmlspecialchars($s,ENT_QUOTES,'UTF-8'); return $s; }