52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
<?php
|
|
|
|
if(count($action)<2) {
|
|
gen_error_400("missing argument action[1]");
|
|
exit;
|
|
}
|
|
|
|
$cid=$action[1];
|
|
|
|
require(__DIR__."/phplib/libvar_cid2tid.php");
|
|
|
|
if(!array_key_exists($game, $cid2tid_l)) {
|
|
gen_error_404("the game ".$game." does not exist");
|
|
exit;
|
|
}
|
|
$gtid_l=$cid2tid_l[$game];
|
|
unset($cid2tid_l);
|
|
|
|
if(!array_key_exists($cid, $gtid_l)) {
|
|
gen_error_404("the cid ".$cid." in game ".$game." does not exist");
|
|
exit;
|
|
}
|
|
|
|
$tid=$gtid_l[$cid];
|
|
|
|
require(__DIR__."/phplib/libvar_tid2proj.php");
|
|
|
|
if(!array_key_exists($tid, $tid2proj_l)) {
|
|
gen_error_500("the tid ".$tid." does not exist");
|
|
exit;
|
|
}
|
|
|
|
$proj=$tid2proj_l[$tid];
|
|
|
|
$thash=gen_team_hash($ginfo["gsalt"], substr($cid, strlen("cid_")), $team_token);
|
|
|
|
$GLOBALS["game"]=$game;
|
|
$GLOBALS["team_id"]=$team_id;
|
|
$GLOBALS["action"]=$action;
|
|
$GLOBALS["cid"]=$cid;
|
|
$GLOBALS["tid"]=$tid;
|
|
$GLOBALS["proj"]=$proj;
|
|
|
|
$fn=make_attachment($thash);
|
|
|
|
header("Cache-Control: public, max-age=600");
|
|
header("Content-Type: application/octet-stream");
|
|
header("Content-Disposition: attachment; filename=\"".$fn[0]."\"");
|
|
header("Content-Length: ".strlen($fn[1]));
|
|
|
|
echo $fn[1];
|