2
0

inter_wiki_del.py 1.5 KB

1234567891011121314151617181920212223242526272829
  1. from .tool.func import *
  2. def inter_wiki_del(tool, name = 'Test'):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. if admin_check(None, tool) == 1:
  6. if tool == 'del_inter_wiki':
  7. curs.execute(db_change("delete from html_filter where html = ? and kind = 'inter_wiki'"), [name])
  8. elif tool == 'del_edit_filter':
  9. curs.execute(db_change("delete from html_filter where html = ? and kind = 'regex_filter'"), [name])
  10. elif tool == 'del_name_filter':
  11. curs.execute(db_change("delete from html_filter where html = ? and kind = 'name'"), [name])
  12. elif tool == 'del_file_filter':
  13. curs.execute(db_change("delete from html_filter where html = ? and kind = 'file'"), [name])
  14. elif tool == 'del_email_filter':
  15. curs.execute(db_change("delete from html_filter where html = ? and kind = 'email'"), [name])
  16. elif tool == 'del_image_license':
  17. curs.execute(db_change("delete from html_filter where html = ? and kind = 'image_license'"), [name])
  18. elif tool == 'del_extension_filter':
  19. curs.execute(db_change("delete from html_filter where html = ? and kind = 'extension'"), [name])
  20. else:
  21. curs.execute(db_change("delete from html_filter where html = ? and kind = 'edit_top'"), [name])
  22. conn.commit()
  23. return redirect('/' + re.sub(r'^del_', '', tool))
  24. else:
  25. return re_error('/error/3')