list_acl.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. from .tool.func import *
  2. def list_acl_2():
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. num = int(number_check(flask.request.args.get('num', '1')))
  6. sql_num = (num * 50 - 50) if num * 50 > 0 else 0
  7. div = '<ul class="inside_ul">'
  8. curs.execute(db_change(
  9. "select distinct title, data, type from acl where data != '' and not title like 'user:%' order by title desc limit ?, 50"
  10. ), [sql_num])
  11. list_data = curs.fetchall()
  12. for data in list_data:
  13. curs.execute(db_change("select time from re_admin where what like ? order by time desc limit 1"), ['acl (' + data[0] + ')%'])
  14. time_data = curs.fetchall()
  15. time_data = (time_data[0][0] + ' | ') if time_data else ''
  16. curs.execute(db_change("select data from acl where title = ? and type = 'why'"), [data[0]])
  17. why_data = curs.fetchall()
  18. why_data = (' | ' + why_data[0][0]) if why_data and why_data[0][0] != '' else ''
  19. div += '' + \
  20. '<li>' + \
  21. time_data + \
  22. '<a href="/acl/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a>' + \
  23. why_data + \
  24. '</li>' + \
  25. ''
  26. div += '</ul>'
  27. div += next_fix('/acl_list?num=', num, list_data)
  28. return easy_minify(flask.render_template(skin_check(),
  29. imp = [load_lang('acl_document_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
  30. data = div,
  31. menu = [['other', load_lang('return')]]
  32. ))