[0005209] Reports: fixed broken reports after session timeout.
[fa-stable.git] / includes / page / header.inc
index 3661c7cf7b1240de475bead083d6fcbfb1bcd170..8db8fe9ba5ae8f3b42cbea08022b42b6e48bd558 100644 (file)
@@ -40,9 +40,26 @@ function help_url($context=null)
        if ($clean)
                $help_page_url = access_string($help_page_url, true);
 
-       return htmlspecialchars($SysPrefs->help_base_url
+       return html_specials_encode(
+               $SysPrefs->help_base_url
                .urlencode(strtr(ucwords($help_page_url), array(' '=>'', '/'=>'', '&'=>'And')))
-               .'&ctxhelp=1&lang='.$country, ENT_QUOTES);
+               .'&ctxhelp=1&lang='.$country);
+}
+
+function send_css($css = '')
+{
+       global $css_files;
+
+       css_files_ensure_init();
+
+       foreach ($css_files as $css_file)
+       {
+               echo "<link href='$css_file' rel='stylesheet' type='text/css'> \n";
+       }
+       if ($css)
+       {
+               echo "<link href='$css' rel='stylesheet' type='text/css'> \n";
+       }
 }
 
 function send_scripts()
@@ -75,14 +92,9 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
        // titles and screen header
        global $path_to_root, $SysPrefs, $db_connections;
 
-       if (in_ajax())
+       if (in_ajax() || isset($_POST['REP_ID']))
                return; // just for speed up
 
-//     $jsext = substr_replace($_SERVER['PHP_SELF'], '.js', -4);
-
-//     if (file_exists($_SERVER['DOCUMENT_ROOT'].$jsext))
-//             add_js_ufile($jsext);
-
        $theme = user_theme();
 
        if ($SysPrefs->help_base_url != null && $SysPrefs->use_popup_windows && $js == '')
@@ -94,7 +106,7 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
                add_js_source(get_js_open_window(900, 500));
        }
        if ($js!='')
-         add_js_source($js);
+               add_js_source($js);
 
        if (!isset($no_menu))
        {
@@ -130,10 +142,9 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') != -1) // IE 11 doesn't work with input file type in form.
                echo "<meta http-equiv='X-UA-Compatible' content='IE=10'>\n";
        echo "<meta http-equiv='Content-type' content='text/html; charset=$encoding'>";
-       echo "<link href='$path_to_root/themes/$theme/default.css' rel='stylesheet' type='text/css'> \n";
-       echo "<link href='$path_to_root/themes/default/images/favicon.ico' rel='icon' type='image/x-icon'> \n";
-       if ($css)
-               echo '<link href="'.$css.'" rel="stylesheet" type="text/css">';
+       echo "<link href='$path_to_root/themes/default/images/favicon.ico' rel='icon' type='image/x-icon'> \n";
+
+       send_css($css);
 
        send_scripts();