aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cgi/formatting.py12
-rw-r--r--cgi/manage.py49
-rw-r--r--cgi/templates/banned.html30
3 files changed, 49 insertions, 42 deletions
diff --git a/cgi/formatting.py b/cgi/formatting.py
index d21bee2..6b2d8bc 100644
--- a/cgi/formatting.py
+++ b/cgi/formatting.py
@@ -121,11 +121,8 @@ def iphash(ip, post, t, useid, mobile, agent, cap_id, hide_end, has_countrycode)
id = '???'
else:
day = int((current_t + (Settings.TIME_ZONE*3600)) / 86400)
- word = ',' + str(day)
-
- # Make difference by thread
- word += ',' + str(t)
-
+ word = ',' + str(day) # IDs change every 24 hours
+ word += ',' + str(t) # IDs vary depending on thread
id = hide_data(ip + word, 6, "id", Settings.SECRET)
if hide_end:
@@ -164,9 +161,8 @@ def iphash(ip, post, t, useid, mobile, agent, cap_id, hide_end, has_countrycode)
if addressIsBanned(ip, ""):
id += '#'
- if (not has_countrycode and
- not addressIsTor(ip) and
- (addressIsProxy(ip) or not addressIsES(ip))):
+ elif (not has_countrycode and not addressIsTor(ip) and
+ (addressIsProxy(ip) or not addressIsES(ip))):
id += '!'
return id
diff --git a/cgi/manage.py b/cgi/manage.py
index 44731ba..71ed647 100644
--- a/cgi/manage.py
+++ b/cgi/manage.py
@@ -421,6 +421,7 @@ def manage(self, path_split):
board = setBoard(oldboardid)
oldboard = board['dir']
oldboardsubject = board['subject']
+ oldboardname = board['anonymous']
# get old posts
posts = FetchAll("SELECT * FROM `posts` WHERE (`id` = {0} OR `parentid` = {0}) AND `boardid` = {1} ORDER BY id ASC".format(oldthread, board['id']))
@@ -460,17 +461,30 @@ def manage(self, path_split):
moved_thumbs.append(post['thumb'])
if is_op:
moved_cats.append(post['thumb'])
-
+
# fix subject if necessary
if post['subject'] and post['subject'] == oldboardsubject:
post['subject'] = board['subject']
-
+
+ # fix new default name
+ if post['name'] == oldboardname:
+ post['name'] = board['anonymous']
+
+ # fix date and (re)add post ID if necessary
+ post['timestamp_formatted'] = formatTimestamp(post['timestamp'])
+ if board["useid"] != '0':
+ if post["parentid"]:
+ tym = parent_time
+ else:
+ tym = post["timestamp"]
+ post['timestamp_formatted'] += ' ID:' + iphash(inet_ntoa(long(post['ip'])), post, tym, board["useid"], False, '', False, False, (board["countrycode"] in ['1', '2']))
+
# insert new post and get its new ID
new_id = post.insert()
-
+
# save the reference (BBS = post number, IB = new ID)
refs[old_id] = num if board['board_type'] == '1' else new_id
-
+
# this was an OP
message += "newthread = %s parentid = %s<br>" % (newthreadid, p['parentid'])
if is_op:
@@ -480,6 +494,7 @@ def manage(self, path_split):
# BBS = new thread timestamp, IB = new thread ID
newthread = post['timestamp'] if board['board_type'] == '1' else new_id
+ parent_time = post['timestamp']
# log it
message += "%s -> %s<br>" % (old_id, new_id)
@@ -523,6 +538,7 @@ def manage(self, path_split):
# insert notice message
if 'msg' in self.formdata:
+ leavemsg = True
board = setBoard(oldboard)
if board['board_type'] == '1':
@@ -540,11 +556,13 @@ def manage(self, path_split):
notice_post["timestamp_formatted"] = "Hilo movido"
notice_post["bumped"] = oldbumped
notice_post.insert()
+ regenerateFrontPages()
+ regenerateThreadPage(oldthread)
- # regenerate
+ # regenerate again (fix?)
+ board = setBoard(newboardid)
regenerateFrontPages()
regenerateThreadPage(newthreadid)
- regenerateThreadPage(oldthread)
message += "done"
@@ -1181,13 +1199,13 @@ def manage(self, path_split):
posts = FetchAll('SELECT * FROM `posts` WHERE `boardid` = %s' % board['id'])
self.output = "total: %d<br />" % len(posts)
for post in posts:
- new_timestamp_formatted = formatTimestamp(post['timestamp'])
- tim = 0
- if board["useid"] != '0':
- new_timestamp_formatted += ' ID:' + iphash(post['ip'], '', tim, '1', False, False, False, '0')
- self.output += "%s - %s <br />" % (post['id'], new_timestamp_formatted)
- query = "UPDATE `posts` SET timestamp_formatted = '%s' WHERE boardid = '%s' AND id = '%s'" % (new_timestamp_formatted, board['id'], post['id'])
- UpdateDb(query)
+ new_timestamp_formatted = formatTimestamp(post['timestamp'])
+ tim = 0
+ if board["useid"] != '0':
+ new_timestamp_formatted += ' ID:' + iphash(post['ip'], '', tim, '1', False, False, False, '0')
+ self.output += "%s - %s <br />" % (post['id'], new_timestamp_formatted)
+ query = "UPDATE `posts` SET timestamp_formatted = '%s' WHERE boardid = '%s' AND id = '%s'" % (new_timestamp_formatted, board['id'], post['id'])
+ UpdateDb(query)
return
elif path_split[2] == 'fixname':
board = setBoard(path_split[3])
@@ -1686,7 +1704,10 @@ def manage(self, path_split):
if self.formdata['ip'] != '':
formatted_ip = str(inet_aton(self.formdata['ip']))
posts = FetchAll("SELECT posts.*, boards.dir, boards.board_type, boards.subject AS default_subject FROM `posts` JOIN `boards` ON boards.id = posts.boardid WHERE ip = '%s' ORDER BY posts.timestamp DESC" % _mysql.escape_string(formatted_ip))
- ip = self.formdata['ip']
+ if '.' in self.formdata['ip']:
+ ip = self.formdata['ip']
+ else:
+ ip = inet_ntoa(long(self.formdata['ip']))
template_filename = "ipshow.html"
template_values = {"mode": 1, "ip": ip, "host": getHost(ip), "country": getCountry(ip), "tor": addressIsTor(ip), "posts": posts}
logAction(staff_account['username'], "ipshow on {}".format(ip))
diff --git a/cgi/templates/banned.html b/cgi/templates/banned.html
index 72f2abe..f63dd41 100644
--- a/cgi/templates/banned.html
+++ b/cgi/templates/banned.html
@@ -3,14 +3,11 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>Acceso prohibido@B.a.I.</title>
+ <title>Acceso prohibido@Bienvenido a Internet</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style type="text/css">
- body {
- background: #1D1F21;
-
- }
-
+ body {background: #1D1F21;}
.box {
display: block;
width: 50%;
@@ -20,18 +17,10 @@
margin: 15% auto;
padding: 1em;
box-shadow: 5px 10px #732e2e;
- border: double #CCC;
- }
-
- a,
- a:visited {
- color: #5F819D;
+ border: 3px double #CCC;
}
-
- a:hover {
- color: #81A2BE;
- }
-
+ a, a:visited {color: #5F819D;}
+ a:hover,a:active {color: #81A2BE;}
.title {
color: white;
margin-bottom: 1em;
@@ -43,7 +32,6 @@
font-weight: 700;
line-height: 23px;
}
-
.description {
font-family: monospace;
font-size: 14px;
@@ -52,6 +40,8 @@
font-weight: 400;
line-height: 23px;
}
+ ul {padding-left: 2em;}
+ .thx {margin-bottom:0;text-align: center;}
</style>
</head>
@@ -77,8 +67,8 @@
href="mailto:burocracia@bienvenidoainternet.org">contáctanos</a> dando tu IP, razón y explicación de los
hechos.
</p>
- <p style="font-size: small;">P.S: En muchos casos a pesar de que hayas sido expulsado del sitio se concede el acceso a la sección <a href="/bai/">Meta</a></p>
- <p style="text-align: center;">¡Gracias por usar Bienvenido a Internet BBS/IB!</p>
+ <p style="font-size:small;">P.S: En muchos casos a pesar de que hayas sido expulsado del sitio se concede el acceso a la sección <a href="/bai/">Meta</a></p>
+ <p class="thx">¡Gracias por usar Bienvenido a Internet BBS/IB!</p>
</div>
</div>
</body>