Add pages and hits to track_users
This commit is contained in:
parent
e67723e58e
commit
f3fbf8b727
|
@ -65,6 +65,7 @@ class IWLADisplayTrackUsers(IPlugin):
|
||||||
def hook(self):
|
def hook(self):
|
||||||
display = self.iwla.getDisplay()
|
display = self.iwla.getDisplay()
|
||||||
hits = self.iwla.getCurrentVisists()
|
hits = self.iwla.getCurrentVisists()
|
||||||
|
stats = {}
|
||||||
|
|
||||||
# All in a page
|
# All in a page
|
||||||
if self.create_tracked_page:
|
if self.create_tracked_page:
|
||||||
|
@ -81,16 +82,21 @@ class IWLADisplayTrackUsers(IPlugin):
|
||||||
else:
|
else:
|
||||||
ip_title = '<b>%s</b>' % (ip)
|
ip_title = '<b>%s</b>' % (ip)
|
||||||
table.appendRow([ip_title, ''])
|
table.appendRow([ip_title, ''])
|
||||||
|
nb_hits = 0
|
||||||
|
nb_pages = 0
|
||||||
for r in hits[ip]['requests'][::-1]:
|
for r in hits[ip]['requests'][::-1]:
|
||||||
uri = r['extract_request']['extract_uri'].lower()
|
uri = r['extract_request']['extract_uri'].lower()
|
||||||
|
if not self.iwla.hasBeenViewed(r): continue
|
||||||
if not self.iwla.isPage(uri) or\
|
if not self.iwla.isPage(uri) or\
|
||||||
self.iwla.isMultimediaFile(uri) or\
|
self.iwla.isMultimediaFile(uri):
|
||||||
not self.iwla.hasBeenViewed(r):
|
nb_hits += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
nb_pages += 1
|
||||||
uri = "%s%s" % (r.get('server_name', ''),
|
uri = "%s%s" % (r.get('server_name', ''),
|
||||||
r['extract_request']['extract_uri'])
|
r['extract_request']['extract_uri'])
|
||||||
table.appendRow([generateHTMLLink(uri), time.asctime(r['time_decoded'])])
|
table.appendRow([generateHTMLLink(uri), time.asctime(r['time_decoded'])])
|
||||||
|
stats[ip] = (nb_pages, nb_hits)
|
||||||
page.appendBlock(table)
|
page.appendBlock(table)
|
||||||
|
|
||||||
display.addPage(page)
|
display.addPage(page)
|
||||||
|
@ -103,12 +109,12 @@ class IWLADisplayTrackUsers(IPlugin):
|
||||||
|
|
||||||
index = self.iwla.getDisplayIndex()
|
index = self.iwla.getDisplayIndex()
|
||||||
|
|
||||||
table = display.createBlock(DisplayHTMLBlockTable, title, [self.iwla._(u'IP'), self.iwla._(u'Last Access')])
|
table = display.createBlock(DisplayHTMLBlockTable, title, [self.iwla._(u'IP'), self.iwla._(u'Last Access'), self.iwla._(u'Pages'), self.iwla._(u'Hits')])
|
||||||
for ip in self.tracked_ip:
|
for ip in self.tracked_ip:
|
||||||
if not ip in hits.keys(): continue
|
if not ip in hits.keys(): continue
|
||||||
if 'dns_name_replaced' in hits[ip].keys():
|
if 'dns_name_replaced' in hits[ip].keys():
|
||||||
ip_title = '%s [%s]' % (hits[ip]['remote_addr'], ip)
|
ip_title = '%s [%s]' % (hits[ip]['remote_addr'], ip)
|
||||||
else:
|
else:
|
||||||
ip_title = ip
|
ip_title = ip
|
||||||
table.appendRow([ip_title, time.asctime(hits[ip]['last_access'])])
|
table.appendRow([ip_title, time.asctime(hits[ip]['last_access']), stats[ip][0], stats[ip][1]])
|
||||||
index.appendBlock(table)
|
index.appendBlock(table)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user