Esempio n. 1
0
function SPITGRAPH($template)
{
    $data = NULL;
    if ($template->GraphImage($data) != 0 || $data == NULL || $data == "") {
        SPITERROR();
    } else {
        header("Content-type: image/png");
        echo "{$data}";
    }
}
Esempio n. 2
0
function handle_error($message, $death)
{
    SPITERROR(400, $message);
}
Esempio n. 3
0
}
$archive = "{$randdir}/archive";
$manifest = "{$randdir}/MANIFEST";
$fd = fopen($manifest, "w");
fwrite($fd, $manifest_str);
fclose($fd);
$origwd = getcwd();
chdir($FILEROOT);
$retval = system("tar -cf {$archive} " . implode(" ", $files));
if ($retval) {
    SPITERROR("cdata1");
}
chdir("{$randdir}");
$retval = system("tar -rf {$archive} MANIFEST");
if ($retval) {
    SPITERROR("cdata2");
}
system("gzip {$archive}");
$archive .= ".gz";
#
# Phew!  Blow chunk and finish.
#
$fstat = stat($archive);
header("Content-Type: application/x-gzip");
header("Content-Length: " . $fstat["size"]);
readfile($archive);
# cleanup
chdir($origwd);
unlink($archive);
unlink($manifest);
rmdir($randdir);
Esempio n. 4
0
{
    header("HTTP/1.0 {$code} {$msg}");
    exit;
}
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("uuid", PAGEARG_STRING);
$image = Image::LookupByUUID($uuid);
if (!isset($image)) {
    SPITERROR(404, "Could not find {$uuid}!");
}
if (!$image->isglobal()) {
    SPITERROR(403, "No permission to access image");
}
$fp = popen("{$TBSUEXEC_PATH} nobody nobody webdumpdescriptor " . "-e -i " . $image->imageid(), "r");
if (!$fp) {
    SPITERROR(404, "Could not get metadata for {$uuid}!");
}
header("Content-Type: text/plain; charset=us-ascii");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
flush();
while (!feof($fp)) {
    $string = fgets($fp, 1024);
    echo "{$string}";
    flush();
}
pclose($fp);
$fp = 0;