topsites.c (sarg-2.3.11) | : | topsites.c (sarg-2.4.0) | ||
---|---|---|---|---|
/* | /* | |||
* SARG Squid Analysis Report Generator http://sarg.sourceforge.net | * SARG Squid Analysis Report Generator http://sarg.sourceforge.net | |||
* 1998, 2013 | * 1998, 2015 | |||
* | * | |||
* SARG donations: | * SARG donations: | |||
* please look at http://sarg.sourceforge.net/donations.php | * please look at http://sarg.sourceforge.net/donations.php | |||
* Support: | * Support: | |||
* http://sourceforge.net/projects/sarg/forums/forum/363374 | * http://sourceforge.net/projects/sarg/forums/forum/363374 | |||
* --------------------------------------------------------------------- | * --------------------------------------------------------------------- | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
skipping to change at line 36 | skipping to change at line 36 | |||
#include "include/conf.h" | #include "include/conf.h" | |||
#include "include/defs.h" | #include "include/defs.h" | |||
#ifdef ENABLE_DOUBLE_CHECK_DATA | #ifdef ENABLE_DOUBLE_CHECK_DATA | |||
extern struct globalstatstruct globstat; | extern struct globalstatstruct globstat; | |||
#endif | #endif | |||
void topsites(void) | void topsites(void) | |||
{ | { | |||
FILE *fp_in, *fp_ou; | FileObject *fp_in; | |||
FILE *fp_ou; | ||||
char *buf; | char *buf; | |||
char *url; | char *url; | |||
char *ourl=NULL; | char *ourl=NULL; | |||
char csort[4096]; | char csort[4096]; | |||
char general[MAXLEN]; | char general[MAXLEN]; | |||
char general2[MAXLEN]; | char general2[MAXLEN]; | |||
char general3[MAXLEN]; | char general3[MAXLEN]; | |||
char sites[MAXLEN]; | char sites[MAXLEN]; | |||
char report[MAXLEN]; | char report[MAXLEN]; | |||
skipping to change at line 71 | skipping to change at line 72 | |||
#endif | #endif | |||
int nusers=0; | int nusers=0; | |||
int regs=0; | int regs=0; | |||
int cstatus; | int cstatus; | |||
int url_len; | int url_len; | |||
int ourl_size=0; | int ourl_size=0; | |||
struct getwordstruct gwarea; | struct getwordstruct gwarea; | |||
longline line; | longline line; | |||
struct generalitemstruct item; | struct generalitemstruct item; | |||
if(Privacy) { | if (Privacy) { | |||
if (debugz) debugaz(_("Top sites report not produced because priv | if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Top si | |||
acy option is on\n")); | tes report not produced because privacy option is on\n")); | |||
return; | return; | |||
} | } | |||
if (debugz>=LogLevel_Process) | ||||
debuga(__FILE__,__LINE__,_("Creating top sites report...\n")); | ||||
sprintf(general,"%s/sarg-general",outdirname); | format_path(__FILE__, __LINE__, general, sizeof(general), "%s/sarg-genera | |||
sprintf(sites,"%s/sarg-sites",outdirname); | l", outdirname); | |||
sprintf(general2,"%s/sarg-general2",outdirname); | format_path(__FILE__, __LINE__, sites, sizeof(sites) ,"%s/sarg-sites",out | |||
sprintf(general3,"%s/sarg-general3",outdirname); | dirname); | |||
format_path(__FILE__, __LINE__, general2, sizeof(general2), "%s/sarg-gene | ||||
ral2", outdirname); | ||||
format_path(__FILE__, __LINE__, general3, sizeof(general3), "%s/sarg-gene | ||||
ral3", outdirname); | ||||
sprintf(report,"%s/topsites.html",outdirname); | format_path(__FILE__, __LINE__, report, sizeof(report), "%s/topsites.html ", outdirname); | |||
if (snprintf(csort,sizeof(csort),"sort -t \"\t\" -k 4,4 -k 1,1 -o \"%s\" \"%s\"",general2,general)>=sizeof(csort)) { | if (snprintf(csort,sizeof(csort),"sort -t \"\t\" -k 4,4 -k 1,1 -o \"%s\" \"%s\"",general2,general)>=sizeof(csort)) { | |||
debuga(_("Command too long: ")); | debuga(__FILE__,__LINE__,_("Sort command too long when sorting fi | |||
debuga_more("sort -t \"\t\" -k 4,4 -k 1,1 -o \"%s\" \"%s\"",gener | le \"%s\" to \"%s\"\n"),general,general2); | |||
al2,general); | ||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
cstatus=system(csort); | cstatus=system(csort); | |||
if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) { | if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) { | |||
debuga(_("sort command return status %d\n"),WEXITSTATUS(cstatus)) | debuga(__FILE__,__LINE__,_("sort command return status %d\n"),WEX | |||
; | ITSTATUS(cstatus)); | |||
debuga(_("sort command: %s\n"),csort); | debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if((fp_in=fopen(general2,"r"))==NULL) { | if ((fp_in=FileObject_Open(general2))==NULL) { | |||
debugapos("topsites",_("Cannot open file \"%s\": %s\n"),general2, | debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),gener | |||
strerror(errno)); | al2,FileObject_GetLastOpenError()); | |||
debuga(_("sort command: %s\n"),csort); | debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if((fp_ou=fopen(general3,"w"))==NULL) { | if ((fp_ou=fopen(general3,"w"))==NULL) { | |||
debugapos("topsites",_("Cannot open file \"%s\": %s\n"),general3, | debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),gener | |||
strerror(errno)); | al3,strerror(errno)); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if ((line=longline_create())==NULL) { | if ((line=longline_create())==NULL) { | |||
debuga(_("Not enough memory to read file \"%s\"\n"),general2); | debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\" \n"),general2); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
while((buf=longline_read(fp_in,line))!=NULL) { | while((buf=longline_read(fp_in,line))!=NULL) { | |||
ger_read(buf,&item,general2); | ger_read(buf,&item,general2); | |||
if(item.total) continue; | if (item.total) continue; | |||
if(!regs) { | if (!regs) { | |||
url_len=strlen(item.url); | url_len=strlen(item.url); | |||
if (!ourl || url_len>=ourl_size) { | if (!ourl || url_len>=ourl_size) { | |||
ourl_size=url_len+1; | ourl_size=url_len+1; | |||
ourl=realloc(ourl,ourl_size); | ourl=realloc(ourl,ourl_size); | |||
if (!ourl) { | if (!ourl) { | |||
debuga(_("Not enough memory to store the url\n")); | debuga(__FILE__,__LINE__,_("Not enough me mory to store the url\n")); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
} | } | |||
strcpy(ourl,item.url); | strcpy(ourl,item.url); | |||
regs++; | regs++; | |||
} | } | |||
if(strcmp(item.url,ourl) != 0) { | if (strcmp(item.url,ourl) != 0) { | |||
/* | /* | |||
This complicated printf is due to Microsoft's inability t o comply with any standard. Msvcrt is unable | This complicated printf is due to Microsoft's inability t o comply with any standard. Msvcrt is unable | |||
to print a long long int unless it is exactly 64-bits lon g. | to print a long long int unless it is exactly 64-bits lon g. | |||
*/ | */ | |||
fprintf(fp_ou,"%"PRIu64"\t%"PRIu64"\t%"PRIu64"\t%d\t%s\n" ,(uint64_t)tnacc,(uint64_t)tnbytes,(uint64_t)tntime,nusers,ourl); | fprintf(fp_ou,"%"PRIu64"\t%"PRIu64"\t%"PRIu64"\t%d\t%s\n" ,(uint64_t)tnacc,(uint64_t)tnbytes,(uint64_t)tntime,nusers,ourl); | |||
url_len=strlen(item.url); | url_len=strlen(item.url); | |||
if (url_len>=ourl_size) { | if (url_len>=ourl_size) { | |||
ourl_size=url_len+1; | ourl_size=url_len+1; | |||
ourl=realloc(ourl,ourl_size); | ourl=realloc(ourl,ourl_size); | |||
if (!ourl) { | if (!ourl) { | |||
debuga(_("Not enough memory to store the url\n")); | debuga(__FILE__,__LINE__,_("Not enough me mory to store the url\n")); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
} | } | |||
strcpy(ourl,item.url); | strcpy(ourl,item.url); | |||
strcpy(ouser,item.user); | strcpy(ouser,item.user); | |||
tnacc=0; | tnacc=0; | |||
tnbytes=0; | tnbytes=0; | |||
tntime=0; | tntime=0; | |||
nusers=1; | nusers=1; | |||
} else if (strcmp(item.user,ouser)!=0) { | } else if (strcmp(item.user,ouser)!=0) { | |||
skipping to change at line 164 | skipping to change at line 166 | |||
tnacc+=item.nacc; | tnacc+=item.nacc; | |||
tnbytes+=item.nbytes; | tnbytes+=item.nbytes; | |||
tntime+=item.nelap; | tntime+=item.nelap; | |||
#ifdef ENABLE_DOUBLE_CHECK_DATA | #ifdef ENABLE_DOUBLE_CHECK_DATA | |||
ttnacc+=item.nacc; | ttnacc+=item.nacc; | |||
ttnbytes+=item.nbytes; | ttnbytes+=item.nbytes; | |||
ttntime+=item.nelap; | ttntime+=item.nelap; | |||
#endif | #endif | |||
} | } | |||
fclose(fp_in); | if (FileObject_Close(fp_in)) { | |||
debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),general2 | ||||
,FileObject_GetLastCloseError()); | ||||
exit(EXIT_FAILURE); | ||||
} | ||||
longline_destroy(&line); | longline_destroy(&line); | |||
if (ourl) { | if (ourl) { | |||
/* | /* | |||
This complicated printf is due to Microsoft's inability to comply with any standard. Msvcrt is unable | This complicated printf is due to Microsoft's inability to comply with any standard. Msvcrt is unable | |||
to print a long long int unless it is exactly 64-bits long. | to print a long long int unless it is exactly 64-bits long. | |||
*/ | */ | |||
fprintf(fp_ou,"%"PRIu64"\t%"PRIu64"\t%"PRIu64"\t%d\t%s\n",(uint64 _t)tnacc,(uint64_t)tnbytes,(uint64_t)tntime,nusers,ourl); | fprintf(fp_ou,"%"PRIu64"\t%"PRIu64"\t%"PRIu64"\t%d\t%s\n",(uint64 _t)tnacc,(uint64_t)tnbytes,(uint64_t)tntime,nusers,ourl); | |||
free(ourl); | free(ourl); | |||
} | } | |||
fclose(fp_ou); | if (fclose(fp_ou)==EOF) { | |||
debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),general | ||||
3,strerror(errno)); | ||||
exit(EXIT_FAILURE); | ||||
} | ||||
#ifdef ENABLE_DOUBLE_CHECK_DATA | #ifdef ENABLE_DOUBLE_CHECK_DATA | |||
if (ttnacc!=globstat.nacc || ttnbytes!=globstat.nbytes || ttntime!=globst at.elap) { | if (ttnacc!=globstat.nacc || ttnbytes!=globstat.nbytes || ttntime!=globst at.elap) { | |||
debuga(_("Total statistics mismatch when reading %s to produce th e top sites\n"),general2); | debuga(__FILE__,__LINE__,_("Total statistics mismatch when readin g \"%s\" to produce the top sites\n"),general2); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
#endif | #endif | |||
if (!KeepTempLog && unlink(general2)) { | if (!KeepTempLog && unlink(general2)) { | |||
debuga(_("Cannot delete \"%s\": %s\n"),general2,strerror(errno)); | debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),general2 ,strerror(errno)); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if((TopsitesSort & TOPSITE_SORT_CONNECT) != 0) { | if ((TopsitesSort & TOPSITE_SORT_CONNECT) != 0) { | |||
sortf="-k 1,1 -k 2,2"; | sortf="-k 1,1 -k 2,2"; | |||
} else if((TopsitesSort & TOPSITE_SORT_BYTES) != 0) { | } else if ((TopsitesSort & TOPSITE_SORT_BYTES) != 0) { | |||
sortf="-k 2,2 -k 1,1"; | sortf="-k 2,2 -k 1,1"; | |||
} else if((TopsitesSort & TOPSITE_SORT_TIME) != 0) { | } else if ((TopsitesSort & TOPSITE_SORT_TIME) != 0) { | |||
sortf="-k 3,3"; | sortf="-k 3,3"; | |||
} else if((TopsitesSort & TOPSITE_SORT_USER) != 0) { | } else if ((TopsitesSort & TOPSITE_SORT_USER) != 0) { | |||
sortf="-k 4,4 -k 1,1 -k 2,2"; | sortf="-k 4,4 -k 1,1 -k 2,2"; | |||
} else { | } else { | |||
sortf="-k 2,2 -k 1,1"; //default is BYTES | sortf="-k 2,2 -k 1,1"; //default is BYTES | |||
} | } | |||
if((TopsitesSort & TOPSITE_SORT_REVERSE) != 0) { | if ((TopsitesSort & TOPSITE_SORT_REVERSE) != 0) { | |||
sortt="-r"; | sortt="-r"; | |||
} else { | } else { | |||
sortt=""; | sortt=""; | |||
} | } | |||
if (snprintf(csort,sizeof(csort),"sort -t \"\t\" %s -n %s -o \"%s\" \"%s\ "",sortt,sortf,sites,general3)>=sizeof(csort)) { | if (snprintf(csort,sizeof(csort),"sort -t \"\t\" %s -n %s -o \"%s\" \"%s\ "",sortt,sortf,sites,general3)>=sizeof(csort)) { | |||
debuga(_("Command too long: ")); | debuga(__FILE__,__LINE__,_("Sort command too long when sorting fi | |||
debuga_more("sort -t \"\t\" %s -n %s -o \"%s\" \"%s\"",sortt,sort | le \"%s\" to \"%s\"\n"),general3,sites); | |||
f,sites,general3); | ||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
cstatus=system(csort); | cstatus=system(csort); | |||
if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) { | if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) { | |||
debuga(_("sort command return status %d\n"),WEXITSTATUS(cstatus)) | debuga(__FILE__,__LINE__,_("sort command return status %d\n"),WEX | |||
; | ITSTATUS(cstatus)); | |||
debuga(_("sort command: %s\n"),csort); | debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if((fp_in=fopen(sites,"r"))==NULL) { | if ((fp_in=FileObject_Open(sites))==NULL) { | |||
debugapos("topsites",_("Cannot open file \"%s\": %s\n"),sites,str | debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),sites | |||
error(errno)); | ,FileObject_GetLastOpenError()); | |||
debuga(_("sort command: %s\n"),csort); | debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if (!KeepTempLog && unlink(general3)) { | if (!KeepTempLog && unlink(general3)) { | |||
debuga(_("Cannot delete \"%s\": %s\n"),general3,strerror(errno)); | debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),general3 ,strerror(errno)); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if((fp_ou=fopen(report,"w"))==NULL) { | if ((fp_ou=fopen(report,"w"))==NULL) { | |||
debugapos("topsites",_("Cannot open file \"%s\": %s\n"),report,st | debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),repor | |||
rerror(errno)); | t,strerror(errno)); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Top sit es"),HTML_JS_SORTTABLE); | write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Top sit es"),HTML_JS_SORTTABLE); | |||
fputs("<tr><td class=\"header_c\">",fp_ou); | fputs("<tr><td class=\"header_c\">",fp_ou); | |||
fprintf(fp_ou,_("Period: %s"),period.html); | fprintf(fp_ou,_("Period: %s"),period.html); | |||
fputs("</td></tr>\n",fp_ou); | fputs("</td></tr>\n",fp_ou); | |||
fputs("<tr><th class=\"header_c\">",fp_ou); | fputs("<tr><th class=\"header_c\">",fp_ou); | |||
fprintf(fp_ou,_("Top %d sites"),TopSitesNum); | fprintf(fp_ou,_("Top %d sites"),TopSitesNum); | |||
fputs("</th></tr>\n",fp_ou); | fputs("</th></tr>\n",fp_ou); | |||
skipping to change at line 258 | skipping to change at line 265 | |||
_("NUM")); | _("NUM")); | |||
if (SortTableJs[0]) fputs(" sorttable_alpha",fp_ou); | if (SortTableJs[0]) fputs(" sorttable_alpha",fp_ou); | |||
fprintf(fp_ou,"\">%s</th><th class=\"header_l\">%s</th><th class=\"header _l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr></t head>\n", | fprintf(fp_ou,"\">%s</th><th class=\"header_l\">%s</th><th class=\"header _l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr></t head>\n", | |||
/* TRANSLATORS: This is a column header showing the URL of the visited si tes. */ | /* TRANSLATORS: This is a column header showing the URL of the visited si tes. */ | |||
_("ACCESSED SITE"), | _("ACCESSED SITE"), | |||
/* TRANSLATORS: This is a column header showing the number of connections to a visited site. */ | /* TRANSLATORS: This is a column header showing the number of connections to a visited site. */ | |||
_("CONNECT"), | _("CONNECT"), | |||
/* TRANSLATORS: This is a column header showing the number of transfered bytes. */ | /* TRANSLATORS: This is a column header showing the number of transfered bytes. */ | |||
_("BYTES"), | _("BYTES"), | |||
/* TRANSLATORS: This is a column header showing the time spent by the pro xy processing the requests. */ | /* TRANSLATORS: This is a column header showing the time spent by the pro xy processing the requests. */ | |||
_("TIME"), | pgettext("duration","TIME"), | |||
/* TRANSLATORS: This is a column header showing the number of users who v isited a sites. */ | /* TRANSLATORS: This is a column header showing the number of users who v isited a sites. */ | |||
_("USERS")); | _("USERS")); | |||
regs=0; | regs=0; | |||
ntopsites = 0; | ntopsites = 0; | |||
if ((line=longline_create())==NULL) { | if ((line=longline_create())==NULL) { | |||
debuga(_("Not enough memory to read file \"%s\"\n"),sites); | debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\" \n"),sites); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
while(regs<TopSitesNum && (buf=longline_read(fp_in,line))!=NULL) { | while(regs<TopSitesNum && (buf=longline_read(fp_in,line))!=NULL) { | |||
getword_start(&gwarea,buf); | getword_start(&gwarea,buf); | |||
if (getword_atoll(&nacc,&gwarea,'\t')<0) { | if (getword_atoll(&nacc,&gwarea,'\t')<0) { | |||
debuga(_("Invalid number of accesses in file \"%s\"\n"),s ites); | debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\" \n"),sites); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if (nacc == 0) continue; | if (nacc == 0) continue; | |||
if (getword_atoll(&nbytes,&gwarea,'\t')<0) { | if (getword_atoll(&nbytes,&gwarea,'\t')<0 || getword_atoll(&ntime | |||
debuga(_("Invalid number of bytes in file \"%s\"\n"),site | ,&gwarea,'\t')<0) { | |||
s); | debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\" | |||
exit(EXIT_FAILURE); | \n"),sites); | |||
} | ||||
if (getword_atoll(&ntime,&gwarea,'\t')<0) { | ||||
debuga(_("Invalid elapsed time in file \"%s\"\n"),sites); | ||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if (getword_atoi(&nusers,&gwarea,'\t')<0) { | if (getword_atoi(&nusers,&gwarea,'\t')<0) { | |||
debuga(_("Invalid number of users in file \"%s\"\n"),site s); | debuga(__FILE__,__LINE__,_("Invalid number of users in fi le \"%s\"\n"),sites); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if (getword_ptr(buf,&url,&gwarea,'\t')<0) { | if (getword_ptr(buf,&url,&gwarea,'\t')<0) { | |||
debuga(_("Invalid url in file \"%s\"\n"),sites); | debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n" ),sites); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
twork1=nacc; | twork1=nacc; | |||
twork2=nbytes; | twork2=nbytes; | |||
twork3=ntime; | twork3=ntime; | |||
fprintf(fp_ou,"<tr><td class=\"data\">%d</td><td class=\"data2\"> ",++regs); | fprintf(fp_ou,"<tr><td class=\"data\">%d</td><td class=\"data2\"> ",++regs); | |||
if(BlockIt[0] != '\0' && url[0]!=ALIAS_PREFIX) { | if (BlockIt[0] != '\0' && url[0]!=ALIAS_PREFIX) { | |||
fprintf(fp_ou,"<a href=\"%s%s?url=\"",wwwDocumentRoot,Blo ckIt); | fprintf(fp_ou,"<a href=\"%s%s?url=\"",wwwDocumentRoot,Blo ckIt); | |||
output_html_url(fp_ou,url); | output_html_url(fp_ou,url); | |||
fputs("\"><img src=\"../images/sarg-squidguard-block.png\ "></a> ",fp_ou); | fputs("\"><img src=\"../images/sarg-squidguard-block.png\ "></a> ",fp_ou); | |||
} | } | |||
output_html_link(fp_ou,url,100); | output_html_link(fp_ou,url,100); | |||
fputs("</td><td class=\"data\"",fp_ou); | fputs("</td><td class=\"data\"",fp_ou); | |||
if (SortTableJs[0]) fprintf(fp_ou," sorttable_customkey=\"%"PRId6 4"\"",(uint64_t)twork1); | if (SortTableJs[0]) fprintf(fp_ou," sorttable_customkey=\"%"PRId6 4"\"",(uint64_t)twork1); | |||
fprintf(fp_ou,">%s</td>",fixnum(twork1,1)); | fprintf(fp_ou,">%s</td>",fixnum(twork1,1)); | |||
fputs("<td class=\"data\"",fp_ou); | fputs("<td class=\"data\"",fp_ou); | |||
if (SortTableJs[0]) fprintf(fp_ou," sorttable_customkey=\"%"PRId6 4"\"",(uint64_t)twork2); | if (SortTableJs[0]) fprintf(fp_ou," sorttable_customkey=\"%"PRId6 4"\"",(uint64_t)twork2); | |||
fprintf(fp_ou,">%s</td>",fixnum(twork2,1)); | fprintf(fp_ou,">%s</td>",fixnum(twork2,1)); | |||
fputs("<td class=\"data\"",fp_ou); | fputs("<td class=\"data\"",fp_ou); | |||
if (SortTableJs[0]) fprintf(fp_ou," sorttable_customkey=\"%"PRId6 4"\"",(uint64_t)twork3); | if (SortTableJs[0]) fprintf(fp_ou," sorttable_customkey=\"%"PRId6 4"\"",(uint64_t)twork3); | |||
fprintf(fp_ou,">%s</td>",fixtime(twork3)); | fprintf(fp_ou,">%s</td>",fixtime(twork3)); | |||
fputs("<td class=\"data\"",fp_ou); | fputs("<td class=\"data\"",fp_ou); | |||
if (SortTableJs[0]) fprintf(fp_ou," sorttable_customkey=\"%d\"",n users); | if (SortTableJs[0]) fprintf(fp_ou," sorttable_customkey=\"%d\"",n users); | |||
fprintf(fp_ou,">%s</td></tr>\n",fixnum(nusers,1)); | fprintf(fp_ou,">%s</td></tr>\n",fixnum(nusers,1)); | |||
} | } | |||
fclose(fp_in); | if (FileObject_Close(fp_in)) { | |||
debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),sites,Fi | ||||
leObject_GetLastCloseError()); | ||||
exit(EXIT_FAILURE); | ||||
} | ||||
longline_destroy(&line); | longline_destroy(&line); | |||
fputs("</table></div>\n",fp_ou); | fputs("</table></div>\n",fp_ou); | |||
if (write_html_trailer(fp_ou)<0) | write_html_trailer(fp_ou); | |||
debuga(_("Write error in file \"%s\"\n"),report); | if (fclose(fp_ou)==EOF) { | |||
if (fclose(fp_ou)==EOF) | debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),report, | |||
debuga(_("Failed to close file \"%s\": %s\n"),report,strerror(err | strerror(errno)); | |||
no)); | exit(EXIT_FAILURE); | |||
} | ||||
return; | return; | |||
} | } | |||
End of changes. 39 change blocks. | ||||
71 lines changed or deleted | 86 lines changed or added |