topic_admin.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. from .tool.func import *
  2. def topic_admin_2(conn, topic_num, num):
  3. curs = conn.cursor()
  4. num = str(num)
  5. topic_num = str(topic_num)
  6. curs.execute(db_change("select block, ip, date from topic where code = ? and id = ?"), [topic_num, num])
  7. data = curs.fetchall()
  8. if not data:
  9. return redirect('/thread/' + topic_num)
  10. ban = '''
  11. <h2>''' + load_lang('state') + '''</h2>
  12. <ul>
  13. <li>''' + load_lang('writer') + ' : ''' + ip_pas(data[0][1]) + '''</li>
  14. <li>''' + load_lang('time') + ' : ' + data[0][2] + '''</li>
  15. </ul>
  16. <br>
  17. <h2>''' + load_lang('other_tool') + '''</h2>
  18. <ul>
  19. <li>
  20. <a href="/thread/''' + topic_num + '/raw/' + num + '''">''' + load_lang('raw') + '''</a>
  21. </li>
  22. </ul>
  23. '''
  24. if admin_check(3) == 1:
  25. curs.execute(db_change("select id from topic where code = ? and id = ? and top = 'O'"), [topic_num, num])
  26. top_topic_d = curs.fetchall()
  27. curs.execute(db_change("select end from ban where block = ?"), [data[0][1]])
  28. user_ban_d = curs.fetchall()
  29. ban += '''
  30. <br>
  31. <h2>''' + load_lang('admin_tool') + '''</h2>
  32. <ul>
  33. <li>
  34. <a href="/ban/''' + url_pas(data[0][1]) + '''">
  35. ''' + (load_lang('ban_release') if user_ban_d else load_lang('ban')) + '''
  36. </a>
  37. </li>
  38. <li>
  39. <a href="/thread/''' + topic_num + '/b/' + num + '''">
  40. ''' + (load_lang('hide_release') if data[0][0] == 'O' else load_lang('hide')) + '''
  41. </a>
  42. </li>
  43. <li>
  44. <a href="/thread/''' + topic_num + '/notice/' + num + '''">
  45. ''' + (load_lang('pinned_release') if top_topic_d else load_lang('pinned')) + '''
  46. </a>
  47. </li>
  48. </ul>
  49. '''
  50. return easy_minify(flask.render_template(skin_check(),
  51. imp = [load_lang('discussion_tool'), wiki_set(), custom(), other2([' (#' + num + ')', 0])],
  52. data = ban,
  53. menu = [['thread/' + topic_num + '#' + num, load_lang('return')]]
  54. ))