From f2a0dac653f9f372129f373104cf5cf56c108b1f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 11 May 2015 22:57:12 -0700 Subject: fix a couple of miscellaneous errors which showed up in the logs --- include/network.php | 5 ++++- include/text.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/network.php b/include/network.php index a0782692e..e0c8885fd 100644 --- a/include/network.php +++ b/include/network.php @@ -603,7 +603,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) $scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[3]); else $scaled = $mtch[3]; - $i = z_fetch_url($scaled); + $i = z_fetch_url($scaled,true); $cache = get_config('system','itemcache'); @@ -613,7 +613,10 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) } // guess mimetype from headers or filename + $type = guess_image_type($mtch[3],$i['header']); + if(strpos($type,'image') === false) + continue; if($i['success']) { $ph = photo_factory($i['body'], $type); diff --git a/include/text.php b/include/text.php index deb5a4c90..6ed06e92a 100644 --- a/include/text.php +++ b/include/text.php @@ -2244,7 +2244,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d // The '=' is needed to not replace color codes if the code is also used as a tag // Much better would be to somehow completely avoiding things in e.g. [color]-tags. // This would allow writing things like "my favourite tag=#foobar". - $body = preg_replace('/(? Date: Tue, 12 May 2015 17:06:47 -0700 Subject: replace project name with $product or $Product in strings to avoid merge issues across different project names. Currently a place-holder. The strings themselves have not yet been modified. --- include/language.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/language.php b/include/language.php index 1e8528dc1..0af72142f 100644 --- a/include/language.php +++ b/include/language.php @@ -159,12 +159,25 @@ function t($s, $ctx = '') { if (x($a->strings, $cs)) { $t = $a->strings[$cs]; - return is_array($t) ? $t[0] : $t; + return ((is_array($t)) ? translate_product($t[0]) : translate_product($t)); } - return $s; + return translate_product($s); } +/** + * @brief translate product name + * Merging strings from different project names is problematic so we'll do that with a string replacement + */ + +function translate_product($s) { + + return str_replace(array('$product','$Product'),array(RED_PLATFORM,ucfirst(RED_PLATFORM)),$s); + +} + + + /** * @brief * -- cgit v1.2.3 From 1e0e812440b8b87c39a88692e39eb0baca736b6e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 12 May 2015 18:11:54 -0700 Subject: provide a method for loading site/custom widgets --- include/comanche.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/comanche.php b/include/comanche.php index f385f3c5a..3030ae5c6 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -245,6 +245,9 @@ function comanche_widget($name, $text) { } } + if(file_exists('widget/' . trim($name) . '.php')) + require_once('widget/' . trim($name) . '.php'); + $func = 'widget_' . trim($name); if (function_exists($func)) return $func($vars); -- cgit v1.2.3