Commit 322011e9 by Scott

Coding style (qa-blobs.php)

parent deffa191
......@@ -23,33 +23,36 @@
// Ensure no PHP errors are shown in the blob response
@ini_set('display_errors', 0);
@ini_set('display_errors', 0);
function qa_blob_db_fail_handler()
{
function qa_blob_db_fail_handler()
{
header('HTTP/1.1 500 Internal Server Error');
qa_exit('error');
}
}
// Load the Q2A base file which sets up a bunch of crucial stuff
require 'qa-base.php';
require 'qa-base.php';
qa_report_process_stage('init_blob');
qa_report_process_stage('init_blob');
// Output the blob in question
require_once QA_INCLUDE_DIR.'app/blobs.php';
require_once QA_INCLUDE_DIR.'app/blobs.php';
qa_db_connect('qa_blob_db_fail_handler');
qa_db_connect('qa_blob_db_fail_handler');
$blob = qa_read_blob(qa_get('qa_blobid'));
$blob=qa_read_blob(qa_get('qa_blobid'));
if (isset($blob)) {
// allows browsers and proxies to cache the blob (30 days)
header('Cache-Control: max-age=2592000, public');
if (isset($blob)) {
$filename=preg_replace('/[^A-Za-z0-9 \\._-]/', '-', $blob['filename']); // for compatibility with HTTP headers and all browsers
header('Cache-Control: max-age=2592000, public'); // allows browsers and proxies to cache the blob
// for compatibility with HTTP headers and all browsers
$filename = preg_replace('/[^A-Za-z0-9 \\._-]/', '-', $blob['filename']);
switch ($blob['format']) {
case 'jpeg':
......@@ -82,13 +85,8 @@
echo $blob['content'];
} else
} else {
header('HTTP/1.0 404 Not Found');
}
qa_db_disconnect();
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
qa_db_disconnect();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment