list_acl.py 1.4 KB

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