-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathajax.export.php
More file actions
28 lines (23 loc) · 1006 Bytes
/
ajax.export.php
File metadata and controls
28 lines (23 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
require_once INCLUDE_DIR . 'class.export.php';
class ExportAjaxAPI extends AjaxController {
function check($id) {
global $thisstaff;
if (!$thisstaff)
Http::response(403, 'Agent login is required');
elseif (!($exporter=Exporter::load($id)) || !$exporter->isAvailable())
Http::response(404, 'No such export');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ($exporter->isReady())
Http::response(201, $this->json_encode([
'status' => 'ready',
'href' => sprintf('export.php?id=%s',
$exporter->getId()),
'filename' => $exporter->getFilename()]));
else // Export is not ready... checkback in a few
Http::response(200, $this->json_encode([
'status' => 'notready']));
}
include STAFFINC_DIR . 'templates/export.tmpl.php';
}
}