topic_comment_blind.py 965 B

12345678910111213141516171819202122232425262728
  1. from .tool.func import *
  2. def topic_comment_blind(topic_num = 1, num = 1):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. topic_num = str(topic_num)
  6. num = str(num)
  7. if admin_check(3, 'blind (code ' + topic_num + '#' + num + ')') != 1:
  8. return re_error('/error/3')
  9. curs.execute(db_change("select block from topic where code = ? and id = ?"), [topic_num, num])
  10. block = curs.fetchall()
  11. if block:
  12. if block[0][0] == 'O':
  13. curs.execute(db_change("update topic set block = '' where code = ? and id = ?"), [topic_num, num])
  14. else:
  15. curs.execute(db_change("update topic set block = 'O' where code = ? and id = ?"), [topic_num, num])
  16. do_reload_recent_thread(
  17. topic_num,
  18. get_time()
  19. )
  20. conn.commit()
  21. return redirect('/thread/' + topic_num + '#' + num)