Commit 2ba80f66 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

checking config before outputting headers

parent 96015067
......@@ -19,6 +19,19 @@ class BrowserVerification
public function handle($request, Closure $next)
{
$bvEnabled = config("metager.metager.browserverification_enabled");
if (empty($bvEnabled) || !$bvEnabled) {
return $next($request);
} else {
$whitelist = config("metager.metager.browserverification_whitelist");
$agent = new Agent();
foreach ($whitelist as $browser) {
if ($agent->match($browser)) {
return $next($request);
}
}
}
if(($request->input("out", "") === "api" || $request->input("out", "") === "atom10") && app('App\Models\Key')->getStatus()) {
header('Content-type: application/xml; charset=utf-8');
} elseif(($request->input("out", "") === "api" || $request->input("out", "") === "atom10") && !app('App\Models\Key')->getStatus()) {
......@@ -37,19 +50,6 @@ class BrowserVerification
ini_set('output_handler', '');
ob_end_clean();
$bvEnabled = config("metager.metager.browserverification_enabled");
if (empty($bvEnabled) || !$bvEnabled) {
return $next($request);
} else {
$whitelist = config("metager.metager.browserverification_whitelist");
$agent = new Agent();
foreach ($whitelist as $browser) {
if ($agent->match($browser)) {
return $next($request);
}
}
}
$mgv = $request->input('mgv', "");
if (!empty($mgv)) {
// Verify that key is a md5 checksum
......
Supports Markdown
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