aboutsummaryrefslogtreecommitdiff
path: root/cgi/manage.py
diff options
context:
space:
mode:
authorLibravatar TDavis 2019-03-30 00:53:47 -0300
committerLibravatar TDavis 2019-03-30 04:21:10 -0300
commit7ce3ee2c0a5378b5935479b50dcb99d4731b1d5a (patch)
treeb088becaa9b40fb81da536a7f6e87003577d0022 /cgi/manage.py
parentbbc3b76803922d611f23e468faf19f24cd1ef996 (diff)
downloadweabot-7ce3ee2c0a5378b5935479b50dcb99d4731b1d5a.tar.gz
weabot-7ce3ee2c0a5378b5935479b50dcb99d4731b1d5a.tar.xz
weabot-7ce3ee2c0a5378b5935479b50dcb99d4731b1d5a.zip
Mover hilos fix
Mover hilos fix 2 Mover hilos fix INTENTO 3 Mover hilos fix 4 Test 1 Mover hilos fix 4 Test 2 Mover hilos fix 4 Test 3 Mover hilos fix 4 Test 4 Mover hilos fix 4 Test 5 Mover hilos fix 4 Test 6 Mover hilos fix 4 Test 7 Mover hilos fix 4 Test 8 Mover hilos fix 4 Test 9 Arreglando función para mover hilos y función para buscar posts por IP
Diffstat (limited to 'cgi/manage.py')
-rw-r--r--cgi/manage.py49
1 files changed, 35 insertions, 14 deletions
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))