list_old_page.py 1.4 KB

123456789101112131415161718192021222324252627282930
  1. from .tool.func import *
  2. def list_old_page():
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. num = flask.request.args.get('num', '1')
  6. num = int(number_check(num))
  7. sql_num = (num * 50 - 50) if num * 50 > 0 else 0
  8. curs.execute(db_change('select data from other where name = "count_all_title"'))
  9. if int(curs.fetchall()[0][0]) > 30000:
  10. return re_error('/error/25')
  11. div = '<ul class="opennamu_ul">'
  12. curs.execute(db_change('' + \
  13. 'select h.title, max(h.date) from history as h where not (title like "user:%" or title like "category:%" or title like "file:%") and exists (select title from data where title = h.title) and not exists (select title from back where link = h.title and type = "redirect") group by h.title order by h.date asc limit ?, 50' + \
  14. ''), [sql_num])
  15. n_list = curs.fetchall()
  16. for data in n_list:
  17. div += '<li>' + data[1] + ' | <a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a></li>'
  18. div += '</ul>' + next_fix('/old_page?num=', num, n_list)
  19. return easy_minify(flask.render_template(skin_check(),
  20. imp = [load_lang('old_page'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
  21. data = div,
  22. menu = [['other', load_lang('return')]]
  23. ))