Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2015-05-06 02:59:38 +0300
committerThomas Steur <thomas.steur@gmail.com>2015-05-11 00:57:19 +0300
commit2684a981baa430987f601002bcabf38460432dfe (patch)
tree1381fd46a259265398114760e84a1facba282e4c /libs
parentf04a12a0f55021e532809af20ada0d8f25448199 (diff)
apply our patches again
Diffstat (limited to 'libs')
-rwxr-xr-xlibs/pChart/class/pData.class.php3
-rwxr-xr-xlibs/pChart/class/pDraw.class.php16
-rwxr-xr-xlibs/pChart/class/pImage.class.php14
3 files changed, 27 insertions, 6 deletions
diff --git a/libs/pChart/class/pData.class.php b/libs/pChart/class/pData.class.php
index 2dfff95444..49d16a33bd 100755
--- a/libs/pChart/class/pData.class.php
+++ b/libs/pChart/class/pData.class.php
@@ -701,6 +701,7 @@
}
/* Create a dataset based on a formula */
+ /* COMMENTED BY PIWIK to avoid eval()
function createFunctionSerie($SerieName,$Formula="",$Options="")
{
$MinX = isset($Options["MinX"]) ? $Options["MinX"] : -10;
@@ -729,7 +730,7 @@
$this->addPoints($Result,$SerieName);
if ( $AutoDescription ) { $this->setSerieDescription($SerieName,$Formula); }
if ( $RecordAbscissa ) { $this->addPoints($Abscissa,$AbscissaSerie); }
- }
+ }*/
function negateValues($Series)
{
diff --git a/libs/pChart/class/pDraw.class.php b/libs/pChart/class/pDraw.class.php
index 2e75aeb725..ef638bbb9e 100755
--- a/libs/pChart/class/pDraw.class.php
+++ b/libs/pChart/class/pDraw.class.php
@@ -1016,17 +1016,27 @@
if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
{
$C_ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa);
- imagettftext($this->Picture,$FontSize,$Angle,$X+$this->ShadowX,$Y+$this->ShadowY,$C_ShadowColor,$FontName,$Text);
+ imagettftext($this->Picture,$FontSize,$Angle,$X+$this->ShadowX,$Y+$this->ShadowY,$C_ShadowColor,$FontName,$this->getEncodedText($Text));
}
$C_TextColor = $this->AllocateColor($this->Picture,$R,$G,$B,$Alpha);
- imagettftext($this->Picture,$FontSize,$Angle,$X,$Y,$C_TextColor,$FontName,$Text);
+ imagettftext($this->Picture,$FontSize,$Angle,$X,$Y,$C_TextColor,$FontName,$this->getEncodedText($Text));
$this->Shadow = $Shadow;
return($TxtPos);
}
+ function getEncodedText($text)
+ {
+ $gdinfo = gd_info();
+ if (!empty($gdinfo['JIS-mapped Japanese Font Support'])) {
+ return mb_convert_encoding($text, "SJIS", "UTF-8");
+ }
+
+ return $text;
+ }
+
/* Draw a gradient within a defined area */
function drawGradientArea($X1,$Y1,$X2,$Y2,$Direction,$Format="")
{
@@ -1388,7 +1398,7 @@
$this->drawArrow($X2,$Y2,$X1,$Y1,$Format);
- $Size = imagettfbbox($FontSize,0,$FontName,$Text);
+ $Size = imagettfbbox($FontSize,0,$FontName,$this->getEncodedText($Text));
$TxtWidth = max(abs($Size[2]-$Size[0]),abs($Size[0]-$Size[6]));
$TxtHeight = max(abs($Size[1]-$Size[7]),abs($Size[3]-$Size[1]));
diff --git a/libs/pChart/class/pImage.class.php b/libs/pChart/class/pImage.class.php
index a21466afa7..900174d720 100755
--- a/libs/pChart/class/pImage.class.php
+++ b/libs/pChart/class/pImage.class.php
@@ -190,7 +190,7 @@
/* Return the surrounding box of text area */
function getTextBox_deprecated($X,$Y,$FontName,$FontSize,$Angle,$Text)
{
- $Size = imagettfbbox($FontSize,$Angle,$FontName,$Text);
+ $Size = imagettfbbox($FontSize,$Angle,$FontName,$this->getEncodedText($Text));
$Width = $this->getLength($Size[0],$Size[1],$Size[2],$Size[3])+1;
$Height = $this->getLength($Size[2],$Size[3],$Size[4],$Size[5])+1;
@@ -205,10 +205,20 @@
return($RealPos);
}
+ function getEncodedText($text)
+ {
+ $gdinfo = gd_info();
+ if (!empty($gdinfo['JIS-mapped Japanese Font Support'])) {
+ return mb_convert_encoding($text, "SJIS", "UTF-8");
+ }
+
+ return $text;
+ }
+
/* Return the surrounding box of text area */
function getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text)
{
- $coords = imagettfbbox($FontSize, 0, $FontName, $Text);
+ $coords = imagettfbbox($FontSize, 0, $FontName, $this->getEncodedText($Text));
$a = deg2rad($Angle); $ca = cos($a); $sa = sin($a); $RealPos = array();
for($i = 0; $i < 7; $i += 2)