]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - html.c
Don't process the details of the users that are not listed
[thirdparty/sarg.git] / html.c
diff --git a/html.c b/html.c
index e77669e16450760da49e23fb2cb3252b32beb9ca..af073490b28f8af70e2678c81cd82bc56004a2f2 100644 (file)
--- a/html.c
+++ b/html.c
@@ -37,15 +37,14 @@ void htmlrel(void)
        long long int totelap=0, totelap2=0, nnelap=0, unelap=0, tnelap=0;
        long long int incache=0, oucache=0, tnincache=0, tnoucache=0, twork=0;
        long long int ltemp;
-       long long int ntotuser=1;
+       long long int ntotuser;
        long long int userbytes, userelap;
        char *buf;
-       char arqin[MAXLEN], arqou[MAXLEN], arqper[MAXLEN], arqip[MAXLEN];
+       char arqin[MAXLEN], arqou[MAXLEN], arqip[MAXLEN];
        char *url, tmsg[50], csort[MAXLEN];
        char duser[MAXLEN];
        char user_ip[MAXLEN], olduserip[MAXLEN], tmp2[MAXLEN], tmp3[MAXLEN];
        char warea[MAXLEN];
-       char totuser[8];
        char tmp6[MAXLEN];
        char *user_url;
        long long int tnacc=0, ttnacc=0, unacc=0;
@@ -55,7 +54,6 @@ void htmlrel(void)
        int have_denied_report;
        const char *sort_field;
        const char *sort_order;
-       const char *user;
        char siteind[MAX_TRUNCATED_URL];
        struct getwordstruct gwarea;
        longline line,line1;
@@ -75,21 +73,7 @@ void htmlrel(void)
        tnacc=globstat.nacc;
        totbytes=globstat.nbytes;
        totelap=globstat.elap;
-
-       if ((ReportType & REPORT_TYPE_TOPUSERS) != 0) {
-               snprintf(arqper,sizeof(arqper),"%s/sarg-users",outdirname);
-               if ((fp_in = fopen(arqper, "r")) == 0){
-                       debuga(_("(html11) Cannot open file %s - %s\n"),arqper,strerror(errno));
-                       exit(EXIT_FAILURE);
-               }
-               if (!fgets(totuser,sizeof(totuser),fp_in)) {
-                       debuga(_("(html11) read error in %s\n"),arqper);
-                       exit(EXIT_FAILURE);
-               }
-               fclose(fp_in);
-               ntotuser=my_atoll(totuser);
-               if (ntotuser<=0) ntotuser=1;
-       }
+       ntotuser=globstat.totuser;
 
        greport_prepare();
 
@@ -101,10 +85,13 @@ void htmlrel(void)
                exit(EXIT_FAILURE);
        }
        while ( (uinfo = userinfo_advancescan(uscan)) != NULL ) {
-               user=uinfo->filename;
+               if (!uinfo->topuser) {
+                       continue;
+               }
+               tmpsort(uinfo);
 
-               if (snprintf(warea,sizeof(warea),"%s/%s",outdirname,user)>=sizeof(warea)) {
-                       debuga(_("Destination directory too long: %s/%s\n"),outdirname,user);
+               if (snprintf(warea,sizeof(warea),"%s/%s",outdirname,uinfo->filename)>=sizeof(warea)) {
+                       debuga(_("Destination directory too long: %s/%s\n"),outdirname,uinfo->filename);
                        exit(EXIT_FAILURE);
                }
                if (access(warea, R_OK) != 0) {
@@ -117,8 +104,8 @@ void htmlrel(void)
                report_day(uinfo);
                greport_day(uinfo);
 
-               if (snprintf(arqin,sizeof(arqin),"%s/%s.txt",tmp,uinfo->filename)>=sizeof(arqin)) {
-                       debuga(_("Input file name too long: %s/%s.txt\n"),tmp,uinfo->filename);
+               if (snprintf(arqin,sizeof(arqin),"%s/htmlrel.txt",tmp)>=sizeof(arqin)) {
+                       debuga(_("Input file name too long: %s/htmlrel.txt\n"),tmp);
                        exit(EXIT_FAILURE);
                }
                if ((fp_in = fopen(arqin, "r")) == 0){