2
0

recent_history_add.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 await render_template(
  26. await get_lang('history_add'),
  27. '''
  28. <form method="post">
  29. <input class="__ON_INPUT__" placeholder="''' + await get_lang('why') + '''" name="send">
  30. <hr class="main_hr">
  31. <input class="__ON_INPUT__" placeholder="''' + await get_lang('name') + '''" name="get_ip">
  32. <hr class="main_hr">
  33. ''' + await edit_editor(conn, ip) + '''
  34. </form>
  35. ''',
  36. '(' + name + ')',
  37. [['history/' + url_pas(name), await get_lang('return')]]
  38. )