CoolFace
Apppublic

kenken999/php

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
dchart_preview.php112 linesDownload Raw Back to public
1<?php2 3ini_set("display_errors","1");4ini_set("display_startup_errors","1");5include("include/dbcommon.php");6header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");7 8 9 10include("include/reportfunctions.php");11 12$strTableName="";13 14$cname = postvalue("cname");15$chrt_array = wrGetEntityArray( postvalue("cname"), WR_CHART );16 17if( !$chrt_array ) {18	header("location: ".GetTableLink("webreport"));19	exit();20} else {21	Reload_Chart(postvalue("cname"));22}23 24include('include/xtempl.php');25$xt = new Xtempl();26 27 28if(is_wr_project())29	include("include/" . $chrt_array['settings']['short_table_name'] . "_variables.php");30 31	if(!isLogged())32	{33		$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];34		header("Location: ".GetTableLink("login", "", "message=expired"));35		return;36	} elseif ( $chrt_array['settings']['status'] == "private" && $chrt_array['settings']['owner'] != Security::getUserName() ) {37		echo "<p>"."You don't have permissions to view this chart"."</p>";38		exit();39	}40 41	if (pre8count(GetUserGroups()) > 1)42	{43	    $arr_reports = array();44	    $arr_reports = wrGetEntityList( WR_CHART );45	    foreach ( $arr_reports as $rpt ) {46		    if (( $rpt["owner"] != Security::getUserName() || $rpt["owner"] == "") && $rpt["view"]==0 && $chrt_array['settings']['name']==$rpt["name"])47		      {48		       echo "<p>"."You don't have permissions to view this chart"."</p>";49		       exit();50		    }51	    }52	}53$width = 780;54$height = 570;55 56$refresh=0;57 58$chartParams = array();59$chartParams['width'] = $width;60$chartParams['height'] = $height;61$chartParams['chartName'] = postvalue('cname');62$chartParams['containerId'] = "showchart";63$chartParams['chartType'] = $chrt_array['chart_type']['type'];64$chartParams['refreshTime'] = $refresh;65$chartParams['xmlFile'] = GetTableLink("dchartdata") . '?cname=' . postvalue('cname') . $chartPreview .66	'&ctype=' . $chrt_array['chart_type']['type'];67 68$show_dchart = '<div id="' . $chartParams['containerId'] . '" style="width:' . $width . 'px;height:' . $height . 'px"></div>';69	$show_dchart .= '<script type="text/javascript" language="javascript" src="' . GetRootPathForResources( 'libs/js/anychart.min.js' ) . '"></script>';70//	$show_dchart .= '<script type="text/javascript" language="javascript" src="' . GetRootPathForResources( 'libs/js/migrationTool.js' ) . '"></script>';71	$show_dchart .= '<script type="text/javascript" language="javascript">72	(function(){73		var params = ' . my_json_encode( $chartParams ) . ';74		createChart( params );75	})();76	</script>';77 78$load_flash_player = '79<script type="text/javascript">80	var svgSupported = window.SVGAngle != undefined;81		var str="";82		if (!svgSupported)83		{84			str = "<center>";85			str += "'."".'<br /><br />";86			str += "<a href=\"http://www.adobe.com/go/getflashplayer\"><img border=\"0\" src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" /></a><br />";87			str += "</center>";		88		}89		if (typeof(ActiveXObject) != "undefined") {90			try { a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");d = a.GetVariable("$version"); }91			catch (e) { d = false; }92			if (!d) {93				$("div.center_div").html( str );	94			}			95		} else if ((navigator.product == "Gecko" && window.find && !navigator.savePreferences)96			|| (navigator.userAgent.indexOf("WebKit") != -1 || navigator.userAgent.indexOf("Konqueror") != -1))97		{98			div = $("div[id*=\'__chart_generated_container__\']");99			if ( div[0] == undefined ) {100				$("div.center_div").html( str );			101			} else {102				$(div).appendTo("div.center_div");103			}104		}105</script>';106$xt->assign("wr_pagestylepath", $wr_pagestylepath);107 108$xt->assign("chart_constructor", $show_dchart);109$xt->assign("load_flash_player", $load_flash_player);110$templatefile = GetTemplateName("", "dchart_preview");111$xt->display($templatefile);112?>