]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Ported r242 to r245 from branches/v2_2_7 (custom graph font + a few bug fixes)
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 10 Feb 2010 15:45:47 +0000 (15:45 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 10 Feb 2010 15:45:47 +0000 (15:45 +0000)
12 files changed:
CMakeLists.txt
ChangeLog
Makefile.in
README
configure.in
getconf.c
grepday.c
include/conf.h
include/info.h
log.c
sarg.conf
topuser.c

index 2b7c8fd12cdd4747b0c5692a66dcafa4195c9f6b..518f8ef3036a65108d1cbf682693ceda752d982e 100755 (executable)
@@ -3,7 +3,7 @@ PROJECT(sarg C)
 SET(sarg_VERSION 2)
 SET(sarg_REVISION "3rc1")
 SET(sarg_BUILD "")
-SET(sarg_BUILDDATE "Feb-04-2010")
+SET(sarg_BUILDDATE "Feb-10-2010")
 
 INCLUDE(AddFileDependencies)
 INCLUDE(CheckIncludeFile)
index 4e23dec5f2cdd4b541e47fa17bd17da395fe0e74..37b2c0367461d04b8e1f1a008d5ef63be9fc2281 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,12 @@ Feb-09-2009 Version 2.3
                - Link to external css file instead of including it verbatim in each HTML file (thanks to Maxim Britov).
                - Enable gettext configuration for autotools.
 
-Feb-04-2010 Version 2.2.7
+Feb-10-2010 Version 2.2.7.1
+               - Fixed compilation error reported by some compilers due to an sizeof in a fprintf (thanks to Maxim Britov and Renato Botelho).
+               - The path to the font used to create the graphs can be set in sarg.conf.
+               - The installation of our fonts can be disabled with --disable-fontdir.
+
+Feb-05-2010 Version 2.2.7
                - Extra compile and run time protection (FORTIFY_SOURCE) fixed in configure.
                - Use tabulations as columns separator in intermediary files to avoid problems when a field of the log contains a space.
                - Input log file type detection partly rewritten to clearly distinguish which type is processed where.
index f13c1ea1054adb84ffdfb7ea543223e7f78d1d2a..618bd26be2212910a2a98cc26b9c3d231b9052f4 100644 (file)
@@ -48,7 +48,10 @@ OBJS = util.o log.o report.o topuser.o email.o sort.o html.o \
        squidguard_log.o squidguard_report.o auth.o download.o grepday.o \
        dansguardian_log.o dansguardian_report.o realtime.o btree_cache.o usertab.o
 
-DISTFILES = $(SRCS)
+DISTFILES = $(SRCS) ABOUT-NLS
+
+SUBDIRS = po
+.PHONY: install clean uninstall mostlyclean distclean $(SUBDIRS)
 
 all: sarg
 
@@ -58,7 +61,10 @@ all: sarg
 sarg: $(OBJS)
        $(CC) $(LDFLAGS) $(OBJS) -o $@ $(LIBS) $(LIBCRYPT)
 
-install: all
+$(SUBDIRS):
+       $(MAKE) -C $@
+
+install: all po
        -@if test ! -d $(DESTDIR)$(BINDIR); then \
                echo "creating $(DESTDIR)$(BINDIR)"; \
                mkdir -p $(DESTDIR)$(BINDIR); \
@@ -75,10 +81,6 @@ install: all
                echo "Creating $(DESTDIR)$(LANGDIR)"; \
                mkdir -p $(DESTDIR)$(LANGDIR); \
        fi
-       -@if test ! -d $(DESTDIR)$(FONTDIR); then \
-               echo "Creating $(DESTDIR)$(FONTDIR)"; \
-               mkdir -p $(DESTDIR)$(FONTDIR); \
-       fi
        -@if test ! -d $(DESTDIR)$(IMAGEDIR); then \
                echo "Creating $(DESTDIR)$(IMAGEDIR)"; \
                mkdir -p $(DESTDIR)$(IMAGEDIR); \
@@ -97,20 +99,26 @@ install: all
        cp ./exclude_codes $(DESTDIR)$(SYSCONFDIR);
        cp ./user_limit_block $(DESTDIR)$(SYSCONFDIR);
        cp -r ./images/* $(DESTDIR)$(IMAGEDIR);
-       cp -r ./fonts/* $(DESTDIR)$(FONTDIR);
+       -@if test -n "$(FONTDIR)" ; then \
+               if test ! -d "$(DESTDIR)$(FONTDIR)" ; then \
+                       echo "Creating $(DESTDIR)$(FONTDIR)"; \
+                       mkdir -p "$(DESTDIR)$(FONTDIR)"; \
+               fi; \
+               cp -r ./fonts/* "$(DESTDIR)$(FONTDIR)"; \
+       fi
        cp -r ./css.tpl $(DESTDIR)$(SYSCONFDIR);
        -@if test -n "$(SARGPHPDIR)" -a -d "$(DESTDIR)$(SARGPHPDIR)"; then \
-               cp -r ./sarg-php $(DESTDIR)$(SARGPHPDIR);       \
+               cp -r ./sarg-php $(DESTDIR)$(SARGPHPDIR); \
        fi
 
-uninstall:
+uninstall: po
        rm -f $(DESTDIR)$(BINDIR)/sarg
        rm -f $(DESTDIR)$(MANDIR)/sarg.1
 
 TAGS: $(SRCS)
        etags $(SRCS)
 
-clean:
+clean: po
        rm -f sarg *.o core
 
 mostlyclean: clean
diff --git a/README b/README
index 0f9c4487693c8a8a7408cb5ed9b2704891f932df..84918abbfd8bfb863d7675682287d08b5dd34364 100644 (file)
--- a/README
+++ b/README
@@ -61,7 +61,7 @@ If you use native squid log format, the elapsed time will be in reports (emulate
                       --enable-languagedir - where the translation of sarg are
                                 default: /usr/local/share/sarg/languages
 
-                      --enable-fontdir - where to find the fonts for the reports
+                      --enable-fontdir - where to find the fonts for the reports (--diable-fontdir don't install the fonts)
                                 default: /usr/local/share/sarg/fonts
 
                       --enable-imagedir - where sarg take the images to include in the reports
index c6dac3de8280d0e1ba435237daf0cba769afc00d..7c5f7f856f389ba9392db685468b70afc7f50219 100644 (file)
@@ -139,7 +139,8 @@ AC_ARG_ENABLE(sargphp,
     fi
 ],[SARGPHPDIR="/var/www/html"])
 if test "$SARGPHPDIR" ; then
-   echo "using $SARGPHPDIR as the directory to install sarg-php"
+   tempfullpath=`eval "echo $SARGPHPDIR"`
+   echo "using $tempfullpath as the directory to install sarg-php"
    AC_SUBST(SARGPHPDIR)
 fi
 
@@ -152,7 +153,8 @@ AC_ARG_ENABLE(languagedir,
         LANGDIR=$enableval
     fi
 ],[LANGDIR="${datarootdir}/sarg/languages"])
-echo "using $LANGDIR as the directory of the translations"
+tempfullpath=`eval "echo $LANGDIR"`
+echo "using $tempfullpath as the directory of the translations"
 AC_SUBST(LANGDIR)
 
 dnl Select fonts dir
@@ -160,12 +162,15 @@ AC_ARG_ENABLE(fontdir,
 [  --enable-fontdir=fontdir
                         Select fontdir as the directory with the fonts to use in the reports ],
 [
-    if test "$enableval"; then
+    if test "$enableval" -a "x$enableval" != "xno" ; then
         FONTDIR=$enableval
     fi
 ],[FONTDIR="${datarootdir}/sarg/fonts"])
-echo "using $FONTDIR as the directory of the fonts"
-AC_SUBST(FONTDIR)
+if test "$FONTDIR" ; then
+   tempfullpath=`eval "echo $FONTDIR"`
+   echo "using $tempfullpath as the directory of the fonts"
+   AC_SUBST(FONTDIR)
+fi
 
 dnl Select images dir
 AC_ARG_ENABLE(imagedir,
@@ -176,7 +181,8 @@ AC_ARG_ENABLE(imagedir,
         IMAGEDIR=$enableval
     fi
 ],[IMAGEDIR="${datarootdir}/sarg/images"])
-echo "using $IMAGEDIR as the directory of the images"
+tempfullpath=`eval "echo $IMAGEDIR"`
+echo "using $tempfullpath as the directory of the images"
 AC_SUBST(IMAGEDIR)
 
 dnl Enable extra compile and run time protection
index 63875a6801ba2b25f1d95714331b9cb2a6c75dcf..fe65246671db28cfe92943093c0af212e9a84171 100644 (file)
--- a/getconf.c
+++ b/getconf.c
@@ -566,6 +566,8 @@ static void parmtest(char *buf)
 
    if (getparam_string("LDAPTargetAttr",buf,LDAPTargetAttr,sizeof(LDAPTargetAttr))>0) return;
 
+   if (getparam_string("graph_font",buf,GraphFont,sizeof(GraphFont))>0) return;
+
    if(strstr(buf,"squid24") != 0) {
       squid24++;
       return;
index 522703af4cf277751ffbb8bc38c878f8faf8d5dc..ee3c26f0cbe11cd3466b1f775ddcddf2de6bec27 100644 (file)
--- a/grepday.c
+++ b/grepday.c
@@ -39,8 +39,6 @@ static int goldenrod2;
 static int gray;
 static int silver;
 static int black;
-//static char *font1 = FONTDIR"/FreeSans.ttf";
-static char *font1 = FONTDIR"/DejaVuSans.ttf";
 
 #if defined(HAVE_ICONV_H) && defined(gdFTEX_Unicode)
 #include <iconv.h>
@@ -156,11 +154,6 @@ static void bar(int x1,long long int n)
     3900000000LL,4000000000LL,4100000000LL,4200000000LL,4300000000LL,4400000000LL,
     4500000000LL,4600000000LL,4700000000LL,4800000000LL,4900000000LL,5000000000LL};
 
-   if(access(font1, R_OK) != 0) {
-     fprintf(stderr, "SARG: (grepday) Fontname: %s not found.\n",font1);
-     exit(1);
-   }
-
    if(strcmp(GraphDaysBytesBarColor,"orange") == 0) {
       color1 = gdImageColorAllocate(im, 255, 233, 142);
       color2 = gdImageColorAllocate(im, 220, 163, 72);
@@ -225,7 +218,7 @@ static void bar(int x1,long long int n)
 
    snprintf(v,6,"%s",fixnum(num,0));
 
-   SARGgdImageStringFT(im,&brect[0],black,font1,6,0.0,x1-1,val-12,v);
+   SARGgdImageStringFT(im,&brect[0],black,GraphFont,6,0.0,x1-1,val-12,v);
 
    points[0].x = x1+17;
    points[0].y = val-5;
@@ -268,10 +261,14 @@ void greport_day(const char *user)
    struct getwordstruct gwarea;
    struct getwordstruct gwarea1;
 
-   if(!Graphs) {
+   if(!Graphs || GraphFont[0]=='\0') {
       unlink(wdirname);
       return;
    }
+   if(access(GraphFont, R_OK) != 0) {
+      fprintf(stderr, "SARG: (grepday) Fontname: %s not found.\n",GraphFont);
+      exit(1);
+   }
 
    im = gdImageCreate(720, 480);
 
@@ -330,7 +327,7 @@ void greport_day(const char *user)
    y=65;
    for(x=1; x<=31; x++) {
       sprintf(s,"%02d",x);
-      SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,y,437,s);
+      SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,y,437,s);
       y=y+20;
    }
 
@@ -345,54 +342,54 @@ void greport_day(const char *user)
       subs(name,sizeof(name),"_",".");
    }
 
-   SARGgdImageStringFT(im,&brect[0],darkblue,font1,7,0.0,620,470,ftime);
-   if(ShowSargInfo) SARGgdImageStringFT(im,&brect[0],darkblue,font1,10,0.0,257,15,"SARG, ");
-   SARGgdImageStringFT(im,&brect[0],darkblue,font1,10,0.0,300,15,Title);
+   SARGgdImageStringFT(im,&brect[0],darkblue,GraphFont,7,0.0,620,470,ftime);
+   if(ShowSargInfo) SARGgdImageStringFT(im,&brect[0],darkblue,GraphFont,10,0.0,257,15,"SARG, ");
+   SARGgdImageStringFT(im,&brect[0],darkblue,GraphFont,10,0.0,300,15,Title);
    sprintf(warea,"%s: %s",text[89],period);
-   SARGgdImageStringFT(im,&brect[0],darkblue,font1,9,0.0,300,27,warea);
+   SARGgdImageStringFT(im,&brect[0],darkblue,GraphFont,9,0.0,300,27,warea);
    sprintf(warea,"%s: %s",text[90],name);
-   SARGgdImageStringFT(im,&brect[0],darkblue,font1,9,0.0,300,38,warea);
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,418,"  50K");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,408,"250K");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,398,"500K");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,388,"   1M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,378,"   2M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,368,"   3M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,358,"   4M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,348,"   5M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,338,"   6M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,328,"   7M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,318,"   8M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,308,"   9M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,298," 10M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,288," 15M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,278," 20M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,268," 30M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,258," 40M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,248," 50M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,238," 60M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,228," 70M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,218," 80M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,208," 90M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,198,"100M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,188,"200M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,178,"300M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,168,"400M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,158,"500M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,148,"600M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,138,"700M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,128,"800M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,118,"900M");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,108,"   1G");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 98,"   2G");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 88,"   3G");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 78,"   4G");
-   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 68,"   5G");
+   SARGgdImageStringFT(im,&brect[0],darkblue,GraphFont,9,0.0,300,38,warea);
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,418,"  50K");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,408,"250K");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,398,"500K");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,388,"   1M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,378,"   2M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,368,"   3M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,358,"   4M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,348,"   5M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,338,"   6M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,328,"   7M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,318,"   8M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,308,"   9M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,298," 10M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,288," 15M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,278," 20M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,268," 30M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,258," 40M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,248," 50M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,238," 60M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,228," 70M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,218," 80M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,208," 90M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,198,"100M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,188,"200M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,178,"300M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,168,"400M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,158,"500M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,148,"600M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,138,"700M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,128,"800M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,118,"900M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,108,"   1G");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23, 98,"   2G");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23, 88,"   3G");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23, 78,"   4G");
+   SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23, 68,"   5G");
    if(strcmp(datetimeby,"bytes") == 0)
-      SARGgdImageStringFT(im,&brect[0],black,font1,10,3.14/2,20,248,text[93]);
+      SARGgdImageStringFT(im,&brect[0],black,GraphFont,10,3.14/2,20,248,text[93]);
    else
-      SARGgdImageStringFT(im,&brect[0],black,font1,10,3.14/2,20,248,text[94]);
-   SARGgdImageStringFT(im,&brect[0],black,font1,10,0.0,330,460,text[127]);
+      SARGgdImageStringFT(im,&brect[0],black,GraphFont,10,3.14/2,20,248,text[94]);
+   SARGgdImageStringFT(im,&brect[0],black,GraphFont,10,0.0,330,460,text[127]);
 
    if (snprintf(graph,sizeof(graph),"%s/%s/graph_day.png",dirname,user)>=sizeof(graph)) {
       fprintf(stderr, "SARG: user name too long for: %s/%s/graph_day.png\n",dirname,user);
index 3ceeb850fbf875b26023b0219426436180ecb8f1..2e6f6ad09f639d25e920e2254be64dfda56bc3a5 100755 (executable)
@@ -305,7 +305,6 @@ char DataFile[MAXLEN];
 char DataFileDelimiter[3];
 unsigned long int DataFileFields;
 char DataFileUrl[20];
-char SiteUserTimeDateType[10];
 int ShowReadStatistics;
 char IndexSortOrder[5];
 char DansGuardianConf[MAXLEN];
@@ -374,6 +373,7 @@ int LDAPProtocolVersion;
 char LDAPBaseSearch[255];
 char LDAPFilterSearch[512];
 char LDAPTargetAttr[64];
+char GraphFont[MAXLEN];
 
 int  idate;
 int  smartfilter;
index e0693c948ddf3ed8e3ae8db2abd285f944d4644c..ab13bc8e3a2859859293aa4586f7667c2c21a97f 100755 (executable)
@@ -1,3 +1,3 @@
-#define VERSION PACKAGE_VERSION" Feb-04-2010"
+#define VERSION PACKAGE_VERSION" Feb-10-2010"
 #define PGM PACKAGE_NAME
 #define URL "http://sarg.sourceforge.net"
diff --git a/log.c b/log.c
index ae0ec600e3e56fef3ee0ca91a3e9d7ec54ccbd49..20769a3e968cb09c4ec61695e89216f1789e206a 100644 (file)
--- a/log.c
+++ b/log.c
@@ -178,6 +178,7 @@ int main(int argc,char *argv[])
    UseComma=0;
    strcpy(MailUtility,"mailx");
    TopSitesNum=100;
+   TopUsersNum=0;
    UserIp=0;
    strcpy(TopuserSortField,"BYTES");
    strcpy(UserSortField,"BYTES");
@@ -204,7 +205,6 @@ int main(int argc,char *argv[])
    strcpy(DataFileDelimiter,";");
    DataFileFields=DATA_FIELD_USER | DATA_FIELD_DATE | DATA_FIELD_TIME | DATA_FIELD_URL | DATA_FIELD_CONNECT |
                   DATA_FIELD_BYTES | DATA_FIELD_IN_CACHE | DATA_FIELD_OUT_CACHE | DATA_FIELD_ELAPSED;
-   strcpy(SiteUserTimeDateType,"table");
    ShowReadStatistics=1;
    strcpy(IndexSortOrder,"D");
    ShowSargInfo=1;
@@ -220,6 +220,11 @@ int main(int argc,char *argv[])
    strcpy(Require,"require user admin %u");
    set_download_suffix("7z,ace,arj,avi,bat,bin,bz2,bzip,cab,com,cpio,dll,doc,dot,exe,gz,iso,lha,lzh,mdb,mov,mp3,mpeg,mpg,mso,nrg,ogg,ppt,rar,rtf,shs,src,sys,tar,tgz,vcd,vob,wma,wmv,zip");
    Graphs=1;
+#if defined(FONTDIR)
+   strcpy(GraphFont,FONTDIR"/DejaVuSans.ttf");
+#else
+   GraphFont[0]='\0';
+#endif
    strcpy(Ulimit,"20000");
    strcpy(NtlmUserFormat,"domainname+username");
    IndexTree=INDEX_TREE_FILE;
@@ -309,7 +314,7 @@ int main(int argc,char *argv[])
    textdomain (PACKAGE_NAME);
 
    NAccessLog=0;
-   for(x=0; x<=MAXLOGS; x++)
+   for(x=0; x<MAXLOGS; x++)
       AccessLog[x][0]='\0';
    AccessLogFromCmdLine=0;
 
index cd630b5f5756407bd2d2f4917124a6994568ce63..3436f43b80294f36be73362d4ec9af4e9ba67072 100644 (file)
--- a/sarg.conf
+++ b/sarg.conf
 #graphs yes
 #graph_days_bytes_bar_color orange
 
+# TAG:  graph_font
+#       The full path to the TTF font file to use to create the graphs. It is required
+#       if graphs is set to yes.
+#
+#graph_font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
+
 # TAG: title
 #      Especify the title for html page.
 #
 #
 #topuser_num 0
 
-# TAG: site_user_time_date_type list|table
-#      generate reports for site_user_time_date in list or table format
-#
-#site_user_time_date_type table
-
 # TAG: datafile file
 #      Save the report results in a file to populate some database
 #
index b49ff2d8fe765bbecccb732d9d2d28c8e23ca5d2..c5d12fa66308669a08a713584aaac3c132581ee0 100644 (file)
--- a/topuser.c
+++ b/topuser.c
@@ -365,7 +365,7 @@ void topuser(void)
          ltext110[i]='\0';
          fputs("<td class=\"data2\">",fp_top3);
 #ifdef HAVE_GD
-         if(Graphs) {
+         if(Graphs && GraphFont[0]!='\0') {
             fprintf(fp_top3,"<a href=\"%s/graph_day.png\"><img src=\"%s/graph.png\" title=\"%s\" alt=\"G\"></a>&nbsp;",user,ImageFile,text[126]);
          }
 #endif