Subversion Repositories SvarDOS

Rev

Rev 560 | Rev 719 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 560 Rev 631
Line 61... Line 61...
61
  http_response_code(404);
61
  http_response_code(404);
62
  echo "ERROR: no action specified\r\n";
62
  echo "ERROR: no action specified\r\n";
63
  exit(0);
63
  exit(0);
64
}
64
}
65
 
65
 
-
 
66
// switch to the packages directory
-
 
67
if (chdir('../../packages') === false) {
-
 
68
  http_response_code(404);
-
 
69
  echo "ERROR: server-side error, cannot access packages\r\n";
-
 
70
  exit(0);
-
 
71
}
-
 
72
 
66
$a = strtolower($_GET['a']);
73
$a = strtolower($_GET['a']);
67
 
74
 
68
$p = '';
75
$p = '';
69
if ($a != 'checkup') {
76
if ($a != 'checkup') {
70
  if (empty($_GET['p'])) {
77
  if (empty($_GET['p'])) {
Line 80... Line 87...
80
 
87
 
81
// pull action is easy (does not require looking into pkg list), do it now
88
// pull action is easy (does not require looking into pkg list), do it now
82
 
89
 
83
if ($a === 'pull') {
90
if ($a === 'pull') {
84
  if (file_exists($p . '.zip')) {
91
  if (file_exists($p . '.zip')) {
-
 
92
    header('Content-Disposition: attachment; filename="' . $p . '.zip"');
-
 
93
    header('Content-Type: application/octet-stream');
85
    readfile($p . '.zip');
94
    readfile($p . '.zip');
86
  } else {
95
  } else {
87
    http_response_code(404);
96
    http_response_code(404);
88
    echo "ERROR: package not found on server\r\n";
97
    echo "ERROR: package not found on server\r\n";
89
  }
98
  }