<?php

$debug = 0;
include 'site.php';

### these need to be set to the correct locations!!
$MISSING = "missing.png";

### we must have been past arguments with GET:
if ($_SERVER[REQUEST_METHOD] != 'GET') {
    exit ();
}

$mode = $_GET[mode];
$type = $_GET[type];
$label = $_GET[label];
$stage = $_GET[stage];
$plottype = $_GET[plottype];

$path = "/data/ipp009.0/czartool_plots"; # TODO horrible hard-coded path - read from config

if ($label == "all") $label = "all_".$mode."_labels";

if ($type=="t" || $type=="r" || $type=="rt" || $type=="rh")
$filePath = "$path/czarplot_".$plottype."_".$label."_".$stage."_".$type.".png";
else if ($type=="h")
$filePath = "$path/czarplot_".$plottype."_".$label."_all_stages_".$type.".png";
else if ($type=="s")
$filePath = "$path/czarplot_hosts_space.png";
else if ($type=="st")
$filePath = "$path/czarplot_cluster.png";


$file = fopen ($filePath, "r");
if ($file && !$debug) {
    header ('Content-Type: image/png');
    fpassthru ($file);
}


exit();

?>
~                                 
