2
0

recent_history_add.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from .tool.func import *
  2. from .edit import edit_editor
  3. async def recent_history_add(name = 'Test', do_type = ''):
  4. with get_db_connect() as conn:
  5. curs = conn.cursor()
  6. ip = ip_check()
  7. if await acl_check('', 'owner_auth', '', '') == 1:
  8. return await re_error(conn, 0)
  9. if flask.request.method == 'POST':
  10. await acl_check(tool = 'owner_auth', memo = 'history_add (' + name + ')')
  11. today = get_time()
  12. content = flask.request.form.get('content', '')
  13. leng = '+' + str(len(content))
  14. history_plus(conn,
  15. name,
  16. content,
  17. today,
  18. 'Add:' + flask.request.form.get('get_ip', ''),
  19. flask.request.form.get('send', ''),
  20. leng,
  21. mode = 'add'
  22. )
  23. return redirect(conn, '/history/' + url_pas(name))
  24. else:
  25. return easy_minify(flask.render_template(await skin_check(),
  26. imp = [await get_lang('history_add'), await wiki_set(), await wiki_custom(), wiki_css(['(' + name + ')', 0])],
  27. data = '''
  28. <form method="post">
  29. <input placeholder="''' + await get_lang('why') + '''" name="send">
  30. <hr class="main_hr">
  31. <input placeholder="''' + await get_lang('name') + '''" name="get_ip">
  32. <hr class="main_hr">
  33. ''' + await edit_editor(conn, ip) + '''
  34. </form>
  35. ''',
  36. menu = [['history/' + url_pas(name), await get_lang('return')]]
  37. ))