lets not hardcode "bans.cgi" in the page.
This commit is contained in:
parent
838f807a3b
commit
9d6dfd01f2
|
@ -13,6 +13,7 @@
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
# This needs to be set to the location of the commoncgi.py file
|
# This needs to be set to the location of the commoncgi.py file
|
||||||
|
@ -20,8 +21,9 @@ sys.path.append('/var/www/bot')
|
||||||
from commoncgi import *
|
from commoncgi import *
|
||||||
|
|
||||||
### Variables
|
### Variables
|
||||||
db = '/home/bot/data/bans.db'
|
db = '/home/bot/data/bans.db'
|
||||||
num_per_page = 100
|
num_per_page = 100
|
||||||
|
pagename = os.path.basename(sys.argv[0])
|
||||||
|
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
|
|
||||||
|
@ -84,7 +86,7 @@ if form.has_key('comment') and form.has_key('comment_id') and user:
|
||||||
con.commit()
|
con.commit()
|
||||||
|
|
||||||
# Write the page
|
# Write the page
|
||||||
print '<form action="bans.cgi" method="POST">'
|
print '<form action="%s" method="POST">' % pagename
|
||||||
|
|
||||||
# Personal data
|
# Personal data
|
||||||
print '<div class="pdata">'
|
print '<div class="pdata">'
|
||||||
|
@ -112,7 +114,7 @@ tz = pytz.timezone(tz)
|
||||||
|
|
||||||
# Search form
|
# Search form
|
||||||
print '<div class="search">'
|
print '<div class="search">'
|
||||||
print '<form action="bans.cgi" method="GET">'
|
print '<form action="%s" method="GET">' % pagename
|
||||||
print '<input class="input" type="text" name="query"'
|
print '<input class="input" type="text" name="query"'
|
||||||
if form.has_key('query'):
|
if form.has_key('query'):
|
||||||
print 'value="%s" ' % form['query'].value
|
print 'value="%s" ' % form['query'].value
|
||||||
|
@ -157,7 +159,7 @@ if not form.has_key('query'):
|
||||||
cur.execute('SELECT COUNT(id) FROM bans')
|
cur.execute('SELECT COUNT(id) FROM bans')
|
||||||
nump = int(math.ceil(int(cur.fetchall()[0][0]) / float(num_per_page)))
|
nump = int(math.ceil(int(cur.fetchall()[0][0]) / float(num_per_page)))
|
||||||
for i in range(nump):
|
for i in range(nump):
|
||||||
print '<a href="bans.cgi?page=%d%s">%d</a> ·' % (i, sort, i+1)
|
print '<a href="%s?page=%d%s">%d</a> ·' % (pagename, i, sort, i+1)
|
||||||
print '</div>'
|
print '</div>'
|
||||||
|
|
||||||
# Empty log div, will be filled with AJAX
|
# Empty log div, will be filled with AJAX
|
||||||
|
@ -173,7 +175,7 @@ for h in [['Channel',0], ['Nick/Mask',1], ['Operator',2], ['Time',6]]:
|
||||||
if v < 10: h[1] += 10
|
if v < 10: h[1] += 10
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
print '<th><a href="bans.cgi?sort=%s">%s</a></th>' % (h[1],h[0])
|
print '<th><a href="%s?sort=%s">%s</a></th>' % (pagename, h[1], h[0])
|
||||||
print '<th>Log</th></tr>'
|
print '<th>Log</th></tr>'
|
||||||
|
|
||||||
# Select and filter bans
|
# Select and filter bans
|
||||||
|
@ -230,6 +232,7 @@ def getQueryTerm(query, term):
|
||||||
return (query, ret)
|
return (query, ret)
|
||||||
return (query, None)
|
return (query, None)
|
||||||
|
|
||||||
|
|
||||||
bans = []
|
bans = []
|
||||||
oper = chan = False
|
oper = chan = False
|
||||||
|
|
||||||
|
@ -328,9 +331,11 @@ for b in bans[start:end]:
|
||||||
if user:
|
if user:
|
||||||
print """<span class="pseudolink" onclick="toggle('%s','comment')">Add comment</span>""" % b[6]
|
print """<span class="pseudolink" onclick="toggle('%s','comment')">Add comment</span>""" % b[6]
|
||||||
print """<div class="invisible" id="comment_%s"><br />""" % b[6]
|
print """<div class="invisible" id="comment_%s"><br />""" % b[6]
|
||||||
print """<form action="bans.cgi" method="POST"><textarea cols="50" rows="5" class="input" name="comment"></textarea><br />"""
|
print """<form action="%s" method="POST">""" % pagename
|
||||||
print """<input type="hidden" name="comment_id" value="%s" />""" % b[6]
|
print """ <textarea cols="50" rows="5" class="input" name="comment"></textarea><br />"""
|
||||||
print """<input class="submit" type="submit" value="Send" /></form>"""
|
print """ <input type="hidden" name="comment_id" value="%s" />""" % b[6]
|
||||||
|
print """ <input class="submit" type="submit" value="Send" />"""
|
||||||
|
print """</form>"""
|
||||||
print '</td></tr>'
|
print '</td></tr>'
|
||||||
|
|
||||||
print '</table>'
|
print '</table>'
|
||||||
|
|
Loading…
Reference in New Issue