From: Frédéric Marchal Date: Sun, 15 Jul 2012 16:40:58 +0000 (+0200) Subject: Hopefully fix the smart filter X-Git-Tag: v2.3.3~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6bcfe7df0e8958fdb904ac18d2ef0b5fa374034;p=thirdparty%2Fsarg.git Hopefully fix the smart filter I can't test it as I don't have any sample log with smartfilter enabled. --- diff --git a/html.c b/html.c index 4ca7bca..751fdbc 100644 --- a/html.c +++ b/html.c @@ -51,7 +51,7 @@ void htmlrel(void) double perc=0, perc2=0, ouperc=0, inperc=0; int count; int cstatus; - int have_denied_report; + bool have_denied_report; const char *sort_field; const char *sort_order; char siteind[MAX_TRUNCATED_URL]; @@ -115,14 +115,14 @@ void htmlrel(void) debuga(_("Output file name too long: %s/%s/%s.html\n"),outdirname,uinfo->filename,uinfo->filename); exit(EXIT_FAILURE); } - if (snprintf(duser,sizeof(duser),"%s/%s/denied_%s.html",tmp,uinfo->filename,uinfo->filename)>=sizeof(duser)) { - debuga(_("File name too long: %s/%s/denied_%s.html\n"),tmp,uinfo->filename,uinfo->filename); + if (snprintf(duser,sizeof(duser),"%s/denied_%s.html",outdirname,uinfo->filename)>=sizeof(duser)) { + debuga(_("File name too long: %s/denied_%s.html\n"),outdirname,uinfo->filename); exit(EXIT_FAILURE); } if(access(duser, R_OK) != 0) - have_denied_report=0; + have_denied_report=false; else - have_denied_report=1; + have_denied_report=true; if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read file %s\n"),arqin); @@ -187,17 +187,16 @@ void htmlrel(void) fprintf(fp_ou,"%s\n",_("User report")); close_html_header(fp_ou); + if (have_denied_report) { + fputs("
\n",fp_ou); + fprintf(fp_ou,"\n",uinfo->filename,_("SmartFilter report")); + fputs("\n
%s
\n",fp_ou); + } + fputs("
\n",fp_ou); - /*! \bug This line lays before the header of the table and is therefore invalid - HTML. It will also break the sorttable script. Beside, I suspect it serves no purpose. - */ - if(have_denied_report) { - fprintf(fp_ou,"\n",uinfo->filename,_("SmartFilter"),_("Report")); - } - fputs("",_("ACCESSED SITE"));
%s %s
%s