inter_wiki.py 3.2 KB

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