CoolFace
Apppublic

kenken999/php

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
get-state.php74 linesDownload Raw Back to public
1<?php2ini_set("display_errors","1");3ini_set("display_startup_errors","1");4include("include/dbcommon.php");5header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");6 7include("include/reportfunctions.php");8 9if ( isset($_POST['type']) && isset( $_POST['web'] ) ) {10 11    if ( $_POST['type'] == "new" )12    {13        unset( $_SESSION[$_POST['web']] );14		$_SESSION[$_POST['web']] = array();15		$_SESSION[$_POST['web']]['table_type'] = "db";	16        echo "OK";17    }18    elseif ( $_POST['type'] == "open" )19    {20        $xml = new xml();21		$arr=array();22        if ( $_POST['web'] == "webreports" ) {23                        	if (count(GetUserGroups()) > 1)24	            {25        	        $arr_reports = array();26                	$arr_reports = wrGetEntityList( WR_REPORT );27	                foreach ( $arr_reports as $rpt ) {28        	            if (( $rpt["owner"] != Security::getUserName()|| $rpt["owner"] == "") && $rpt["view"]==0 && $_SESSION['webreports']['settings']['name']==$rpt["name"])29                	    {30                        	echo "<p>"."You don't have permissions to view this report"."</p>";31	                        exit();32        	            }33                	}34	            }35			$arr = wrGetEntityArray( $_POST['name'], WR_REPORT );36			if(!$arr["table_type"])37				if($arr["db_based"])38					$arr["table_type"]="db";39				else40					$arr["table_type"]="project";41            $_SESSION['webreports'] = $arr;42			update_report_totals();43	    $_SESSION["webobject"]["table_type"]=$_SESSION['webreports']["table_type"];44            $_SESSION["webobject"]["name"]=$_SESSION['webreports']['settings']['name'];45        } else {46            	            if (count(GetUserGroups()) > 1)47        	    {48                	$arr_reports = array();49	                $arr_reports = wrGetEntityList( WR_CHART );50        	        foreach ( $arr_reports as $rpt ) {51                	    if (( $rpt["owner"] != Security::getUserName() || $rpt["owner"] == "") && $rpt["view"]==0 && $_SESSION['webcharts']['settings']['name']==$rpt["name"])52                    	{53                        	echo "<p>".""."</p>";54	                        exit();55        	            }56                	}57	            }58			$arr = wrGetEntityArray( $_POST['name'], WR_CHART );59			if(!$arr["table_type"])60				if($arr["db_based"])61					$arr["table_type"]="db";62				else63					$arr["table_type"]="project";64            $_SESSION['webcharts']=$arr;65			$_SESSION['webcharts']=Convert_Old_Chart($_SESSION['webcharts']);66		$_SESSION["webobject"]["table_type"]=$_SESSION['webcharts']["table_type"];67            $_SESSION["webobject"]["name"]=$_SESSION['webcharts']['settings']['name'];68        }69 70        echo "OK";71    }72	$_SESSION["webobject"]["table_type"]=@$_SESSION[$_POST['web']]['table_type'];73}74?>