aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-08-05 21:41:58 -0700
committerfriendica <info@friendica.com>2012-08-05 21:41:58 -0700
commitc673c70c25143f18b2ef6aef9ee6633d0eac46ae (patch)
treea5e242bc114a08cd7a46868e56f5159075f3e7fe /include/network.php
parent4f645992100a9c2a9877548b37cf4f78b4c6a160 (diff)
downloadvolse-hubzilla-c673c70c25143f18b2ef6aef9ee6633d0eac46ae.tar.gz
volse-hubzilla-c673c70c25143f18b2ef6aef9ee6633d0eac46ae.tar.bz2
volse-hubzilla-c673c70c25143f18b2ef6aef9ee6633d0eac46ae.zip
updates
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/network.php b/include/network.php
index 8b26713b9..0e16f3c2d 100644
--- a/include/network.php
+++ b/include/network.php
@@ -894,7 +894,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) {
@@ -915,6 +915,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);
@@ -940,6 +946,11 @@ 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;
}