topic_comment_delete.py 1.0 KB

123456789101112131415161718192021222324252627
  1. from .tool.func import *
  2. def topic_comment_delete(topic_num = 1, num = 1):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. if acl_check(tool = 'owner_auth') == 1:
  6. return re_error(conn, 3)
  7. topic_num = str(topic_num)
  8. num = str(num)
  9. if flask.request.method == 'POST':
  10. curs.execute(db_change("delete from topic where code = ? and id = ?"), [topic_num, num])
  11. return redirect(conn, '/thread/' + topic_num)
  12. else:
  13. return easy_minify(conn, flask.render_template(skin_check(conn),
  14. imp = [get_lang(conn, 'topic_delete'), wiki_set(conn), wiki_custom(conn), wiki_css(['(#' + num + ')', 0])],
  15. data = '''
  16. <hr class="main_hr">
  17. <form method="post">
  18. <button type="submit">''' + get_lang(conn, 'start') + '''</button>
  19. </form>
  20. ''',
  21. menu = [['thread/' + topic_num + '/comment/' + num + '/tool', get_lang(conn, 'return')]]
  22. ))