Skip to content

Commit

Permalink
Undo changes
Browse files Browse the repository at this point in the history
  • Loading branch information
meezaan committed Apr 16, 2021
1 parent a0d186f commit a7d2675
Showing 1 changed file with 56 additions and 56 deletions.
112 changes: 56 additions & 56 deletions html/media/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,20 @@
$number = $request->getAttribute('number');
$edition = $request->getAttribute('edition');
$url = $this->s3url . "audio/" . $this->s3[$edition]['low'] . "/" . $edition . "/" . $number . ".mp3";
return $response->withStatus(301)->withHeader('Location', $url);
// if (($this->urlExists)($url)) {
// $response = $response->withHeader('Content-Description', 'Audio File Transfer')
// ->withHeader('Content-Type', 'audio/mp3')
// ->withHeader('Expires', gmdate ("D, d M Y H:i:s", time() + 31104000) . " GMT")
// ->withHeader('Cache-Control', 'must-revalidate')
// ->withHeader('Pragma', 'public');
// readfile($url);
// }
// else {
// $response = $response->withStatus(404)->getBody()->write('Not found');
// }
//
// return $response;
//return $response->withStatus(301)->withHeader('Location', $url);
if (($this->urlExists)($url)) {
$response = $response->withHeader('Content-Description', 'Audio File Transfer')
->withHeader('Content-Type', 'audio/mp3')
->withHeader('Expires', gmdate ("D, d M Y H:i:s", time() + 31104000) . " GMT")
->withHeader('Cache-Control', 'must-revalidate')
->withHeader('Pragma', 'public');
readfile($url);
}
else {
$response = $response->withStatus(404)->getBody()->write('Not found');
}

return $response;
});


Expand All @@ -213,20 +213,20 @@
$number = $request->getAttribute('number');
$edition = $request->getAttribute('edition');
$url = $this->s3url . "audio/" . $this->s3[$edition]['high'] . "/" . $edition . "/" . $number . ".mp3";
return $response->withStatus(301)->withHeader('Location', $url);
// if (($this->urlExists)($url)) {
// $response = $response->withHeader('Content-Description', 'Audio File Transfer')
// ->withHeader('Content-Type', 'audio/mp3')
// ->withHeader('Expires', gmdate ("D, d M Y H:i:s", time() + 31104000) . " GMT")
// ->withHeader('Cache-Control', 'must-revalidate')
// ->withHeader('Pragma', 'public');
// readfile($url);
// }
// else {
// $response = $response->withStatus(404)->getBody()->write('Not found');
// }
//
// return $response;
//return $response->withStatus(301)->withHeader('Location', $url);
if (($this->urlExists)($url)) {
$response = $response->withHeader('Content-Description', 'Audio File Transfer')
->withHeader('Content-Type', 'audio/mp3')
->withHeader('Expires', gmdate ("D, d M Y H:i:s", time() + 31104000) . " GMT")
->withHeader('Cache-Control', 'must-revalidate')
->withHeader('Pragma', 'public');
readfile($url);
}
else {
$response = $response->withStatus(404)->getBody()->write('Not found');
}

return $response;
});


Expand All @@ -235,20 +235,20 @@
$number = $request->getAttribute('number');
$edition = $request->getAttribute('edition');
$url = $this->s3url . "audio/" . $this->s3[$edition]['medium'] . "/" . $edition . "/" . $number . ".mp3";
return $response->withStatus(301)->withHeader('Location', $url);
// if (($this->urlExists)($url)) {
// $response = $response->withHeader('Content-Description', 'Audio File Transfer')
// ->withHeader('Content-Type', 'audio/mp3')
// ->withHeader('Expires', gmdate ("D, d M Y H:i:s", time() + 31104000) . " GMT")
// ->withHeader('Cache-Control', 'must-revalidate')
// ->withHeader('Pragma', 'public');
// readfile($url);
// }
// else {
// $response = $response->withStatus(404)->getBody()->write('Not found');
// }
//
// return $response;
//return $response->withStatus(301)->withHeader('Location', $url);
if (($this->urlExists)($url)) {
$response = $response->withHeader('Content-Description', 'Audio File Transfer')
->withHeader('Content-Type', 'audio/mp3')
->withHeader('Expires', gmdate ("D, d M Y H:i:s", time() + 31104000) . " GMT")
->withHeader('Cache-Control', 'must-revalidate')
->withHeader('Pragma', 'public');
readfile($url);
}
else {
$response = $response->withStatus(404)->getBody()->write('Not found');
}

return $response;
});


Expand All @@ -264,20 +264,20 @@
$surah = $request->getAttribute('surah');
$ayah = $request->getAttribute('ayah');
$url = $this->s3url . 'images/' . $surah . '_' . $ayah . '.png';
return $response->withStatus(301)->withHeader('Location', $url);
// if (($this->urlExists)($url)) {
// $response = $response->withHeader('Content-Description', 'PNG File Transfer')
// ->withHeader('Content-Type', 'image/png')
// ->withHeader('Expires', gmdate ("D, d M Y H:i:s", time() + 31104000) . " GMT")
// ->withHeader('Cache-Control', 'must-revalidate')
// ->withHeader('Pragma', 'public');
// readfile($url);
// }
// else {
// $response = $response->withStatus(404)->getBody()->write('Not found');
// }
//
// return $response;
//return $response->withStatus(301)->withHeader('Location', $url);
if (($this->urlExists)($url)) {
$response = $response->withHeader('Content-Description', 'PNG File Transfer')
->withHeader('Content-Type', 'image/png')
->withHeader('Expires', gmdate ("D, d M Y H:i:s", time() + 31104000) . " GMT")
->withHeader('Cache-Control', 'must-revalidate')
->withHeader('Pragma', 'public');
readfile($url);
}
else {
$response = $response->withStatus(404)->getBody()->write('Not found');
}

return $response;
});

/** Can be expensive, so do not run in pipeline
Expand Down

0 comments on commit a7d2675

Please sign in to comment.