list_old_page.py 1.3 KB

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