inter_wiki.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. from .tool.func import *
  2. def inter_wiki(conn, tool):
  3. curs = conn.cursor()
  4. div = '<table id="main_table_set">'
  5. div += '<tr id="main_table_top_tr">'
  6. div += '<td id="main_table_width">A</td>'
  7. div += '<td id="main_table_width">B</td>'
  8. div += '<td id="main_table_width">C</td>'
  9. div += '</tr>'
  10. admin = admin_check()
  11. if tool == 'inter_wiki':
  12. title = load_lang('interwiki_list')
  13. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'inter_wiki'"))
  14. elif tool == 'email_filter':
  15. title = load_lang('email_filter_list')
  16. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'email'"))
  17. elif tool == 'name_filter':
  18. title = load_lang('id_filter_list')
  19. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'name'"))
  20. elif tool == 'edit_filter':
  21. title = load_lang('edit_filter_list')
  22. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'regex_filter'"))
  23. elif tool == 'file_filter':
  24. title = load_lang('file_filter_list')
  25. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'file'"))
  26. elif tool == 'file_filter':
  27. title = load_lang('file_filter_list')
  28. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'file'"))
  29. elif tool == 'image_license':
  30. title = load_lang('image_license_list')
  31. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'image_license'"))
  32. elif tool == 'extension_filter':
  33. title = load_lang('extension_filter_list')
  34. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'extension'"))
  35. else:
  36. title = load_lang('edit_tool_list')
  37. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'edit_top'"))
  38. db_data = curs.fetchall()
  39. for data in db_data:
  40. div += '<tr>'
  41. div += '<td>'
  42. div += data[0]
  43. if admin == 1:
  44. div += ' <a href="/' + tool + '/add/' + url_pas(data[0]) + '">(' + load_lang('edit') + ')</a>'
  45. div += ' <a href="/' + tool + '/del/' + url_pas(data[0]) + '">(' + load_lang('delete') + ')</a>'
  46. div += '</td>'
  47. if tool == 'inter_wiki':
  48. div += '<td><a id="out_link" href="' + data[1] + '">' + html.escape(data[1]) + '</a></td>'
  49. else:
  50. div += '<td>' + html.escape(data[1]) + '</td>'
  51. div += '<td>' + html.escape(data[2]) + '</td>'
  52. div += '</tr>'
  53. div += '</table>'
  54. if admin == 1:
  55. div += '<hr class="main_hr">'
  56. div += '<a href="/' + tool + '/add">(' + load_lang('add') + ')</a>'
  57. return easy_minify(flask.render_template(skin_check(),
  58. imp = [title, wiki_set(), wiki_custom(), wiki_css([0, 0])],
  59. data = div,
  60. menu = [['manager/1', load_lang('return')]]
  61. ))