예제 #1
0
        header($header);
        echo $header;
        die;
    } else {
        if (!strstr($mime, "video")) {
            header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 24 * 60 * 60) . ' GMT');
            header("Cache-Control: ");
            // leave blank to avoid IE errors
            header("Pragma: ");
            // leave blank to avoid IE errors
            header("Content-Disposition: attachment; filename=\"" . $filename . "\"");
            header("Content-Transfer-Encoding: binary");
            header("Content-Type: {$mime}");
            header("Content-length: " . (string) $filesize);
        }
        fclose($fdl);
        byteserve($filestring, $mime);
        exit;
    }
} elseif (is_numeric($fileId) && sFileMgr()->fileExists($fileId) && $fileinfo["DELETED"] != 1) {
    sFileMgr()->callExtensionHook("onAccessDenied", $fileId, $version);
    $header = $_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden';
    header($header);
    echo $header;
    die;
} else {
    $header = $_SERVER['SERVER_PROTOCOL'] . ' 404 Not found';
    header($header);
    echo $header;
    die;
}
예제 #2
0
}
function log_message($message, $include_backtrace = False)
{
    $written = 0;
    global $LOG_FILE_HANDLE;
    $time = date("H:i:s d M Y");
    $act_msg = $time . " " . $message . "\n";
    $written = fwrite($LOG_FILE_HANDLE, $act_msg);
    //This doesn't include that much info
    if ($include_backtrace) {
        $written += fwrite($LOG_FILE_HANDLE, var_export(debug_backtrace(True), True));
    }
    return $written;
}
function exit_cleanly()
{
    global $LOG_FILE_HANDLE;
    fclose($LOG_FILE_HANDLE);
    exit;
}
if (!file_exists($filepath)) {
    header('HTTP/1.1 404 Not Found');
    if ($DEBUG) {
        echo "Unable to find " . $filepath;
    }
    exit_cleanly();
}
//unset magic quotes; otherwise, file contents will be modified
set_magic_quotes_runtime(0);
byteserve($filepath);
exit_cleanly();