From 34256e502541c2f7c3f3bb3c1fb1fd3acf0e0e61 Mon Sep 17 00:00:00 2001
From: Thomas Oster <mail@thomas-oster.de>
Date: Tue, 15 Sep 2015 15:12:48 +0200
Subject: [PATCH] Send header information before output. Fixes #2554

---
 include/client/header.inc.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/client/header.inc.php b/include/client/header.inc.php
index 245edf61a..680dc71ae 100644
--- a/include/client/header.inc.php
+++ b/include/client/header.inc.php
@@ -6,18 +6,20 @@ $signin_url = ROOT_PATH . "login.php"
 $signout_url = ROOT_PATH . "logout.php?auth=".$ost->getLinkToken();
 
 header("Content-Type: text/html; charset=UTF-8");
+if (($lang = Internationalization::getCurrentLanguage())) {
+    $langs = array_unique(array($lang, $cfg->getPrimaryLanguage()));
+    $langs = Internationalization::rfc1766($langs);
+    header("Content-Language: ".implode(', ', $langs));
+}
 ?>
 <!DOCTYPE html>
 <html<?php
-if (($lang = Internationalization::getCurrentLanguage())
+if ($lang
         && ($info = Internationalization::getLanguageInfo($lang))
         && (@$info['direction'] == 'rtl'))
     echo ' dir="rtl" class="rtl"';
 if ($lang) {
-    $langs = array_unique(array($lang, $cfg->getPrimaryLanguage()));
-    $langs = Internationalization::rfc1766($langs);
     echo ' lang="' . $lang . '"';
-    header("Content-Language: ".implode(', ', $langs));
 }
 ?>>
 <head>
-- 
GitLab