2
0

topic_block.py 819 B

123456789101112131415161718192021
  1. from .tool.func import *
  2. def topic_block_2(conn, name, sub, num):
  3. curs = conn.cursor()
  4. if admin_check(3, 'blind (' + name + ' - ' + sub + '#' + str(num) + ')') != 1:
  5. return re_error('/error/3')
  6. curs.execute("select block from topic where title = ? and sub = ? and id = ?", [name, sub, str(num)])
  7. block = curs.fetchall()
  8. if block:
  9. if block[0][0] == 'O':
  10. curs.execute("update topic set block = '' where title = ? and sub = ? and id = ?", [name, sub, str(num)])
  11. else:
  12. curs.execute("update topic set block = 'O' where title = ? and sub = ? and id = ?", [name, sub, str(num)])
  13. rd_plus(name, sub, get_time())
  14. conn.commit()
  15. return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '#' + str(num))