//require("login/login.php"); include 'monitor.inc'; include_once 'graph_functions.inc'; include_once 'jash/functions.inc'; include_once 'jash/staticGraphFunctions.inc'; include_once 'firephp/0.3.2/fb.php'; switch ($_GET['type']) { case 'graph': $graphType = 'graph'; break; case 'histogram': $graphType = 'histogram'; break; default: setHttpResponseCode('404'); echo 'Unknown type'; die; } $filePath = 'graph/staticGraphData/' . $graphType . '/'; $fileName = $_GET['id'] . '.json.gz'; if (!file_exists($filePath . generateSubDirs($fileName) . $fileName)) { setHttpResponseCode('404'); echo 'Data missing'; die; } $fileContent = implode(gzfile($filePath . generateSubDirs($fileName) . $fileName)); $graphCreationDate = date("Y-m-d H:i:s", filemtime($filePath . generateSubDirs($fileName) . $fileName)); $smarty->assign('data', $fileContent); $smarty->assign('graphType', $graphType); $smarty->assign('graphCreationDate', $graphCreationDate); $smarty->display('report/staticGraph.tpl');
header('Content-Type: application/json'); header('Cache-Control: public', TRUE); switch ($_POST['chartType']) { case 'graph': $chartType = 'graph'; break; case 'histogram': $chartType = 'histogram'; break; default: die('bad data'); } $filePath = 'graph/staticGraphData/' . $chartType . '/'; $data = $_POST['chartData']; $filename = generateFileName($data); $subPath = generateSubDirs($filename); if (!file_exists($filePath . $subPath)) { mkdir($filePath . $subPath, 0777, true); } $file = gzopen($filePath . $subPath . $filename, 'w9'); if ($file) { gzwrite($file, $data); gzclose($file); } if (file_exists($filePath . $subPath . $filename)) { $graphId = explode('.', $filename); echo json_encode(array('staticGraphUrl' => 'staticGraph.php?id=' . $graphId[0] . '&type=' . $chartType)); } else { echo json_encode(array('errorMessage' => 'There is a problem writing data to server filesystem.')); } /**