diff options
Diffstat (limited to 'cgi/manage.py')
-rw-r--r-- | cgi/manage.py | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/cgi/manage.py b/cgi/manage.py index 79a94de..e3d7704 100644 --- a/cgi/manage.py +++ b/cgi/manage.py @@ -527,14 +527,17 @@ def manage(self, path_split): if post['name'] == oldboardname: post['name'] = board['anonymous'] - # fix date and (re)add post ID if necessary + # fix date post['timestamp_formatted'] = formatTimestamp(post['timestamp']) + + #(re)add post ID if necessary if board["useid"] != '0': if post["parentid"]: tym = parent_time else: tym = post["timestamp"] - post['timestamp_formatted'] += ' ID:' + iphash(post['ip'], post, tym, board["useid"], False, '', False, False, (board["countrycode"] in [1, 2])) + + post['posterid'] = iphash(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() @@ -1450,27 +1453,55 @@ def manage(self, path_split): self.output = "done" return + elif path_split[2] == 'sepid': + if not administrator: + return + + #sql = 'update posts set posterid = \'\'' + #UpdateDb(sql) + + board = setBoard(path_split[3]) + #posts = FetchAll('SELECT * FROM `posts` WHERE `boardid` = %s LIMIT 5' % board['id']) + #for post in posts: + # self.output += str(post) + + #return + + posts = FetchAll('SELECT * FROM `posts` WHERE `boardid` = %s' % board['id']) + + for post in posts: + if not post['posterid']: + splitted = post['timestamp_formatted'].split(' ID:') + + self.output += splitted[0] + '<br>' + + idhash = '' + if len(splitted) > 1: + self.output += splitted[1] + idhash = splitted[1] + + self.output += '<hr>' + + sql = "update posts set timestamp_formatted = '%s', posterid = '%s' where boardid = '%s' and id = '%s'" % (splitted[0], idhash, board['id'], post['id']) + UpdateDb(sql) + + return + elif path_split[2] == 'fixid': if not administrator: return board = setBoard(path_split[3]) - posts = FetchAll( - 'SELECT * FROM `posts` WHERE `boardid` = %s' % board['id']) - self.output = "total: %d<br />" % len(posts) + posts = FetchAll('SELECT id, email, posterid, message, parentid, INET6_NTOA(ip) AS ip FROM posts WHERE boardid = %s', (board['id'],) ) 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']) + new_hash = iphash(post['ip'], post, tim, board["useid"], False, '', False, False, (board["countrycode"] in [1, 2])) + self.output += "%s - %s <br />" % (post['id'], new_hash) + query = "UPDATE `posts` SET posterid = '%s' WHERE boardid = '%s' AND id = '%s'" % (new_hash, board['id'], post['id']) UpdateDb(query) + + self.output = "total: %d<br />" % len(posts) return elif path_split[2] == 'fixname': return |