]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Link to external css file instead of including it in each HTML file (thanks to Maxim...
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Tue, 9 Feb 2010 11:11:41 +0000 (11:11 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Tue, 9 Feb 2010 11:11:41 +0000 (11:11 +0000)
ChangeLog
css.c
sarg.conf

index 8753bbee40fda5aee654536e3cff86d13a76be3e..936f74fe2ac1d5551a740473fa129235eac5a483 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,13 @@
 SARG ChangeLog
 
-Feb-02-2009 Version 2.3
+Feb-09-2009 Version 2.3
                - LDAP usertab added. 
                  Now you can have your users in a LDAP Server.
                  Use these tags in sarg.conf: LDAPHost, LDAPPort, LDAPBindDN, LDAPBindPW,
                                               LDAPBaseSearch, LDAPFilterSearch
                - Parse the string flags from sarg.conf once during the reading of sarg.conf instead of manipulating and duplicating the tests of the strings where they are used.
                - Useragent report limited to requested date range.
+               - Link to external css file instead of including it verbatim in each HTML file (thanks to Maxim Britov).
 
 Feb-04-2010 Version 2.2.7
                - Extra compile and run time protection (FORTIFY_SOURCE) fixed in configure.
diff --git a/css.c b/css.c
index de5c6fa91719d95ebdbb892be7987efe69eddba8..7417f27c0bea09bc51c94bbbfea3a4c7fcb45194 100644 (file)
--- a/css.c
+++ b/css.c
 
 void css(FILE *fp_css)
 {
-   FILE *fp_in;
-   char buf[MAXLEN];
-   size_t nbytes;
-
    if(ExternalCSSFile[0] != '\0') {
-      if((fp_in=fopen(ExternalCSSFile,"r"))==NULL) {
-         fprintf(stderr, "SARG: (css) %s: %s\n",text[45],ExternalCSSFile);
-         exit(1);
-      }
-      fputs("<style type=\"text/css\">\n",fp_css);
-      while((nbytes=fread(buf,1,sizeof(buf),fp_in))>0)
-         fwrite(buf,1,nbytes,fp_css);
-      fclose(fp_in);
-      fputs("</style>\n",fp_css);
+      fprintf(fp_css,"<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n",ExternalCSSFile);
       return;
    }
 
index ca209891cff72ceaf9e60aac7243b8c20260211f..cd630b5f5756407bd2d2f4917124a6994568ce63 100644 (file)
--- a/sarg.conf
+++ b/sarg.conf
 #block_it none
 
 # TAG: external_css_file path
-#     This tag allow internal sarg css override.
+#     This tag allow internal sarg css override by providing the name of
+#     the css file to link into each HTML page.
+#
+#     In versions prior to 2.3, this used to be an absolute file name to
+#     a file to include verbatim in each HTML but as it takes a lot of
+#     spaces, version 2.3 switched to a link to an external css file.
+#     Therefore, it must be the HTTP server path on which a client browser
+#     may find the css file.
+#
 #     Sarg use theses style classes:
-#      .body           body class
+#      .body           body class
 #      .info           sarg information class, align=center
 #      .title          title class, align=center
 #      .header         header class, align:left