Merge branch 'main' into feature/71

This commit is contained in:
2020-08-13 20:55:57 +01:00
3 changed files with 22 additions and 2 deletions

View File

@@ -67,6 +67,26 @@
return $requests; return $requests;
} }
function get_open_subscribed_requests($db) {
$requests = array();
$sub_tickets_stmt = "SELECT ticket_uuid FROM ticket_subscribers WHERE user_uuid=:uuid AND status != 'Closed'";
$sub_tickets_sql = $db->prepare($sub_tickets_stmt);
$sub_tickets_sql->bindParam(':uuid', $_SESSION['uuid']);
$sub_tickets_sql->execute();
$sub_tickets_sql->setFetchMode(PDO::FETCH_ASSOC);
$sub_tickets_result = $sub_tickets_sql->fetchAll();
foreach ($sub_tickets_result as $tkt) {
$stmt = "SELECT * FROM tickets WHERE uuid=:uuid";
$sql = $db->prepare($stmt);
$sql->bindParam(':uuid', $tkt['ticket_uuid']);
$sql->execute();
$sql->setFetchMode(PDO::FETCH_ASSOC);
$result = $sql->fetchAll();
array_push($requests, $result[0]);
}
return $requests;
}
function get_request($db, $uuid) { function get_request($db, $uuid) {
$ticket_stmt = "SELECT * FROM tickets WHERE uuid=:uuid"; $ticket_stmt = "SELECT * FROM tickets WHERE uuid=:uuid";
$ticket_sql = $db->prepare($ticket_stmt); $ticket_sql = $db->prepare($ticket_stmt);

View File

@@ -20,7 +20,7 @@
finfo_close($finfo); finfo_close($finfo);
//Use Content-Disposition: attachment to specify the filename //Use Content-Disposition: attachment to specify the filename
header('Content-Disposition: attachment; filename='.$remote_filename); header('Content-Disposition: attachment; filename="'.$remote_filename.'"');
//No cache //No cache
header('Expires: 0'); header('Expires: 0');

View File

@@ -4,7 +4,7 @@
if (is_signed_in()) { if (is_signed_in()) {
$requests = get_my_open_requests($db); $requests = get_my_open_requests($db);
$subscriptions = get_subscribed_requests($db); $subscriptions = get_open_subscribed_requests($db);
} }
?> ?>