Author: leithoff
New Revision: 55408
URL: http://svn.stylite.de/viewvc/egroupware?rev=55408&view=rev
Log:
fix issues with new namespaces / translation class moved to new api/src location
Modified:
trunk/egroupware/api/src/Html/HtmLawed.php
trunk/emailadmin/inc/class.emailadmin_imapbase.inc.php
— trunk/egroupware/api/src/Html/HtmLawed.php (original)
+++ trunk/egroupware/api/src/Html/HtmLawed.php Thu Mar 17 10:29:54 2016
@@ -11,6 +11,8 @@
*/
namespace EGroupware\Api\Html;
+use EGroupware\Api;
+use translation;
require_once(DIR.’/htmLawed/htmLawed.php’);
@@ -136,7 +138,7 @@
{
//error_log(METHOD.LINE.array2string($newStyle[0]));
$style2buffer = implode(’’,$newStyle[0]);
-
// only replace what we have found, we use it here, as we use the same routine in translation::replaceTagsCompletley
// no need to do the extra routine
$html = str_ireplace($newStyle[0],'',$html);
}
@@ -149,7 +151,7 @@
if ($test==“null” && strlen($style2buffer)>0)
{
// this should not be needed, unless something fails with charset detection/ wrong charset passed
@@ -165,15 +167,15 @@
// CSS Security
// http://code.google.com/p/browsersec/wiki/Part1#Cascading_stylesheets
$css = preg_replace(’/(javascript|expession|-moz-binding)/i’,’’,$style);
-
if (stripos($css,'script')!==false) translation::replaceTagsCompletley($css,'script'); // Strip out script that may be included
// we need this, as styledefinitions are enclosed with curly brackets; and template stuff tries to replace everything between curly brackets that is having no horizontal whitespace
// as the comments as <!-- styledefinition --> in stylesheet are outdated, and ck-editor does not understand it, we remove it
$css_no_comment = str_replace(array(':','<!--','-->'),array(': ','',''),$css);
//error_log(__METHOD__.__LINE__.$css);
-
// we already removed what we have found, above, as we used pretty much the same routine as in translation::replaceTagsCompletley
// no need to do the extra routine
// TODO: we may have to strip urls and maybe comments and ifs
@@ -389,17 +391,21 @@
if (!isset($attribute_array[‘title’])) $attribute_array[‘title’]=$attribute_array[‘alt’];
$attribute_array[‘src’]=common::image(‘phpgwapi’,‘dialog_error’);
}
-
$attribute_array['alt']= $attribute_array['alt'].' [blocked external image:'.$attribute_array['src'].']';
-
if (!isset($attribute_array['title'])) $attribute_array['title']=$attribute_array['alt'];
-
$attribute_array['src']=common::image('mail','no-image-shown');
-
$attribute_array['border'] = 1;
-
if ($attribute_array['style'])
-
//the own webserver url is not external, so it should be allowed
-
if (empty($GLOBALS['egw_info']['server']['webserver_url'])||!preg_match("$^".$GLOBALS['egw_info']['server']['webserver_url'].".*$",$attribute_array['src']))
{
-
if (stripos($attribute_array['style'],'border')!==false) $attribute_array['style'] = preg_replace('~border(:|-left:|-right:|-bottom:|-top:)+ (0px)+ (none)+;~si','',$attribute_array['style']);
-
$attribute_array['alt']= $attribute_array['alt'].' [blocked external image:'.$attribute_array['src'].']';
-
if (!isset($attribute_array['title'])) $attribute_array['title']=$attribute_array['alt'];
-
$attribute_array['src']=common::image('mail','no-image-shown');
-
$attribute_array['border'] = 1;
-
if ($attribute_array['style'])
-
{
-
if (stripos($attribute_array['style'],'border')!==false) $attribute_array['style'] = preg_replace('~border(:|-left:|-right:|-bottom:|-top:)+ (0px)+ (none)+;~si','',$attribute_array['style']);
-
}
}
}
}
— trunk/emailadmin/inc/class.emailadmin_imapbase.inc.php (original)
+++ trunk/emailadmin/inc/class.emailadmin_imapbase.inc.php Thu Mar 17 10:29:54 2016
@@ -11,6 +11,7 @@
*/
use EGroupware\Api;
+use translation;
/**
- Mail worker class
@@ -1495,7 +1496,7 @@
$buffer = translation::convertHTMLToText($part->toString(array(
‘encode’ => Horde_Mime_Part::ENCODE_BINARY, // otherwise we cant recode charset
)), $charset, ‘utf-8’);
-
$headerObject['BODYPREVIEW']=trim(str_replace(array("\r\n","\r","\n"),' ',mb_substr(translation::convert_jsonsafe($buffer),0,((int)$_fetchPreviews<300?300:$_fetchPreviews))));
-
$headerObject['BODYPREVIEW']=trim(str_replace(array("\r\n","\r","\n"),' ',mb_substr(Api\Translation::convert_jsonsafe($buffer),0,((int)$_fetchPreviews<300?300:$_fetchPreviews))));
} elseif (empty($headerObject['BODYPREVIEW'])&&$part->getPrimaryType()== 'multipart')
{
//error_log(__METHOD__.' ('.__LINE__.') '.array2string($part));
@@ -1526,10 +1527,10 @@
$_structure=$part;
$this->fetchPartContents($uid, $_structure, false,true);
$headerObject[‘BODYPREVIEW’]=trim(str_replace(array("\r\n","\r","\n"),’ ',mb_substr(translation::convertHTMLToText($_structure->getContents()),0,((int)$_fetchPreviews<300?300:$_fetchPreviews))));
@@ -2298,7 +2299,7 @@
}
catch (Exception $e)
{
@@ -4067,7 +4068,7 @@
//setting the charset (if not given)
if ($_charset===false) $_charset = self::$displayCharset;
$string = @htmlentities($_string, ENT_QUOTES, $_charset, false);
-
if (empty($string) && !empty($_string)) $string = @htmlentities(translation::convert($_string,translation::detect_encoding($_string),$_charset),ENT_QUOTES | ENT_IGNORE,$_charset, false);
-
if (empty($string) && !empty($_string)) $string = @htmlentities(translation::convert($_string,Api\Translation::detect_encoding($_string),$_charset),ENT_QUOTES | ENT_IGNORE,$_charset, false);
return $string;
}
@@ -4758,10 +4759,10 @@
$bodyParts[$i][‘body’] = preg_replace($sar,$rar,$bodyParts[$i][‘body’]);
}
@@ -5165,7 +5166,7 @@
continue;
}
@@ -5187,7 +5188,7 @@
if ($test==“null” && strlen($style2buffer)>0)
{
// this should not be needed, unless something fails with charset detection/ wrong charset passed
@@ -5957,7 +5958,7 @@
// no attempt to convert, if we dont know about the charset
if (isset($attachments[$num][‘charset’])&&!empty($attachments[$num][‘charset’])) {
// we do not try guessing the charset, if it is not set
-
//if ($attachments[$num]['charset']===false) $attachments[$num]['charset'] = Api\Translation::detect_encoding($attachments[$num]['attachment']);
translation::convert($attachments[$num]['attachment'],$attachments[$num]['charset']);
}
if(in_array($attachments[$num]['name'], $file_list))
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs