$arrPrivateReports[] = $rpt;
	}
}

$arr_charts = GetChartsList();
foreach ( $arr_charts as $chart ) {
	if (( trim($chart["owner"]) != trim(@$_SESSION["UserID"]) || trim($chart["owner"]) == "" ) && $chart["status"]=="public") {
		$arrSharedCharts[] = $chart;
	} elseif ( trim($chart["owner"]) == trim(@$_SESSION["UserID"]) ) {
		$arrPrivateCharts[] = $chart;
	}
}

$arr_tables_db = DBGetTablesListByGroup("db");
$arr_tables_project = DBGetTablesListByGroup("project");
$arr_tables_custom = DBGetTablesListByGroup("custom");
	foreach ( $arrSharedReports as $rpt ) {
		if ( $rpt["status"] == "public" && ($rpt['view'] || $rpt['edit'])) {
			$shared_reports .= '<div style="margin-bottom:5px;">';
			$shared_reports .= '<span class="ritem" id="' . $rpt['name'] . '" title="'.runner_htmlspecialchars($rpt['title']).'">';
			$shared_reports .= ( strlen( $rpt['title'] ) > $cMaxTitleLength+5 ) ? substr( $rpt['title'], 0, $cMaxTitleLength  ) . "..." : $rpt['title'];
		// if @BUILDER.bDynamicPermissions
			if ( $rpt['view'] ) {
				$shared_reports .= '<a class="action view" type="report" href="#">['."View".']</a>';
			}
			if ( $rpt['edit'] ) {
				if(count($arr_tables_db) || count($arr_tables_project) || count($arr_tables_custom))	
					$shared_reports .= '<a class="action edit" type="report" href="#">['."Edit".']</a>';
				$shared_reports .= '<a class="action del" type="report" href="#">['."Delete".']</a>';
			}
			$shared_reports .= '</span>';
include("include/dbcommon.php");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");


include("include/reportfunctions.php");

	if(!@$_SESSION["UserID"])
	{
		$_SESSION["MyURL"] = GetTableLink("webreport");
		header("Location: ".GetTableLink("login", "", "message=expired"));
		return;
	}

//$conn=db_connect();
Reload_Chart(postvalue("cname"));
$arr_tables = DBGetTablesListByGroup("db");


include('include/xtempl.php');
$xt = new Xtempl();

if (@$_SESSION['webcharts']['settings']['title'] != "") {
	$title=@$_SESSION['webcharts']['settings']['title'];
	if(strlen($title)>25)
		$title=substr($title,25)."...";
	$xt->assign("chart_title",", "."Title".": ".$title);
} else {
	$xt->assign("chart_title","");
}
if (@$_SESSION['webcharts']['tables'][0] != "") {
	$stable=@$_SESSION['webcharts']['tables'][0];