Browse Source

매우 불안정한 패치 (테스트용)

잉여개발기 (SPDV) 2 years ago
parent
commit
98e44f9432
100 changed files with 1459 additions and 1459 deletions
  1. 3 3
      app.py
  2. 1 1
      emergency_tool.py
  3. 1 1
      route/api_func_lang.py
  4. 1 1
      route/api_image_view.py
  5. 3 3
      route/api_skin_info.py
  6. 4 4
      route/api_user_info.py
  7. 3 3
      route/api_w_render.py
  8. 10 10
      route/bbs_delete.py
  9. 10 10
      route/bbs_make.py
  10. 22 22
      route/bbs_w.py
  11. 9 9
      route/bbs_w_comment_tool.py
  12. 14 14
      route/bbs_w_delete.py
  13. 30 30
      route/bbs_w_edit.py
  14. 8 8
      route/bbs_w_hide.py
  15. 10 10
      route/bbs_w_pinned.py
  16. 50 50
      route/bbs_w_post.py
  17. 18 18
      route/bbs_w_set.py
  18. 11 11
      route/bbs_w_tool.py
  19. 43 43
      route/edit.py
  20. 2 2
      route/edit_backlink_reset.py
  21. 20 20
      route/edit_delete.py
  22. 11 11
      route/edit_delete_file.py
  23. 14 14
      route/edit_delete_multiple.py
  24. 45 45
      route/edit_move.py
  25. 15 15
      route/edit_request.py
  26. 26 26
      route/edit_revert.py
  27. 28 28
      route/edit_upload.py
  28. 18 18
      route/filter_all.py
  29. 58 58
      route/filter_all_add.py
  30. 3 3
      route/filter_all_delete.py
  31. 17 17
      route/give_admin_groups.py
  32. 17 17
      route/give_auth.py
  33. 8 8
      route/give_delete_admin_group.py
  34. 28 28
      route/give_user_ban.py
  35. 20 20
      route/give_user_fix.py
  36. 5 5
      route/go_api_topic.py
  37. 1 1
      route/go_api_w_raw.py
  38. 2 2
      route/go_main_func_easter_egg.py
  39. 4 4
      route/list_acl.py
  40. 4 4
      route/list_admin.py
  41. 9 9
      route/list_admin_auth_use.py
  42. 6 6
      route/list_admin_group.py
  43. 8 8
      route/list_image_file.py
  44. 4 4
      route/list_long_page.py
  45. 4 4
      route/list_no_link.py
  46. 4 4
      route/list_old_page.py
  47. 4 4
      route/list_please.py
  48. 10 10
      route/list_title_index.py
  49. 5 5
      route/list_user.py
  50. 22 22
      route/list_user_check.py
  51. 11 11
      route/list_user_check_delete.py
  52. 5 5
      route/login_find.py
  53. 25 25
      route/login_find_email.py
  54. 17 17
      route/login_find_email_check.py
  55. 16 16
      route/login_find_key.py
  56. 22 22
      route/login_login.py
  57. 18 18
      route/login_login_2fa.py
  58. 18 18
      route/login_login_2fa_email.py
  59. 1 1
      route/login_logout.py
  60. 27 27
      route/login_register.py
  61. 13 13
      route/login_register_email.py
  62. 10 10
      route/login_register_email_check.py
  63. 14 14
      route/login_register_submit.py
  64. 1 1
      route/main_func_error_404.py
  65. 1 1
      route/main_search.py
  66. 10 10
      route/main_search_deep.py
  67. 2 2
      route/main_search_goto.py
  68. 14 14
      route/main_setting.py
  69. 24 24
      route/main_setting_acl.py
  70. 25 25
      route/main_setting_external.py
  71. 15 15
      route/main_setting_head.py
  72. 60 60
      route/main_setting_main.py
  73. 10 10
      route/main_setting_main_logo.py
  74. 38 38
      route/main_setting_phrase.py
  75. 10 10
      route/main_setting_robot.py
  76. 9 9
      route/main_setting_sitemap.py
  77. 15 15
      route/main_setting_sitemap_set.py
  78. 37 37
      route/main_setting_skin_set.py
  79. 10 10
      route/main_setting_top_menu.py
  80. 8 8
      route/main_sys_restart.py
  81. 7 7
      route/main_sys_shutdown.py
  82. 13 13
      route/main_sys_update.py
  83. 39 39
      route/main_tool_admin.py
  84. 33 33
      route/main_tool_other.py
  85. 29 29
      route/main_tool_redirect.py
  86. 2 2
      route/main_view_file.py
  87. 1 1
      route/main_view_image.py
  88. 5 5
      route/n_w_watch_list.py
  89. 17 17
      route/recent_app_submit.py
  90. 29 29
      route/recent_block.py
  91. 38 38
      route/recent_change.py
  92. 15 15
      route/recent_discuss.py
  93. 6 6
      route/recent_edit_request.py
  94. 10 10
      route/recent_history_add.py
  95. 9 9
      route/recent_history_delete.py
  96. 2 2
      route/recent_history_hidden.py
  97. 9 9
      route/recent_history_reset.py
  98. 10 10
      route/recent_history_send.py
  99. 17 17
      route/recent_history_tool.py
  100. 9 9
      route/recent_record_reset.py

+ 3 - 3
app.py

@@ -118,11 +118,11 @@ with get_db_connect() as conn:
             pass
 
         if setup_tool == 'update':
-            update(int(ver_set_data[0][0]), set_data)
+            update(conn, int(ver_set_data[0][0]), set_data)
         else:
-            set_init()
+            set_init(conn)
 
-    set_init_always(version_list['beta']['c_ver'])
+    set_init_always(conn, version_list['beta']['c_ver'])
 
     # Init-Route
     class EverythingConverter(werkzeug.routing.PathConverter):

+ 1 - 1
emergency_tool.py

@@ -132,7 +132,7 @@ elif what_i_do == '7':
     user_name = input('User name : ')
     user_pw = input('User password : ')
 
-    hashed = pw_encode(user_pw)
+    hashed = pw_encode(conn, user_pw)
     curs.execute(db_change("update user_set set data = ? where id = ? and name = 'pw'"), [
         hashed,
         user_name

+ 1 - 1
route/api_func_lang.py

@@ -2,4 +2,4 @@ from .tool.func import *
 
 def api_func_lang(data = 'Test'):
     with get_db_connect() as conn:
-        return flask.jsonify({ "data" : load_lang(data) })
+        return flask.jsonify({ "data" : get_lang(conn, data) })

+ 1 - 1
route/api_image_view.py

@@ -2,7 +2,7 @@ from .tool.func import *
 
 def api_image_view(name = 'Test'):
     with get_db_connect() as conn:
-        if os.path.exists(os.path.join(load_image_url(), name)):
+        if os.path.exists(os.path.join(load_image_url(conn), name)):
             return flask.jsonify({ "exist" : "1" })
         else:
             return flask.jsonify({})

+ 3 - 3
route/api_skin_info.py

@@ -5,7 +5,7 @@ from .tool.func import *
 def api_skin_info(name = ''):
     with get_db_connect() as conn:
         curs = conn.cursor()
-        name = skin_check() if name == '' else './views/' + name + '/index.html'
+        name = skin_check(conn) if name == '' else './views/' + name + '/index.html'
 
         if not flask.request.args.get('all', None):
             json_address = re.sub(r"(((?!\.|\/).)+)\.html$", "info.json", name)
@@ -26,7 +26,7 @@ def api_skin_info(name = ''):
                 "Before Namu" : "https://raw.githubusercontent.com/openNAMU/openNAMU-Skin-Before_Namu/master/info.json"
             }
 
-            for i in load_skin(skin_check(1), 1):
+            for i in load_skin(conn, skin_check(conn, 1), 1):
                 json_address = re.sub(r"(((?!\.|\/).)+)\.html$", "info.json", './views/' + i + '/index.html')
                 try:
                     json_data = json.loads(open(json_address, encoding='utf8').read())
@@ -34,7 +34,7 @@ def api_skin_info(name = ''):
                     json_data = None
 
                 if json_data:
-                    if i == skin_check(1):
+                    if i == skin_check(conn, 1):
                         json_data = {**json_data, **{ "main" : "true" }}
 
                     if "info_link" in json_data:

+ 4 - 4
route/api_user_info.py

@@ -7,7 +7,7 @@ def api_user_info(user_name = ''):
         data_result = {}
         
         # name part
-        data_result['render'] = ip_pas(user_name)
+        data_result['render'] = ip_pas(conn, user_name)
         
         # auth part
         curs.execute(db_change("select data from user_set where id = ? and name = 'acl'"), [user_name])
@@ -31,13 +31,13 @@ def api_user_info(user_name = ''):
         else:
             data_result['auth_date'] = '0'
 
-        level_data = level_check(user_name)
+        level_data = level_check(conn, user_name)
         data_result['level'] = level_data[0]
         data_result['exp'] = level_data[1]
         data_result['max_exp'] = level_data[2]
             
         # ban part
-        if ban_check(user_name)[0] == 0:
+        if ban_check(conn, user_name)[0] == 0:
             data_result['ban'] = '0'
         else:
             data_result['ban'] = {}
@@ -119,6 +119,6 @@ def api_user_info(user_name = ''):
             'option',
             'edit_request_able'
         ]
-        lang_data = { for_a : load_lang(for_a) for for_a in lang_data_list }
+        lang_data = { for_a : get_lang(conn, for_a) for for_a in lang_data_list }
                 
         return flask.jsonify({ 'data' : data_result, 'language' : lang_data })

+ 3 - 3
route/api_w_render.py

@@ -48,19 +48,19 @@ def api_w_render(name = '', tool = ''):
                 data_org = re.sub('^\n+', '', data_org)
 
             if tool == '':
-                data_pas = render_set(
+                data_pas = render_set(conn, 
                     doc_name = name, 
                     doc_data = data_org, 
                     data_type = 'api_view'
                 )
             elif tool == 'include':
-                data_pas = render_set(
+                data_pas = render_set(conn, 
                     doc_name = name, 
                     doc_data = data_org, 
                     data_type = 'api_include'
                 )
             else:
-                data_pas = render_set(
+                data_pas = render_set(conn, 
                     doc_name = name,
                     doc_data = data_org, 
                     data_type = 'api_thread'

+ 10 - 10
route/bbs_delete.py

@@ -7,30 +7,30 @@ def bbs_delete(bbs_num = ''):
         curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_name"'), [bbs_num])
         db_data = curs.fetchall()
         if not db_data:
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
         
         bbs_name = db_data[0][0]
         
         bbs_num_str = str(bbs_num)
 
-        if admin_check() != 1:
-            return redirect('/bbs/w/' + bbs_num_str)
+        if admin_check(conn) != 1:
+            return redirect(conn, '/bbs/w/' + bbs_num_str)
         
         if flask.request.method == 'POST':
             curs.execute(db_change('delete from bbs_data where set_id = ?'), [bbs_num_str])
             curs.execute(db_change('delete from bbs_set where set_id = ?'), [bbs_num_str])
             curs.execute(db_change('delete from bbs_data where set_id like ?'), [bbs_num_str + '-%'])
             
-            return redirect('/bbs/w/' + bbs_num_str)
+            return redirect(conn, '/bbs/w/' + bbs_num_str)
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('bbs_delete'), wiki_set(), wiki_custom(), wiki_css(['(' + bbs_name + ')', 0])],
-                data = render_simple_set('''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'bbs_delete'), wiki_set(conn), wiki_custom(conn), wiki_css(['(' + bbs_name + ')', 0])],
+                data = render_simple_set(conn, '''
                     <form method="post">
-                        <span>''' + load_lang('delete_warning') + '''</span>
+                        <span>''' + get_lang(conn, 'delete_warning') + '''</span>
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('delete') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'delete') + '''</button>
                     </form>
                 '''),
-                menu = [['bbs/set/' + bbs_num_str, load_lang('return')]]
+                menu = [['bbs/set/' + bbs_num_str, get_lang(conn, 'return')]]
             ))

+ 10 - 10
route/bbs_make.py

@@ -4,8 +4,8 @@ def bbs_make():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/error/3')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/3')
         
         if flask.request.method == 'POST':
             
@@ -22,23 +22,23 @@ def bbs_make():
 
             conn.commit()
 
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('bbs_make'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'bbs_make'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
-                        <input placeholder="''' + load_lang('bbs_name') + '''" name="bbs_name">
+                        <input placeholder="''' + get_lang(conn, 'bbs_name') + '''" name="bbs_name">
                         <hr class="main_hr">
                         
                         <select name="bbs_type">
-                            <option value="comment">''' + load_lang('comment_base') + '''</option>
-                            <option value="thread">''' + load_lang('thread_base') + '''</option>
+                            <option value="comment">''' + get_lang(conn, 'comment_base') + '''</option>
+                            <option value="thread">''' + get_lang(conn, 'thread_base') + '''</option>
                         </select>
                         <hr class="main_hr">
                         
-                        <button type="submit">''' + load_lang('save') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['bbs/main', load_lang('return')]]
+                menu = [['bbs/main', get_lang(conn, 'return')]]
             ))

+ 22 - 22
route/bbs_w.py

@@ -9,36 +9,36 @@ def bbs_w(bbs_num = '', tool = 'bbs', page = 1, name = ''):
         sub = ''
         bbs_name_dict = {}
 
-        admin_auth = admin_check()
+        admin_auth = admin_check(conn)
 
         if tool == 'bbs':
             curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_name"'), [bbs_num])
             db_data = curs.fetchall()
             if not db_data:
-                return redirect('/bbs/main')
+                return redirect(conn, '/bbs/main')
         
             bbs_name = db_data[0][0]
             bbs_num_str = str(bbs_num)
 
             title_name = bbs_name
-            sub = '(' + load_lang('bbs') + ')'
-            menu = [['bbs/main', load_lang('return')], ['bbs/edit/' + bbs_num_str, load_lang('add')], ['bbs/set/' + bbs_num_str, load_lang('bbs_set')]]
+            sub = '(' + get_lang(conn, 'bbs') + ')'
+            menu = [['bbs/main', get_lang(conn, 'return')], ['bbs/edit/' + bbs_num_str, get_lang(conn, 'add')], ['bbs/set/' + bbs_num_str, get_lang(conn, 'bbs_set')]]
         elif tool == 'record':
             curs.execute(db_change('select set_data, set_id from bbs_set where set_name = "bbs_name"'))
             db_data = curs.fetchall()
             bbs_name_dict = { for_a[1] : for_a[0] for for_a in db_data } if db_data else {}
             
             title_name = name
-            sub = '(' + load_lang('bbs_record') + ')'
-            menu = [['user/' + url_pas(name), load_lang('user_tool')]]
+            sub = '(' + get_lang(conn, 'bbs_record') + ')'
+            menu = [['user/' + url_pas(name), get_lang(conn, 'user_tool')]]
         elif tool == 'comment_record':
             curs.execute(db_change('select set_data, set_id from bbs_set where set_name = "bbs_name"'))
             db_data = curs.fetchall()
             bbs_name_dict = { for_a[1] : for_a[0] for for_a in db_data } if db_data else {}
             
             title_name = name
-            sub = '(' + load_lang('bbs_comment_record') + ')'
-            menu = [['user/' + url_pas(name), load_lang('user_tool')]]
+            sub = '(' + get_lang(conn, 'bbs_comment_record') + ')'
+            menu = [['user/' + url_pas(name), get_lang(conn, 'user_tool')]]
         else:
             curs.execute(db_change('select set_data, set_id from bbs_set where set_name = "bbs_name"'))
             db_data = curs.fetchall()
@@ -52,9 +52,9 @@ def bbs_w(bbs_num = '', tool = 'bbs', page = 1, name = ''):
                     bbs_type = db_data_2[0][0] if db_data_2 else 'comment'
 
                     if bbs_type == 'thread':
-                        bbs_type = load_lang('thread_base')
+                        bbs_type = get_lang(conn, 'thread_base')
                     else:
-                        bbs_type = load_lang('comment_base')
+                        bbs_type = get_lang(conn, 'comment_base')
                     
                     curs.execute(db_change('select set_data from bbs_data where set_id = ? and set_name = "date" order by set_code + 0 desc limit 1'), [for_a[1]])
                     db_data_2 = curs.fetchall()
@@ -68,25 +68,25 @@ def bbs_w(bbs_num = '', tool = 'bbs', page = 1, name = ''):
             
             data += '<hr class="main_hr">'
 
-            title_name = load_lang('bbs_main')
-            menu = [['other', load_lang('other_tool')]] + ([['bbs/make', load_lang('add')]] if admin_auth == 1 else [])
+            title_name = get_lang(conn, 'bbs_main')
+            menu = [['other', get_lang(conn, 'other_tool')]] + ([['bbs/make', get_lang(conn, 'add')]] if admin_auth == 1 else [])
 
         if tool == 'comment_record':
             data += '''
                 <table id="main_table_set">
                     <tr id="main_table_top_tr">
-                        <td id="main_table_width">''' + load_lang('editor') + '''</td>
-                        <td id="main_table_width">''' + load_lang('time') + '''</td>
-                        <td id="main_table_width">''' + load_lang('comment') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'editor') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'time') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'comment') + '''</td>
                     </tr>
             '''
         else:
             data += '''
                 <table id="main_table_set">
                     <tr id="main_table_top_tr">
-                        <td id="main_table_width">''' + load_lang('editor') + '''</td>
-                        <td id="main_table_width">''' + load_lang('time') + '''</td>
-                        <td id="main_table_width">''' + load_lang('last_comment_time') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'editor') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'time') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'last_comment_time') + '''</td>
                     </tr>
             '''
 
@@ -150,7 +150,7 @@ def bbs_w(bbs_num = '', tool = 'bbs', page = 1, name = ''):
                     
                 data += '''
                     <tr>
-                        <td>''' + ip_pas(temp_dict['comment_user_id']) + '''</td>
+                        <td>''' + ip_pas(conn, temp_dict['comment_user_id']) + '''</td>
                         <td>''' + temp_dict['comment_date'] + '''</td>
                         <td>''' + ('#' + comment_link) + '''</td>
                     </tr>
@@ -172,7 +172,7 @@ def bbs_w(bbs_num = '', tool = 'bbs', page = 1, name = ''):
             
                 data += '''
                     <tr class="''' + ('opennamu_comment_color_red' if notice == 1 else '') + '''">
-                        <td>''' + ip_pas(temp_dict['user_id']) + '''</td>
+                        <td>''' + ip_pas(conn, temp_dict['user_id']) + '''</td>
                         <td>''' + temp_dict['date'] + '''</td>
                         <td>''' + last_comment_date + '''</td>
                     </tr>
@@ -187,8 +187,8 @@ def bbs_w(bbs_num = '', tool = 'bbs', page = 1, name = ''):
                 
         data += '</table>'
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [title_name, wiki_set(), wiki_custom(), wiki_css([sub, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [title_name, wiki_set(conn), wiki_custom(conn), wiki_css([sub, 0])],
             data = data,
             menu = menu
         ))

+ 9 - 9
route/bbs_w_comment_tool.py

@@ -10,23 +10,23 @@ def bbs_w_comment_tool(bbs_num = '', post_num = '', comment_num = ''):
         post_num_str = str(post_num)
         
         data += '''
-            <h2>''' + load_lang('tool') + '''</h2>
+            <h2>''' + get_lang(conn, 'tool') + '''</h2>
             <ul class="opennamu_ul">
-                <li><a href="/bbs/raw/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '/' + url_pas(comment_num) + '">' + load_lang('raw') + '''</a></li>
-                <li><a href="/bbs/edit/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '/' + url_pas(comment_num) + '">' + load_lang('edit') + '''</a></li>
+                <li><a href="/bbs/raw/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '/' + url_pas(comment_num) + '">' + get_lang(conn, 'raw') + '''</a></li>
+                <li><a href="/bbs/edit/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '/' + url_pas(comment_num) + '">' + get_lang(conn, 'edit') + '''</a></li>
             </ul>
         '''
 
-        if admin_check() == 1:
+        if admin_check(conn) == 1:
             data += '''
-                <h3>''' + load_lang('owner') + '''</h2>
+                <h3>''' + get_lang(conn, 'owner') + '''</h2>
                 <ul class="opennamu_ul">
-                    <li><a href="/bbs/delete/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '/' + url_pas(comment_num) + '">' + load_lang('delete') + '''</a></li>
+                    <li><a href="/bbs/delete/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '/' + url_pas(comment_num) + '">' + get_lang(conn, 'delete') + '''</a></li>
                 </ul>
             '''
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('bbs_comment_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'bbs_comment_tool'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = data,
-            menu = [['bbs/w/' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '#' + url_pas(comment_num), load_lang('return')]]
+            menu = [['bbs/w/' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '#' + url_pas(comment_num), get_lang(conn, 'return')]]
         ))

+ 14 - 14
route/bbs_w_delete.py

@@ -9,19 +9,19 @@ def bbs_w_delete(bbs_num = '', post_num = '', comment_num = ''):
         curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_name"'), [bbs_num])
         db_data = curs.fetchall()
         if not db_data:
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
 
         bbs_name = db_data[0][0]
         
         bbs_num_str = str(bbs_num)
         post_num_str = str(post_num)
 
-        if admin_check() != 1:
-            return redirect('/bbs/w/' + bbs_num_str)
+        if admin_check(conn) != 1:
+            return redirect(conn, '/bbs/w/' + bbs_num_str)
         
         temp_dict = json.loads(api_bbs_w_post(bbs_num_str + '-' + post_num_str).data)
         if not 'user_id' in temp_dict:
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
         
         if flask.request.method == 'POST':
             if comment_num == '':
@@ -29,7 +29,7 @@ def bbs_w_delete(bbs_num = '', post_num = '', comment_num = ''):
                 curs.execute(db_change('delete from bbs_set where set_code = ? and set_id = ?'), [post_num_str, bbs_num_str])
                 curs.execute(db_change('delete from bbs_data where set_id = ? or set_id like ?'), [bbs_num_str + '-' + post_num_str, bbs_num_str + '-' + post_num_str + '-%'])
                 
-                return redirect('/bbs/w/' + bbs_num_str)
+                return redirect(conn, '/bbs/w/' + bbs_num_str)
             else:
                 comment_num_split = comment_num.split('-')
                 
@@ -44,25 +44,25 @@ def bbs_w_delete(bbs_num = '', post_num = '', comment_num = ''):
 
                 curs.execute(db_change("update bbs_data set set_data = '' where set_code = ? and set_id = ?"), [set_code, set_id])
                 
-                return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
+                return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str)
         else:
             sub = '(' + bbs_name + ')'
             sub += ' (' + post_num_str + ')'
             
-            name = load_lang('bbs_comment_delete')
+            name = get_lang(conn, 'bbs_comment_delete')
             if comment_num == '':
-                name = load_lang('bbs_post_delete')
+                name = get_lang(conn, 'bbs_post_delete')
             else:
                 sub += ' (' + comment_num + ')'
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css([sub, 0])],
-                data = render_simple_set('''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css([sub, 0])],
+                data = render_simple_set(conn, '''
                     <form method="post">
-                        <span>''' + load_lang('delete_warning') + '''</span>
+                        <span>''' + get_lang(conn, 'delete_warning') + '''</span>
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('delete') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'delete') + '''</button>
                     </form>
                 '''),
-                menu = [['bbs/w/' + bbs_num_str + '/' + post_num_str, load_lang('return')]]
+                menu = [['bbs/w/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'return')]]
             ))

+ 30 - 30
route/bbs_w_edit.py

@@ -16,33 +16,33 @@ def bbs_w_edit(bbs_num = '', post_num = '', comment_num = ''):
 
         curs.execute(db_change('select set_id from bbs_set where set_id = ? and set_name = "bbs_name"'), [bbs_num_str])
         if not curs.fetchall():
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
         
         if comment_num != '':
             temp_dict = json.loads(api_bbs_w_comment_one(bbs_num_str + '-' + post_num_str + '-' + comment_num).data)
             if 'comment_user_id' in temp_dict:
-                if not temp_dict['comment_user_id'] == ip and admin_check() != 1:
-                    return re_error('/ban')
+                if not temp_dict['comment_user_id'] == ip and admin_check(conn) != 1:
+                    return re_error(conn, '/ban')
             else:
-                return redirect('/bbs/main')
+                return redirect(conn, '/bbs/main')
         elif post_num != '':
             temp_dict = json.loads(api_bbs_w_post(bbs_num_str + '-' + post_num_str).data)
             if 'user_id' in temp_dict:
-                if not temp_dict['user_id'] == ip and admin_check() != 1:
-                    return re_error('/ban')
+                if not temp_dict['user_id'] == ip and admin_check(conn) != 1:
+                    return re_error(conn, '/ban')
             else:
-                return redirect('/bbs/main')
+                return redirect(conn, '/bbs/main')
             
-        if acl_check(bbs_num_str, 'bbs_edit') == 1:
-            return redirect('/bbs/set/' + bbs_num_str)
+        if acl_check(conn, bbs_num_str, 'bbs_edit') == 1:
+            return redirect(conn, '/bbs/set/' + bbs_num_str)
         
         i_list = ['post_view_acl', 'post_comment_acl']
 
         if flask.request.method == 'POST':
-            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                return re_error('/error/13')
+            if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error(conn, '/error/13')
             else:
-                captcha_post('', 0)
+                captcha_post(conn, '', 0)
         
             if post_num == '':
                 curs.execute(db_change('select set_code from bbs_data where set_name = "title" and set_id = ? order by set_code + 0 desc'), [bbs_num_str])
@@ -56,7 +56,7 @@ def bbs_w_edit(bbs_num = '', post_num = '', comment_num = ''):
             data = flask.request.form.get('content', '')
             if data == '':
                 # re_error로 대체 예정
-                return redirect('/bbs/w/' + bbs_num_str)
+                return redirect(conn, '/bbs/w/' + bbs_num_str)
             
             date = get_time()
 
@@ -81,9 +81,9 @@ def bbs_w_edit(bbs_num = '', post_num = '', comment_num = ''):
                 curs.execute(db_change("update bbs_data set set_data = ? where set_name = 'date' and set_code = ? and set_id = ?"), [date, id_data, bbs_num_str])
 
             if comment_num != '':
-                return redirect('/bbs/w/' + bbs_num_str + '/' + id_data + '#' + url_pas(comment_num))
+                return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + id_data + '#' + url_pas(comment_num))
             else:
-                return redirect('/bbs/w/' + bbs_num_str + '/' + id_data)
+                return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + id_data)
         else:
             option_display = ''
 
@@ -108,45 +108,45 @@ def bbs_w_edit(bbs_num = '', post_num = '', comment_num = ''):
                 for data_list in acl_list:
                     acl_div[for_a] += '<option value="' + data_list + '">' + (data_list if data_list != '' else 'normal') + '</option>'
     
-            editor_top_text = '<a href="/filter/edit_filter">(' + load_lang('edit_filter_rule') + ')</a>'
+            editor_top_text = '<a href="/filter/edit_filter">(' + get_lang(conn, 'edit_filter_rule') + ')</a>'
 
             if editor_top_text != '':
                 editor_top_text += '<hr class="main_hr">'
 
             if comment_num != '':
-                bbs_title = load_lang('bbs_comment_edit')
+                bbs_title = get_lang(conn, 'bbs_comment_edit')
             elif post_num == '':
-                bbs_title = load_lang('post_add')
+                bbs_title = get_lang(conn, 'post_add')
             else:
-                bbs_title = load_lang('post_edit')
+                bbs_title = get_lang(conn, 'post_edit')
     
-            return easy_minify(flask.render_template(skin_check(), 
-                imp = [bbs_title, wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn), 
+                imp = [bbs_title, wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data =  editor_top_text + '''
                     <form method="post">                        
-                        <input style="''' + option_display + '''" placeholder="''' + load_lang('title') + '''" name="title" value="''' + html.escape(title) + '''">
+                        <input style="''' + option_display + '''" placeholder="''' + get_lang(conn, 'title') + '''" name="title" value="''' + html.escape(title) + '''">
                         <hr style="''' + option_display + '''" class="main_hr">
 
                         ''' + edit_editor(curs, ip, data, 'bbs') + '''
 
                         <!--
                         <div style="''' + option_display + '''">
-                            ''' + render_simple_set('''
+                            ''' + render_simple_set(conn, '''
                                 <hr class="main_hr">
-                                <a href="/acl/TEST#exp">(''' + load_lang('reference') + ''')</a>
-                                <h2>''' + load_lang('acl') + '''</h2>
-                                <h3>''' + load_lang('post_view_acl') + '''</h3>
+                                <a href="/acl/TEST#exp">(''' + get_lang(conn, 'reference') + ''')</a>
+                                <h2>''' + get_lang(conn, 'acl') + '''</h2>
+                                <h3>''' + get_lang(conn, 'post_view_acl') + '''</h3>
                                 <select name="post_view_acl">''' + acl_div[0] + '''</select>
 
-                                <h4>''' + load_lang('post_comment_acl') + '''</h4>
+                                <h4>''' + get_lang(conn, 'post_comment_acl') + '''</h4>
                                 <select name="post_comment_acl">''' + acl_div[1] + '''</select>
 
-                                <h2>''' + load_lang('markup') + '''</h2>
-                                ''' + load_lang('not_working') + '''
+                                <h2>''' + get_lang(conn, 'markup') + '''</h2>
+                                ''' + get_lang(conn, 'not_working') + '''
                             ''') + '''
                         </div>
                         -->
                     </form>
                 ''',
-                menu = [['bbs/w/' + bbs_num_str, load_lang('return')]]
+                menu = [['bbs/w/' + bbs_num_str, get_lang(conn, 'return')]]
             ))

+ 8 - 8
route/bbs_w_hide.py

@@ -7,25 +7,25 @@ def bbs_w_hide(bbs_num = '', post_num = ''):
         curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_name"'), [bbs_num])
         db_data = curs.fetchall()
         if not db_data:
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
 
         bbs_name = db_data[0][0]
         
         bbs_num_str = str(bbs_num)
         post_num_str = str(post_num)
 
-        if admin_check() != 1:
-            return redirect('/bbs/w/' + bbs_num_str)
+        if admin_check(conn) != 1:
+            return redirect(conn, '/bbs/w/' + bbs_num_str)
         
         if flask.request.method == 'POST':
             pass
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('bbs_post_hide'), wiki_set(), wiki_custom(), wiki_css(['(' + bbs_name + ')' + ' (' + post_num_str + ')', 0])],
-                data = render_simple_set('''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'bbs_post_hide'), wiki_set(conn), wiki_custom(conn), wiki_css(['(' + bbs_name + ')' + ' (' + post_num_str + ')', 0])],
+                data = render_simple_set(conn, '''
                     <form method="post">
-                        <button type="submit">''' + load_lang('hide') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'hide') + '''</button>
                     </form>
                 '''),
-                menu = [['bbs/w/' + bbs_num_str + '/' + post_num_str, load_lang('return')]]
+                menu = [['bbs/w/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'return')]]
             ))

+ 10 - 10
route/bbs_w_pinned.py

@@ -9,19 +9,19 @@ def bbs_w_pinned(bbs_num = '', post_num = ''):
         curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_name"'), [bbs_num])
         db_data = curs.fetchall()
         if not db_data:
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
 
         bbs_name = db_data[0][0]
         
         bbs_num_str = str(bbs_num)
         post_num_str = str(post_num)
 
-        if admin_check() != 1:
-            return redirect('/bbs/w/' + bbs_num_str)
+        if admin_check(conn) != 1:
+            return redirect(conn, '/bbs/w/' + bbs_num_str)
         
         temp_dict = json.loads(api_bbs_w_post(bbs_num_str + '-' + post_num_str).data)
         if not 'user_id' in temp_dict:
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
         
         if flask.request.method == 'POST':
             curs.execute(db_change('select set_data from bbs_data where set_code = ? and set_id = ? and set_name = "pinned"'), [post_num_str, bbs_num_str])
@@ -30,17 +30,17 @@ def bbs_w_pinned(bbs_num = '', post_num = ''):
             else:
                 curs.execute(db_change('delete from bbs_data where set_code = ? and set_id = ? and set_name = "pinned"'), [post_num_str, bbs_num_str])
             
-            return redirect('/bbs/w/' + bbs_num_str)
+            return redirect(conn, '/bbs/w/' + bbs_num_str)
         else:
             curs.execute(db_change('select set_data from bbs_data where set_code = ? and set_id = ? and set_name = "pinned"'), [post_num_str, bbs_num_str])
-            pinned = load_lang('pinned') if not curs.fetchall() else load_lang('pinned_release')
+            pinned = get_lang(conn, 'pinned') if not curs.fetchall() else get_lang(conn, 'pinned_release')
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('bbs_post_pinned'), wiki_set(), wiki_custom(), wiki_css(['(' + bbs_name + ')' + ' (' + post_num_str + ')', 0])],
-                data = render_simple_set('''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'bbs_post_pinned'), wiki_set(conn), wiki_custom(conn), wiki_css(['(' + bbs_name + ')' + ' (' + post_num_str + ')', 0])],
+                data = render_simple_set(conn, '''
                     <form method="post">
                         <button type="submit">''' + pinned + '''</button>
                     </form>
                 '''),
-                menu = [['bbs/w/' + bbs_num_str + '/' + post_num_str, load_lang('return')]]
+                menu = [['bbs/w/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'return')]]
             ))

+ 50 - 50
route/bbs_w_post.py

@@ -6,7 +6,7 @@ from .go_api_topic import api_topic_thread_make, api_topic_thread_pre_render
 
 from .edit import edit_editor
 
-def bbs_w_post_comment(user_id, sub_code, comment_num, bbs_num_str, post_num_str):
+def bbs_w_post_comment(conn, user_id, sub_code, comment_num, bbs_num_str, post_num_str):
     comment_data = ''
     comment_select = ''
 
@@ -28,15 +28,15 @@ def bbs_w_post_comment(user_id, sub_code, comment_num, bbs_num_str, post_num_str
             margin_count = sub_code_check.count('-')
 
             date = ''
-            date += '<a href="javascript:opennamu_change_comment(\'' + sub_code_check + '\');">(' + load_lang('comment') + ')</a> '
-            date += '<a href="/bbs/tool/' + bbs_num_str + '/' + post_num_str + '/' + sub_code_check + '">(' + load_lang('tool') + ')</a> '
+            date += '<a href="javascript:opennamu_change_comment(\'' + sub_code_check + '\');">(' + get_lang(conn, 'comment') + ')</a> '
+            date += '<a href="/bbs/tool/' + bbs_num_str + '/' + post_num_str + '/' + sub_code_check + '">(' + get_lang(conn, 'tool') + ')</a> '
             date += temp_dict['comment_date']
 
             comment_data += '<span style="padding-left: 20px;"></span>' * margin_count
             comment_data += api_topic_thread_make(
-                ip_pas(temp_dict['comment_user_id']),
+                ip_pas(conn, temp_dict['comment_user_id']),
                 date,
-                render_set(doc_data = temp_dict['comment']),
+                render_set(conn, doc_data = temp_dict['comment']),
                 sub_code_check,
                 color = color,
                 add_style = 'width: calc(100% - ' + str(margin_count * 20) + 'px);'
@@ -48,7 +48,7 @@ def bbs_w_post_comment(user_id, sub_code, comment_num, bbs_num_str, post_num_str
 
             comment_select += '<option value="' + sub_code_check + '" ' + comment_default + '>' + sub_code_check + '</option>'
 
-        temp_data = bbs_w_post_comment(user_id, sub_code + '-' + temp_dict['code'], comment_num, bbs_num_str, post_num_str)
+        temp_data = bbs_w_post_comment(conn, user_id, sub_code + '-' + temp_dict['code'], comment_num, bbs_num_str, post_num_str)
 
         comment_data += temp_data[0]
         comment_select += temp_data[1]
@@ -63,32 +63,32 @@ def bbs_w_post(bbs_num = '', post_num = ''):
         curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_name"'), [bbs_num])
         db_data_3 = curs.fetchall()
         if not db_data_3:
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
         
         bbs_name = db_data_3[0][0]
 
         bbs_num_str = str(bbs_num)
         post_num_str = str(post_num)
-        bbs_comment_acl = acl_check(bbs_num_str, 'bbs_comment')
+        bbs_comment_acl = acl_check(conn, bbs_num_str, 'bbs_comment')
         ip = ip_check()
 
         temp_dict = json.loads(api_bbs_w_post(bbs_num_str + '-' + post_num_str).data)
         if temp_dict == {}:
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
         
         curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_type"'), [bbs_num])
         db_data_2 = curs.fetchall()
         if not db_data_2:
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
         elif db_data_2[0][0] == 'thread':
             if flask.request.method == 'POST':
                 if bbs_comment_acl == 1:
-                    return redirect('/bbs/set/' + bbs_num_str)
+                    return redirect(conn, '/bbs/set/' + bbs_num_str)
                 
-                if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                    return re_error('/error/13')
+                if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                    return re_error(conn, '/error/13')
                 else:
-                    captcha_post('', 0)
+                    captcha_post(conn, '', 0)
 
                 set_id = bbs_num_str + '-' + post_num_str
 
@@ -99,7 +99,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                 data = flask.request.form.get('content', '')
                 if data == '':
                     # re_error로 대체 예정
-                    return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
+                    return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str)
                 
                 data = data.replace('\r', '')
                 data = api_topic_thread_pre_render(curs, data, id_data, ip, set_id, bbs_name, temp_dict['title'], 'post')
@@ -110,14 +110,14 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                 curs.execute(db_change("insert into bbs_data (set_name, set_code, set_id, set_data) values ('comment_date', ?, ?, ?)"), [id_data, set_id, date])
                 curs.execute(db_change("insert into bbs_data (set_name, set_code, set_id, set_data) values ('comment_user_id', ?, ?, ?)"), [id_data, set_id, ip])
 
-                add_alarm(temp_dict['user_id'], ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + id_data + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + id_data + '</a>')
+                add_alarm(conn, temp_dict['user_id'], ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + id_data + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + id_data + '</a>')
 
                 conn.commit()
 
-                return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + id_data)
+                return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + id_data)
             else:
-                if acl_check(bbs_num_str, 'bbs_view') == 1:
-                    return re_error('/ban')
+                if acl_check(conn, bbs_num_str, 'bbs_view') == 1:
+                    return re_error(conn, '/ban')
 
                 text = ''
 
@@ -127,9 +127,9 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                 data = ''
                 data += '<h2>' + html.escape(temp_dict['title']) + '</h2>'
                 data += api_topic_thread_make(
-                    ip_pas(temp_dict['user_id']),
+                    ip_pas(conn, temp_dict['user_id']),
                     date,
-                    render_set(doc_data = temp_dict['data'], data_type = 'thread'),
+                    render_set(conn, doc_data = temp_dict['data'], data_type = 'thread'),
                     '0',
                     color = 'green'
                 )
@@ -146,13 +146,13 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                         color = 'default'
                         
                     date = ''
-                    date += '<a href="/bbs/tool/' + bbs_num_str + '/' + post_num_str + '/' + str(count) + '">(' + load_lang('tool') + ')</a> '
+                    date += '<a href="/bbs/tool/' + bbs_num_str + '/' + post_num_str + '/' + str(count) + '">(' + get_lang(conn, 'tool') + ')</a> '
                     date += temp_dict['comment_date']
 
                     data += api_topic_thread_make(
-                        ip_pas(temp_dict['comment_user_id']),
+                        ip_pas(conn, temp_dict['comment_user_id']),
                         date,
-                        render_set(doc_data = temp_dict['comment'], data_type = 'thread'),
+                        render_set(conn, doc_data = temp_dict['comment'], data_type = 'thread'),
                         str(count),
                         color = color
                     )
@@ -163,21 +163,21 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                     </form>
                 '''
 
-                return easy_minify(flask.render_template(skin_check(),
-                    imp = [bbs_name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('bbs') + ')', 0])],
+                return easy_minify(conn, flask.render_template(skin_check(conn),
+                    imp = [bbs_name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'bbs') + ')', 0])],
                     data = data,
-                    menu = [['bbs/w/' + bbs_num_str, load_lang('return')], ['bbs/edit/' + bbs_num_str + '/' + post_num_str, load_lang('edit')], ['bbs/tool/' + bbs_num_str + '/' + post_num_str, load_lang('tool')]]
+                    menu = [['bbs/w/' + bbs_num_str, get_lang(conn, 'return')], ['bbs/edit/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'edit')], ['bbs/tool/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'tool')]]
                 ))
         else:
             # db_data_2[0][0] == 'comment'
             if flask.request.method == 'POST':
                 if bbs_comment_acl == 1:
-                    return redirect('/bbs/set/' + bbs_num_str)
+                    return redirect(conn, '/bbs/set/' + bbs_num_str)
                 
-                if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                    return re_error('/error/13')
+                if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                    return re_error(conn, '/error/13')
                 else:
-                    captcha_post('', 0)
+                    captcha_post(conn, '', 0)
                 
                 select = flask.request.form.get('comment_select', '0')
                 select = '' if select == '0' else select
@@ -191,7 +191,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                         db_data_6 = curs.fetchall()
                         if not db_data_6:
                             # re_error로 변경 예정
-                            return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
+                            return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str)
                         else:
                             set_id = bbs_num_str + '-' + post_num_str + '-' + select_split[0]
                             comment_user_name = db_data_6[0][0]
@@ -199,7 +199,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                         curs.execute(db_change('select set_data from bbs_data where set_name = "comment_user_id" and set_id = ? and set_code = ? limit 1'), [bbs_num_str + '-' + post_num_str + '-' + '-'.join(select_split[0:len(select_split) - 1]), select_split[len(select_split) - 1]])
                         db_data_7 = curs.fetchall()
                         if not db_data_7:
-                            return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
+                            return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str)
                         else:
                             set_id = bbs_num_str + '-' + post_num_str + '-' + '-'.join(select_split)
                             comment_user_name = db_data_7[0][0]
@@ -213,7 +213,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                 data = flask.request.form.get('content', '')
                 if data == '':
                     # re_error로 대체 예정
-                    return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
+                    return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str)
 
                 date = get_time()
 
@@ -230,28 +230,28 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                     set_id += '-' if set_id != '' else ''
                     end_id = set_id + id_data
 
-                add_alarm(temp_dict['user_id'], ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + end_id + '</a>')
+                add_alarm(conn, temp_dict['user_id'], ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + end_id + '</a>')
                 if comment_user_name != '':
-                    add_alarm(comment_user_name, ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + end_id + '</a>')
+                    add_alarm(conn, comment_user_name, ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + end_id + '</a>')
 
-                return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id)
+                return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id)
             else:
-                if acl_check(bbs_num_str, 'bbs_view') == 1:
-                    return re_error('/ban')
+                if acl_check(conn, bbs_num_str, 'bbs_view') == 1:
+                    return re_error(conn, '/ban')
                     
                 text = ''
                 comment_num = ''
 
                 date = ''
-                date += '<a href="javascript:opennamu_change_comment(\'0\');">(' + load_lang('comment') + ')</a> '
+                date += '<a href="javascript:opennamu_change_comment(\'0\');">(' + get_lang(conn, 'comment') + ')</a> '
                 date += temp_dict['date']
 
                 data = ''
                 data += '<h2>' + html.escape(temp_dict['title']) + '</h2>'
                 data += api_topic_thread_make(
-                    ip_pas(temp_dict['user_id']),
+                    ip_pas(conn, temp_dict['user_id']),
                     date,
-                    render_set(doc_data = temp_dict['data']),
+                    render_set(conn, doc_data = temp_dict['data']),
                     '0',
                     color = 'red'
                 )
@@ -260,12 +260,12 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                 comment_data = ''
 
                 comment_select = '<select id="opennamu_comment_select" name="comment_select">'
-                comment_select += '<option value="0">' + load_lang('normal') + '</option>'
+                comment_select += '<option value="0">' + get_lang(conn, 'normal') + '</option>'
 
                 comment_count = 0
                 comment_add_count = 0
 
-                temp_data = bbs_w_post_comment(user_id, bbs_num_str + '-' + post_num_str, comment_num, bbs_num_str, post_num_str)
+                temp_data = bbs_w_post_comment(conn, user_id, bbs_num_str + '-' + post_num_str, comment_num, bbs_num_str, post_num_str)
 
                 comment_data += temp_data[0]
                 comment_select += temp_data[1]
@@ -278,8 +278,8 @@ def bbs_w_post(bbs_num = '', post_num = ''):
 
                 comment_select += '</select>'
                 if comment_data != '':
-                    data += load_lang('comment') + ' : ' + str(comment_count) + '<hr class="main_hr">'
-                    data += load_lang('reply') + ' : ' + str(comment_add_count) + '<hr class="main_hr">'
+                    data += get_lang(conn, 'comment') + ' : ' + str(comment_count) + '<hr class="main_hr">'
+                    data += get_lang(conn, 'reply') + ' : ' + str(comment_add_count) + '<hr class="main_hr">'
                     data += comment_data
                 else:
                     data += '<hr class="main_hr">'
@@ -287,7 +287,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                 bbs_comment_form = ''
                 if bbs_comment_acl == 0:
                     bbs_comment_form += '''
-                        ''' + comment_select + ''' <a href="javascript:opennamu_return_comment();">(''' + load_lang('return') + ''')</a>
+                        ''' + comment_select + ''' <a href="javascript:opennamu_return_comment();">(''' + get_lang(conn, 'return') + ''')</a>
                         <hr class="main_hr">
                         
                         ''' + edit_editor(curs, ip, text, 'bbs_comment') + '''
@@ -300,8 +300,8 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                     <script src="/views/main_css/js/route/bbs_w_post.js''' + cache_v() + '''"></script>
                 '''
 
-                return easy_minify(flask.render_template(skin_check(),
-                    imp = [bbs_name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('bbs') + ')', 0])],
+                return easy_minify(conn, flask.render_template(skin_check(conn),
+                    imp = [bbs_name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'bbs') + ')', 0])],
                     data = data,
-                    menu = [['bbs/w/' + bbs_num_str, load_lang('return')], ['bbs/edit/' + bbs_num_str + '/' + post_num_str, load_lang('edit')], ['bbs/tool/' + bbs_num_str + '/' + post_num_str, load_lang('tool')]]
+                    menu = [['bbs/w/' + bbs_num_str, get_lang(conn, 'return')], ['bbs/edit/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'edit')], ['bbs/tool/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'tool')]]
                 ))

+ 18 - 18
route/bbs_w_set.py

@@ -7,7 +7,7 @@ def bbs_w_set(bbs_num = ''):
         curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_name"'), [bbs_num])
         db_data = curs.fetchall()
         if not db_data:
-            return redirect('/bbs/main')
+            return redirect(conn, '/bbs/main')
         else:
             bbs_name = db_data[0][0]
         
@@ -16,8 +16,8 @@ def bbs_w_set(bbs_num = ''):
         i_list = ['bbs_acl', 'bbs_edit_acl', 'bbs_comment_acl', 'bbs_view_acl', 'bbs_markup']
 
         if flask.request.method == 'POST':
-            if admin_check(None, 'bbs_set (acl)') != 1:
-                return re_error('/ban')
+            if admin_check(conn, None, 'bbs_set (acl)') != 1:
+                return re_error(conn, '/ban')
             else:
                 for for_a in range(len(i_list)):
                     curs.execute(db_change("update bbs_set set set_data = ? where set_name = ? and set_id = ?"), [
@@ -28,16 +28,16 @@ def bbs_w_set(bbs_num = ''):
 
                 conn.commit()
 
-                return redirect('/bbs/set/' + bbs_num_str)
+                return redirect(conn, '/bbs/set/' + bbs_num_str)
         else:
             d_list = ['' for _ in range(0, len(i_list))]
 
             other_menu = []
-            if admin_check() != 1:
+            if admin_check(conn) != 1:
                 disable = 'disabled'
             else:
                 disable = ''
-                other_menu += [['bbs/delete/' + bbs_num_str, load_lang('delete')]]
+                other_menu += [['bbs/delete/' + bbs_num_str, get_lang(conn, 'delete')]]
 
             for for_a in range(len(i_list)):
                 curs.execute(db_change('select set_data from bbs_set where set_name = ? and set_id = ?'), [i_list[for_a], bbs_num])
@@ -64,32 +64,32 @@ def bbs_w_set(bbs_num = ''):
 
                     acl_div[for_a] += '<option value="' + data_list + '" ' + check + '>' + (data_list if data_list != '' else 'normal') + '</option>'
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('bbs_set'), wiki_set(), wiki_custom(), wiki_css(['(' + bbs_name + ')', 0])],
-                data = render_simple_set('''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'bbs_set'), wiki_set(conn), wiki_custom(conn), wiki_css(['(' + bbs_name + ')', 0])],
+                data = render_simple_set(conn, '''
                     <form method="post">
                         <hr class="main_hr">
-                        <a href="/acl/TEST#exp">(''' + load_lang('reference') + ''')</a>
+                        <a href="/acl/TEST#exp">(''' + get_lang(conn, 'reference') + ''')</a>
                         
-                        <h2>''' + load_lang('acl') + '''</h2>
-                        <h3>''' + load_lang('bbs_view_acl') + '''</h3>
+                        <h2>''' + get_lang(conn, 'acl') + '''</h2>
+                        <h3>''' + get_lang(conn, 'bbs_view_acl') + '''</h3>
                         <select ''' + disable + ''' name="bbs_view_acl">''' + acl_div[3] + '''</select>
 
-                        <h4>''' + load_lang('bbs_acl') + '''</h4>
+                        <h4>''' + get_lang(conn, 'bbs_acl') + '''</h4>
                         <select ''' + disable + ''' name="bbs_acl">''' + acl_div[0] + '''</select>
 
-                        <h5>''' + load_lang('bbs_edit_acl') + '''</h5>
+                        <h5>''' + get_lang(conn, 'bbs_edit_acl') + '''</h5>
                         <select ''' + disable + ''' name="bbs_edit_acl">''' + acl_div[1] + '''</select>
 
-                        <h5>''' + load_lang('bbs_comment_acl') + '''</h5>
+                        <h5>''' + get_lang(conn, 'bbs_comment_acl') + '''</h5>
                         <select ''' + disable + ''' name="bbs_comment_acl">''' + acl_div[2] + '''</select>
 
-                        <h2>''' + load_lang('markup') + '''</h2>
+                        <h2>''' + get_lang(conn, 'markup') + '''</h2>
                         <select ''' + disable + ''' name="bbs_markup">''' + acl_div[4] + '''</select>
                         
                         <hr class="main_hr">
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 '''),
-                menu = [['bbs/w/' + bbs_num_str, load_lang('return')]] + other_menu
+                menu = [['bbs/w/' + bbs_num_str, get_lang(conn, 'return')]] + other_menu
             ))

+ 11 - 11
route/bbs_w_tool.py

@@ -10,33 +10,33 @@ def bbs_w_tool(bbs_num = '', post_num = ''):
         post_num_str = str(post_num)
         
         data += '''
-            <h2>''' + load_lang('tool') + '''</h2>
+            <h2>''' + get_lang(conn, 'tool') + '''</h2>
             <ul class="opennamu_ul">
-                <li><a href="/bbs/raw/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '">' + load_lang('raw') + '''</a></li>
+                <li><a href="/bbs/raw/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '">' + get_lang(conn, 'raw') + '''</a></li>
             </ul>
         '''
 
-        if admin_check() == 1:
+        if admin_check(conn) == 1:
             curs.execute(db_change('select set_data from bbs_data where set_code = ? and set_id = ? and set_name = "pinned"'), [post_num_str, bbs_num_str])
-            pinned = load_lang('pinned') if not curs.fetchall() else load_lang('pinned_release')
+            pinned = get_lang(conn, 'pinned') if not curs.fetchall() else get_lang(conn, 'pinned_release')
 
             data += '''
-                <h3>''' + load_lang('admin') + '''</h3>
+                <h3>''' + get_lang(conn, 'admin') + '''</h3>
                 <ul class="opennamu_ul">
-                    <!-- <li><a href="/bbs/blind/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '">' + load_lang('hide') + '''</a></li> -->
+                    <!-- <li><a href="/bbs/blind/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '">' + get_lang(conn, 'hide') + '''</a></li> -->
                     <li><a href="/bbs/pinned/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '">' + pinned + '''</a></li>
                 </ul>
             '''
 
             data += '''
-                <h3>''' + load_lang('owner') + '''</h2>
+                <h3>''' + get_lang(conn, 'owner') + '''</h2>
                 <ul class="opennamu_ul">
-                    <li><a href="/bbs/delete/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '">' + load_lang('delete') + '''</a></li>
+                    <li><a href="/bbs/delete/''' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str) + '">' + get_lang(conn, 'delete') + '''</a></li>
                 </ul>
             '''
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('bbs_post_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'bbs_post_tool'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = data,
-            menu = [['bbs/w/' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str), load_lang('return')]]
+            menu = [['bbs/w/' + url_pas(bbs_num_str) + '/' + url_pas(post_num_str), get_lang(conn, 'return')]]
         ))

+ 43 - 43
route/edit.py

@@ -3,8 +3,8 @@ import multiprocessing
 from .tool.func import *
 
 
-def edit_render_set(name, content):
-    render_set(
+def edit_render_set(conn, name, content):
+    render_set(conn, 
         doc_name = name,
         doc_data = content
     )
@@ -51,10 +51,10 @@ def edit_editor(curs, ip, data_main = '', do_type = 'edit', addon = '', name = '
     elif do_type == 'bbs':
         do_type = 'edit'
             
-    p_text = html.escape(sql_d[0][0]) if sql_d and sql_d[0][0] != '' else load_lang('default_edit_help')
+    p_text = html.escape(sql_d[0][0]) if sql_d and sql_d[0][0] != '' else get_lang(conn, 'default_edit_help')
     
-    monaco_editor_top += '<a href="javascript:opennamu_do_editor_temp_save();">(' + load_lang('load_temp_save') + ')</a> <a href="javascript:opennamu_do_editor_temp_save_load();">(' + load_lang('load_temp_save_load') + ')</a> '
-    monaco_editor_top += '<a href="javascript:opennamu_edit_turn_off_monaco();">(' + load_lang('turn_off_monaco') + ')</a>'
+    monaco_editor_top += '<a href="javascript:opennamu_do_editor_temp_save();">(' + get_lang(conn, 'load_temp_save') + ')</a> <a href="javascript:opennamu_do_editor_temp_save_load();">(' + get_lang(conn, 'load_temp_save_load') + ')</a> '
+    monaco_editor_top += '<a href="javascript:opennamu_edit_turn_off_monaco();">(' + get_lang(conn, 'turn_off_monaco') + ')</a>'
     
     darkmode = flask.request.cookies.get('main_css_darkmode', '0')
     monaco_thema = 'vs-dark' if darkmode == '1' else ''
@@ -74,7 +74,7 @@ def edit_editor(curs, ip, data_main = '', do_type = 'edit', addon = '', name = '
         <div>
             ''' + monaco_editor_top + '''
             <hr class="main_hr">
-            ''' + edit_button() + '''
+            ''' + edit_button(conn) + '''
         </div>
         
         ''' + div + '''
@@ -83,7 +83,7 @@ def edit_editor(curs, ip, data_main = '', do_type = 'edit', addon = '', name = '
         <textarea id="opennamu_edit_textarea" ''' + editor_display + ''' class="''' + textarea_size + '''" name="content" placeholder="''' + p_text + '''">''' + html.escape(data_main) + '''</textarea>
         <hr class="main_hr">
         
-        ''' + captcha_get() + ip_warning() + addon + '''
+        ''' + captcha_get(conn) + ip_warning(conn) + addon + '''
         <hr class="main_hr">
 
         <script>
@@ -92,8 +92,8 @@ def edit_editor(curs, ip, data_main = '', do_type = 'edit', addon = '', name = '
             ''' + add_script + '''
         </script>
                         
-        <button id="opennamu_save_button" type="submit" onclick="do_stop_exit_release();">''' + load_lang('send') + '''</button>
-        <button id="opennamu_preview_button" type="button" onclick="opennamu_do_editor_preview();">''' + load_lang('preview') + '''</button>
+        <button id="opennamu_save_button" type="submit" onclick="do_stop_exit_release();">''' + get_lang(conn, 'send') + '''</button>
+        <button id="opennamu_preview_button" type="button" onclick="opennamu_do_editor_preview();">''' + get_lang(conn, 'preview') + '''</button>
         <hr class="main_hr">
 
         <div id="opennamu_preview_area"></div>
@@ -106,11 +106,11 @@ def edit(name = 'Test', section = 0, do_type = ''):
         ip = ip_check()
 
         edit_req_mode = 0
-        if acl_check(name, 'document_edit') == 1:
+        if acl_check(conn, name, 'document_edit') == 1:
             edit_req_mode = 1
             
-        if do_title_length_check(name) == 1:
-            return re_error('/error/38')
+        if do_title_length_check(conn, name) == 1:
+            return re_error(conn, '/error/38')
         
         curs.execute(db_change("select id from history where title = ? order by id + 0 desc"), [name])
         doc_ver = curs.fetchall()
@@ -118,7 +118,7 @@ def edit(name = 'Test', section = 0, do_type = ''):
 
         curs.execute(db_change("select set_data from data_set where doc_name = ? and doc_rev = ? and set_name = 'edit_request_data'"), [name, doc_ver])
         if curs.fetchall():
-            return redirect('/edit_request_from/' + url_pas(name))
+            return redirect(conn, '/edit_request_from/' + url_pas(name))
         
         section = '' if section == 0 else section
         post_ver = flask.request.form.get('ver', '')
@@ -128,27 +128,27 @@ def edit(name = 'Test', section = 0, do_type = ''):
             edit_repeat = 'get'
         
         if edit_repeat == 'post':
-            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                return re_error('/error/13')
+            if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error(conn, '/error/13')
             else:
-                captcha_post('', 0)
+                captcha_post(conn, '', 0)
     
-            if do_edit_slow_check() == 1:
-                return re_error('/error/24')
+            if do_edit_slow_check(conn) == 1:
+                return re_error(conn, '/error/24')
     
             today = get_time()
             content = flask.request.form.get('content', '').replace('\r', '')
             send = flask.request.form.get('send', '')
             agree = flask.request.form.get('copyright_agreement', '')
             
-            if do_edit_filter(content) == 1:
-                return re_error('/error/21')
+            if do_edit_filter(conn, content) == 1:
+                return re_error(conn, '/error/21')
 
-            if do_edit_send_check(send) == 1:
-                return re_error('/error/37')
+            if do_edit_send_check(conn, send) == 1:
+                return re_error(conn, '/error/37')
 
-            if do_edit_text_bottom_check_box_check(agree) == 1:
-                return re_error('/error/29')
+            if do_edit_text_bottom_check_box_check(conn, agree) == 1:
+                return re_error(conn, '/error/29')
             
             curs.execute(db_change("select data from data where title = ?"), [name])
             db_data = curs.fetchall()
@@ -182,7 +182,7 @@ def edit(name = 'Test', section = 0, do_type = ''):
             db_data_3 = curs.fetchall()
             if db_data_3 and db_data_3[0][0] != '':
                 if int(number_check(db_data_3[0][0])) < len(content):
-                    return re_error('/error/44')
+                    return re_error(conn, '/error/44')
 
             curs.execute(db_change("select data from other where name = 'edit_timeout'"))
             db_data_2 = curs.fetchall()
@@ -193,7 +193,7 @@ def edit(name = 'Test', section = 0, do_type = ''):
                 timeout = 0
 
             if timeout == 1:
-                return re_error('/error/41')
+                return re_error(conn, '/error/41')
             
             if edit_req_mode == 0:
                 # 진짜 기록 부분
@@ -202,9 +202,9 @@ def edit(name = 'Test', section = 0, do_type = ''):
         
                 curs.execute(db_change("select id from user_set where name = 'watchlist' and data = ?"), [name])
                 for scan_user in curs.fetchall():
-                    add_alarm(scan_user[0], ip, '<a href="/w/' + url_pas(name) + '">' + html.escape(name) + '</a>')
+                    add_alarm(conn, scan_user[0], ip, '<a href="/w/' + url_pas(name) + '">' + html.escape(name) + '</a>')
                         
-                history_plus(
+                history_plus(conn, 
                     name,
                     content,
                     today,
@@ -213,7 +213,7 @@ def edit(name = 'Test', section = 0, do_type = ''):
                     leng
                 )
                 
-                render_set(
+                render_set(conn, 
                     doc_name = name,
                     doc_data = content,
                     data_type = 'backlink'
@@ -228,13 +228,13 @@ def edit(name = 'Test', section = 0, do_type = ''):
 
                 curs.execute(db_change("select id from user_set where name = 'watchlist' and data = ?"), [name])
                 for scan_user in curs.fetchall():
-                    add_alarm(scan_user[0], ip, '<a href="/edit_request/' + url_pas(name) + '">' + html.escape(name) + '</a> edit_request')
+                    add_alarm(conn, scan_user[0], ip, '<a href="/edit_request/' + url_pas(name) + '">' + html.escape(name) + '</a> edit_request')
             
             conn.commit()
             
             section = (('#edit_load_' + str(section)) if section != '' else '')
             
-            return redirect('/w/' + url_pas(name) + section)
+            return redirect(conn, '/w/' + url_pas(name) + section)
         else:
             editor_top_text = ''
 
@@ -253,7 +253,7 @@ def edit(name = 'Test', section = 0, do_type = ''):
                 
                 if load_title == 0 and section == '':
                     load_title = name
-                    editor_top_text += '<a href="/manager/15/' + url_pas(name) + '">(' + load_lang('load') + ')</a> '
+                    editor_top_text += '<a href="/manager/15/' + url_pas(name) + '">(' + get_lang(conn, 'load') + ')</a> '
                 elif section != '':
                     load_title = name
                     
@@ -310,7 +310,7 @@ def edit(name = 'Test', section = 0, do_type = ''):
 
                 doc_ver = flask.request.form.get('ver', '')
 
-                warning_edit = load_lang('exp_edit_conflict') + ' '
+                warning_edit = get_lang(conn, 'exp_edit_conflict') + ' '
     
                 if flask.request.form.get('ver', '0') == '0':
                     warning_edit += '<a href="/raw/' + url_pas(name) + '">(r' + doc_ver + ')</a>'
@@ -327,16 +327,16 @@ def edit(name = 'Test', section = 0, do_type = ''):
             if data_section == '':
                 data_section = data
     
-            editor_top_text += '<a href="/filter/edit_filter">(' + load_lang('edit_filter_rule') + ')</a>'
+            editor_top_text += '<a href="/filter/edit_filter">(' + get_lang(conn, 'edit_filter_rule') + ')</a>'
     
             if editor_top_text != '':
                 editor_top_text += '<hr class="main_hr">'
 
             sub_menu = ' (' + str(section) + ')' if section != '' else ''
-            sub_title = '(' + load_lang('edit_request') + ')' if edit_req_mode == 1 else '(' + load_lang('edit') + ')'
+            sub_title = '(' + get_lang(conn, 'edit_request') + ')' if edit_req_mode == 1 else '(' + get_lang(conn, 'edit') + ')'
 
-            return easy_minify(flask.render_template(skin_check(), 
-                imp = [name, wiki_set(), wiki_custom(), wiki_css([sub_title + sub_menu, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn), 
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css([sub_title + sub_menu, 0])],
                 data = editor_top_text + '''
                     <form method="post">
                         <textarea style="display: none;" name="doc_section_data_where">''' + data_section_where + '''</textarea>
@@ -345,16 +345,16 @@ def edit(name = 'Test', section = 0, do_type = ''):
                         <input style="display: none;" id="opennamu_editor_doc_name" value="''' + html.escape(name) + '''">
                         <input style="display: none;" name="ver" value="''' + doc_ver + '''">
                         
-                        <input placeholder="''' + load_lang('why') + '''" name="send">
+                        <input placeholder="''' + get_lang(conn, 'why') + '''" name="send">
                         <hr class="main_hr">
                         
-                        ''' + edit_editor(curs, ip, data_section, addon = get_edit_text_bottom_check_box() + get_edit_text_bottom(), name = name) + '''
+                        ''' + edit_editor(curs, ip, data_section, addon = get_edit_text_bottom_check_box(conn) + get_edit_text_bottom(conn) , name = name) + '''
                     </form>
                 ''',
                 menu = [
-                    ['w/' + url_pas(name), load_lang('return')],
-                    ['delete/' + url_pas(name), load_lang('delete')], 
-                    ['move/' + url_pas(name), load_lang('move')], 
-                    ['upload', load_lang('upload')]
+                    ['w/' + url_pas(name), get_lang(conn, 'return')],
+                    ['delete/' + url_pas(name), get_lang(conn, 'delete')], 
+                    ['move/' + url_pas(name), get_lang(conn, 'move')], 
+                    ['upload', get_lang(conn, 'upload')]
                 ]
             ))

+ 2 - 2
route/edit_backlink_reset.py

@@ -7,10 +7,10 @@ def edit_backlink_reset(name = 'Test'):
         curs.execute(db_change("select data from data where title = ?"), [name])
         old = curs.fetchall()
         if old:
-            render_set(
+            render_set(conn, 
                 doc_name = name,
                 doc_data = old[0][0],
                 data_type = 'backlink'
             )
 
-        return redirect('/xref/' + url_pas(name))
+        return redirect(conn, '/xref/' + url_pas(name))

+ 20 - 20
route/edit_delete.py

@@ -5,30 +5,30 @@ def edit_delete(name):
         curs = conn.cursor()
 
         ip = ip_check()
-        if acl_check(name, 'document_delete') == 1:
-            return re_error('/ban')
+        if acl_check(conn, name, 'document_delete') == 1:
+            return re_error(conn, '/ban')
 
         curs.execute(db_change("select title from data where title = ?"), [name])
         if not curs.fetchall():
-            return redirect('/w/' + url_pas(name))
+            return redirect(conn, '/w/' + url_pas(name))
 
         if flask.request.method == 'POST':
-            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                return re_error('/error/13')
+            if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error(conn, '/error/13')
             else:
-                captcha_post('', 0)
+                captcha_post(conn, '', 0)
 
-            if do_edit_slow_check() == 1:
-                return re_error('/error/24')
+            if do_edit_slow_check(conn) == 1:
+                return re_error(conn, '/error/24')
             
             send = flask.request.form.get('send', '')
             agree = flask.request.form.get('copyright_agreement', '')
             
-            if do_edit_send_check(send) == 1:
-                return re_error('/error/37')
+            if do_edit_send_check(conn, send) == 1:
+                return re_error(conn, '/error/37')
             
-            if do_edit_text_bottom_check_box_check(agree) == 1:
-                return re_error('/error/29')
+            if do_edit_text_bottom_check_box_check(conn, agree) == 1:
+                return re_error(conn, '/error/29')
 
             curs.execute(db_change("select data from data where title = ?"), [name])
             data = curs.fetchall()
@@ -36,7 +36,7 @@ def edit_delete(name):
                 today = get_time()
                 leng = '-' + str(len(data[0][0]))
 
-                history_plus(
+                history_plus(conn, 
                     name,
                     '',
                     today,
@@ -55,17 +55,17 @@ def edit_delete(name):
 
                 conn.commit()
 
-            return redirect('/w/' + url_pas(name))
+            return redirect(conn, '/w/' + url_pas(name))
         else:            
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('delete') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'delete') + ')', 0])],
                 data = '''
                     <form method="post">
-                        <input placeholder="''' + load_lang('why') + '''" name="send">
+                        <input placeholder="''' + get_lang(conn, 'why') + '''" name="send">
                         <hr class="main_hr">
-                        ''' + captcha_get() + ip_warning() + get_edit_text_bottom_check_box() + get_edit_text_bottom() + '''
-                        <button type="submit">''' + load_lang('delete') + '''</button>
+                        ''' + captcha_get(conn) + ip_warning(conn) + get_edit_text_bottom_check_box(conn) + get_edit_text_bottom(conn)  + '''
+                        <button type="submit">''' + get_lang(conn, 'delete') + '''</button>
                     </form>
                 ''',
-                menu = [['w/' + url_pas(name), load_lang('return')]]
+                menu = [['w/' + url_pas(name), get_lang(conn, 'return')]]
             ))

+ 11 - 11
route/edit_delete_file.py

@@ -7,8 +7,8 @@ def edit_delete_file(name = 'test.jpg'):
         curs = conn.cursor()
 
         ip = ip_check()
-        if admin_check() == 0:
-            return re_error('/ban')
+        if admin_check(conn) == 0:
+            return re_error(conn, '/ban')
 
         mime_type = re.search(r'([^.]+)$', name)
         mime_type_str = 'jpg'
@@ -19,32 +19,32 @@ def edit_delete_file(name = 'test.jpg'):
         file_name = re.sub(r'^file:', '', file_name)
 
         file_all_name = sha224_replace(file_name) + '.' + mime_type_str
-        file_directory = os.path.join(load_image_url(), file_all_name)
+        file_directory = os.path.join(load_image_url(conn), file_all_name)
 
         if not os.path.exists(file_directory):
-            return redirect('/w/' + url_pas(name))
+            return redirect(conn, '/w/' + url_pas(name))
 
         if flask.request.method == 'POST':
-            admin_check(None, 'file del (' + name + ')')
+            admin_check(conn, None, 'file del (' + name + ')')
             os.remove(file_directory)
 
             if flask.request.form.get('with_doc', '') != '':
                 edit_delete(name)
 
-            return redirect('/w/' + url_pas(name))
+            return redirect(conn, '/w/' + url_pas(name))
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('file_delete') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'file_delete') + ')', 0])],
                 data = '''
                     <form method="post">
                         <img src="/image/''' + url_pas(file_all_name) + '''">
                         <hr class="main_hr">
                         <a href="/image/''' + url_pas(file_all_name) + '''">/image/''' + url_pas(file_all_name) + '''</a>
                         <hr class="main_hr">
-                        <input name="with_doc" type="checkbox" checked> ''' + load_lang('file_delete_with_document') + '''
+                        <input name="with_doc" type="checkbox" checked> ''' + get_lang(conn, 'file_delete_with_document') + '''
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('file_delete') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'file_delete') + '''</button>
                     </form>
                 ''',
-                menu = [['w/' + url_pas(name), load_lang('return')]]
+                menu = [['w/' + url_pas(name), get_lang(conn, 'return')]]
             ))

+ 14 - 14
route/edit_delete_multiple.py

@@ -7,36 +7,36 @@ def edit_delete_multiple():
         curs = conn.cursor()
 
         ip = ip_check()
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
 
         if flask.request.method == 'POST':
             send = flask.request.form.get('send', '')
             agree = flask.request.form.get('copyright_agreement', '')
             
-            if do_edit_send_check(send) == 1:
-                return re_error('/error/37')
+            if do_edit_send_check(conn, send) == 1:
+                return re_error(conn, '/error/37')
             
-            if do_edit_text_bottom_check_box_check(agree) == 1:
-                return re_error('/error/29')
+            if do_edit_text_bottom_check_box_check(conn, agree) == 1:
+                return re_error(conn, '/error/29')
             
             all_title = re.findall(r'([^\n]+)\n', flask.request.form.get('content', '').replace('\r', '') + '\n')
             for name in all_title:
                 edit_delete(name)
 
-            return redirect('/recent_change')
+            return redirect(conn, '/recent_change')
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('many_delete'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'many_delete'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
-                        <textarea class="opennamu_textarea_500" placeholder="''' + load_lang('many_delete_help') + '''" name="content"></textarea>
+                        <textarea class="opennamu_textarea_500" placeholder="''' + get_lang(conn, 'many_delete_help') + '''" name="content"></textarea>
                         <hr class="main_hr">
-                        <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
+                        <input placeholder="''' + get_lang(conn, 'why') + '''" name="send" type="text">
                         <hr class="main_hr">
-                        ''' + captcha_get() + ip_warning() + get_edit_text_bottom_check_box() + get_edit_text_bottom() + '''
-                        <button type="submit">''' + load_lang('delete') + '''</button>
+                        ''' + captcha_get(conn) + ip_warning(conn) + get_edit_text_bottom_check_box(conn) + get_edit_text_bottom(conn)  + '''
+                        <button type="submit">''' + get_lang(conn, 'delete') + '''</button>
                     </form>
                 ''',
-                menu = [['manager/1', load_lang('return')]]
+                menu = [['manager/1', get_lang(conn, 'return')]]
             ))

+ 45 - 45
route/edit_move.py

@@ -4,24 +4,24 @@ def edit_move(name):
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if acl_check(name, 'document_move') == 1:
-            return re_error('/ban')
+        if acl_check(conn, name, 'document_move') == 1:
+            return re_error(conn, '/ban')
         
-        if do_title_length_check(name) == 1:
-            return re_error('/error/38')
+        if do_title_length_check(conn, name) == 1:
+            return re_error(conn, '/error/38')
 
         if flask.request.method == 'POST':
             move_title = flask.request.form.get('title', 'test')
-            if acl_check(move_title) == 1:
-                return re_error('/ban')
+            if acl_check(conn, move_title) == 1:
+                return re_error(conn, '/ban')
 
-            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                return re_error('/error/13')
+            if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error(conn, '/error/13')
             else:
-                captcha_post('', 0)
+                captcha_post(conn, '', 0)
 
-            if do_edit_slow_check() == 1:
-                return re_error('/error/24')
+            if do_edit_slow_check(conn) == 1:
+                return re_error(conn, '/error/24')
             
             send = flask.request.form.get('send', '')
             agree = flask.request.form.get('copyright_agreement', '')
@@ -35,18 +35,18 @@ def edit_move(name):
             move_option_topic = flask.request.form.get('move_topic_option', 'none')
             document_set_option = flask.request.form.get('document_set_option', 'none')
             
-            if do_edit_send_check(send) == 1:
-                return re_error('/error/37')
+            if do_edit_send_check(conn, send) == 1:
+                return re_error(conn, '/error/37')
             
-            if do_edit_text_bottom_check_box_check(agree) == 1:
-                return re_error('/error/29')
+            if do_edit_text_bottom_check_box_check(conn, agree) == 1:
+                return re_error(conn, '/error/29')
 
             # 역링크 관련 패치 해야할 듯
 
             # 문서 이동 파트 S
             curs.execute(db_change("select title from history where title = ?"), [move_title])
             if curs.fetchall():
-                if move_option == 'merge' and admin_check(None, 'merge documents (' + name + ') (' + move_title + ')') == 1:
+                if move_option == 'merge' and admin_check(conn, None, 'merge documents (' + name + ') (' + move_title + ')') == 1:
                     curs.execute(db_change("select data from data where title = ?"), [move_title])
                     data = curs.fetchall()
                     if data:
@@ -77,7 +77,7 @@ def edit_move(name):
                         curs.execute(db_change("update rc set title = ?, id = ? where title = ? and id = ?"), [move_title, str(int(num) + int(move[0])), name, move[0]])
                         curs.execute(db_change("update history set title = ?, id = ? where title = ? and id = ?"), [move_title, str(int(num) + int(move[0])), name, move[0]])
 
-                    history_plus(
+                    history_plus(conn, 
                         move_title, 
                         data_in, 
                         time, 
@@ -113,7 +113,7 @@ def edit_move(name):
                         data = curs.fetchall()
                         data_in = data[0][0] if data else ''
 
-                        history_plus(
+                        history_plus(conn, 
                             title_name[0], 
                             data_in, 
                             time, 
@@ -146,7 +146,7 @@ def edit_move(name):
                 curs.execute(db_change("update rc set title = ? where title = ?"), [move_title, name])
                 # 역사와 최근 변경 이동 E
 
-                history_plus(
+                history_plus(conn, 
                     move_title, 
                     data_in, 
                     time, 
@@ -162,7 +162,7 @@ def edit_move(name):
             # 토론 이동 파트 S
             curs.execute(db_change("select title from rd where title = ?"), [move_title])
             if curs.fetchall():
-                if move_option_topic == 'merge' and admin_check(None, 'merge document\'s topics (' + name + ') (' + move_title + ')') == 1:
+                if move_option_topic == 'merge' and admin_check(conn, None, 'merge document\'s topics (' + name + ') (' + move_title + ')') == 1:
                     curs.execute(db_change("update rd set title = ? where title = ?"), [move_title, name])
                 elif move_option_topic == 'reverse':
                     i = 0
@@ -210,59 +210,59 @@ def edit_move(name):
             conn.commit()
 
             if has_error == 0:
-                return redirect('/w/' + url_pas(move_title))
+                return redirect(conn, '/w/' + url_pas(move_title))
             else:
-                return re_error('/error/19')
+                return re_error(conn, '/error/19')
         else:
-            owner_auth = admin_check()
+            owner_auth = admin_check(conn)
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('move') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'move') + ')', 0])],
                 data = '''
                     <form method="post">
-                        <span>''' + load_lang('document_name') + '''</span>
+                        <span>''' + get_lang(conn, 'document_name') + '''</span>
                         <hr class="main_hr">
                         <input value="''' + name + '''" name="title" type="text">
                         <hr class="main_hr">
                         
-                        <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
+                        <input placeholder="''' + get_lang(conn, 'why') + '''" name="send" type="text">
                         <hr class="main_hr">
                         
-                        <h2>''' + load_lang('document') + '''</h2>
+                        <h2>''' + get_lang(conn, 'document') + '''</h2>
                         <select name="move_option">
-                            <option value="none"> ''' + load_lang('dont_move') + '''</option>
-                            <option value="normal"> ''' + load_lang('normal') + '''</option>
-                            <option value="reverse"> ''' + load_lang('replace_move') + '''</option>
-                            ''' + ('<option value="merge"> ' + load_lang('merge_move') + '</option>' if owner_auth == 1 else '') + '''
+                            <option value="none"> ''' + get_lang(conn, 'dont_move') + '''</option>
+                            <option value="normal"> ''' + get_lang(conn, 'normal') + '''</option>
+                            <option value="reverse"> ''' + get_lang(conn, 'replace_move') + '''</option>
+                            ''' + ('<option value="merge"> ' + get_lang(conn, 'merge_move') + '</option>' if owner_auth == 1 else '') + '''
                         </select>
                         <hr class="main_hr">
-                        <!-- <input type="checkbox" name="move_redirect_make"> ''' + load_lang('move_redirect_make') + '''
+                        <!-- <input type="checkbox" name="move_redirect_make"> ''' + get_lang(conn, 'move_redirect_make') + '''
                         <hr class="main_hr"> -->
                         
-                        <h2>''' + load_lang('discussion') + '''</h2>
+                        <h2>''' + get_lang(conn, 'discussion') + '''</h2>
                         <select name="move_topic_option">
-                            <option value="none"> ''' + load_lang('dont_move') + '''</option>
-                            <option value="normal"> ''' + load_lang('normal') + '''</option>
-                            <option value="reverse"> ''' + load_lang('replace_move') + '''</option>
-                            ''' + ('<option value="merge"> ' + load_lang('merge_move') + '</option>' if owner_auth == 1 else '') + '''
+                            <option value="none"> ''' + get_lang(conn, 'dont_move') + '''</option>
+                            <option value="normal"> ''' + get_lang(conn, 'normal') + '''</option>
+                            <option value="reverse"> ''' + get_lang(conn, 'replace_move') + '''</option>
+                            ''' + ('<option value="merge"> ' + get_lang(conn, 'merge_move') + '</option>' if owner_auth == 1 else '') + '''
                         </select>
                         <hr class="main_hr">
 
                         ''' + ((
-                            '''<h2>''' + load_lang('document_set') + '''</h2>
+                            '''<h2>''' + get_lang(conn, 'document_set') + '''</h2>
                             <select name="document_set_option">
-                                <option value="none"> ''' + load_lang('dont_move') + '''</option>
-                                <option value="normal"> ''' + load_lang('normal') + '''</option>
-                                <option value="reverse"> ''' + load_lang('replace_move') + '''</option>
+                                <option value="none"> ''' + get_lang(conn, 'dont_move') + '''</option>
+                                <option value="normal"> ''' + get_lang(conn, 'normal') + '''</option>
+                                <option value="reverse"> ''' + get_lang(conn, 'replace_move') + '''</option>
                             </select>
                             <hr class="main_hr">
                             '''
                         ) if owner_auth == 1 else '') + '''
 
-                        ''' + captcha_get() + ip_warning() + get_edit_text_bottom_check_box() + get_edit_text_bottom() + '''
+                        ''' + captcha_get(conn) + ip_warning(conn) + get_edit_text_bottom_check_box(conn) + get_edit_text_bottom(conn)  + '''
                         
-                        <button type="submit">''' + load_lang('move') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'move') + '''</button>
                     </form>
                 ''',
-                menu = [['w/' + url_pas(name), load_lang('return')]]
+                menu = [['w/' + url_pas(name), get_lang(conn, 'return')]]
             ))

+ 15 - 15
route/edit_request.py

@@ -7,7 +7,7 @@ def edit_request(name = 'Test', do_type = ''):
         curs = conn.cursor()
 
         disabled = ""
-        if acl_check(name, 'document_edit') == 1:
+        if acl_check(conn, name, 'document_edit') == 1:
             disabled = "disabled"
 
         curs.execute(db_change("select id from history where title = ? order by id + 0 desc"), [name])
@@ -17,7 +17,7 @@ def edit_request(name = 'Test', do_type = ''):
         curs.execute(db_change("select set_data from data_set where doc_name = ? and doc_rev = ? and set_name = 'edit_request_data'"), [name, doc_ver])
         db_data = curs.fetchall()
         if not db_data:
-            return redirect('/edit/' + url_pas(name))
+            return redirect(conn, '/edit/' + url_pas(name))
         
         edit_request_data = db_data[0][0]
 
@@ -38,8 +38,8 @@ def edit_request(name = 'Test', do_type = ''):
         edit_request_leng = db_data[0][0] if db_data else ''
 
         if flask.request.method == 'POST':
-            if acl_check(name, 'document_edit') == 1:
-                return redirect('/w/' + url_pas(name))
+            if acl_check(conn, name, 'document_edit') == 1:
+                return redirect(conn, '/w/' + url_pas(name))
             
             curs.execute(db_change("select data from data where title = ?"), [name])
             db_data = curs.fetchall()
@@ -47,13 +47,13 @@ def edit_request(name = 'Test', do_type = ''):
             
             curs.execute(db_change("select id from user_set where name = 'watchlist' and data = ?"), [name])
             for scan_user in curs.fetchall():
-                add_alarm(scan_user[0], edit_request_user, '<a href="/w/' + url_pas(name) + '">' + html.escape(name) + '</a>')
+                add_alarm(conn, scan_user[0], edit_request_user, '<a href="/w/' + url_pas(name) + '">' + html.escape(name) + '</a>')
 
             if flask.request.form.get('check', '') == 'Y':
                 curs.execute(db_change("delete from data where title = ?"), [name])
                 curs.execute(db_change("insert into data (title, data) values (?, ?)"), [name, edit_request_data])
                         
-                history_plus(
+                history_plus(conn, 
                     name,
                     edit_request_data,
                     edit_request_date,
@@ -63,13 +63,13 @@ def edit_request(name = 'Test', do_type = ''):
                     mode = 'edit_request'
                 )
                 
-                render_set(
+                render_set(conn, 
                     doc_name = name,
                     doc_data = edit_request_data,
                     data_type = 'backlink'
                 )
             else:
-                history_plus(
+                history_plus(conn, 
                     name,
                     edit_request_data,
                     edit_request_date,
@@ -80,18 +80,18 @@ def edit_request(name = 'Test', do_type = ''):
                 )
                 
             if do_type == 'from':
-                return redirect('/edit/' + url_pas(name))
+                return redirect(conn, '/edit/' + url_pas(name))
             else:
-                return redirect('/w/' + url_pas(name))
+                return redirect(conn, '/w/' + url_pas(name))
         else:
             curs.execute(db_change("select data from data where title = ?"), [name])
             db_data = curs.fetchall()
             old_data = db_data[0][0] if db_data else ''
 
-            result = view_diff_do(old_data, edit_request_data, 'r' + doc_ver, load_lang('edit_request'))
+            result = view_diff_do(old_data, edit_request_data, 'r' + doc_ver, get_lang(conn, 'edit_request'))
 
-            return easy_minify(flask.render_template(skin_check(), 
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('edit_request_check') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn), 
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'edit_request_check') + ')', 0])],
                 data = '''
                     <div id="opennamu_get_user_info">''' + html.escape(edit_request_user) + '''</div>
                     <hr class="main_hr">
@@ -102,8 +102,8 @@ def edit_request(name = 'Test', do_type = ''):
                     ''' + result + '''
                     <hr class="main_hr">
                     <form method="post">
-                        <button ''' + disabled + ''' id="opennamu_save_button" type="submit" name="check" value="Y">''' + load_lang('approve') + '''</button>
-                        <button ''' + disabled + ''' id="opennamu_preview_button" type="submit" name="check" value="">''' + load_lang('decline') + '''</button>
+                        <button ''' + disabled + ''' id="opennamu_save_button" type="submit" name="check" value="Y">''' + get_lang(conn, 'approve') + '''</button>
+                        <button ''' + disabled + ''' id="opennamu_preview_button" type="submit" name="check" value="">''' + get_lang(conn, 'decline') + '''</button>
                         <hr class="main_hr">
                         <textarea readonly class="opennamu_textarea_500">''' + html.escape(edit_request_data) + '''</textarea>
                     </form>

+ 26 - 26
route/edit_revert.py

@@ -5,43 +5,43 @@ def edit_revert(name, num):
         curs = conn.cursor()
 
         curs.execute(db_change("select title from history where title = ? and id = ? and hide = 'O'"), [name, str(num)])
-        if curs.fetchall() and admin_check(6) != 1:
-            return re_error('/error/3')
+        if curs.fetchall() and admin_check(conn, 6) != 1:
+            return re_error(conn, '/error/3')
 
-        if acl_check(name, 'document_edit') == 1:
-            return re_error('/ban')
+        if acl_check(conn, name, 'document_edit') == 1:
+            return re_error(conn, '/ban')
         
         curs.execute(db_change("select data from history where title = ? and id = ?"), [name, str(num)])
         data = curs.fetchall()
         if not data:
-            return redirect('/w/' + url_pas(name))
+            return redirect(conn, '/w/' + url_pas(name))
 
         if flask.request.method == 'POST':
-            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                return re_error('/error/13')
+            if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error(conn, '/error/13')
             else:
-                captcha_post('', 0)
+                captcha_post(conn, '', 0)
 
-            if do_edit_slow_check() == 1:
-                return re_error('/error/24')
+            if do_edit_slow_check(conn) == 1:
+                return re_error(conn, '/error/24')
             
             send = flask.request.form.get('send', '')
             agree = flask.request.form.get('copyright_agreement', '')
             
-            if do_edit_send_check(send) == 1:
-                return re_error('/error/37')
+            if do_edit_send_check(conn, send) == 1:
+                return re_error(conn, '/error/37')
             
-            if do_edit_text_bottom_check_box_check(agree) == 1:
-                return re_error('/error/29')
+            if do_edit_text_bottom_check_box_check(conn, agree) == 1:
+                return re_error(conn, '/error/29')
 
-            if do_edit_filter(data[0][0]) == 1:
-                return re_error('/error/21')
+            if do_edit_filter(conn, data[0][0]) == 1:
+                return re_error(conn, '/error/21')
             
             curs.execute(db_change("select data from other where name = 'document_content_max_length'"))
             db_data = curs.fetchall()
             if db_data and db_data[0][0] != '':
                 if int(number_check(db_data[0][0])) < len(data[0][0]):
-                    return re_error('/error/44')
+                    return re_error(conn, '/error/44')
 
             curs.execute(db_change("select data from data where title = ?"), [name])
             data_old = curs.fetchall()
@@ -52,7 +52,7 @@ def edit_revert(name, num):
                 leng = '+' + str(len(data[0][0]))
                 curs.execute(db_change("insert into data (title, data) values (?, ?)"), [name, data[0][0]])
 
-            history_plus(
+            history_plus(conn, 
                 name,
                 data[0][0],
                 get_time(),
@@ -63,7 +63,7 @@ def edit_revert(name, num):
                 mode = 'revert'
             )
 
-            render_set(
+            render_set(conn, 
                 doc_name = name,
                 doc_data = data[0][0],
                 data_type = 'backlink'
@@ -71,22 +71,22 @@ def edit_revert(name, num):
 
             conn.commit()
 
-            return redirect('/w/' + url_pas(name))
+            return redirect(conn, '/w/' + url_pas(name))
         else:
             if data:
                 preview = '<hr class="main_hr"><pre>' + html.escape(data[0][0]) + '</pre>'
             else:
                 preview = ''
             
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(r' + str(num) + ') (' + load_lang('revert') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(r' + str(num) + ') (' + get_lang(conn, 'revert') + ')', 0])],
                 data = '''
                     <form method="post">
-                        <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
+                        <input placeholder="''' + get_lang(conn, 'why') + '''" name="send" type="text">
                         <hr class="main_hr">
-                        ''' + captcha_get() + ip_warning() + get_edit_text_bottom_check_box() + get_edit_text_bottom() + '''
-                        <button type="submit">''' + load_lang('revert') + '''</button>
+                        ''' + captcha_get(conn) + ip_warning(conn) + get_edit_text_bottom_check_box(conn) + get_edit_text_bottom(conn)  + '''
+                        <button type="submit">''' + get_lang(conn, 'revert') + '''</button>
                     </form>
                 ''' + preview,
-                menu = [['history/' + url_pas(name), load_lang('history')], ['recent_changes', load_lang('recent_change')]]
+                menu = [['history/' + url_pas(name), get_lang(conn, 'history')], ['recent_changes', get_lang(conn, 'recent_change')]]
             ))

+ 28 - 28
route/edit_upload.py

@@ -4,8 +4,8 @@ def edit_upload():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if acl_check(None, 'upload') == 1:
-            return re_error('/ban')
+        if acl_check(conn, None, 'upload') == 1:
+            return re_error(conn, '/ban')
         
         curs.execute(db_change('select data from other where name = "upload"'))
         db_data = curs.fetchall()
@@ -13,35 +13,35 @@ def edit_upload():
         file_max = int(file_max)
 
         if flask.request.method == 'POST':
-            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                return re_error('/error/13')
+            if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error(conn, '/error/13')
             else:
-                captcha_post('', 0)
+                captcha_post(conn, '', 0)
 
             file_data = flask.request.files.getlist("f_data[]", None)
             file_len = len(file_data)
 
             if (file_max * 1000 * 1000 * file_len) < flask.request.content_length:
-                return re_error('/error/17')
+                return re_error(conn, '/error/17')
 
             if file_len == 1:
                 file_num = None
             else:
-                if acl_check(None, 'many_upload') == 1:
-                    return re_error('/ban')
+                if acl_check(conn, None, 'many_upload') == 1:
+                    return re_error(conn, '/ban')
 
                 file_num = 1
 
             for data in file_data:
                 if data.filename == '':
-                    return re_error('/error/9')
+                    return re_error(conn, '/error/9')
                 
                 value = os.path.splitext(data.filename)[1]
 
                 curs.execute(db_change("select html from html_filter where kind = 'extension'"))
                 extension = [i[0].lower() for i in curs.fetchall()]
                 if not re.sub(r'^\.', '', value).lower() in extension:
-                    return re_error('/error/14')
+                    return re_error(conn, '/error/14')
 
                 if flask.request.form.get('f_name', None):
                     name = flask.request.form.get('f_name', None) + (' ' + str(file_num) if file_num else '') + value
@@ -50,24 +50,24 @@ def edit_upload():
 
                 piece = os.path.splitext(name)
                 if re.search(r'\.', piece[0]):
-                    return re_error('/error/22')
+                    return re_error(conn, '/error/22')
 
                 e_data = sha224_replace(piece[0]) + piece[1]
 
                 curs.execute(db_change("select title from data where title = ?"), ['file:' + name])
                 if curs.fetchall():
-                    return re_error('/error/16')
+                    return re_error(conn, '/error/16')
 
                 curs.execute(db_change("select html from html_filter where kind = 'file'"))
                 db_data = curs.fetchall()
                 for i in db_data:
                     t_re = re.compile(i[0])
                     if t_re.search(name):
-                        return redirect('/filter/file_filter')
+                        return redirect(conn, '/filter/file_filter')
 
-                data_url_image = load_image_url()
+                data_url_image = load_image_url(conn)
                 if os.path.exists(os.path.join(data_url_image, e_data)):
-                    return re_error('/error/16')
+                    return re_error(conn, '/error/16')
                 else:
                     data.save(os.path.join(data_url_image, e_data))
 
@@ -92,13 +92,13 @@ def edit_upload():
 
                 curs.execute(db_change("insert into data (title, data) values (?, ?)"), ['file:' + name, file_d])
 
-                render_set(
+                render_set(conn, 
                     doc_name = 'file:' + name,
                     doc_data = file_d,
                     data_type = 'backlink'
                 )
 
-                history_plus(
+                history_plus(conn, 
                     'file:' + name,
                     file_d,
                     get_time(),
@@ -113,9 +113,9 @@ def edit_upload():
 
                 conn.commit()
 
-            return redirect('/w/file:' + name)
+            return redirect(conn, '/w/file:' + name)
         else:
-            license_list = '<option value="direct_input">' + load_lang('direct_input') + '</option>'
+            license_list = '<option value="direct_input">' + get_lang(conn, 'direct_input') + '</option>'
             file_name = html.escape(flask.request.args.get('name', ''))
 
             curs.execute(db_change("select html from html_filter where kind = 'image_license'"))
@@ -130,28 +130,28 @@ def edit_upload():
             db_data = curs.fetchall()
             upload_default = html.escape(db_data[0][0]) if db_data and db_data[0][0] != '' else ''
             
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('upload'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'upload'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
-                    <a href="/filter/file_filter">(''' + load_lang('file_filter_list') + ''')</a> <a href="/filter/extension_filter">(''' + load_lang('extension_filter_list') + ''')</a>
+                    <a href="/filter/file_filter">(''' + get_lang(conn, 'file_filter_list') + ''')</a> <a href="/filter/extension_filter">(''' + get_lang(conn, 'extension_filter_list') + ''')</a>
                     ''' + upload_help + '''
                     <hr class="main_hr">
-                    ''' + load_lang('max_file_size') + ''' : ''' + str(file_max) + '''MB
+                    ''' + get_lang(conn, 'max_file_size') + ''' : ''' + str(file_max) + '''MB
                     <hr class="main_hr">
                     <form method="post" enctype="multipart/form-data" accept-charset="utf8">
                         <input multiple="multiple" type="file" name="f_data[]">
                         <hr class="main_hr">
-                        <input placeholder="''' + load_lang('file_name') + '''" name="f_name" value="''' + file_name + '''">
+                        <input placeholder="''' + get_lang(conn, 'file_name') + '''" name="f_name" value="''' + file_name + '''">
                         <hr class="main_hr">
                         <select name="f_lice_sel">
                             ''' + license_list + '''
                         </select>
                         <hr class="main_hr">
-                        <textarea class="opennamu_textarea_100" placeholder="''' + load_lang('other') + '''" name="f_lice">''' + upload_default + '''</textarea>
+                        <textarea class="opennamu_textarea_100" placeholder="''' + get_lang(conn, 'other') + '''" name="f_lice">''' + upload_default + '''</textarea>
                         <hr class="main_hr">
-                        ''' + captcha_get() + '''
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
+                        ''' + captcha_get(conn) + '''
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['other', load_lang('return')]]
+                menu = [['other', get_lang(conn, 'return')]]
             ))

+ 18 - 18
route/filter_all.py

@@ -13,40 +13,40 @@ def filter_all(tool):
 
         div += '</tr>'
 
-        admin = admin_check()
+        admin = admin_check(conn)
 
         if tool == 'inter_wiki':
-            title = load_lang('interwiki_list')
+            title = get_lang(conn, 'interwiki_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'inter_wiki'"))
         elif tool == 'email_filter':
-            title = load_lang('email_filter_list')
+            title = get_lang(conn, 'email_filter_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'email'"))
         elif tool == 'name_filter':
-            title = load_lang('id_filter_list')
+            title = get_lang(conn, 'id_filter_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'name'"))
         elif tool == 'edit_filter':
-            title = load_lang('edit_filter_list')
+            title = get_lang(conn, 'edit_filter_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'regex_filter'"))
         elif tool == 'file_filter':
-            title = load_lang('file_filter_list')
+            title = get_lang(conn, 'file_filter_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'file'"))
         elif tool == 'image_license':
-            title = load_lang('image_license_list')
+            title = get_lang(conn, 'image_license_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'image_license'"))
         elif tool == 'extension_filter':
-            title = load_lang('extension_filter_list')
+            title = get_lang(conn, 'extension_filter_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'extension'"))
         elif tool == 'document':
-            title = load_lang('document_filter_list')
+            title = get_lang(conn, 'document_filter_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'document'"))
         elif tool == 'outer_link':
-            title = load_lang('outer_link_filter_list')
+            title = get_lang(conn, 'outer_link_filter_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'outer_link'"))
         elif tool == 'template':
-            title = load_lang('template_document_list')
+            title = get_lang(conn, 'template_document_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'template'"))
         else:
-            title = load_lang('edit_tool_list')
+            title = get_lang(conn, 'edit_tool_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'edit_top'"))
 
         db_data = curs.fetchall()
@@ -57,9 +57,9 @@ def filter_all(tool):
             div += html.escape(data[0])
             if admin == 1:
                 if tool in ('inter_wiki', 'outer_link', 'edit_filter', 'document', 'edit_top', 'template'):
-                    div += ' <a href="/filter/' + tool + '/add/' + url_pas(data[0]) + '">(' + load_lang('edit') + ')</a>'
+                    div += ' <a href="/filter/' + tool + '/add/' + url_pas(data[0]) + '">(' + get_lang(conn, 'edit') + ')</a>'
                     
-                div += ' <a href="/filter/' + tool + '/del/' + url_pas(data[0]) + '">(' + load_lang('delete') + ')</a>'
+                div += ' <a href="/filter/' + tool + '/del/' + url_pas(data[0]) + '">(' + get_lang(conn, 'delete') + ')</a>'
 
             div += '</td>'
 
@@ -80,10 +80,10 @@ def filter_all(tool):
 
         if admin == 1:
             div += '<hr class="main_hr">'
-            div += '<a href="/filter/' + tool + '/add">(' + load_lang('add') + ')</a>'
+            div += '<a href="/filter/' + tool + '/add">(' + get_lang(conn, 'add') + ')</a>'
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [title, wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [title, wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = div,
-            menu = [['manager/1', load_lang('return')]]
+            menu = [['manager/1', get_lang(conn, 'return')]]
         ))

+ 58 - 58
route/filter_all_add.py

@@ -5,11 +5,11 @@ def filter_all_add(tool, name = None):
         curs = conn.cursor()
 
         if not name and tool == 'edit_filter':
-            return redirect('/manager/9')
+            return redirect(conn, '/manager/9')
 
         if flask.request.method == 'POST':
-            if admin_check() != 1:
-                return re_error('/error/3')
+            if admin_check(conn) != 1:
+                return re_error(conn, '/error/3')
 
             title = flask.request.form.get('title', 'test')
             if tool in ('inter_wiki', 'outer_link'):
@@ -23,7 +23,7 @@ def filter_all_add(tool, name = None):
                     curs.execute(db_change("delete from html_filter where html = ? and kind = 'inter_wiki_sub'"), [title])
                     curs.execute(db_change('insert into html_filter (html, plus, plus_t, kind) values (?, "inter_wiki_type", ?, "inter_wiki_sub")'), [title, inter_type])
                 
-                admin_check(None, tool + ' edit')
+                admin_check(conn, None, tool + ' edit')
             elif tool == 'edit_filter':
                 sec = flask.request.form.get('second', '0')
                 end = 'X' if sec == '0' else sec
@@ -32,58 +32,58 @@ def filter_all_add(tool, name = None):
                 try:
                     re.compile(content)
                 except:
-                    return re_error('/error/23')
+                    return re_error(conn, '/error/23')
                 
                 curs.execute(db_change("delete from html_filter where html = ? and kind = 'regex_filter'"), [name])
                 curs.execute(db_change("insert into html_filter (html, plus, plus_t, kind) values (?, ?, ?, 'regex_filter')"), [name, content, end])
-                admin_check(None, 'edit_filter edit')
+                admin_check(conn, None, 'edit_filter edit')
             elif tool == 'document':
                 post_name = flask.request.form.get('name', '')
                 if post_name == '':
-                    return redirect('/filter/document')
+                    return redirect(conn, '/filter/document')
             
                 post_acl = flask.request.form.get('acl', '')
                 post_regex = flask.request.form.get('regex', '')
                 try:
                     re.compile(post_regex)
                 except:
-                    return re_error('/error/23')
+                    return re_error(conn, '/error/23')
                 
                 curs.execute(db_change('insert into html_filter (html, kind, plus, plus_t) values (?, "document", ?, ?)'), [post_name, post_regex, post_acl])
-                admin_check(None, 'document_filter edit')
+                admin_check(conn, None, 'document_filter edit')
             else:
                 plus_d = ''
                 if tool == 'name_filter':
                     try:
                         re.compile(title)
                     except:
-                        return re_error('/error/23')
+                        return re_error(conn, '/error/23')
 
-                    admin_check(None, 'name_filter edit')
+                    admin_check(conn, None, 'name_filter edit')
                     type_d = 'name'
                 elif tool == 'file_filter':
                     try:
                         re.compile(title)
                     except:
-                        return re_error('/error/23')
+                        return re_error(conn, '/error/23')
 
-                    admin_check(None, 'file_filter edit')
+                    admin_check(conn, None, 'file_filter edit')
                     type_d = 'file'
                 elif tool == 'email_filter':
-                    admin_check(None, 'email_filter edit')
+                    admin_check(conn, None, 'email_filter edit')
                     type_d = 'email'
                 elif tool == 'image_license':
-                    admin_check(None, 'image_license edit')
+                    admin_check(conn, None, 'image_license edit')
                     type_d = 'image_license'
                 elif tool == 'extension_filter':
-                    admin_check(None, 'extension_filter edit')
+                    admin_check(conn, None, 'extension_filter edit')
                     type_d = 'extension'
                 elif tool == 'template':
-                    admin_check(None, 'template_document edit')
+                    admin_check(conn, None, 'template_document edit')
                     type_d = 'template'
                     plus_d = flask.request.form.get('exp', 'test')
                 else:
-                    admin_check(None, 'edit_top edit')
+                    admin_check(conn, None, 'edit_top edit')
                     type_d = 'edit_top'
                     plus_d = flask.request.form.get('markup', 'test')
 
@@ -94,10 +94,10 @@ def filter_all_add(tool, name = None):
 
             conn.commit()
 
-            return redirect('/filter/' + tool)
+            return redirect(conn, '/filter/' + tool)
         else:
             get_sub = 0
-            stat = 'disabled' if admin_check() != 1 else ''
+            stat = 'disabled' if admin_check(conn) != 1 else ''
             name = name if name else ''
 
             if tool in ('inter_wiki', 'outer_link'):
@@ -119,7 +119,7 @@ def filter_all_add(tool, name = None):
 
                     select = '''
                         <hr class="main_hr">
-                        ''' + load_lang('inter_wiki_space_change') + '''
+                        ''' + get_lang(conn, 'inter_wiki_space_change') + '''
                         <hr class="main_hr">
                         <select name="inter_type">
                             <option ''' + select[0] + ''' value="url_encode">%20</option>
@@ -129,17 +129,17 @@ def filter_all_add(tool, name = None):
                 else:
                     ex = 'youtube.com'
 
-                title = load_lang('interwiki_add') if tool == 'inter_wiki' else load_lang('outer_link_add')
+                title = get_lang(conn, 'interwiki_add') if tool == 'inter_wiki' else get_lang(conn, 'outer_link_add')
                 form_data = '''
-                    ''' + load_lang('name') + '''
+                    ''' + get_lang(conn, 'name') + '''
                     <hr class="main_hr">
                     <input value="''' + html.escape(value[0]) + '''" type="text" name="title">
                     <hr class="main_hr">
-                    ''' + load_lang('link') + ''' (EX : ''' + ex + ''')
+                    ''' + get_lang(conn, 'link') + ''' (EX : ''' + ex + ''')
                     <hr class="main_hr">
                     <input value="''' + html.escape(value[1]) + '''" type="text" name="link">
                     <hr class="main_hr">
-                    ''' + load_lang('icon') + ''' (''' + ('HTML' if tool == 'inter_wiki' else load_lang('html_or_link')) + ''') (''' + load_lang('link') + ' - EX' + ''' : /image/Test.svg)
+                    ''' + get_lang(conn, 'icon') + ''' (''' + ('HTML' if tool == 'inter_wiki' else get_lang(conn, 'html_or_link')) + ''') (''' + get_lang(conn, 'link') + ' - EX' + ''' : /image/Test.svg)
                     <hr class="main_hr">
                     <input value="''' + html.escape(value[2]) + '''" type="text" name="icon">
                     ''' + select + '''
@@ -157,55 +157,55 @@ def filter_all_add(tool, name = None):
                 insert_data = ''
                 if stat == '':
                     t_data = [
-                        ['86400', load_lang('1_day')],
-                        ['432000', load_lang('5_day')],
-                        ['2592000', load_lang('30_day')],
-                        ['15552000', load_lang('180_day')],
-                        ['31104000', load_lang('360_day')],
-                        ['0', load_lang('limitless')]
+                        ['86400', get_lang(conn, '1_day')],
+                        ['432000', get_lang(conn, '5_day')],
+                        ['2592000', get_lang(conn, '30_day')],
+                        ['15552000', get_lang(conn, '180_day')],
+                        ['31104000', get_lang(conn, '360_day')],
+                        ['0', get_lang(conn, 'limitless')]
                     ]
                     insert_data += ''.join(['<a href="javascript:opennamu_insert_v(\'second\', \'' + for_a[0] + '\')">(' + for_a[1] + ')</a> ' for for_a in t_data])
 
-                title = load_lang('edit_filter_add')
+                title = get_lang(conn, 'edit_filter_add')
                 form_data = '''
                     ''' + insert_data + '''
                     <hr class="main_hr">
-                    <input placeholder="''' + load_lang('second') + '''" id="second" name="second" type="text" value="''' + html.escape(time_data) + '''">
+                    <input placeholder="''' + get_lang(conn, 'second') + '''" id="second" name="second" type="text" value="''' + html.escape(time_data) + '''">
                     <hr class="main_hr">
-                    <input placeholder="''' + load_lang('regex') + '''" name="content" value="''' + html.escape(textarea) + '''" type="text">
+                    <input placeholder="''' + get_lang(conn, 'regex') + '''" name="content" value="''' + html.escape(textarea) + '''" type="text">
                 '''
             elif tool == 'name_filter':
-                title = load_lang('id_filter_add')
+                title = get_lang(conn, 'id_filter_add')
                 form_data = '' + \
-                    load_lang('regex') + \
+                    get_lang(conn, 'regex') + \
                     '<hr class="main_hr">' + \
                     '<input value="' + html.escape(name) + '" type="text" name="title">' + \
                 ''
             elif tool == 'file_filter':
-                title = load_lang('file_filter_add')
+                title = get_lang(conn, 'file_filter_add')
                 form_data = '' + \
-                    load_lang('regex') + \
+                    get_lang(conn, 'regex') + \
                     '<hr class="main_hr">' + \
                     '<input value="' + html.escape(name) + '" type="text" name="title">' + \
                 ''
             elif tool == 'email_filter':
-                title = load_lang('email_filter_add')
+                title = get_lang(conn, 'email_filter_add')
                 form_data = '' + \
-                    load_lang('email') + \
+                    get_lang(conn, 'email') + \
                     '<hr class="main_hr">' + \
                     '<input value="' + html.escape(name) + '" type="text" name="title">' + \
                 ''
             elif tool == 'image_license':
-                title = load_lang('image_license_add')
+                title = get_lang(conn, 'image_license_add')
                 form_data = '' + \
-                    load_lang('license') + \
+                    get_lang(conn, 'license') + \
                     '<hr class="main_hr">' + \
                     '<input value="' + html.escape(name) + '" type="text" name="title">' + \
                 ''
             elif tool == 'extension_filter':
-                title = load_lang('extension_filter_add')
+                title = get_lang(conn, 'extension_filter_add')
                 form_data = '' + \
-                    load_lang('extension') + \
+                    get_lang(conn, 'extension') + \
                     '<hr class="main_hr">' + \
                     '<input value="' + html.escape(name) + '" type="text" name="title">' + \
                 ''
@@ -216,24 +216,24 @@ def filter_all_add(tool, name = None):
                 db_data = curs.fetchall()
                 acl_list = [['selected' if db_data and db_data[0][1] == for_a else '', for_a] for for_a in acl_list]
 
-                title = load_lang('document_filter_add')
+                title = get_lang(conn, 'document_filter_add')
                 form_data = '''
-                    ''' + load_lang('name') + '''
+                    ''' + get_lang(conn, 'name') + '''
                     <hr class="main_hr">
                     <input value="''' + html.escape(name) + '''" type="text" name="name">
                     <hr class="main_hr">
-                    ''' + load_lang('regex') + '''
+                    ''' + get_lang(conn, 'regex') + '''
                     <hr class="main_hr">
                     <input value="''' + (html.escape(db_data[0][0]) if db_data else '') + '''" type="text" name="regex">
                     <hr class="main_hr">
-                    <a href="/acl/Test#exp">''' + load_lang('acl') + '''</a>
+                    <a href="/acl/Test#exp">''' + get_lang(conn, 'acl') + '''</a>
                     <hr class="main_hr">
                     <select name="acl">
                         ''' + ''.join(['<option ' + for_a[0] + ' value=' + for_a[1] + '>' + ('normal' if for_a[1] == '' else for_a[1]) + '</option>' for for_a in acl_list]) + '''
                     </select>
                 '''
             elif tool == 'template':
-                title = load_lang('template_document_add')
+                title = get_lang(conn, 'template_document_add')
 
                 value = ''
                 if name:
@@ -242,17 +242,17 @@ def filter_all_add(tool, name = None):
                     value = exist[0][0] if exist else '' 
 
                 form_data = '' + \
-                    load_lang('template') + \
+                    get_lang(conn, 'template') + \
                     '<hr class="main_hr">' + \
                     '<input value="' + html.escape(name) + '" type="text" name="title">' + \
                     '<hr class="main_hr">' + \
-                    load_lang('explanation') + \
+                    get_lang(conn, 'explanation') + \
                     '<hr class="main_hr">' + \
                     '<input value="' + html.escape(value) + '" type="text" name="exp">' + \
                     '<hr class="main_hr">' + \
                 ''
             else:
-                title = load_lang('edit_tool_add')
+                title = get_lang(conn, 'edit_tool_add')
                 
                 value = ''
                 if name:
@@ -261,23 +261,23 @@ def filter_all_add(tool, name = None):
                     value = exist[0][0] if exist else ''    
 
                 form_data = '''
-                    ''' + load_lang('title') + '''
+                    ''' + get_lang(conn, 'title') + '''
                     <hr class="main_hr">
                     <input value="''' + html.escape(name) + '''" type="text" name="title">
                     <hr class="main_hr">
-                    ''' + load_lang('markup') + '''
+                    ''' + get_lang(conn, 'markup') + '''
                     <hr class="main_hr">
                     <input value="''' + html.escape(value) + '''" type="text" name="markup">
                 '''
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [title, wiki_set(), wiki_custom(), wiki_css([get_sub, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [title, wiki_set(conn), wiki_custom(conn), wiki_css([get_sub, 0])],
                 data =  '''
                         <form method="post">
                             ''' + form_data + '''
                             <hr class="main_hr">
-                            <button ''' + stat + ''' type="submit">''' + load_lang('add') + '''</button>
+                            <button ''' + stat + ''' type="submit">''' + get_lang(conn, 'add') + '''</button>
                         </form>
                         ''',
-                menu = [['filter/' + tool, load_lang('return')]]
+                menu = [['filter/' + tool, get_lang(conn, 'return')]]
             ))

+ 3 - 3
route/filter_all_delete.py

@@ -4,8 +4,8 @@ def filter_all_delete(tool, name = 'Test'):
     with get_db_connect() as conn:
         curs = conn.cursor()
         
-        if admin_check(None, 'del_' + tool) != 1:
-            return re_error('/error/3')
+        if admin_check(conn, None, 'del_' + tool) != 1:
+            return re_error(conn, '/error/3')
 
         if tool == 'inter_wiki':
             curs.execute(db_change("delete from html_filter where html = ? and kind = 'inter_wiki'"), [name])
@@ -33,4 +33,4 @@ def filter_all_delete(tool, name = 'Test'):
 
         conn.commit()
 
-        return redirect('/filter/' + tool)
+        return redirect(conn, '/filter/' + tool)

+ 17 - 17
route/give_admin_groups.py

@@ -7,10 +7,10 @@ def give_admin_groups_2(name = 'test'):
         acl_name_list = ['ban', 'nothing', 'toron', 'check', 'acl', 'hidel', 'give', 'owner']
 
         if flask.request.method == 'POST':
-            if admin_check(None, 'auth list add (' + name + ')') != 1:
-                return re_error('/error/3')
+            if admin_check(conn, None, 'auth list add (' + name + ')') != 1:
+                return re_error(conn, '/error/3')
             elif name in get_default_admin_group():
-                return re_error('/error/3')
+                return re_error(conn, '/error/3')
 
             curs.execute(db_change("delete from alist where name = ?"), [name])
             for i in acl_name_list:
@@ -19,11 +19,11 @@ def give_admin_groups_2(name = 'test'):
 
             conn.commit()
 
-            return redirect('/auth/list/add/' + url_pas(name))
+            return redirect(conn, '/auth/list/add/' + url_pas(name))
         else:
             data = ''
             exist_list = ['', '', '', '', '', '', '', '']
-            state = 'disabled' if admin_check() != 1 else ''
+            state = 'disabled' if admin_check(conn) != 1 else ''
             state = 'disabled' if name in get_default_admin_group() else ''
 
             curs.execute(db_change('select acl from alist where name = ?'), [name])
@@ -43,25 +43,25 @@ def give_admin_groups_2(name = 'test'):
 
             data += ''
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('admin_group') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'admin_group') + ')', 0])],
                 data = '''
                     <form method="post">
                         ''' + data + '''
                         <hr class="main_hr">
-                        <h2>''' + load_lang('explanation') + '''</h2>
+                        <h2>''' + get_lang(conn, 'explanation') + '''</h2>
                         <ul class="opennamu_ul">
-                            <li style="margin-left: 20px;">owner : ''' + load_lang('owner_authority') + '''</li>
-                            <li style="margin-left: 40px; list-style: circle;">ban : ''' + load_lang('ban_authority') + '''</li>
-                            <li style="margin-left: 40px; list-style: circle;">toron : ''' + load_lang('discussion_authority') + '''</li>
-                            <li style="margin-left: 40px; list-style: circle;">check : ''' + load_lang('user_check_authority') + '''</li>
-                            <li style="margin-left: 40px; list-style: circle;">acl : ''' + load_lang('document_acl_authority') + '''</li>
-                            <li style="margin-left: 40px; list-style: circle;">hidel : ''' + load_lang('history_hide_authority') + '''</li>
-                            <li style="margin-left: 40px; list-style: circle;">give : ''' + load_lang('authorization_authority') + '''</li>
+                            <li style="margin-left: 20px;">owner : ''' + get_lang(conn, 'owner_authority') + '''</li>
+                            <li style="margin-left: 40px; list-style: circle;">ban : ''' + get_lang(conn, 'ban_authority') + '''</li>
+                            <li style="margin-left: 40px; list-style: circle;">toron : ''' + get_lang(conn, 'discussion_authority') + '''</li>
+                            <li style="margin-left: 40px; list-style: circle;">check : ''' + get_lang(conn, 'user_check_authority') + '''</li>
+                            <li style="margin-left: 40px; list-style: circle;">acl : ''' + get_lang(conn, 'document_acl_authority') + '''</li>
+                            <li style="margin-left: 40px; list-style: circle;">hidel : ''' + get_lang(conn, 'history_hide_authority') + '''</li>
+                            <li style="margin-left: 40px; list-style: circle;">give : ''' + get_lang(conn, 'authorization_authority') + '''</li>
                         </ul>
                         <hr class="main_hr">
-                        <button ''' + state +  ''' type="submit">''' + load_lang('save') + '''</button>
+                        <button ''' + state +  ''' type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['auth/list', load_lang('return')]]
+                menu = [['auth/list', get_lang(conn, 'return')]]
             ))

+ 17 - 17
route/give_auth.py

@@ -5,27 +5,27 @@ def give_auth(name):
         curs = conn.cursor()
 
         ip = ip_check()
-        owner_auth = admin_check()
-        admin_auth = admin_check(7)
+        owner_auth = admin_check(conn)
+        admin_auth = admin_check(conn, 7)
 
         curs.execute(db_change("select data from user_set where id = ? and name = 'acl'"), [name])
         user_acl = curs.fetchall()
         if not user_acl:
-            return re_error('/error/2')
+            return re_error(conn, '/error/2')
         else:
             user_acl = user_acl[0][0]
 
         if owner_auth != 1:
             curs.execute(db_change('select name from alist where name = ? and acl = "owner"'), [user_acl])
             if curs.fetchall():
-                return re_error('/error/3')
+                return re_error(conn, '/error/3')
 
             if ip == name:
-                return re_error('/error/3')
+                return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
-            if admin_check(7, 'admin (' + name + ')') != 1:
-                return re_error('/error/3')
+            if admin_check(conn, 7, 'admin (' + name + ')') != 1:
+                return re_error(conn, '/error/3')
 
             select_data = flask.request.form.get('select', 'X')
             if select_data == 'X':
@@ -33,7 +33,7 @@ def give_auth(name):
 
             curs.execute(db_change('select name from alist where name = ? and acl = "owner"'), [select_data])
             if owner_auth != 1 and curs.fetchall():
-                return re_error('/error/3')
+                return re_error(conn, '/error/3')
 
             curs.execute(db_change("update user_set set data = ? where id = ? and name = 'acl'"), [select_data, name])
             curs.execute(db_change('delete from user_set where name = "auth_date" and id = ?'), [name])
@@ -44,17 +44,17 @@ def give_auth(name):
             else:
                 time_limit = ''
 
-            add_alarm(name, ip, 'Auth change to ' + select_data + (' (' + time_limit + ')' if time_limit != '' else ''))
+            add_alarm(conn, name, ip, 'Auth change to ' + select_data + (' (' + time_limit + ')' if time_limit != '' else ''))
 
             conn.commit()
 
-            return redirect('/auth/give/' + url_pas(name))
+            return redirect(conn, '/auth/give/' + url_pas(name))
         else:
             if admin_auth != 1:
-                return re_error('/error/3')
+                return re_error(conn, '/error/3')
 
-            div = '<option value="X">' + load_lang('normal') + '</option>'
-            div += '<option value="ban">' + load_lang('ban') + '</option>'
+            div = '<option value="X">' + get_lang(conn, 'normal') + '</option>'
+            div += '<option value="ban">' + get_lang(conn, 'ban') + '</option>'
 
             curs.execute(db_change('select distinct name from alist order by name asc'))
             for data in curs.fetchall():
@@ -70,8 +70,8 @@ def give_auth(name):
             if db_data:
                 date_value = db_data[0][0]
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('authorize') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'authorize') + ')', 0])],
                 data =  '''
                     <form method="post">
                         <div id="opennamu_get_user_info">''' + html.escape(name) + '''</div>
@@ -80,8 +80,8 @@ def give_auth(name):
                         <hr class="main_hr">
                         <input type="date" value="''' + date_value + '''" name="date" pattern="\\d{4}-\\d{2}-\\d{2}">
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('save') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['manager', load_lang('return')]]
+                menu = [['manager', get_lang(conn, 'return')]]
             ))

+ 8 - 8
route/give_delete_admin_group.py

@@ -4,25 +4,25 @@ def give_delete_admin_group_2(name = 'test'):
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/error/3')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
-            admin_check(None, 'auth list delete (' + name + ')')
+            admin_check(conn, None, 'auth list delete (' + name + ')')
 
             curs.execute(db_change("delete from alist where name = ?"), [name])
             curs.execute(db_change("update user_set set data = 'user' where name = 'acl' and data = ?"), [name])
 
             conn.commit()
 
-            return redirect('/auth/list')
+            return redirect(conn, '/auth/list')
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang("delete_admin_group"), wiki_set(), wiki_custom(), wiki_css(['(' + name + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, "delete_admin_group"), wiki_set(conn), wiki_custom(conn), wiki_css(['(' + name + ')', 0])],
                 data = '''
                     <form method=post>
-                        <button type=submit>''' + load_lang('delete') + '''</button>
+                        <button type=submit>''' + get_lang(conn, 'delete') + '''</button>
                     </form>
                 ''',
-                menu = [['auth/list', load_lang('return')]]
+                menu = [['auth/list', get_lang(conn, 'return')]]
             ))

+ 28 - 28
route/give_user_ban.py

@@ -6,12 +6,12 @@ def give_user_ban(name = None, ban_type = ''):
 
         ip = ip_check()
         
-        if ban_check(ip = ip, tool = 'login')[0] == 1:
-            if ip_or_user(ip) == 1 or admin_check('all', None, ip) == 0:
-                return re_error('/ban')
+        if ban_check(conn, ip = ip, tool = 'login')[0] == 1:
+            if ip_or_user(ip) == 1 or admin_check(conn, 'all', None, ip) == 0:
+                return re_error(conn, '/ban')
         else:
-            if admin_check(1, None, ip) != 1:
-                return re_error('/error/3')
+            if admin_check(conn, 1, None, ip) != 1:
+                return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
             time_limit = flask.request.form.get('date', '')
@@ -49,22 +49,22 @@ def give_user_ban(name = None, ban_type = ''):
                     try:
                         re.compile(name)
                     except:
-                        return re_error('/error/23')
+                        return re_error(conn, '/error/23')
                 else:
                     type_d = None
 
                 if type_d:
-                    if admin_check(None, 'ban' + (' ' + type_d if type_d else '') + ' (' + name + ')') != 1:
-                        return re_error('/error/3')
+                    if admin_check(conn, None, 'ban' + (' ' + type_d if type_d else '') + ' (' + name + ')') != 1:
+                        return re_error(conn, '/error/3')
                 else:
                     if name == ip:
-                        if admin_check('all', 'ban (' + name + ')') != 1:
-                            return re_error('/error/3')
+                        if admin_check(conn, 'all', 'ban (' + name + ')') != 1:
+                            return re_error(conn, '/error/3')
                     else:
-                        if admin_check(1, 'ban (' + name + ')') != 1:
-                            return re_error('/error/3')
+                        if admin_check(conn, 1, 'ban (' + name + ')') != 1:
+                            return re_error(conn, '/error/3')
 
-                ban_insert(
+                ban_insert(conn, 
                     name,
                     end,
                     why,
@@ -74,14 +74,14 @@ def give_user_ban(name = None, ban_type = ''):
                     1 if release != '' else 0
                 )
 
-            return redirect('/block_log')
+            return redirect(conn, '/block_log')
         else:
             if ban_type == 'multiple':
-                main_name = load_lang('multiple_ban')
-                n_name = '<textarea class="opennamu_textarea_500" placeholder="' + load_lang('name_or_ip_or_regex_multiple') + '" name="name"></textarea><hr class="main_hr">'
+                main_name = get_lang(conn, 'multiple_ban')
+                n_name = '<textarea class="opennamu_textarea_500" placeholder="' + get_lang(conn, 'name_or_ip_or_regex_multiple') + '" name="name"></textarea><hr class="main_hr">'
             else:
-                main_name = load_lang('ban')
-                n_name = '<input placeholder="' + load_lang('name_or_ip_or_regex') + '" value="' + (name if name else '') + '" name="name"><hr class="main_hr">'
+                main_name = get_lang(conn, 'ban')
+                n_name = '<input placeholder="' + get_lang(conn, 'name_or_ip_or_regex') + '" value="' + (name if name else '') + '" name="name"><hr class="main_hr">'
 
             now = 0
             
@@ -103,26 +103,26 @@ def give_user_ban(name = None, ban_type = ''):
                     <hr class="main_hr">
                 '''
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [main_name, wiki_set(), wiki_custom(), wiki_css([now, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [main_name, wiki_set(conn), wiki_custom(conn), wiki_css([now, 0])],
                 data = info_data + '''
                     <form method="post" ''' + action + '''>
                         ''' + n_name + '''
-                        <input type="checkbox" name="regex" ''' + ('checked' if ban_type == 'regex' else '') + '> ' + load_lang('regex') + '''
+                        <input type="checkbox" name="regex" ''' + ('checked' if ban_type == 'regex' else '') + '> ' + get_lang(conn, 'regex') + '''
                         <hr class="main_hr">
                         <input type="date" value="''' + date_value + '''" name="date" pattern="\\d{4}-\\d{2}-\\d{2}">
                         <hr class="main_hr">
-                        <input placeholder="''' + load_lang('why') + '''" name="why" type="text">
+                        <input placeholder="''' + get_lang(conn, 'why') + '''" name="why" type="text">
                         <hr class="main_hr">
                         <select name="ban_option">
-                            <option value="">''' + load_lang('default') + '''</option>
-                            <option value="login_able">''' + load_lang('login_able') + '''</option>
-                            <option value="edit_request_able">''' + load_lang('edit_request_able') + '''</option>
-                            <option value="release">''' + load_lang('release') + '''</option>
+                            <option value="">''' + get_lang(conn, 'default') + '''</option>
+                            <option value="login_able">''' + get_lang(conn, 'login_able') + '''</option>
+                            <option value="edit_request_able">''' + get_lang(conn, 'edit_request_able') + '''</option>
+                            <option value="release">''' + get_lang(conn, 'release') + '''</option>
                         </select>
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('save') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['manager', load_lang('return')]]
+                menu = [['manager', get_lang(conn, 'return')]]
             ))   

+ 20 - 20
route/give_user_fix.py

@@ -6,40 +6,40 @@ def give_user_fix(user_name = ''):
 
         curs.execute(db_change("select data from user_set where id = ? and name = 'pw'"), [user_name])
         if not curs.fetchall():
-            return re_error('/error/2')
+            return re_error(conn, '/error/2')
 
-        if admin_check() != 1:
-            return re_error('/error/3')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
             select = flask.request.form.get('select', '')
 
-            admin_check(None, 'user_fix (' + user_name + ') (' + select + ')')
+            admin_check(conn, None, 'user_fix (' + user_name + ') (' + select + ')')
             if select == 'password_change':
                 password = flask.request.form.get('new_password', '')
                 check_password = flask.request.form.get('password_check', '')
 
                 if password == check_password:
-                    hashed = pw_encode(password)
+                    hashed = pw_encode(conn, password)
                     curs.execute(db_change("update user_set set data = ? where id = ? and name = 'pw'"), [
                         hashed,
                         user_name
                     ])
                 else:
-                    return re_error('/error/20')
+                    return re_error(conn, '/error/20')
             elif select == '2fa_password_change':
                 password = flask.request.form.get('new_password', '')
                 check_password = flask.request.form.get('password_check', '')
 
                 if password == check_password:
-                    hashed = pw_encode(password)
+                    hashed = pw_encode(conn, password)
                     curs.execute(db_change('select data from user_set where name = "2fa_pw" and id = ?'), [user_name])
                     if curs.fetchall():
                         curs.execute(db_change("update user_set set data = ? where name = '2fa_pw' and id = ?"), [hashed, user_name])
                     else:
                         curs.execute(db_change("insert into user_set (name, id, data) values ('2fa_pw', ?, ?)"), [user_name, hashed])
                 else:
-                    return re_error('/error/20')
+                    return re_error(conn, '/error/20')
             elif select == '2fa_off':
                 curs.execute(db_change('select data from user_set where name = "2fa" and id = ?'), [user_name])
                 if curs.fetchall():
@@ -47,30 +47,30 @@ def give_user_fix(user_name = ''):
 
             conn.commit()
 
-            return redirect('/user/' + url_pas(user_name))
+            return redirect(conn, '/user/' + url_pas(user_name))
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('user_fix'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'user_fix'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
                         <div id="opennamu_get_user_info">''' + html.escape(user_name) + '''</div>
                         <hr class="main_hr">
-                        <a href="/change/user_name/''' + url_pas(user_name) + '''">(''' + load_lang('change_user_name') + ''')</a>
+                        <a href="/change/user_name/''' + url_pas(user_name) + '''">(''' + get_lang(conn, 'change_user_name') + ''')</a>
                         <hr class="main_hr">
                         <select name="select">
-                            <option value="password_change">''' + load_lang('password_change') + '''</option>
-                            <option value="2fa_password_change">''' + load_lang('2fa_password_change') + '''</option>
-                            <option value="2fa_off">''' + load_lang('2fa_off') + '''</option>
+                            <option value="password_change">''' + get_lang(conn, 'password_change') + '''</option>
+                            <option value="2fa_password_change">''' + get_lang(conn, '2fa_password_change') + '''</option>
+                            <option value="2fa_off">''' + get_lang(conn, '2fa_off') + '''</option>
                         </select>
                         <hr class="main_hr">
-                        ''' + load_lang('password_change') + ''' | ''' + load_lang('2fa_password_change') + '''
+                        ''' + get_lang(conn, 'password_change') + ''' | ''' + get_lang(conn, '2fa_password_change') + '''
                         <hr class="main_hr">
-                        <input placeholder="''' + load_lang('new_password') + '''" name="new_password" type="password">
+                        <input placeholder="''' + get_lang(conn, 'new_password') + '''" name="new_password" type="password">
                         <hr class="main_hr">
-                        <input placeholder="''' + load_lang('password_confirm') + '''" name="password_check" type="password">
+                        <input placeholder="''' + get_lang(conn, 'password_confirm') + '''" name="password_check" type="password">
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('go') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'go') + '''</button>
                     </form>
                 ''',
-                menu = [['manager', load_lang('return')]]
+                menu = [['manager', get_lang(conn, 'return')]]
             ))

+ 5 - 5
route/go_api_topic.py

@@ -78,12 +78,12 @@ def api_topic_thread_pre_render(curs, data, num, ip, topic_num = '', name = '',
             ip_data = curs.fetchall()
             if ip_data and ip_or_user(ip_data[0][0]) == 0:
                 if do_type == 'thread':
-                    add_alarm(ip_data[0][0], ip, '<a href="/thread/' + topic_num + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
+                    add_alarm(conn, ip_data[0][0], ip, '<a href="/thread/' + topic_num + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
                 else:
                     set_id = topic_num.split('-')
                     set_id = ['', ''] if len(set_id) < 2 else set_id
 
-                    add_alarm(ip_data[0][0], ip, 'BBS <a href="/bbs/w/' + set_id[0] + '/' + set_id[1] + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
+                    add_alarm(conn, ip_data[0][0], ip, 'BBS <a href="/bbs/w/' + set_id[0] + '/' + set_id[1] + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
 
             data = re.sub(call_thread_regex, rd_data[0] + '<topic_a_' + do_type + '>#' + view_data + '</topic_a_' + do_type + '>' + rd_data[3], data, 1)
 
@@ -108,10 +108,10 @@ def api_topic_thread_pre_render(curs, data, num, ip, topic_num = '', name = '',
 
             if ip_data and ip_or_user(ip_data[0][0]) == 0:
                 if do_type == 'thread':
-                    add_alarm(ip_data[0][0], ip, '<a href="/thread/' + topic_num + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
+                    add_alarm(conn, ip_data[0][0], ip, '<a href="/thread/' + topic_num + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
                 else:
                     set_id = topic_num.split('-')
-                    add_alarm(ip_data[0][0], ip, 'BBS <a href="/bbs/w/' + set_id[0] + '/' + set_id[1] + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
+                    add_alarm(conn, ip_data[0][0], ip, 'BBS <a href="/bbs/w/' + set_id[0] + '/' + set_id[1] + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
 
             data = re.sub(call_user_regex, rd_data[0] + '<topic_call>@' + rd_data[1] + '</topic_call>' + rd_data[2], data, 1)
 
@@ -131,7 +131,7 @@ def api_topic(db_set, topic_num = 1, tool = 'normal', s_num = '', e_num = ''):
         other_set["ip"] = ip_check()
         other_set = json.dumps(other_set)
 
-        if acl_check('', 'topic_view', topic_num) != 1:
+        if acl_check(conn, '', 'topic_view', topic_num) != 1:
             if platform.system() == 'Linux':
                 if platform.machine() in ["AMD64", "x86_64"]:
                     data = subprocess.Popen([os.path.join(".", "route_go", "bin", "main.amd64.bin"), sys._getframe().f_code.co_name, db_set, other_set], stdout = subprocess.PIPE).communicate()[0]

+ 1 - 1
route/go_api_w_raw.py

@@ -10,7 +10,7 @@ def api_w_raw(db_set, name = 'Test', rev = '', exist_check = ''):
         other_set["exist_check"] = exist_check
         other_set = json.dumps(other_set)
 
-        if acl_check(name, 'render') != 1:
+        if acl_check(conn, name, 'render') != 1:
             if platform.system() == 'Linux':
                 if platform.machine() in ["AMD64", "x86_64"]:
                     data = subprocess.Popen([os.path.join(".", "route_go", "bin", "main.amd64.bin"), sys._getframe().f_code.co_name, db_set, other_set], stdout = subprocess.PIPE).communicate()[0]

+ 2 - 2
route/go_main_func_easter_egg.py

@@ -24,8 +24,8 @@ def main_func_easter_egg():
 
         data = data.decode('utf8')
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = ['Easter Egg', wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = ['Easter Egg', wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = data,
             menu = 0
         ))

+ 4 - 4
route/list_acl.py

@@ -30,10 +30,10 @@ def list_acl(arg_num = 1):
             ''
 
         div += '</ul>'
-        div += next_fix('/list/document/acl/', arg_num, list_data)
+        div += next_fix(conn, '/list/document/acl/', arg_num, list_data)
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('acl_document_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'acl_document_list'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = div,
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 4 - 4
route/list_admin.py

@@ -11,7 +11,7 @@ def list_admin():
         ))
         for data in curs.fetchall():
             name = '' + \
-                ip_pas(data[0]) + ' ' + \
+                ip_pas(conn, data[0]) + ' ' + \
                 '<a href="/auth/list/add/' + url_pas(data[1]) + '">(' + data[1] + ')</a>' + \
             ''
 
@@ -19,8 +19,8 @@ def list_admin():
 
         div += '</ul>'
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('admin_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'admin_list'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = div,
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 9 - 9
route/list_admin_auth_use.py

@@ -7,7 +7,7 @@ def list_admin_auth_use(arg_num = 1, arg_search = 'normal'):
         sql_num = (arg_num * 50 - 50) if arg_num * 50 > 0 else 0
 
         if flask.request.method == 'POST':
-            return redirect('/list/admin/auth_use_page/1/' + url_pas(flask.request.form.get('search', 'normal')))
+            return redirect(conn, '/list/admin/auth_use_page/1/' + url_pas(flask.request.form.get('search', 'normal')))
         else:
             arg_search = 'normal' if arg_search == '' else arg_search
             
@@ -22,28 +22,28 @@ def list_admin_auth_use(arg_num = 1, arg_search = 'normal'):
             for data in get_list:
                 do_data = data[1]
 
-                if ip_pas('127.0.0.1', 1) != '127.0.0.1': 
+                if ip_pas(conn, '127.0.0.1', 1) != '127.0.0.1': 
                     do_data = do_data.split(' ')
                     if do_data[0] in ('ban'):
                         do_data = do_data[0]
                     else:
                         do_data = data[1]
 
-                list_data += '<li>' + ip_pas(data[0]) + ' | ' + html.escape(do_data) + ' | ' + data[2] + '</li>'
+                list_data += '<li>' + ip_pas(conn, data[0]) + ' | ' + html.escape(do_data) + ' | ' + data[2] + '</li>'
 
             list_data += '</ul>'
-            list_data += get_next_page_bottom('/list/admin/auth_use_page/{}/' + url_pas(arg_search), arg_num, get_list)
+            list_data += get_next_page_bottom(conn, '/list/admin/auth_use_page/{}/' + url_pas(arg_search), arg_num, get_list)
 
             arg_search = html.escape(arg_search) if arg_search != 'normal' else ''
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('authority_use_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'authority_use_list'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
-                        <input class="opennamu_width_200" name="search" placeholder="''' + load_lang('start_with_search') + '''" value="''' + arg_search + '''">
-                        <button type="submit">''' + load_lang('search') + '''</button>
+                        <input class="opennamu_width_200" name="search" placeholder="''' + get_lang(conn, 'start_with_search') + '''" value="''' + arg_search + '''">
+                        <button type="submit">''' + get_lang(conn, 'search') + '''</button>
                     </form>
                     <hr class="main_hr">
                 ''' + list_data,
-                menu = [['other', load_lang('return')]]
+                menu = [['other', get_lang(conn, 'return')]]
             ))

+ 6 - 6
route/list_admin_group.py

@@ -9,9 +9,9 @@ def list_admin_group_2():
 
         curs.execute(db_change("select distinct name from alist order by name asc"))
         for data in curs.fetchall():            
-            if  admin_check() == 1 and \
+            if  admin_check(conn) == 1 and \
                 not data[0] in org_acl_list:
-                delete_admin_group = ' <a href="/auth/list/delete/' + url_pas(data[0]) + '">(' + load_lang("delete") + ')</a>'
+                delete_admin_group = ' <a href="/auth/list/delete/' + url_pas(data[0]) + '">(' + get_lang(conn, "delete") + ')</a>'
             else:
                 delete_admin_group = ''
 
@@ -25,11 +25,11 @@ def list_admin_group_2():
         list_data += '' + \
             '</ul>' + \
             '<hr class="main_hr">' + \
-            '<a href="/manager/8">(' + load_lang('add') + ')</a>' + \
+            '<a href="/manager/8">(' + get_lang(conn, 'add') + ')</a>' + \
         ''
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('admin_group_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'admin_group_list'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = list_data,
-            menu = [['manager', load_lang('return')]]
+            menu = [['manager', get_lang(conn, 'return')]]
         ))

+ 8 - 8
route/list_image_file.py

@@ -8,9 +8,9 @@ def list_image_file(arg_num = 1, do_type = 0):
 
         list_data = ''
         if do_type == 0:
-            list_data += '<a href="/list/image">(' + load_lang('image') + ')</a>'
+            list_data += '<a href="/list/image">(' + get_lang(conn, 'image') + ')</a>'
         else:
-            list_data += '<a href="/list/file">(' + load_lang('normal') + ')</a>'
+            list_data += '<a href="/list/file">(' + get_lang(conn, 'normal') + ')</a>'
         
         list_data += '<hr class="main_hr">'
 
@@ -36,7 +36,7 @@ def list_image_file(arg_num = 1, do_type = 0):
                 render_data += '||\n'
                 render_data += sub_data + '||'
 
-            end_data = render_set(
+            end_data = render_set(conn, 
                 doc_name = '',
                 doc_data = render_data,
                 data_type = 'view',
@@ -54,12 +54,12 @@ def list_image_file(arg_num = 1, do_type = 0):
             list_data += '</ul>'
 
         if do_type == 0:
-            list_data += next_fix('/list/file/', arg_num, data_list)
+            list_data += next_fix(conn, '/list/file/', arg_num, data_list)
         else:
-            list_data += next_fix('/list/image/', arg_num, data_list)
+            list_data += next_fix(conn, '/list/image/', arg_num, data_list)
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('image_file_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'image_file_list'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = list_data,
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 4 - 4
route/list_long_page.py

@@ -23,10 +23,10 @@ def list_long_page(tool = 'long_page', arg_num = 1):
 
             div += '</li>'
 
-        div += '</ul>' + next_fix('/list/document/' + ('long' if title == 'long_page' else 'short') + '/', arg_num, n_list)
+        div += '</ul>' + next_fix(conn, '/list/document/' + ('long' if title == 'long_page' else 'short') + '/', arg_num, n_list)
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang(title), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, title), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = div,
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 4 - 4
route/list_no_link.py

@@ -21,10 +21,10 @@ def list_no_link(num = 1):
 
             div += '</li>'
         
-        div += '</ul>' + next_fix('/list/document/no_link/', num, n_list)
+        div += '</ul>' + next_fix(conn, '/list/document/no_link/', num, n_list)
         
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('no_link_document_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'no_link_document_list'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = div,
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 4 - 4
route/list_old_page.py

@@ -21,10 +21,10 @@ def list_old_page(num = 1):
 
             div += '</li>'
         
-        div += '</ul>' + next_fix('/list/document/old/', num, n_list)
+        div += '</ul>' + next_fix(conn, '/list/document/old/', num, n_list)
         
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('old_page'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'old_page'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = div,
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 4 - 4
route/list_please.py

@@ -18,10 +18,10 @@ def list_please(arg_num = 1):
                 '</li>' + \
             ''
 
-        div += '</ul>' + next_fix('/list/document/need/', arg_num, data_list)
+        div += '</ul>' + next_fix(conn, '/list/document/need/', arg_num, data_list)
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('need_document'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'need_document'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = div,
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 10 - 10
route/list_title_index.py

@@ -40,26 +40,26 @@ def list_title_index(num = 1):
                 data += '''
                     </ul>
                     <ul class="opennamu_ul">
-                        <li>''' + load_lang('all') + ' : ' + str(count_end[0]) + '''</li>
+                        <li>''' + get_lang(conn, 'all') + ' : ' + str(count_end[0]) + '''</li>
                     </ul>
                     <ul class="opennamu_ul">
-                        <li>''' + load_lang('category') + ' : ' + str(count_end[1]) + '''</li>
-                        <li>''' + load_lang('user_document') + ' : ' + str(count_end[2]) + '''</li>
-                        <li>''' + load_lang('file') + ' : ' + str(count_end[3]) + '''</li>
-                        <li>''' + load_lang('other') + ' : ' + str(count_end[4]) + '''</li>
+                        <li>''' + get_lang(conn, 'category') + ' : ' + str(count_end[1]) + '''</li>
+                        <li>''' + get_lang(conn, 'user_document') + ' : ' + str(count_end[2]) + '''</li>
+                        <li>''' + get_lang(conn, 'file') + ' : ' + str(count_end[3]) + '''</li>
+                        <li>''' + get_lang(conn, 'other') + ' : ' + str(count_end[4]) + '''</li>
                 '''
             else:
                 data += '''
                     </ul>
                     <ul class="opennamu_ul">
-                        <li>''' + load_lang('all') + ' : ' + all_title[0][0] + '''</li>
+                        <li>''' + get_lang(conn, 'all') + ' : ' + all_title[0][0] + '''</li>
                 '''
 
-        data += '</ul>' + next_fix('/list/document/all/', num, title_list)
+        data += '</ul>' + next_fix(conn, '/list/document/all/', num, title_list)
         sub = ' (' + str(num) + ')'
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('all_document_list'), wiki_set(), wiki_custom(), wiki_css([sub, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'all_document_list'), wiki_set(conn), wiki_custom(conn), wiki_css([sub, 0])],
             data = data,
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 5 - 5
route/list_user.py

@@ -13,14 +13,14 @@ def list_user(arg_num = 1):
         for data in user_list:
             list_data += '' + \
                 '<li>' + \
-                    ip_pas(data[0]) + (' (' + data[1] + ')' if data[1] != '' else '') + \
+                    ip_pas(conn, data[0]) + (' (' + data[1] + ')' if data[1] != '' else '') + \
                 '</li>' + \
             ''
 
-        list_data += '</ul>' + next_fix('/list/user/', arg_num, user_list)
+        list_data += '</ul>' + next_fix(conn, '/list/user/', arg_num, user_list)
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('member_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'member_list'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = list_data,
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 22 - 22
route/list_user_check.py

@@ -13,14 +13,14 @@ def list_user_check(name = 'test', plus_name = None, arg_num = 1, do_type = 'nor
         num = arg_num
         sql_num = (num * 50 - 50) if num * 50 > 0 else 0
 
-        if admin_check('all', None, name) == 1 or (plus_id and admin_check('all', None, plus_id) == 1):
-            if admin_check() != 1:
-                return re_error('/error/4')
+        if admin_check(conn, 'all', None, name) == 1 or (plus_id and admin_check(conn, 'all', None, plus_id) == 1):
+            if admin_check(conn) != 1:
+                return re_error(conn, '/error/4')
 
         div = ''
 
-        if admin_check(4, (check_type + ' ' if check_type != '' else '') + 'check (' + name + ')') != 1:
-            return re_error('/error/3')
+        if admin_check(conn, 4, (check_type + ' ' if check_type != '' else '') + 'check (' + name + ')') != 1:
+            return re_error(conn, '/error/3')
 
         if check_type == '':
             if ip_or_user(name) == 0:
@@ -68,7 +68,7 @@ def list_user_check(name = 'test', plus_name = None, arg_num = 1, do_type = 'nor
                     b_ip_count = len(curs.fetchall())
 
                     if a_ip_count + b_ip_count != all_ip_count:
-                        div += load_lang('same_ip_exist') + '<hr class="main_hr">'    
+                        div += get_lang(conn, 'same_ip_exist') + '<hr class="main_hr">'    
             else:
                 plus = ''
                 set_list = [name, sql_num]
@@ -84,8 +84,8 @@ def list_user_check(name = 'test', plus_name = None, arg_num = 1, do_type = 'nor
             if record:
                 if not plus_id:
                     div = '' + \
-                        '<a href="/manager/14/' + url_pas(name) + '">(' + load_lang('compare') + ')</a> ' + \
-                        '<a href="/list/user/check/' + url_pas(name) + '/simple">(' + load_lang('simple_check') + ')</a>' + \
+                        '<a href="/manager/14/' + url_pas(name) + '">(' + get_lang(conn, 'compare') + ')</a> ' + \
+                        '<a href="/list/user/check/' + url_pas(name) + '/simple">(' + get_lang(conn, 'simple_check') + ')</a>' + \
                         '<hr class="main_hr">' + \
                     '' + div
                 else:
@@ -99,9 +99,9 @@ def list_user_check(name = 'test', plus_name = None, arg_num = 1, do_type = 'nor
                     <table id="main_table_set">
                         <tbody>
                             <tr id="main_table_top_tr">
-                                <td id="main_table_width">''' + load_lang('name') + '''</td>
-                                <td id="main_table_width">''' + load_lang('ip') + '''</td>
-                                <td id="main_table_width">''' + load_lang('time') + '''</td>
+                                <td id="main_table_width">''' + get_lang(conn, 'name') + '''</td>
+                                <td id="main_table_width">''' + get_lang(conn, 'ip') + '''</td>
+                                <td id="main_table_width">''' + get_lang(conn, 'time') + '''</td>
                             </tr>
                 '''
 
@@ -124,7 +124,7 @@ def list_user_check(name = 'test', plus_name = None, arg_num = 1, do_type = 'nor
                             <td>
                                 <a href="/list/user/check/''' + url_pas(data[0]) + '''">''' + data[0] + '''</a>
                                 <a href="/list/user/check/delete/''' + url_pas(data[0]) + '/' + url_pas(data[1]) + '/' + url_pas(data[3]) + '/' + ('0' if ip_or_user(name) == 0 else '1') + '''">
-                                    (''' + load_lang('delete') + ''')
+                                    (''' + get_lang(conn, 'delete') + ''')
                                 </a>
                             </td>
                             <td><a href="/list/user/check/''' + url_pas(data[1]) + '''">''' + data[1] + '''</a></td>
@@ -141,13 +141,13 @@ def list_user_check(name = 'test', plus_name = None, arg_num = 1, do_type = 'nor
                 '''
 
             if plus_id:
-                div += get_next_page_bottom(
+                div += get_next_page_bottom(conn, 
                     '/list/user/check/' + url_pas(name) + '/normal/{}/' + url_pas(plus_id), 
                     num, 
                     record
                 )
             else:
-                div += next_fix(
+                div += next_fix(conn, 
                     '/list/user/check/' + url_pas(name) + '/normal/', 
                     num, 
                     record
@@ -156,10 +156,10 @@ def list_user_check(name = 'test', plus_name = None, arg_num = 1, do_type = 'nor
             if plus_id:
                 name += ', ' + plus_id
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('check') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'check') + ')', 0])],
                 data = div,
-                menu = [['manager', load_lang('return')]]
+                menu = [['manager', get_lang(conn, 'return')]]
             ))
         else:
             curs.execute(db_change("" + \
@@ -175,18 +175,18 @@ def list_user_check(name = 'test', plus_name = None, arg_num = 1, do_type = 'nor
 
             if div != '':
                 div = '<ul class="opennamu_ul">' + div + '</ul>'
-                div += next_fix(
+                div += next_fix(conn, 
                     '/list/user/check/' + url_pas(name) + '/' + check_type + '/', 
                     num, 
                     record
                 )
 
             div = '' + \
-                '<a href="/list/user/check/' + url_pas(name) + '/normal">(' + load_lang('check') + ')</a>' + \
+                '<a href="/list/user/check/' + url_pas(name) + '/normal">(' + get_lang(conn, 'check') + ')</a>' + \
             '' + div
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('simple_check') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'simple_check') + ')', 0])],
                 data = div,
-                menu = [['check/' + url_pas(name), load_lang('return')]]
+                menu = [['check/' + url_pas(name), get_lang(conn, 'return')]]
             ))

+ 11 - 11
route/list_user_check_delete.py

@@ -4,8 +4,8 @@ def list_user_check_delete(name = None, ip = None, time = None, do_type = 1):
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/error/4')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/4')
 
         user_id = name
         user_ip = ip
@@ -16,22 +16,22 @@ def list_user_check_delete(name = None, ip = None, time = None, do_type = 1):
                 curs.execute(db_change("delete from ua_d where name = ? and ip = ? and today = ?"), [user_id, user_ip, time])
                 conn.commit()
 
-                return redirect('/list/user/check/' + url_pas(user_id if return_type == '0' else user_ip))
+                return redirect(conn, '/list/user/check/' + url_pas(user_id if return_type == '0' else user_ip))
             else:
-                return easy_minify(flask.render_template(skin_check(),
-                    imp = [load_lang('check'), wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('delete') + ')', 0])],
+                return easy_minify(conn, flask.render_template(skin_check(conn),
+                    imp = [get_lang(conn, 'check'), wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'delete') + ')', 0])],
                     data = '''
-                        ''' + load_lang('name') + ''' : ''' + user_id + '''
+                        ''' + get_lang(conn, 'name') + ''' : ''' + user_id + '''
                         <hr class="main_hr">
-                        ''' + load_lang('ip') + ''' : ''' + user_ip + '''
+                        ''' + get_lang(conn, 'ip') + ''' : ''' + user_ip + '''
                         <hr class="main_hr">
-                        ''' + load_lang('time') + ''' : ''' + time + '''
+                        ''' + get_lang(conn, 'time') + ''' : ''' + time + '''
                         <hr class="main_hr">
                         <form method="post">
-                            <button type="submit">''' + load_lang('delete') + '''</button>
+                            <button type="submit">''' + get_lang(conn, 'delete') + '''</button>
                         </form>
                     ''',
-                    menu = [['check/' + url_pas(user_id if return_type == '0' else user_ip), load_lang('return')]]
+                    menu = [['check/' + url_pas(user_id if return_type == '0' else user_ip), get_lang(conn, 'return')]]
                 ))
         else:
-            return redirect()
+            return redirect(conn)

+ 5 - 5
route/login_find.py

@@ -2,13 +2,13 @@ from .tool.func import *
 
 def login_find():
     with get_db_connect() as conn:
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('password_search'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'password_search'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = '''
                 <ul class="opennamu_ul">
-                    <li><a href="/login/find/email">''' + load_lang('email') + '''</a></li>
-                    <li><a href="/login/find/key">''' + load_lang('key') + '''</a></li>
+                    <li><a href="/login/find/email">''' + get_lang(conn, 'email') + '''</a></li>
+                    <li><a href="/login/find/key">''' + get_lang(conn, 'key') + '''</a></li>
                 </ul>
             ''',
-            menu = [['user', load_lang('return')]]
+            menu = [['user', get_lang(conn, 'return')]]
         ))

+ 25 - 25
route/login_find_email.py

@@ -21,7 +21,7 @@ def login_find_email(tool):
                 flask.session['c_type'] = 'pass_find'
             else:
                 if not 'c_type' in flask.session:
-                    return redirect('/register')
+                    return redirect(conn, '/register')
         
             if tool != 'pass_find':
                 user_email = flask.request.form.get('email', '')
@@ -32,16 +32,16 @@ def login_find_email(tool):
                         for i in re_set_list:
                             flask.session.pop(i, None)
                         
-                        return redirect('/filter/email_filter')
+                        return redirect(conn, '/filter/email_filter')
                 else:
                     for i in re_set_list:
                         flask.session.pop(i, None)
                     
-                    return re_error('/error/36')
+                    return re_error(conn, '/error/36')
         
             curs.execute(db_change('select data from other where name = "email_title"'))
             sql_d = curs.fetchall()
-            t_text = html.escape(sql_d[0][0]) if sql_d and sql_d[0][0] != '' else (wiki_set()[0] + ' key')
+            t_text = html.escape(sql_d[0][0]) if sql_d and sql_d[0][0] != '' else (wiki_set(conn)[0] + ' key')
         
             curs.execute(db_change('select data from other where name = "email_text"'))
             sql_d = curs.fetchall()
@@ -50,67 +50,67 @@ def login_find_email(tool):
             if tool == 'pass_find':
                 curs.execute(db_change("select id from user_set where id = ? and name = 'email' and data = ?"), [user_id, user_email])
                 if not curs.fetchall():
-                    return re_error('/error/12')
+                    return re_error(conn, '/error/12')
                     
-                if send_email(user_email, t_text, i_text) == 0:
-                    return re_error('/error/18')
+                if send_email(conn, user_email, t_text, i_text) == 0:
+                    return re_error(conn, '/error/18')
         
-                return redirect('/pass_find/email')
+                return redirect(conn, '/pass_find/email')
             else:
                 curs.execute(db_change('select id from user_set where name = "email" and data = ?'), [user_email])
                 if curs.fetchall():
                     for i in re_set_list:
                         flask.session.pop(i, None)
         
-                    return re_error('/error/35')
+                    return re_error(conn, '/error/35')
                 
-                if send_email(user_email, t_text, i_text) == 0:
+                if send_email(conn, user_email, t_text, i_text) == 0:
                     for i in re_set_list:
                         flask.session.pop(i, None)
         
-                    return re_error('/error/18')
+                    return re_error(conn, '/error/18')
         
                 flask.session['c_email'] = user_email
         
-                return redirect('/pass_find/email')
+                return redirect(conn, '/pass_find/email')
         else:
             if tool == 'pass_find':
                 curs.execute(db_change('select data from other where name = "password_search_text"'))
                 sql_d = curs.fetchall()
                 b_text = (sql_d[0][0] + '<hr class="main_hr">') if sql_d and sql_d[0][0] != '' else ''
         
-                return easy_minify(flask.render_template(skin_check(),
-                    imp = [load_lang('password_search'), wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('email') + ')', 0])],
+                return easy_minify(conn, flask.render_template(skin_check(conn),
+                    imp = [get_lang(conn, 'password_search'), wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'email') + ')', 0])],
                     data = b_text + '''
                         <form method="post">
-                            <input placeholder="''' + load_lang('id') + '''" name="id" type="text">
+                            <input placeholder="''' + get_lang(conn, 'id') + '''" name="id" type="text">
                             <hr class="main_hr">
-                            <input placeholder="''' + load_lang('email') + '''" name="email" type="text">
+                            <input placeholder="''' + get_lang(conn, 'email') + '''" name="email" type="text">
                             <hr class="main_hr">
-                            <button type="submit">''' + load_lang('save') + '''</button>
+                            <button type="submit">''' + get_lang(conn, 'save') + '''</button>
                         </form>
                     ''',
-                    menu = [['user', load_lang('return')]]
+                    menu = [['user', get_lang(conn, 'return')]]
                 ))
             else:
                 if tool == 'need_email' and not 'c_type' in flask.session:
-                    return redirect('/register')
+                    return redirect(conn, '/register')
         
                 curs.execute(db_change('select data from other where name = "email_insert_text"'))
                 sql_d = curs.fetchall()
                 b_text = (sql_d[0][0] + '<hr class="main_hr">') if sql_d and sql_d[0][0] != '' else ''
         
-                return easy_minify(flask.render_template(skin_check(),
-                    imp = [load_lang('email'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                return easy_minify(conn, flask.render_template(skin_check(conn),
+                    imp = [get_lang(conn, 'email'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                     data = '''
-                        <a href="/filter/email_filter">(''' + load_lang('email_filter_list') + ''')</a>
+                        <a href="/filter/email_filter">(''' + get_lang(conn, 'email_filter_list') + ''')</a>
                         <hr class="main_hr">
                         ''' + b_text + '''
                         <form method="post">
-                            <input placeholder="''' + load_lang('email') + '''" name="email" type="text">
+                            <input placeholder="''' + get_lang(conn, 'email') + '''" name="email" type="text">
                             <hr class="main_hr">
-                            <button type="submit">''' + load_lang('save') + '''</button>
+                            <button type="submit">''' + get_lang(conn, 'save') + '''</button>
                         </form>
                     ''',
-                    menu = [['user', load_lang('return')]]
+                    menu = [['user', get_lang(conn, 'return')]]
                 ))

+ 17 - 17
route/login_find_email_check.py

@@ -17,7 +17,7 @@ def login_find_email_check(tool):
                 user_id = flask.session['c_id']
                 user_pw = flask.session['c_key']
             
-                curs.execute(db_change("update user_set set data = ? where name = 'pw' and id = ?"), [pw_encode(user_pw), user_id])
+                curs.execute(db_change("update user_set set data = ? where name = 'pw' and id = ?"), [pw_encode(conn, user_pw), user_id])
                 
                 curs.execute(db_change('select data from user_set where name = "2fa" and id = ?'), [user_id])
                 if curs.fetchall():
@@ -32,15 +32,15 @@ def login_find_email_check(tool):
 
                 conn.commit()
         
-                return easy_minify(flask.render_template(skin_check(),
-                    imp = [load_lang('reset_user_ok'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                return easy_minify(conn, flask.render_template(skin_check(conn),
+                    imp = [get_lang(conn, 'reset_user_ok'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                     data = '' + \
                         b_text + \
-                        load_lang('id') + ' : ' + user_id + \
+                        get_lang(conn, 'id') + ' : ' + user_id + \
                         '<hr class="main_hr">' + \
-                        load_lang('password') + ' : ' + user_pw + \
+                        get_lang(conn, 'password') + ' : ' + user_pw + \
                     '',
-                    menu = [['user', load_lang('return')]]
+                    menu = [['user', get_lang(conn, 'return')]]
                 ))
             elif 'c_type' in flask.session and (flask.session['c_key'] == input_key or flask.session['c_key'] == 'email_pass'):
                 curs.execute(db_change('select data from other where name = "encode"'))
@@ -58,14 +58,14 @@ def login_find_email_check(tool):
                         for i in re_set_list:
                             flask.session.pop(i, None)
         
-                        return re_error('/error/8')
+                        return re_error(conn, '/error/8')
                 
                     curs.execute(db_change("select id from user_set where id = ? and name = 'application'"), [flask.session['c_id']])
                     if curs.fetchall():
                         for i in re_set_list:
                             flask.session.pop(i, None)
         
-                        return re_error('/error/8')
+                        return re_error(conn, '/error/8')
         
                     curs.execute(db_change('select data from other where name = "requires_approval"'))
                     requires_approval = curs.fetchall()
@@ -87,7 +87,7 @@ def login_find_email_check(tool):
                         for i in re_set_list:
                             flask.session.pop(i, None)
         
-                        return redirect('/application_submitted')
+                        return redirect(conn, '/application_submitted')
                     else:
                         if first == 0:
                             user_auth = 'user'
@@ -100,7 +100,7 @@ def login_find_email_check(tool):
                         curs.execute(db_change("insert into user_set (id, name, data) values (?, 'encode', ?)"), [flask.session['c_id'], db_data[0][0]])
         
                     curs.execute(db_change("insert into user_set (name, id, data) values ('email', ?, ?)"), [flask.session['c_id'], flask.session['c_email']])
-                    ua_plus(flask.session['c_id'], ip, user_agent, get_time())
+                    ua_plus(conn, flask.session['c_id'], ip, user_agent, get_time())
         
                     flask.session['id'] = flask.session['c_id']
                     flask.session['head'] = ''
@@ -115,26 +115,26 @@ def login_find_email_check(tool):
                 for i in re_set_list:
                     flask.session.pop(i, None)
         
-                return redirect('/change') if first == 0 else redirect('/setting') 
+                return redirect(conn, '/change') if first == 0 else redirect(conn, '/setting') 
             else:
                 for i in re_set_list:
                     flask.session.pop(i, None)
         
-                return redirect('/user')
+                return redirect(conn, '/user')
         else:
             curs.execute(db_change('select data from other where name = "check_key_text"'))
             sql_d = curs.fetchall()
             b_text = (sql_d[0][0] + '<hr class="main_hr">') if sql_d and sql_d[0][0] != '' else ''
         
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('check_key'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'check_key'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
                         ''' + b_text + '''
-                        <input placeholder="''' + load_lang('key') + '''" name="key" type="password">
+                        <input placeholder="''' + get_lang(conn, 'key') + '''" name="key" type="password">
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('save') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['user', load_lang('return')]]
+                menu = [['user', get_lang(conn, 'return')]]
             ))

+ 16 - 16
route/login_find_key.py

@@ -4,22 +4,22 @@ def login_find_key():
     with get_db_connect() as conn:
         curs = conn.cursor()
         if flask.request.method == 'POST':
-            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                return re_error('/error/13')
+            if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error(conn, '/error/13')
             else:
-                captcha_post('', 0)
+                captcha_post(conn, '', 0)
             
             input_key = flask.request.form.get('key', '')
             curs.execute(db_change('select id from user_set where name = "random_key" and data = ?'), [input_key])
             db_data = curs.fetchall()
             if not db_data:
-                return redirect('/user')
+                return redirect(conn, '/user')
             else:
                 user_id = db_data[0][0]
             
             key = load_random_key(32)
             curs.execute(db_change("update user_set set data = ? where name = 'pw' and id = ?"), [
-                pw_encode(key), 
+                pw_encode(conn, key), 
                 user_id
             ])
             
@@ -31,26 +31,26 @@ def login_find_key():
             sql_d = curs.fetchall()
             b_text = (sql_d[0][0] + '<hr class="main_hr">') if sql_d and sql_d[0][0] != '' else ''
             
-            return easy_minify(flask.render_template(skin_check(),
-                    imp = [load_lang('reset_user_ok'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                    imp = [get_lang(conn, 'reset_user_ok'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                     data = '' + \
                         b_text + \
-                        load_lang('id') + ' : ' + user_id + \
+                        get_lang(conn, 'id') + ' : ' + user_id + \
                         '<hr class="main_hr">' + \
-                        load_lang('password') + ' : ' + key + \
+                        get_lang(conn, 'password') + ' : ' + key + \
                     '',
-                    menu = [['user', load_lang('return')]]
+                    menu = [['user', get_lang(conn, 'return')]]
                 ))
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('password_search'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'password_search'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
-                        <input placeholder="''' + load_lang('key') + '''" name="key" type="password">
+                        <input placeholder="''' + get_lang(conn, 'key') + '''" name="key" type="password">
                         <hr class="main_hr">
-                        ''' + captcha_get() + '''
-                        <button type="submit">''' + load_lang('send') + '''</button>
+                        ''' + captcha_get(conn) + '''
+                        <button type="submit">''' + get_lang(conn, 'send') + '''</button>
                     </form>
                 ''',
-                menu = [['user', load_lang('return')]]
+                menu = [['user', get_lang(conn, 'return')]]
             ))

+ 22 - 22
route/login_login.py

@@ -6,19 +6,19 @@ def login_login_2():
 
         ip = ip_check()
         if ip_or_user(ip) == 0:
-            return redirect('/user')
+            return redirect(conn, '/user')
 
-        if ban_check(None, 'login')[0] == 1:
-            return re_error('/ban')
+        if ban_check(conn, None, 'login')[0] == 1:
+            return re_error(conn, '/ban')
 
         if flask.request.method == 'POST':
             if 'login_count' in flask.session:
                 count = int(number_check(flask.session['login_count']))
                 if count > 3:
-                    if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                        return re_error('/error/13')
+                    if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                        return re_error(conn, '/error/13')
                     else:
-                        captcha_post('', 0)
+                        captcha_post(conn, '', 0)
 
             user_agent = flask.request.headers.get('User-Agent', '')
             user_id = flask.request.form.get('id', '')
@@ -27,59 +27,59 @@ def login_login_2():
             curs.execute(db_change("select data from user_set where id = ? and name = 'pw'"), [user_id])
             db_data = curs.fetchall()
             if not db_data:
-                return re_error('/error/2')
+                return re_error(conn, '/error/2')
             else:
                 db_user_pw = db_data[0][0]
                 
             curs.execute(db_change("select data from user_set where id = ? and name = 'encode'"), [user_id])
             db_data = curs.fetchall()
             if not db_data:
-                return re_error('/error/2')
+                return re_error(conn, '/error/2')
             else:
                 db_user_encode = db_data[0][0]
 
-            if pw_check(user_pw, db_user_pw, db_user_encode, user_id) != 1:
+            if pw_check(conn, user_pw, db_user_pw, db_user_encode, user_id) != 1:
                 if not 'login_count' in flask.session:
                     flask.session['login_count'] = 1
                 else:
                     flask.session['login_count'] = int(number_check(flask.session['login_count'])) + 1
 
-                return re_error('/error/10')
+                return re_error(conn, '/error/10')
 
             curs.execute(db_change('select data from user_set where name = "2fa" and id = ?'), [user_id])
             fa_data = curs.fetchall()
             if fa_data and fa_data[0][0] != '':
                 flask.session['login_id'] = user_id
 
-                return redirect('/login/2fa')
+                return redirect(conn, '/login/2fa')
             else:
                 flask.session['id'] = user_id
 
-                ua_plus(user_id, ip, user_agent, get_time())
+                ua_plus(conn, user_id, ip, user_agent, get_time())
                 conn.commit()
 
-                return redirect('/user')
+                return redirect(conn, '/user')
         else:
             captcha_data = ''
             if 'login_count' in flask.session:
                 count = int(number_check(flask.session['login_count']))
                 if count > 3:
-                    captcha_data = captcha_get()
+                    captcha_data = captcha_get(conn)
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('login'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'login'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data =  '''
                         <form method="post">
-                            <input placeholder="''' + load_lang('id') + '''" name="id" type="text">
+                            <input placeholder="''' + get_lang(conn, 'id') + '''" name="id" type="text">
                             <hr class="main_hr">
-                            <input placeholder="''' + load_lang('password') + '''" name="pw" type="password">
+                            <input placeholder="''' + get_lang(conn, 'password') + '''" name="pw" type="password">
                             <hr class="main_hr">
-                            <!-- <input type="checkbox" name="auto_login"> ''' + load_lang('auto_login') + ''' (''' + load_lang('not_working') + ''')
+                            <!-- <input type="checkbox" name="auto_login"> ''' + get_lang(conn, 'auto_login') + ''' (''' + get_lang(conn, 'not_working') + ''')
                             <hr class="main_hr"> -->
                             ''' + captcha_data + '''
-                            <button type="submit">''' + load_lang('login') + '''</button>
-                            ''' + http_warning() + '''
+                            <button type="submit">''' + get_lang(conn, 'login') + '''</button>
+                            ''' + http_warning(conn) + '''
                         </form>
                         ''',
-                menu = [['user', load_lang('return')]]
+                menu = [['user', get_lang(conn, 'return')]]
             ))

+ 18 - 18
route/login_login_2fa.py

@@ -8,20 +8,20 @@ def login_login_2fa_2():
         # pw 2fa
         # q_a 2fa
         if not (flask.session and 'login_id' in flask.session):
-            return redirect('/user')
+            return redirect(conn, '/user')
 
         ip = ip_check()
         if ip_or_user(ip) == 0:
-            return redirect('/user')
+            return redirect(conn, '/user')
 
-        if ban_check(None, 'login')[0] == 1:
-            return re_error('/ban')
+        if ban_check(conn, None, 'login')[0] == 1:
+            return re_error(conn, '/ban')
 
         if flask.request.method == 'POST':
-            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                return re_error('/error/13')
+            if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error(conn, '/error/13')
             else:
-                captcha_post('', 0)
+                captcha_post(conn, '', 0)
 
             user_agent = flask.request.headers.get('User-Agent', '')
             user_id = flask.session['login_id']
@@ -34,13 +34,13 @@ def login_login_2fa_2():
                 user_1 = user_1[0][0]
                 user_2 = curs.fetchall()[0][0]
 
-                pw_check_d = pw_check(user_pw, user_1, user_2, user_id)
+                pw_check_d = pw_check(conn, user_pw, user_1, user_2, user_id)
                 if pw_check_d != 1:
-                    return re_error('/error/10')
+                    return re_error(conn, '/error/10')
 
             flask.session['id'] = user_id
 
-            ua_plus(
+            ua_plus(conn, 
                 user_id, 
                 ip, 
                 user_agent, 
@@ -50,18 +50,18 @@ def login_login_2fa_2():
 
             flask.session.pop('b_id', None)
 
-            return redirect('/user')
+            return redirect(conn, '/user')
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('login'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'login'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data =  '''
                         <form method="post">
-                            <input placeholder="''' + load_lang('2fa_password') + '''" name="pw" type="password">
+                            <input placeholder="''' + get_lang(conn, '2fa_password') + '''" name="pw" type="password">
                             <hr class="main_hr">
-                            ''' + captcha_get() + '''
-                            <button type="submit">''' + load_lang('login') + '''</button>
-                            ''' + http_warning() + '''
+                            ''' + captcha_get(conn) + '''
+                            <button type="submit">''' + get_lang(conn, 'login') + '''</button>
+                            ''' + http_warning(conn) + '''
                         </form>
                         ''',
-                menu = [['user', load_lang('return')]]
+                menu = [['user', get_lang(conn, 'return')]]
             ))

+ 18 - 18
route/login_login_2fa_email.py

@@ -8,20 +8,20 @@ def login_login_2fa_email_2():
         # pw 2fa
         # q_a 2fa
         if not (flask.session and 'login_id' in flask.session):
-            return redirect('/user')
+            return redirect(conn, '/user')
 
         ip = ip_check()
         if ip_or_user(ip) == 0:
-            return redirect('/user')
+            return redirect(conn, '/user')
 
-        if ban_check(None, 'login')[0] == 1:
-            return re_error('/ban')
+        if ban_check(conn, None, 'login')[0] == 1:
+            return re_error(conn, '/ban')
 
         if flask.request.method == 'POST':
-            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                return re_error('/error/13')
+            if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error(conn, '/error/13')
             else:
-                captcha_post('', 0)
+                captcha_post(conn, '', 0)
 
             user_agent = flask.request.headers.get('User-Agent', '')
             user_id = flask.session['b_id']
@@ -34,29 +34,29 @@ def login_login_2fa_email_2():
                 user_1 = user_1[0][0]
                 user_2 = curs.fetchall()[0][0]
 
-                pw_check_d = pw_check(user_pw, user_1, user_2, user_id)
+                pw_check_d = pw_check(conn, user_pw, user_1, user_2, user_id)
                 if pw_check_d != 1:
-                    return re_error('/error/10')
+                    return re_error(conn, '/error/10')
 
             flask.session['id'] = user_id
 
-            ua_plus(user_id, ip, user_agent, get_time())
+            ua_plus(conn, user_id, ip, user_agent, get_time())
             conn.commit()
 
             flask.session.pop('b_id', None)
 
-            return redirect('/user')
+            return redirect(conn, '/user')
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('login'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'login'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data =  '''
                         <form method="post">
-                            <input placeholder="''' + load_lang('2fa_password') + '''" name="pw" type="password">
+                            <input placeholder="''' + get_lang(conn, '2fa_password') + '''" name="pw" type="password">
                             <hr class=\"main_hr\">
-                            ''' + captcha_get() + '''
-                            <button type="submit">''' + load_lang('login') + '''</button>
-                            ''' + http_warning() + '''
+                            ''' + captcha_get(conn) + '''
+                            <button type="submit">''' + get_lang(conn, 'login') + '''</button>
+                            ''' + http_warning(conn) + '''
                         </form>
                         ''',
-                menu = [['user', load_lang('return')]]
+                menu = [['user', get_lang(conn, 'return')]]
             ))

+ 1 - 1
route/login_logout.py

@@ -5,4 +5,4 @@ def login_logout():
         flask.session.pop('state', None)
         flask.session.pop('id', None)
 
-        return redirect('/user')
+        return redirect(conn, '/user')

+ 27 - 27
route/login_register.py

@@ -4,26 +4,26 @@ def login_register_2():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if ban_check(None, 'login')[0] == 1:
-            return re_error('/ban')
+        if ban_check(conn, None, 'login')[0] == 1:
+            return re_error(conn, '/ban')
 
         ip = ip_check()
-        admin = admin_check()
+        admin = admin_check(conn)
         if admin != 1 and ip_or_user(ip) == 0:
-            return redirect('/user')
+            return redirect(conn, '/user')
 
         if admin != 1:
             curs.execute(db_change('select data from other where name = "reg"'))
             set_d = curs.fetchall()
             if set_d and set_d[0][0] == 'on':
-                return re_error('/ban')
+                return re_error(conn, '/ban')
 
         if flask.request.method == 'POST':
             # 리캡차
-            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-                return re_error('/error/13')
+            if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error(conn, '/error/13')
             else:
-                captcha_post('', 0)
+                captcha_post(conn, '', 0)
 
             user_id = flask.request.form.get('id', '')
             user_pw = flask.request.form.get('pw', '')
@@ -31,10 +31,10 @@ def login_register_2():
 
             # PW 검증
             if user_id == '' or user_pw == '':
-                return re_error('/error/27')
+                return re_error(conn, '/error/27')
 
             if user_pw != user_repeat:
-                return re_error('/error/20')
+                return re_error(conn, '/error/20')
 
             # PW 길이 제한
             curs.execute(db_change("select data from other where name = 'password_min_length'"))
@@ -42,10 +42,10 @@ def login_register_2():
             if db_data and db_data[0][0] != '':
                 password_min_length = int(number_check(db_data[0][0]))
                 if password_min_length > len(user_pw):
-                    return re_error('/error/40')
+                    return re_error(conn, '/error/40')
 
-            if do_user_name_check(user_id) == 1:
-                return re_error('/error/8')
+            if do_user_name_check(conn, user_id) == 1:
+                return re_error(conn, '/error/8')
 
             if admin != 1:
                 # 이메일 필요시 /register/email로 발송
@@ -56,7 +56,7 @@ def login_register_2():
                     flask.session['reg_id'] = user_id
                     flask.session['reg_pw'] = user_pw
 
-                    return redirect('/register/email')
+                    return redirect(conn, '/register/email')
 
                 # 가입 승인 필요시 /register/submit으로 발송
                 curs.execute(db_change('select data from other where name = "requires_approval"'))
@@ -65,14 +65,14 @@ def login_register_2():
                     flask.session['submit_id'] = user_id
                     flask.session['submit_pw'] = user_pw
 
-                    return redirect('/register/submit')
+                    return redirect(conn, '/register/submit')
 
             # 전부 아니면 바로 가입 후 /login으로 발송
-            add_user(user_id, user_pw)
+            add_user(conn, user_id, user_pw)
 
             conn.commit()
 
-            return redirect('/login')
+            return redirect(conn, '/login')
         else:
             curs.execute(db_change('select data from other where name = "contract"'))
             data = curs.fetchall()
@@ -81,31 +81,31 @@ def login_register_2():
             curs.execute(db_change("select data from other where name = 'password_min_length'"))
             db_data = curs.fetchall()
             if db_data and db_data[0][0] != '':
-                password_min_length = ' (' + load_lang('password_min_length') + ' : ' + db_data[0][0] + ')'
+                password_min_length = ' (' + get_lang(conn, 'password_min_length') + ' : ' + db_data[0][0] + ')'
             else:
                 password_min_length = ''
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('register'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'register'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
                         ''' + contract + '''
 
-                        <input placeholder="''' + load_lang('id') + '''" name="id" type="text">
+                        <input placeholder="''' + get_lang(conn, 'id') + '''" name="id" type="text">
                         <hr class="main_hr">
 
-                        <input placeholder="''' + load_lang('password') + password_min_length + '''" name="pw" type="password">
+                        <input placeholder="''' + get_lang(conn, 'password') + password_min_length + '''" name="pw" type="password">
                         <hr class="main_hr">
 
-                        <input placeholder="''' + load_lang('password_confirm') + '''" name="pw2" type="password">
+                        <input placeholder="''' + get_lang(conn, 'password_confirm') + '''" name="pw2" type="password">
                         <hr class="main_hr">
 
-                        ''' + captcha_get() + '''
+                        ''' + captcha_get(conn) + '''
 
-                        <button type="submit">''' + load_lang('save') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'save') + '''</button>
 
-                        ''' + http_warning() + '''
+                        ''' + http_warning(conn) + '''
                     </form>
                 ''',
-                menu = [['user', load_lang('return')]]
+                menu = [['user', get_lang(conn, 'return')]]
             ))

+ 13 - 13
route/login_register_email.py

@@ -5,7 +5,7 @@ def login_register_email_2():
         curs = conn.cursor()
 
         if not 'reg_id' in flask.session:
-            return redirect('/register')
+            return redirect(conn, '/register')
 
         if flask.request.method == 'POST':
             flask.session['reg_key'] = load_random_key(32)
@@ -19,14 +19,14 @@ def login_register_email_2():
                     "select html from html_filter where html = ? and kind = 'email'"
                 ), [email_data])
                 if not curs.fetchall():                
-                    return redirect('/filter/email_filter')
+                    return redirect(conn, '/filter/email_filter')
 
             curs.execute(db_change('select data from other where name = "email_title"'))
             sql_d = curs.fetchall()
             if sql_d and sql_d[0][0] != '':
                 t_text = html.escape(sql_d[0][0])
             else:
-                t_text = wiki_set()[0] + ' key'
+                t_text = wiki_set(conn)[0] + ' key'
 
             curs.execute(db_change('select data from other where name = "email_text"'))
             sql_d = curs.fetchall()
@@ -38,30 +38,30 @@ def login_register_email_2():
 
             curs.execute(db_change('select id from user_set where name = "email" and data = ?'), [user_email])
             if curs.fetchall():
-                return re_error('/error/35')
+                return re_error(conn, '/error/35')
 
-            if send_email(user_email, t_text, i_text) == 0:
-                return re_error('/error/18')
+            if send_email(conn, user_email, t_text, i_text) == 0:
+                return re_error(conn, '/error/18')
 
             flask.session['reg_email'] = user_email
 
-            return redirect('/register/email/check')
+            return redirect(conn, '/register/email/check')
         else:
             curs.execute(db_change('select data from other where name = "email_insert_text"'))
             sql_d = curs.fetchall()
             b_text = (sql_d[0][0] + '<hr class="main_hr">') if sql_d and sql_d[0][0] != '' else ''
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('email'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'email'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
-                    <a href="/filter/email_filter">(''' + load_lang('email_filter_list') + ''')</a>
+                    <a href="/filter/email_filter">(''' + get_lang(conn, 'email_filter_list') + ''')</a>
                     <hr class="main_hr">
                     ''' + b_text + '''
                     <form method="post">
-                        <input placeholder="''' + load_lang('email') + '''" name="email" type="text">
+                        <input placeholder="''' + get_lang(conn, 'email') + '''" name="email" type="text">
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('save') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['user', load_lang('return')]]
+                menu = [['user', get_lang(conn, 'return')]]
             ))

+ 10 - 10
route/login_register_email_check.py

@@ -5,13 +5,13 @@ def login_register_email_check_2():
         curs = conn.cursor()
 
         if not 'reg_email' in flask.session:
-            return redirect('/register')
+            return redirect(conn, '/register')
 
         if  flask.request.method == 'POST':
             input_key = flask.request.form.get('key', '')
 
             if flask.session['reg_key'] != input_key:
-                return redirect('/register')
+                return redirect(conn, '/register')
 
             curs.execute(db_change('select data from other where name = "requires_approval"'))
             sql_data = curs.fetchall()
@@ -20,29 +20,29 @@ def login_register_email_check_2():
                 flask.session['submit_pw'] = flask.session['reg_pw']
                 flask.session['submit_email'] = flask.session['reg_email']
 
-                return redirect('/register/submit')
+                return redirect(conn, '/register/submit')
 
-            add_user(
+            add_user(conn, 
                 flask.session['reg_id'],
                 flask.session['reg_pw'],
                 flask.session['reg_email']
             )
 
-            return redirect('/login')
+            return redirect(conn, '/login')
         else:
             curs.execute(db_change('select data from other where name = "check_key_text"'))
             sql_d = curs.fetchall()
             b_text = (sql_d[0][0] + '<hr class="main_hr">') if sql_d and sql_d[0][0] != '' else ''
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('check_key'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'check_key'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
                         ''' + b_text + '''
-                        <input placeholder="''' + load_lang('key') + '''" name="key" type="text">
+                        <input placeholder="''' + get_lang(conn, 'key') + '''" name="key" type="text">
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('save') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['user', load_lang('return')]]
+                menu = [['user', get_lang(conn, 'return')]]
             ))

+ 14 - 14
route/login_register_submit.py

@@ -10,7 +10,7 @@ def login_register_submit_2():
             for for_a in session_reset_list:
                 flask.session.pop(for_a, None)
 
-            return redirect('/register')
+            return redirect(conn, '/register')
 
         curs.execute(db_change('select data from other where name = "approval_question"'))
         sql_data = curs.fetchall()
@@ -18,15 +18,15 @@ def login_register_submit_2():
             for for_a in session_reset_list:
                 flask.session.pop(for_a, None)
 
-            return redirect('/register')
+            return redirect(conn, '/register')
 
         data_que = sql_data[0][0]
 
-        if do_user_name_check(flask.session['submit_id']) == 1:
+        if do_user_name_check(conn, flask.session['submit_id']) == 1:
             for for_a in session_reset_list:
                 flask.session.pop(for_a, None)
         
-            return redirect('/register')
+            return redirect(conn, '/register')
 
         if flask.request.method == 'POST':
             curs.execute(db_change('select data from other where name = "encode"'))
@@ -35,7 +35,7 @@ def login_register_submit_2():
 
             user_app_data = {}
             user_app_data['id'] = flask.session['submit_id']
-            user_app_data['pw'] = pw_encode(flask.session['submit_pw'])
+            user_app_data['pw'] = pw_encode(conn, flask.session['submit_pw'])
             user_app_data['encode'] = data_encode
             user_app_data['question'] = data_que
             user_app_data['answer'] = flask.request.form.get('answer', '')
@@ -51,21 +51,21 @@ def login_register_submit_2():
             curs.execute(db_change("insert into user_set (id, name, data) values (?, ?, ?)"), [user_app_data['id'], 'application', json.dumps(user_app_data)])
             conn.commit()
 
-            for for_a in get_admin_list():
-                add_alarm(for_a, user_app_data['id'], '<a href="/app_submit">' + load_lang('new_application') + '</a>')
+            for for_a in get_admin_list(conn):
+                add_alarm(conn, for_a, user_app_data['id'], '<a href="/app_submit">' + get_lang(conn, 'new_application') + '</a>')
 
-            return re_error('/error/43')
+            return re_error(conn, '/error/43')
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('approval_question'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'approval_question'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
-                        ''' + load_lang('approval_question') + ' : ' + data_que + '''
+                        ''' + get_lang(conn, 'approval_question') + ' : ' + data_que + '''
                         <hr class="main_hr">
-                        <input placeholder="''' + load_lang('approval_question') + '''" name="answer">
+                        <input placeholder="''' + get_lang(conn, 'approval_question') + '''" name="answer">
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('save') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['user', load_lang('return')]]
+                menu = [['user', get_lang(conn, 'return')]]
             ))

+ 1 - 1
route/main_func_error_404.py

@@ -11,4 +11,4 @@ def main_func_error_404(e = ''):
             db_data = curs.fetchall()
             db_data = db_data[0][0] if db_data and db_data[0][0] != '' else 'FrontPage'
             
-            return redirect('/w/' + url_pas(db_data))
+            return redirect(conn, '/w/' + url_pas(db_data))

+ 1 - 1
route/main_search.py

@@ -2,4 +2,4 @@ from .tool.func import *
 
 def main_search():
     with get_db_connect() as conn:
-        return redirect('/search/' + url_pas(flask.request.form.get('search', 'test')))
+        return redirect(conn, '/search/' + url_pas(flask.request.form.get('search', 'test')))

+ 10 - 10
route/main_search_deep.py

@@ -7,28 +7,28 @@ def main_search_deep(db_set, name = 'Test', search_type = 'title', num = 1):
         curs = conn.cursor()
 
         if name == '':
-            return redirect()
+            return redirect(conn)
 
         sql_num = (num * 50 - 50) if num * 50 > 0 else 0
 
         if flask.request.method == 'POST':
             if search_type == 'title':
-                return redirect('/search_page/1/' + url_pas(flask.request.form.get('search', 'test')))
+                return redirect(conn, '/search_page/1/' + url_pas(flask.request.form.get('search', 'test')))
             else:
-                return redirect('/search_data_page/1/' + url_pas(flask.request.form.get('search', 'test')))
+                return redirect(conn, '/search_data_page/1/' + url_pas(flask.request.form.get('search', 'test')))
         else:
             div = '''
                 <form method="post">
                     <input class="opennamu_width_200" name="search" value="''' + html.escape(name) + '''">
-                    <button type="submit">''' + load_lang('search') + '''</button>
+                    <button type="submit">''' + get_lang(conn, 'search') + '''</button>
                 </form>
                 <hr class="main_hr">
             '''
 
             if search_type == 'title':
-                div += '<a href="/search_data_page/1/' + url_pas(name) + '">(' + load_lang('search_document_data') + ')</a>'
+                div += '<a href="/search_data_page/1/' + url_pas(name) + '">(' + get_lang(conn, 'search_document_data') + ')</a>'
             else:
-                div += '<a href="/search_page/1/' + url_pas(name) + '">(' + load_lang('search_document_name') + ')</a>'
+                div += '<a href="/search_page/1/' + url_pas(name) + '">(' + get_lang(conn, 'search_document_name') + ')</a>'
 
             name_new = ''
             if re.search(r'^분류:', name):
@@ -60,12 +60,12 @@ def main_search_deep(db_set, name = 'Test', search_type = 'title', num = 1):
             div += '</ul>'
             
             if search_type == 'title':
-                div += get_next_page_bottom('/search_page/{}/' + url_pas(name), num, all_list)
+                div += get_next_page_bottom(conn, '/search_page/{}/' + url_pas(name), num, all_list)
             else:
-                div += get_next_page_bottom('/search_data_page/{}/' + url_pas(name), num, all_list)
+                div += get_next_page_bottom(conn, '/search_data_page/{}/' + url_pas(name), num, all_list)
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('search') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'search') + ')', 0])],
                 data = div,
                 menu = 0
             ))

+ 2 - 2
route/main_search_goto.py

@@ -12,6 +12,6 @@ def main_search_goto(name = 'Test'):
         curs.execute(db_change("select title from data where title = ? collate nocase"), [data])
         db_data = curs.fetchall()
         if db_data:
-            return redirect('/w/' + url_pas(db_data[0][0]))
+            return redirect(conn, '/w/' + url_pas(db_data[0][0]))
         else:
-            return redirect('/search/' + url_pas(data))
+            return redirect(conn, '/search/' + url_pas(data))

+ 14 - 14
route/main_setting.py

@@ -3,23 +3,23 @@ from .tool.func import *
 def main_setting():
     with get_db_connect() as conn:
         li_list = [
-            ['main', load_lang('main_setting')],
-            ['phrase', load_lang('text_setting')],
+            ['main', get_lang(conn, 'main_setting')],
+            ['phrase', get_lang(conn, 'text_setting')],
             ['robot', 'robots.txt'],
-            ['external', load_lang('ext_api_req_set')],
-            ['head', load_lang('main_head')],
-            ['body/top', load_lang('main_body')],
-            ['body/bottom', load_lang('main_bottom_body')],
-            ['sitemap_set', load_lang('sitemap_management')],
-            ['top_menu', load_lang('top_menu_setting')],
-            ['skin_set', load_lang('main_skin_set_default')],
-            ['acl', load_lang('main_acl_setting')]
+            ['external', get_lang(conn, 'ext_api_req_set')],
+            ['head', get_lang(conn, 'main_head')],
+            ['body/top', get_lang(conn, 'main_body')],
+            ['body/bottom', get_lang(conn, 'main_bottom_body')],
+            ['sitemap_set', get_lang(conn, 'sitemap_management')],
+            ['top_menu', get_lang(conn, 'top_menu_setting')],
+            ['skin_set', get_lang(conn, 'main_skin_set_default')],
+            ['acl', get_lang(conn, 'main_acl_setting')]
         ]
 
         li_data = ''.join(['<li><a href="/setting/' + str(li[0]) + '">' + li[1] + '</a></li>' for li in li_list])
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-            data = '<h2>' + load_lang('list') + '</h2><ul class="opennamu_ul">' + li_data + '</ul>',
-            menu = [['manager', load_lang('return')]]
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'setting'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
+            data = '<h2>' + get_lang(conn, 'list') + '</h2><ul class="opennamu_ul">' + li_data + '</ul>',
+            menu = [['manager', get_lang(conn, 'return')]]
         ))

+ 24 - 24
route/main_setting_acl.py

@@ -25,16 +25,16 @@ def main_setting_acl():
         }
 
         if flask.request.method == 'POST':
-            if admin_check(None, 'edit_set (acl)') != 1:
-                return re_error('/ban')
+            if admin_check(conn, None, 'edit_set (acl)') != 1:
+                return re_error(conn, '/ban')
             else:
                 curs.executemany(db_change("update other set data = ? where name = ?"), [[flask.request.form.get(i_list[for_a], 'normal'), i_list[for_a]] for for_a in i_list])
                 conn.commit()
 
-                return redirect('/setting/acl')
+                return redirect(conn, '/setting/acl')
         else:
             d_list = {}
-            disable = 'disabled' if admin_check() != 1 else ''
+            disable = 'disabled' if admin_check(conn) != 1 else ''
             acl_div = ['' for _ in range(0, len(i_list))]
 
             for for_a in i_list:
@@ -54,58 +54,58 @@ def main_setting_acl():
                 for data_list in acl_list:
                     acl_div[for_a] += '<option value="' + data_list + '" ' + ('selected="selected"' if data_list == d_list[for_a + 1] else '') + '>' + (data_list if data_list != '' else 'normal') + '</option>'
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('main_acl_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-                data = render_simple_set('''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'main_acl_setting'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
+                data = render_simple_set(conn, '''
                     <form method="post">
                         <hr class="main_hr">
-                        <a href="/acl/TEST#exp">(''' + load_lang('reference') + ''')</a>
+                        <a href="/acl/TEST#exp">(''' + get_lang(conn, 'reference') + ''')</a>
                         
-                        <h2>''' + load_lang('document_acl') + '''</h2>
+                        <h2>''' + get_lang(conn, 'document_acl') + '''</h2>
                         <select ''' + disable + ''' name="edit">''' + acl_div[0] + '''</select>
 
-                        <h3>''' + load_lang('document_edit_acl') + '''</h3>
+                        <h3>''' + get_lang(conn, 'document_edit_acl') + '''</h3>
                         <select ''' + disable + ''' name="document_edit_acl">''' + acl_div[6] + '''</select>
 
-                        <h3>''' + load_lang('document_edit_request_acl') + '''</h3>
+                        <h3>''' + get_lang(conn, 'document_edit_request_acl') + '''</h3>
                         <select ''' + disable + ''' name="document_edit_request_acl">''' + acl_div[13] + '''</select>
 
-                        <h3>''' + load_lang('document_move_acl') + '''</h3>
+                        <h3>''' + get_lang(conn, 'document_move_acl') + '''</h3>
                         <select ''' + disable + ''' name="document_move_acl">''' + acl_div[7] + '''</select>
 
-                        <h3>''' + load_lang('document_delete_acl') + '''</h3>
+                        <h3>''' + get_lang(conn, 'document_delete_acl') + '''</h3>
                         <select ''' + disable + ''' name="document_delete_acl">''' + acl_div[8] + '''</select>
                         
-                        <h2>''' + load_lang('discussion_acl') + '''</h2>
+                        <h2>''' + get_lang(conn, 'discussion_acl') + '''</h2>
                         <select ''' + disable + ''' name="discussion">''' + acl_div[1] + '''</select>
                         
-                        <h2>''' + load_lang('upload_acl') + '''</h2>
+                        <h2>''' + get_lang(conn, 'upload_acl') + '''</h2>
                         <select ''' + disable + ''' name="upload_acl">''' + acl_div[2] + '''</select>
                         
-                        <h3>''' + load_lang('many_upload_acl') + '''</h3>
+                        <h3>''' + get_lang(conn, 'many_upload_acl') + '''</h3>
                         <select ''' + disable + ''' name="many_upload_acl">''' + acl_div[4] + '''</select>
                         
-                        <h2>''' + load_lang('view_acl') + '''</h2>
+                        <h2>''' + get_lang(conn, 'view_acl') + '''</h2>
                         <select ''' + disable + ''' name="all_view_acl">''' + acl_div[3] + '''</select>
                         
-                        <h2>''' + load_lang('vote_acl') + '''</h2>
+                        <h2>''' + get_lang(conn, 'vote_acl') + '''</h2>
                         <select ''' + disable + ''' name="vote_acl">''' + acl_div[5] + '''</select>
 
-                        <h2>''' + load_lang('slow_edit_acl') + '''</h2>
+                        <h2>''' + get_lang(conn, 'slow_edit_acl') + '''</h2>
                         <select ''' + disable + ''' name="slow_edit_acl">''' + acl_div[9] + '''</select>
 
-                        <h2>''' + load_lang('edit_bottom_compulsion_acl') + '''</h2>
+                        <h2>''' + get_lang(conn, 'edit_bottom_compulsion_acl') + '''</h2>
                         <select ''' + disable + ''' name="edit_bottom_compulsion_acl">''' + acl_div[10] + '''</select>
 
-                        <h2>''' + load_lang('recaptcha_pass_acl') + '''</h2>
+                        <h2>''' + get_lang(conn, 'recaptcha_pass_acl') + '''</h2>
                         <select ''' + disable + ''' name="recaptcha_pass_acl">''' + acl_div[11] + '''</select>
 
-                        <h3>''' + load_lang('recaptcha_one_check_five_pass_acl') + '''</h3>
+                        <h3>''' + get_lang(conn, 'recaptcha_one_check_five_pass_acl') + '''</h3>
                         <select ''' + disable + ''' name="recaptcha_one_check_five_pass_acl">''' + acl_div[12] + '''</select>
                         
                         <hr class="main_hr">
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 '''),
-                menu = [['setting/main', load_lang('return')]]
+                menu = [['setting/main', get_lang(conn, 'return')]]
             ))

+ 25 - 25
route/main_setting_external.py

@@ -4,8 +4,8 @@ def main_setting_external():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
         
         i_list = [
             'recaptcha',
@@ -28,9 +28,9 @@ def main_setting_external():
 
             conn.commit()
 
-            admin_check(None, 'edit_set (external)')
+            admin_check(conn, None, 'edit_set (external)')
 
-            return redirect('/setting/external')
+            return redirect(conn, '/setting/external')
         else:
             d_list = []
 
@@ -69,78 +69,78 @@ def main_setting_external():
                 else:
                     re_ver += '<option value="' + i + '">' + re_ver_list[i] + '</option>'
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('ext_api_req_set'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-                data = render_simple_set('''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'ext_api_req_set'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
+                data = render_simple_set(conn, '''
                     <form method="post">
-                        <h2>''' + load_lang('captcha') + '''</h2>
-                        <a href="https://www.google.com/recaptcha/">(''' + load_lang('recaptcha') + ''')</a> <a href="https://www.hcaptcha.com/">(''' + load_lang('hcaptcha') + ''')</a>
+                        <h2>''' + get_lang(conn, 'captcha') + '''</h2>
+                        <a href="https://www.google.com/recaptcha/">(''' + get_lang(conn, 'recaptcha') + ''')</a> <a href="https://www.hcaptcha.com/">(''' + get_lang(conn, 'hcaptcha') + ''')</a>
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('public_key') + '''</span>
+                        <span>''' + get_lang(conn, 'public_key') + '''</span>
                         <hr class="main_hr">
                         <input name="recaptcha" value="''' + html.escape(d_list[0]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('secret_key') + '''</span>
+                        <span>''' + get_lang(conn, 'secret_key') + '''</span>
                         <hr class="main_hr">
                         <input name="sec_re" value="''' + html.escape(d_list[1]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('version') + '''</span>
+                        <span>''' + get_lang(conn, 'version') + '''</span>
                         <hr class="main_hr">
                         <select name="recaptcha_ver">
                             ''' + re_ver + '''
                         </select>
 
-                        <h2>''' + load_lang('email_setting') + '''</h2>
-                        <a href="/setting/phrase#s-6">(''' + load_lang('text_setting') + ''')</a>
+                        <h2>''' + get_lang(conn, 'email_setting') + '''</h2>
+                        <a href="/setting/phrase#s-6">(''' + get_lang(conn, 'text_setting') + ''')</a>
                         <hr class="main_hr">
 
-                        <input type="checkbox" name="email_have" ''' + ('checked' if d_list[9] != '' else '')  + '''> ''' + load_lang('email_required') + '''
+                        <input type="checkbox" name="email_have" ''' + ('checked' if d_list[9] != '' else '')  + '''> ''' + get_lang(conn, 'email_required') + '''
 
-                        <h3>''' + load_lang('smtp_setting') + '''</h3>
+                        <h3>''' + get_lang(conn, 'smtp_setting') + '''</h3>
                         <a href="https://support.google.com/mail/answer/7126229">(Google)</a>
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('smtp_server') + '''</span>
+                        <span>''' + get_lang(conn, 'smtp_server') + '''</span>
                         <hr class="main_hr">
                         <input name="smtp_server" value="''' + html.escape(d_list[2]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('smtp_port') + '''</span>
+                        <span>''' + get_lang(conn, 'smtp_port') + '''</span>
                         <hr class="main_hr">
                         <input name="smtp_port" value="''' + html.escape(d_list[3]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('smtp_security') + '''</span>
+                        <span>''' + get_lang(conn, 'smtp_security') + '''</span>
                         <hr class="main_hr">
                         <select name="smtp_security">
                             ''' + security_radios + '''
                         </select>
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('smtp_username') + '''</span>
+                        <span>''' + get_lang(conn, 'smtp_username') + '''</span>
                         <hr class="main_hr">
                         <input name="smtp_email" value="''' + html.escape(d_list[5]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('smtp_password') + '''</span>
+                        <span>''' + get_lang(conn, 'smtp_password') + '''</span>
                         <hr class="main_hr">
                         <input type="password" name="smtp_pass" value="''' + html.escape(d_list[6]) + '''">
 
-                        <h2>''' + load_lang('oauth') + ''' (''' + load_lang('not_working') + ''')</h2>
+                        <h2>''' + get_lang(conn, 'oauth') + ''' (''' + get_lang(conn, 'not_working') + ''')</h2>
                         <a href="https://developers.google.com/identity/protocols/oauth2">(Google)</a>
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('oauth_client_id') + '''</span>
+                        <span>''' + get_lang(conn, 'oauth_client_id') + '''</span>
                         <hr class="main_hr">
                         <input name="oauth_client_id" value="''' + html.escape(d_list[8]) + '''">
                         <hr class="main_hr">
 
                         <hr class="main_hr">
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 '''),
-                menu = [['setting', load_lang('return')]]
+                menu = [['setting', get_lang(conn, 'return')]]
             ))

+ 15 - 15
route/main_setting_head.py

@@ -4,8 +4,8 @@ def main_setting_head(num, skin_name = '', set_preview = 0):
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
         
         if flask.request.method == 'POST' and set_preview == 0:
             if num == 4:
@@ -32,12 +32,12 @@ def main_setting_head(num, skin_name = '', set_preview = 0):
 
             conn.commit()
 
-            admin_check(None, 'edit_set (' + info_d + ')')
+            admin_check(conn, None, 'edit_set (' + info_d + ')')
 
             if skin_name == '':
-                return redirect('/setting/' + end_r)
+                return redirect(conn, '/setting/' + end_r)
             else:
-                return redirect('/setting/' + end_r + '/' + skin_name)
+                return redirect(conn, '/setting/' + end_r + '/' + skin_name)
         else:
             title = ''
             start = ''
@@ -51,7 +51,7 @@ def main_setting_head(num, skin_name = '', set_preview = 0):
                 form_action = 'formaction="/setting/body/top"'
                 data_preview = flask.request.form.get('content', '') if set_preview == 1 else ''
                 plus = '''
-                    <button id="opennamu_preview_button" type="submit" formaction="/setting_preview/body/top">''' + load_lang('preview') + '''</button>
+                    <button id="opennamu_preview_button" type="submit" formaction="/setting_preview/body/top">''' + get_lang(conn, 'preview') + '''</button>
                     <hr class="main_hr">
                     <div id="opennamu_preview_area">''' + data_preview + '''</div>
                 '''
@@ -61,7 +61,7 @@ def main_setting_head(num, skin_name = '', set_preview = 0):
                 data_preview = flask.request.form.get('content', '') if set_preview == 1 else ''
                 form_action = 'formaction="/setting/body/bottom"'
                 plus = '''
-                    <button id="opennamu_preview_button" type="submit" formaction="/setting_preview/body/bottom">''' + load_lang('preview') + '''</button>
+                    <button id="opennamu_preview_button" type="submit" formaction="/setting_preview/body/bottom">''' + get_lang(conn, 'preview') + '''</button>
                     <hr class="main_hr">
                     <div id="opennamu_preview_area">''' + data_preview + '''</div>
                 '''
@@ -69,8 +69,8 @@ def main_setting_head(num, skin_name = '', set_preview = 0):
                 curs.execute(db_change("select data from other where name = 'head' and coverage = ?"), [skin_name])
                 title = '_head'
                 start = '' + \
-                    '<a href="/setting/head">(' + load_lang('all') + ')</a> ' + \
-                    ' '.join(['<a href="/setting/head/' + url_pas(i) + '">(' + html.escape(i) + ')</a>' for i in load_skin('', 1)]) + '''
+                    '<a href="/setting/head">(' + get_lang(conn, 'all') + ')</a> ' + \
+                    ' '.join(['<a href="/setting/head/' + url_pas(i) + '">(' + html.escape(i) + ')</a>' for i in load_skin(conn, '', 1)]) + '''
                     <hr class="main_hr">
                     <span>
                         &lt;style&gt;CSS&lt;/style&gt;
@@ -94,17 +94,17 @@ def main_setting_head(num, skin_name = '', set_preview = 0):
             else:
                 sub_plus = ''
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang(data = 'main' + title, safe = 1), wiki_set(), wiki_custom(), wiki_css(['(HTML)' + sub_plus, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, data = 'main' + title, safe = 1), wiki_set(conn), wiki_custom(conn), wiki_css(['(HTML)' + sub_plus, 0])],
                 data = '''
                     <form method="post">
                         ''' + start + '''
-                        <textarea class="opennamu_textarea_500" placeholder="''' + load_lang('enter_html') + '''" name="content" id="content">''' + html.escape(data) + '''</textarea>
+                        <textarea class="opennamu_textarea_500" placeholder="''' + get_lang(conn, 'enter_html') + '''" name="content" id="content">''' + html.escape(data) + '''</textarea>
                         <hr class="main_hr">
-                        ''' + (load_lang('main_css_warning') + '<hr class="main_hr">' if title == '_head' else '') + '''
-                        <button id="opennamu_save_button" type="submit" ''' + form_action + '''>''' + load_lang('save') + '''</button>
+                        ''' + (get_lang(conn, 'main_css_warning') + '<hr class="main_hr">' if title == '_head' else '') + '''
+                        <button id="opennamu_save_button" type="submit" ''' + form_action + '''>''' + get_lang(conn, 'save') + '''</button>
                         ''' + plus + '''
                     </form>
                 ''',
-                menu = [['setting', load_lang('return')]]
+                menu = [['setting', get_lang(conn, 'return')]]
             ))

+ 60 - 60
route/main_setting_main.py

@@ -4,8 +4,8 @@ def main_setting_main(db_set):
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
         
         setting_list = {
             0 : ['name', 'Wiki'],
@@ -57,9 +57,9 @@ def main_setting_main(db_set):
 
             conn.commit()
 
-            admin_check(None, 'edit_set (main)')
+            admin_check(conn, None, 'edit_set (main)')
 
-            return redirect('/setting/main')
+            return redirect(conn, '/setting/main')
         else:
             d_list = {}
             for i in setting_list:
@@ -110,199 +110,199 @@ def main_setting_main(db_set):
 
             sqlite_only = 'style="display:none;"' if db_set != 'sqlite' else ''
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('main_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-                data = render_simple_set('''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'main_setting'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
+                data = render_simple_set(conn, '''
                     <form method="post">
-                        <h2>''' + load_lang('basic_set') + '''</h2>
+                        <h2>''' + get_lang(conn, 'basic_set') + '''</h2>
                         
-                        <span>''' + load_lang('wiki_name') + '''</span>
+                        <span>''' + get_lang(conn, 'wiki_name') + '''</span>
                         <hr class="main_hr">
                         <input name="name" value="''' + html.escape(d_list[0]) + '''">
                         <hr class="main_hr">
 
-                        <span><a href="/setting/main/logo">(''' + load_lang('wiki_logo') + ''')</a></span>
+                        <span><a href="/setting/main/logo">(''' + get_lang(conn, 'wiki_logo') + ''')</a></span>
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('main_page') + '''</span>
+                        <span>''' + get_lang(conn, 'main_page') + '''</span>
                         <hr class="main_hr">
                         <input name="frontpage" value="''' + html.escape(d_list[2]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('tls_method') + '''</span>
+                        <span>''' + get_lang(conn, 'tls_method') + '''</span>
                         <hr class="main_hr">
                         <select name="http_select">''' + tls_select + '''</select>
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('domain') + '''</span> (EX : 2du.pythonanywhere.com) (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <span>''' + get_lang(conn, 'domain') + '''</span> (EX : 2du.pythonanywhere.com) (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                         <hr class="main_hr">
                         <input name="domain" value="''' + html.escape(d_list[22]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('wiki_host') + '''</span>
+                        <span>''' + get_lang(conn, 'wiki_host') + '''</span>
                         <hr class="main_hr">
                         <input name="host" value="''' + html.escape(d_list[16]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('wiki_port') + '''</span>
+                        <span>''' + get_lang(conn, 'wiki_port') + '''</span>
                         <hr class="main_hr">
                         <input name="port" value="''' + html.escape(d_list[10]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('wiki_secret_key') + '''</span>
+                        <span>''' + get_lang(conn, 'wiki_secret_key') + '''</span>
                         <hr class="main_hr">
                         <input type="password" name="key" value="''' + html.escape(d_list[11]) + '''">
                         <hr class="main_hr">
                         
-                        <input type="checkbox" name="wiki_access_password_need" ''' + check_box_div[8] + '''> ''' + load_lang('set_wiki_access_password_need') + ''' (''' + load_lang('restart_required') + ''')
+                        <input type="checkbox" name="wiki_access_password_need" ''' + check_box_div[8] + '''> ''' + get_lang(conn, 'set_wiki_access_password_need') + ''' (''' + get_lang(conn, 'restart_required') + ''')
                         <hr class="main_hr">
                         
-                        <span>''' + load_lang('set_wiki_access_password') + '''</span> (''' + load_lang('restart_required') + ''')
+                        <span>''' + get_lang(conn, 'set_wiki_access_password') + '''</span> (''' + get_lang(conn, 'restart_required') + ''')
                         <hr class="main_hr">
                         <input type="password" name="wiki_access_password" value="''' + html.escape(d_list[32]) + '''">
                         
-                        <h3>''' + load_lang('authority_use_list') + '''</h3>
+                        <h3>''' + get_lang(conn, 'authority_use_list') + '''</h3>
                         
-                        <input type="checkbox" name="auth_history_off" ''' + check_box_div[14] + '''> ''' + load_lang('authority_use_list_off') + '''
+                        <input type="checkbox" name="auth_history_off" ''' + check_box_div[14] + '''> ''' + get_lang(conn, 'authority_use_list_off') + '''
                         <hr class="main_hr">
                         
-                        <span>''' + load_lang('authority_use_list_expiration_date') + '''</span> (''' + load_lang('day') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <span>''' + get_lang(conn, 'authority_use_list_expiration_date') + '''</span> (''' + get_lang(conn, 'day') + ''') (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                         <hr class="main_hr">
                         <input name="auth_history_expiration_date" value="''' + html.escape(d_list[43]) + '''">
                         <hr class="main_hr">
 
-                        <h3>''' + load_lang('communication_set') + '''</h3>
+                        <h3>''' + get_lang(conn, 'communication_set') + '''</h3>
                         
-                        <input type="checkbox" name="enable_comment" ''' + check_box_div[5] + '''> ''' + load_lang('enable_comment_function') + ''' (''' + load_lang('not_working') + ''')
+                        <input type="checkbox" name="enable_comment" ''' + check_box_div[5] + '''> ''' + get_lang(conn, 'enable_comment_function') + ''' (''' + get_lang(conn, 'not_working') + ''')
                         <hr class="main_hr">
 
-                        <input type="checkbox" name="user_name_level" ''' + check_box_div[15] + '''> ''' + load_lang('display_level_in_user_name') + '''
+                        <input type="checkbox" name="user_name_level" ''' + check_box_div[15] + '''> ''' + get_lang(conn, 'display_level_in_user_name') + '''
                         <hr class="main_hr">
 
-                        <h2>''' + load_lang('design_set') + '''</h2>
+                        <h2>''' + get_lang(conn, 'design_set') + '''</h2>
                         
-                        <span>''' + load_lang('wiki_skin') + '''</span>
+                        <span>''' + get_lang(conn, 'wiki_skin') + '''</span>
                         <hr class="main_hr">
-                        <select name="skin">''' + load_skin(d_list[5] if d_list[5] != '' else 'ringo') + '''</select>
+                        <select name="skin">''' + load_skin(conn, d_list[5] if d_list[5] != '' else 'ringo') + '''</select>
 
-                        <h2>''' + load_lang('render_set') + '''</h2>
+                        <h2>''' + get_lang(conn, 'render_set') + '''</h2>
                         
-                        <input type="checkbox" name="namumark_compatible" ''' + check_box_div[10] + '''> ''' + load_lang('namumark_fully_compatible_mode') + '''
+                        <input type="checkbox" name="namumark_compatible" ''' + check_box_div[10] + '''> ''' + get_lang(conn, 'namumark_fully_compatible_mode') + '''
                         <hr class="main_hr">
                         
-                        <input type="checkbox" name="link_case_insensitive" ''' + check_box_div[12] + '''> ''' + load_lang('link_case_insensitive') + '''
+                        <input type="checkbox" name="link_case_insensitive" ''' + check_box_div[12] + '''> ''' + get_lang(conn, 'link_case_insensitive') + '''
                         <hr class="main_hr">
 
-                        <h2>''' + load_lang('login_set') + '''</h2>
+                        <h2>''' + get_lang(conn, 'login_set') + '''</h2>
                         
-                        <input type="checkbox" name="reg" ''' + check_box_div[0] + '''> ''' + load_lang('no_register') + '''
+                        <input type="checkbox" name="reg" ''' + check_box_div[0] + '''> ''' + get_lang(conn, 'no_register') + '''
                         <hr class="main_hr">
 
-                        <input type="checkbox" name="ip_view" ''' + check_box_div[1] + '''> ''' + load_lang('hide_ip') + '''
+                        <input type="checkbox" name="ip_view" ''' + check_box_div[1] + '''> ''' + get_lang(conn, 'hide_ip') + '''
                         <hr class="main_hr">
 
-                        <input type="checkbox" name="user_name_view" ''' + check_box_div[11] + '''> ''' + load_lang('hide_user_name') + '''
+                        <input type="checkbox" name="user_name_view" ''' + check_box_div[11] + '''> ''' + get_lang(conn, 'hide_user_name') + '''
                         <hr class="main_hr">
 
-                        <input type="checkbox" name="requires_approval" ''' + check_box_div[3] + '''> ''' + load_lang('requires_approval') + '''
+                        <input type="checkbox" name="requires_approval" ''' + check_box_div[3] + '''> ''' + get_lang(conn, 'requires_approval') + '''
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('password_min_length') + '''</span> (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <span>''' + get_lang(conn, 'password_min_length') + '''</span> (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                         <hr class="main_hr">
                         <input name="password_min_length" value="''' + html.escape(d_list[30]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('encryption_method') + '''</span>
+                        <span>''' + get_lang(conn, 'encryption_method') + '''</span>
                         <hr class="main_hr">
                         <select name="encode">''' + encode_select + '''</select>
 
-                        <h3>''' + load_lang('ua') + '''</h3>
+                        <h3>''' + get_lang(conn, 'ua') + '''</h3>
                         
-                        <input type="checkbox" name="ua_get" ''' + check_box_div[4] + '''> ''' + load_lang('ua_get_off') + '''
+                        <input type="checkbox" name="ua_get" ''' + check_box_div[4] + '''> ''' + get_lang(conn, 'ua_get_off') + '''
                         <hr class="main_hr">
                         
-                        <span>''' + load_lang('ua_expiration_date') + '''</span> (''' + load_lang('day') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <span>''' + get_lang(conn, 'ua_expiration_date') + '''</span> (''' + get_lang(conn, 'day') + ''') (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                         <hr class="main_hr">
                         <input name="ua_expiration_date" value="''' + html.escape(d_list[42]) + '''">
                         <hr class="main_hr">
                         
-                        <h2>''' + load_lang('server_set') + '''</h2>
+                        <h2>''' + get_lang(conn, 'server_set') + '''</h2>
 
-                        <span>''' + load_lang('update_branch') + '''</span>
+                        <span>''' + get_lang(conn, 'update_branch') + '''</span>
                         <hr class="main_hr">
                         <select name="update">''' + branch_div + '''</select>
 
                         <span ''' + sqlite_only + '''>
-                            <h3>''' + load_lang('backup') + ''' (''' + load_lang('sqlite_only') + ''')</h3>
+                            <h3>''' + get_lang(conn, 'backup') + ''' (''' + get_lang(conn, 'sqlite_only') + ''')</h3>
                             
-                            <span>''' + load_lang('backup_warning') + ''' (EX : data_YYYYMMDDHHMMSS.db)</span>
+                            <span>''' + get_lang(conn, 'backup_warning') + ''' (EX : data_YYYYMMDDHHMMSS.db)</span>
                             <hr class="main_hr">
                             <hr class="main_hr">
                             
-                            <span>''' + load_lang('backup_interval') + '''</span> (''' + load_lang('hour') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                            <span>''' + get_lang(conn, 'backup_interval') + '''</span> (''' + get_lang(conn, 'hour') + ''') (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                             <hr class="main_hr">
                             <input name="back_up" value="''' + html.escape(d_list[9]) + '''">
                             <hr class="main_hr">
                             
-                            <span>''' + load_lang('backup_where') + '''</span> (''' + load_lang('default') + ''' : ''' + load_lang('empty') + ''') (''' + load_lang('example') + ''' : ./data/backup.db)
+                            <span>''' + get_lang(conn, 'backup_where') + '''</span> (''' + get_lang(conn, 'default') + ''' : ''' + get_lang(conn, 'empty') + ''') (''' + get_lang(conn, 'example') + ''' : ./data/backup.db)
                             <hr class="main_hr">
                             <input name="backup_where" value="''' + html.escape(d_list[21]) + '''">
                             <hr class="main_hr">
 
-                            <span>''' + load_lang('backup_count') + '''</span> (''' + load_lang('default') + ''' : ''' + load_lang('empty') + ''')
+                            <span>''' + get_lang(conn, 'backup_count') + '''</span> (''' + get_lang(conn, 'default') + ''' : ''' + get_lang(conn, 'empty') + ''')
                             <hr class="main_hr">
                             <input name="backup_count" value="''' + html.escape(d_list[41]) + '''">
                             <hr class="main_hr">
                         </span>
 
-                        <h2>''' + load_lang('edit_set') + '''</h2>
+                        <h2>''' + get_lang(conn, 'edit_set') + '''</h2>
                         
-                        <span>''' + load_lang('slow_edit') + '''</span> (''' + load_lang('second') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <span>''' + get_lang(conn, 'slow_edit') + '''</span> (''' + get_lang(conn, 'second') + ''') (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                         <hr class="main_hr">
                         <input name="slow_edit" value="''' + html.escape(d_list[19]) + '''">
                         <hr class="main_hr">
                         
-                        <input type="checkbox" name="edit_bottom_compulsion" ''' + check_box_div[7] + '''> ''' + load_lang('edit_bottom_compulsion') + '''
+                        <input type="checkbox" name="edit_bottom_compulsion" ''' + check_box_div[7] + '''> ''' + get_lang(conn, 'edit_bottom_compulsion') + '''
                         <hr class="main_hr">
                         
-                        <span>''' + load_lang('title_max_length') + '''</span> (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <span>''' + get_lang(conn, 'title_max_length') + '''</span> (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                         <hr class="main_hr">
                         <input name="title_max_length" value="''' + html.escape(d_list[28]) + '''">
                         <hr class="main_hr">
                         
-                        <span>''' + load_lang('title_topic_max_length') + '''</span> (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <span>''' + get_lang(conn, 'title_topic_max_length') + '''</span> (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                         <hr class="main_hr">
                         <input name="title_topic_max_length" value="''' + html.escape(d_list[29]) + '''">
                         <hr class="main_hr">
                         
-                        <span>''' + load_lang('max_file_size') + ''' (MB)</span>
+                        <span>''' + get_lang(conn, 'max_file_size') + ''' (MB)</span>
                         <hr class="main_hr">
                         <input name="upload" value="''' + html.escape(d_list[4]) + '''">
                         <hr class="main_hr">
                         
-                        <input type="checkbox" name="history_recording_off" ''' + check_box_div[9] + '''> ''' + load_lang('set_history_recording_off') + '''
+                        <input type="checkbox" name="history_recording_off" ''' + check_box_div[9] + '''> ''' + get_lang(conn, 'set_history_recording_off') + '''
                         <hr class="main_hr">
 
-                        <input type="checkbox" name="move_with_redirect" ''' + check_box_div[13] + '''> ''' + load_lang('move_with_redirect') + ''' (''' + load_lang('not_working') + ''')
+                        <input type="checkbox" name="move_with_redirect" ''' + check_box_div[13] + '''> ''' + get_lang(conn, 'move_with_redirect') + ''' (''' + get_lang(conn, 'not_working') + ''')
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('slow_thread') + '''</span> (''' + load_lang('second') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <span>''' + get_lang(conn, 'slow_thread') + '''</span> (''' + get_lang(conn, 'second') + ''') (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                         <hr class="main_hr">
                         <input name="slow_thread" value="''' + html.escape(d_list[38]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('edit_timeout') + '''</span> (''' + load_lang('second') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''') (''' + load_lang('linux_only') + ''')
+                        <span>''' + get_lang(conn, 'edit_timeout') + '''</span> (''' + get_lang(conn, 'second') + ''') (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''') (''' + get_lang(conn, 'linux_only') + ''')
                         <hr class="main_hr">
                         <input name="edit_timeout" value="''' + html.escape(d_list[39]) + '''">
                         <hr class="main_hr">
 
-                        <span>''' + load_lang('document_content_max_length') + '''</span> (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <span>''' + get_lang(conn, 'document_content_max_length') + '''</span> (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                         <hr class="main_hr">
                         <input name="document_content_max_length" value="''' + html.escape(d_list[40]) + '''">
                         <hr class="main_hr">
 
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 '''),
-                menu = [['setting', load_lang('return')]]
+                menu = [['setting', get_lang(conn, 'return')]]
             ))

+ 10 - 10
route/main_setting_main_logo.py

@@ -4,10 +4,10 @@ def main_setting_main_logo():
     with get_db_connect() as conn:
         curs = conn.cursor()
         
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
 
-        skin_list = [0] + load_skin('', 1)
+        skin_list = [0] + load_skin(conn, '', 1)
         i_list = []
         for i in skin_list:
             i_list += [['logo', '' if i == 0 else i]]
@@ -22,9 +22,9 @@ def main_setting_main_logo():
 
             conn.commit()
 
-            admin_check(None, 'edit_set (logo)')
+            admin_check(conn, None, 'edit_set (logo)')
 
-            return redirect('/setting/main/logo')
+            return redirect(conn, '/setting/main/logo')
         else:
             d_list = []
             for i in i_list:
@@ -42,19 +42,19 @@ def main_setting_main_logo():
             end_data = ''
             for i in range(0, len(skin_list)):
                 end_data += '' + \
-                    '<span>' + load_lang('wiki_logo') + ' ' + ('(' + skin_list[i] + ')' if skin_list[i] != 0 else '') + ' (HTML)' + \
+                    '<span>' + get_lang(conn, 'wiki_logo') + ' ' + ('(' + skin_list[i] + ')' if skin_list[i] != 0 else '') + ' (HTML)' + \
                     '<hr class="main_hr">' + \
                     '<input name="' + (skin_list[i] if skin_list[i] != 0 else 'main_css') + '" value="' + html.escape(d_list[i]) + '">' + \
                     '<hr class="main_hr">' + \
                 ''
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('wiki_logo'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'wiki_logo'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
                         ''' + end_data + '''
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['setting/main', load_lang('return')]]
+                menu = [['setting/main', get_lang(conn, 'return')]]
             ))

+ 38 - 38
route/main_setting_phrase.py

@@ -4,8 +4,8 @@ def main_setting_phrase():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
         
         i_list = [
             'contract',
@@ -40,9 +40,9 @@ def main_setting_phrase():
             curs.executemany(db_change("update other set data = ? where name = ?"), [[flask.request.form.get(for_a, ''), for_a] for for_a in i_list])
             conn.commit()
 
-            admin_check(None, 'edit_set (phrase)')
+            admin_check(conn, None, 'edit_set (phrase)')
 
-            return redirect('/setting/phrase')
+            return redirect(conn, '/setting/phrase')
         else:
             d_list = []
             for i in i_list:
@@ -56,99 +56,99 @@ def main_setting_phrase():
 
             conn.commit()
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('text_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-                data = render_simple_set('''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'text_setting'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
+                data = render_simple_set(conn, '''
                     <form method="post">
-                        <h2>''' + load_lang('register_text') + ''' (HTML)</h2>
+                        <h2>''' + get_lang(conn, 'register_text') + ''' (HTML)</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[0] + '''">''' + html.escape(d_list[0]) + '''</textarea>
 
-                        <h2>''' + load_lang('non_login_alert') + ''' (HTML)</h2>
+                        <h2>''' + get_lang(conn, 'non_login_alert') + ''' (HTML)</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[1] + '''">''' + html.escape(d_list[1]) + '''</textarea>
 
-                        <h2>''' + load_lang('edit_bottom_text') + ''' (HTML)</h2>
+                        <h2>''' + get_lang(conn, 'edit_bottom_text') + ''' (HTML)</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[2] + '''">''' + html.escape(d_list[2]) + '''</textarea>
 
-                        <h2>''' + load_lang('copyright_checkbox_text') + ''' (HTML)</h2>
+                        <h2>''' + get_lang(conn, 'copyright_checkbox_text') + ''' (HTML)</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[3] + '''">''' + html.escape(d_list[3]) + '''</textarea>
 
-                        <h2>''' + load_lang('check_key_text') + ''' (HTML)</h2>
+                        <h2>''' + get_lang(conn, 'check_key_text') + ''' (HTML)</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[4] + '''">''' + html.escape(d_list[4]) + '''</textarea>
 
-                        <h2>''' + load_lang('email_title') + '''</h2>
+                        <h2>''' + get_lang(conn, 'email_title') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[5] + '''">''' + html.escape(d_list[5]) + '''</textarea>
 
-                        <h2>''' + load_lang('email_text') + '''</h2>
+                        <h2>''' + get_lang(conn, 'email_text') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[6] + '''">''' + html.escape(d_list[6]) + '''</textarea>
 
-                        <h2>''' + load_lang('email_insert_text') + '''</h2>
+                        <h2>''' + get_lang(conn, 'email_insert_text') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[7] + '''">''' + html.escape(d_list[7]) + '''</textarea>
 
-                        <h2>''' + load_lang('password_search_text') + '''</h2>
+                        <h2>''' + get_lang(conn, 'password_search_text') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[8] + '''">''' + html.escape(d_list[8]) + '''</textarea>
 
-                        <h2>''' + load_lang('reset_user_text') + '''</h2>
+                        <h2>''' + get_lang(conn, 'reset_user_text') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[9] + '''">''' + html.escape(d_list[9]) + '''</textarea>
 
-                        <h2>''' + load_lang('error_401') + '''</h2>
+                        <h2>''' + get_lang(conn, 'error_401') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[10] + '''">''' + html.escape(d_list[10]) + '''</textarea>
 
-                        <h2>''' + load_lang('error_404') + '''</h2>
+                        <h2>''' + get_lang(conn, 'error_404') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[11] + '''">''' + html.escape(d_list[11]) + '''</textarea>
 
-                        <h2>''' + load_lang('approval_question') + '''</h2>
-                        <sup><a href="/setting/main">''' + load_lang('approval_question_visible_only_when_approval_on') + '''</a></sup>
+                        <h2>''' + get_lang(conn, 'approval_question') + '''</h2>
+                        <sup><a href="/setting/main">''' + get_lang(conn, 'approval_question_visible_only_when_approval_on') + '''</a></sup>
                         <hr class="main_hr">
                         <textarea class="opennamu_textarea_100" name="''' + i_list[12] + '''">''' + html.escape(d_list[12]) + '''</textarea>
 
-                        <h2>''' + load_lang('edit_help') + '''</h2>
+                        <h2>''' + get_lang(conn, 'edit_help') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[13] + '''">''' + html.escape(d_list[13]) + '''</textarea>
 
-                        <h2>''' + load_lang('upload_help') + ''' (HTML)</h2>
+                        <h2>''' + get_lang(conn, 'upload_help') + ''' (HTML)</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[14] + '''">''' + html.escape(d_list[14]) + '''</textarea>
 
-                        <h2>''' + load_lang('upload_default') + '''</h2>
+                        <h2>''' + get_lang(conn, 'upload_default') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[15] + '''">''' + html.escape(d_list[15]) + '''</textarea>
 
-                        <h2>''' + load_lang('bottom_text') + ''' (HTML)</h2>
+                        <h2>''' + get_lang(conn, 'bottom_text') + ''' (HTML)</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[16] + '''">''' + html.escape(d_list[16]) + '''</textarea>
 
-                        <h2>''' + load_lang('topic_text') + '''</h2>
+                        <h2>''' + get_lang(conn, 'topic_text') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[17] + '''">''' + html.escape(d_list[17]) + '''</textarea>
                         
-                        <h2>''' + load_lang('phrase_user_page_admin') + ''' (HTML)</h2>
+                        <h2>''' + get_lang(conn, 'phrase_user_page_admin') + ''' (HTML)</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[18] + '''">''' + html.escape(d_list[18]) + '''</textarea>
                         
-                        <h2>''' + load_lang('phrase_user_page_owner') + ''' (HTML)</h2>
+                        <h2>''' + get_lang(conn, 'phrase_user_page_owner') + ''' (HTML)</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[19] + '''">''' + html.escape(d_list[19]) + '''</textarea>
 
-                        <h2>''' + load_lang('phrase_old_page_warning') + ''' (''' + load_lang('beta') + ''') (HTML)</h2>
+                        <h2>''' + get_lang(conn, 'phrase_old_page_warning') + ''' (''' + get_lang(conn, 'beta') + ''') (HTML)</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[20] + '''">''' + html.escape(d_list[20]) + '''</textarea>
                         
-                        <h2>''' + load_lang('bbs_help') + '''</h2>
+                        <h2>''' + get_lang(conn, 'bbs_help') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[21] + '''">''' + html.escape(d_list[21]) + '''</textarea>
 
-                        <h2>''' + load_lang('bbs_comment_help') + '''</h2>
+                        <h2>''' + get_lang(conn, 'bbs_comment_help') + '''</h2>
                         <textarea class="opennamu_textarea_100" name="''' + i_list[22] + '''">''' + html.escape(d_list[22]) + '''</textarea>
 
-                        <h2>''' + load_lang('outdated_doc_warning') + '''  (HTML)</h2>
-                        <span>''' + load_lang('period') + '''</span> (''' + load_lang('day') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <h2>''' + get_lang(conn, 'outdated_doc_warning') + '''  (HTML)</h2>
+                        <span>''' + get_lang(conn, 'period') + '''</span> (''' + get_lang(conn, 'day') + ''') (''' + get_lang(conn, 'off') + ''' : ''' + get_lang(conn, 'empty') + ''')
                         <hr class="main_hr">
                         <input name="''' + i_list[24] + '''" value="''' + html.escape(d_list[24]) + '''">
                         <hr class="main_hr">
-                        <textarea class="opennamu_textarea_100" name="''' + i_list[23] + '''" placeholder="''' + load_lang('old_page_warning') + '''">''' + html.escape(d_list[23]) + '''</textarea>
+                        <textarea class="opennamu_textarea_100" name="''' + i_list[23] + '''" placeholder="''' + get_lang(conn, 'old_page_warning') + '''">''' + html.escape(d_list[23]) + '''</textarea>
 
-                        <h2>''' + load_lang('category') + '''</h2>
+                        <h2>''' + get_lang(conn, 'category') + '''</h2>
                         <input name="''' + i_list[25] + '''" value="''' + html.escape(d_list[25]) + '''">
 
-                        <h2>''' + load_lang('redirect') + '''</h2>
+                        <h2>''' + get_lang(conn, 'redirect') + '''</h2>
                         <span>EX : {0} ➤ {1}</span>
                         <hr class="main_hr">
                         <input name="''' + i_list[26] + '''" value="''' + html.escape(d_list[26]) + '''">
 
                         <hr class="main_hr">
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 '''),
-                menu = [['setting', load_lang('return')]]
+                menu = [['setting', get_lang(conn, 'return')]]
             ))

+ 10 - 10
route/main_setting_robot.py

@@ -4,8 +4,8 @@ def main_setting_robot():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
 
         curs.execute(db_change("select data from other where name = 'robot'"))
         db_data = curs.fetchall()
@@ -34,22 +34,22 @@ def main_setting_robot():
 
             conn.commit()
 
-            admin_check(None, 'edit_set (robot)')
+            admin_check(conn, None, 'edit_set (robot)')
 
-            return redirect('/setting/robot')
+            return redirect(conn, '/setting/robot')
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = ['robots.txt', wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = ['robots.txt', wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
-                    <a href="/robots.txt">(''' + load_lang('view') + ''')</a>
+                    <a href="/robots.txt">(''' + get_lang(conn, 'view') + ''')</a>
                     <hr class="main_hr">
                     <form method="post">
                         <textarea class="opennamu_textarea_500" name="content">''' + html.escape(data) + '''</textarea>
                         <hr class="main_hr">
-                        <input type="checkbox" name="default" ''' + default_data + '''> ''' + load_lang('default') + '''
+                        <input type="checkbox" name="default" ''' + default_data + '''> ''' + get_lang(conn, 'default') + '''
                         <hr class="main_hr">
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['setting', load_lang('return')]]
+                menu = [['setting', get_lang(conn, 'return')]]
             ))

+ 9 - 9
route/main_setting_sitemap.py

@@ -5,12 +5,12 @@ def main_setting_sitemap(do_type = 0):
         curs = conn.cursor()
 
         if not do_type == 1:
-            if admin_check() != 1:
-                return re_error('/ban')
+            if admin_check(conn) != 1:
+                return re_error(conn, '/ban')
         
         if do_type == 1 or flask.request.method == 'POST':
             if not do_type == 1:
-                admin_check(None, 'make sitemap')
+                admin_check(conn, None, 'make sitemap')
 
             data = '' + \
                 '<?xml version="1.0" encoding="UTF-8"?>\n' + \
@@ -22,7 +22,7 @@ def main_setting_sitemap(do_type = 0):
             if db_data and db_data[0][0] != '':
                 domain = ''
             else:
-                domain = load_domain('full')
+                domain = load_domain(conn, 'full')
 
             sql_add = ''
 
@@ -90,16 +90,16 @@ def main_setting_sitemap(do_type = 0):
                 f.close()
 
             if not do_type == 1:
-                return redirect('/setting/sitemap')
+                return redirect(conn, '/setting/sitemap')
             else:
                 return ''
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('sitemap_manual_create'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'sitemap_manual_create'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('create') + '''</button>
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'create') + '''</button>
                     </form>
                 ''',
-                menu = [['setting/sitemap_set', load_lang('return')]]
+                menu = [['setting/sitemap_set', get_lang(conn, 'return')]]
             ))

+ 15 - 15
route/main_setting_sitemap_set.py

@@ -4,8 +4,8 @@ def main_setting_sitemap_set():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
         
         setting_list = {
             0 : ['sitemap_auto_exclude_domain', ''],
@@ -24,9 +24,9 @@ def main_setting_sitemap_set():
 
             conn.commit()
 
-            admin_check(None, 'edit_set (sitemap)')
+            admin_check(conn, None, 'edit_set (sitemap)')
 
-            return redirect('/setting/sitemap_set')
+            return redirect(conn, '/setting/sitemap_set')
         else:
             d_list = {}
             for i in setting_list:
@@ -52,7 +52,7 @@ def main_setting_sitemap_set():
 
             sitemap_list = ''
             if os.path.exists('sitemap.xml'):
-                sitemap_list += '<a href="/sitemap.xml">(' + load_lang('view') + ')</a>'
+                sitemap_list += '<a href="/sitemap.xml">(' + get_lang(conn, 'view') + ')</a>'
 
                 for_a = 0
                 while os.path.exists('sitemap_' + str(for_a) + '.xml'):
@@ -60,32 +60,32 @@ def main_setting_sitemap_set():
 
                     for_a += 1
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('sitemap_management'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'sitemap_management'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     ''' + sitemap_list + '''
                     <hr class="main_hr">
                     <form method="post">
-                        <a href="/setting/sitemap">(''' + load_lang('sitemap_manual_create') + ''')</a>
+                        <a href="/setting/sitemap">(''' + get_lang(conn, 'sitemap_manual_create') + ''')</a>
                         <hr class="main_hr">
 
-                        <input type="checkbox" ''' + check_box_div[4] + ''' name="sitemap_auto_make"> ''' + load_lang('sitemap_auto_make') + '''
+                        <input type="checkbox" ''' + check_box_div[4] + ''' name="sitemap_auto_make"> ''' + get_lang(conn, 'sitemap_auto_make') + '''
                         <hr class="main_hr">
 
-                        <input type="checkbox" ''' + check_box_div[0] + ''' name="sitemap_auto_exclude_domain"> ''' + load_lang('stiemap_exclude_domain') + '''
+                        <input type="checkbox" ''' + check_box_div[0] + ''' name="sitemap_auto_exclude_domain"> ''' + get_lang(conn, 'stiemap_exclude_domain') + '''
                         <hr class="main_hr">
 
-                        <input type="checkbox" ''' + check_box_div[1] + ''' name="sitemap_auto_exclude_user_page"> ''' + load_lang('stiemap_exclude_user_page') + '''
+                        <input type="checkbox" ''' + check_box_div[1] + ''' name="sitemap_auto_exclude_user_page"> ''' + get_lang(conn, 'stiemap_exclude_user_page') + '''
                         <hr class="main_hr">
 
-                        <input type="checkbox" ''' + check_box_div[2] + ''' name="sitemap_auto_exclude_file_page"> ''' + load_lang('stiemap_exclude_file_page') + '''
+                        <input type="checkbox" ''' + check_box_div[2] + ''' name="sitemap_auto_exclude_file_page"> ''' + get_lang(conn, 'stiemap_exclude_file_page') + '''
                         <hr class="main_hr">
 
-                        <input type="checkbox" ''' + check_box_div[3] + ''' name="sitemap_auto_exclude_category_page"> ''' + load_lang('stiemap_exclude_category_page') + '''
+                        <input type="checkbox" ''' + check_box_div[3] + ''' name="sitemap_auto_exclude_category_page"> ''' + get_lang(conn, 'stiemap_exclude_category_page') + '''
                         <hr class="main_hr">
 
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['setting', load_lang('return')]]
+                menu = [['setting', get_lang(conn, 'return')]]
             ))

+ 37 - 37
route/main_setting_skin_set.py

@@ -6,8 +6,8 @@ def main_setting_skin_set():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
             
         set_list = user_setting_skin_set_main_set_list()
 
@@ -21,9 +21,9 @@ def main_setting_skin_set():
             
             conn.commit()
 
-            admin_check(None, 'edit_set (skin_set)')
+            admin_check(conn, None, 'edit_set (skin_set)')
 
-            return redirect('/setting/skin_set')
+            return redirect(conn, '/setting/skin_set')
         else:
             set_data = {}
             for for_b in set_list:
@@ -41,130 +41,130 @@ def main_setting_skin_set():
 
             set_data_main = { for_b : '' for for_b in set_list }
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('main_skin_set_default'), wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('beta') + ')', 0])],
-                data = render_simple_set('''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'main_skin_set_default'), wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'beta') + ')', 0])],
+                data = render_simple_set(conn, '''
                     <form method="post">
-                        <h2>''' + load_lang("render") + '''</h2>
-                        <h3>''' + load_lang("strike") + '''</h3>
+                        <h2>''' + get_lang(conn, "render") + '''</h2>
+                        <h3>''' + get_lang(conn, "strike") + '''</h3>
                         ''' + set_data_main["main_css_strike"] + '''
                         <select name="main_css_strike">
                             ''' + set_data["main_css_strike"] + '''
                         </select>
-                        <h3>''' + load_lang("bold") + '''</h3>
+                        <h3>''' + get_lang(conn, "bold") + '''</h3>
                         ''' + set_data_main["main_css_bold"] + '''
                         <select name="main_css_bold">
                             ''' + set_data["main_css_bold"] + '''
                         </select>
-                        <h3>''' + load_lang("category") + '''</h3>
-                        <h4>''' + load_lang("position") + '''</h4>
+                        <h3>''' + get_lang(conn, "category") + '''</h3>
+                        <h4>''' + get_lang(conn, "position") + '''</h4>
                         ''' + set_data_main["main_css_category_set"] + '''
                         <select name="main_css_category_set">
                             ''' + set_data["main_css_category_set"] + '''
                         </select>
-                        <h4>''' + load_lang("category_change_title") + '''</h4>
+                        <h4>''' + get_lang(conn, "category_change_title") + '''</h4>
                         ''' + set_data_main["main_css_category_change_title"] + '''
                         <select name="main_css_category_change_title">
                             ''' + set_data["main_css_category_change_title"] + '''
                         </select>
-                        <h3>''' + load_lang("footnote") + ''' (''' + load_lang('beta') + ''')</h3>
-                        <h4>''' + load_lang("footnote_render") + '''</h4>
+                        <h3>''' + get_lang(conn, "footnote") + ''' (''' + get_lang(conn, 'beta') + ''')</h3>
+                        <h4>''' + get_lang(conn, "footnote_render") + '''</h4>
                         ''' + set_data_main["main_css_footnote_set"] + '''
                         <select name="main_css_footnote_set">
                             ''' + set_data["main_css_footnote_set"] + '''
                         </select>
-                        <h4>''' + load_lang("footnote_number") + '''</h4>
+                        <h4>''' + get_lang(conn, "footnote_number") + '''</h4>
                         ''' + set_data_main["main_css_footnote_number"] + '''
                         <select name="main_css_footnote_number">
                             ''' + set_data["main_css_footnote_number"] + '''
                         </select>
-                        <h4>''' + load_lang("footnote_real_num_view") + '''</h4>
+                        <h4>''' + get_lang(conn, "footnote_real_num_view") + '''</h4>
                         ''' + set_data_main["main_css_view_real_footnote_num"] + '''
                         <select name="main_css_view_real_footnote_num">
                             ''' + set_data["main_css_view_real_footnote_num"] + '''
                         </select>
-                        <h3>''' + load_lang("include_link") + '''</h3>
+                        <h3>''' + get_lang(conn, "include_link") + '''</h3>
                         ''' + set_data_main["main_css_include_link"] + '''
                         <select name="main_css_include_link">
                             ''' + set_data["main_css_include_link"] + '''
                         </select>
-                        <h3>''' + load_lang("image") + ''' (''' + load_lang('beta') + ''')</h3>
+                        <h3>''' + get_lang(conn, "image") + ''' (''' + get_lang(conn, 'beta') + ''')</h3>
                         ''' + set_data_main["main_css_image_set"] + '''
                         <select name="main_css_image_set">
                             ''' + set_data["main_css_image_set"] + '''
                         </select>
-                        <h3>''' + load_lang("toc") + '''</h3>
+                        <h3>''' + get_lang(conn, "toc") + '''</h3>
                         ''' + set_data_main["main_css_toc_set"] + '''
                         <select name="main_css_toc_set">
                             ''' + set_data["main_css_toc_set"] + '''
                         </select>
-                        <h3>''' + load_lang("exter_link") + '''</h3>
+                        <h3>''' + get_lang(conn, "exter_link") + '''</h3>
                         ''' + set_data_main["main_css_exter_link"] + '''
                         <select name="main_css_exter_link">
                             ''' + set_data["main_css_exter_link"] + '''
                         </select>
-                        <h3>''' + load_lang("link_delimiter") + '''</h3>
+                        <h3>''' + get_lang(conn, "link_delimiter") + '''</h3>
                         ''' + set_data_main["main_css_link_delimiter"] + '''
                         <select name="main_css_link_delimiter">
                             ''' + set_data["main_css_link_delimiter"] + '''
                         </select>
-                        <h3>''' + load_lang("force_darkmode") + '''</h3>
+                        <h3>''' + get_lang(conn, "force_darkmode") + '''</h3>
                         ''' + set_data_main["main_css_darkmode"] + '''
                         <select name="main_css_darkmode">
                             ''' + set_data["main_css_darkmode"] + '''
                         </select>
-                        <h3>''' + load_lang("table") + '''</h3>
-                        <h4>''' + load_lang("table_scroll") + '''</h4>
+                        <h3>''' + get_lang(conn, "table") + '''</h3>
+                        <h4>''' + get_lang(conn, "table_scroll") + '''</h4>
                         ''' + set_data_main["main_css_table_scroll"] + '''
                         <select name="main_css_table_scroll">
                             ''' + set_data["main_css_table_scroll"] + '''
                         </select>
-                        <h4>''' + load_lang("table_transparent") + '''</h4>
+                        <h4>''' + get_lang(conn, "table_transparent") + '''</h4>
                         ''' + set_data_main["main_css_table_transparent"] + '''
                         <select name="main_css_table_transparent">
                             ''' + set_data["main_css_table_transparent"] + '''
                         </select>
-                        <h3>''' + load_lang("list_view_change") + '''</h3>
+                        <h3>''' + get_lang(conn, "list_view_change") + '''</h3>
                         ''' + set_data_main["main_css_list_view_change"] + '''
                         <select name="main_css_list_view_change">
                             ''' + set_data["main_css_list_view_change"] + '''
                         </select>
-                        <h3>''' + load_lang("view_joke") + '''</h3>
+                        <h3>''' + get_lang(conn, "view_joke") + '''</h3>
                         ''' + set_data_main["main_css_view_joke"] + '''
                         <select name="main_css_view_joke">
                             ''' + set_data["main_css_view_joke"] + '''
                         </select>
-                        <h3>''' + load_lang("math_scroll") + '''</h3>
+                        <h3>''' + get_lang(conn, "math_scroll") + '''</h3>
                         ''' + set_data_main["main_css_math_scroll"] + '''
                         <select name="main_css_math_scroll">
                             ''' + set_data["main_css_math_scroll"] + '''
                         </select>
-                        <h3>''' + load_lang("view_history") + '''</h3>
+                        <h3>''' + get_lang(conn, "view_history") + '''</h3>
                         ''' + set_data_main["main_css_view_history"] + '''
                         <select name="main_css_view_history">
                             ''' + set_data["main_css_view_history"] + '''
                         </select>
-                        <h3>''' + load_lang("font_size") + '''</h3>
+                        <h3>''' + get_lang(conn, "font_size") + '''</h3>
                         ''' + set_data_main["main_css_font_size"] + '''
                         <select name="main_css_font_size">
                             ''' + set_data["main_css_font_size"] + '''
                         </select>
-                        <h2>''' + load_lang("edit") + '''</h2>
-                        <h3>''' + load_lang("image_paste") + '''</h3>
-                        <sup>''' + load_lang('only_korean') + '''</sup> <sup>''' + load_lang('unavailable_in_monaco') + '''</sup>
+                        <h2>''' + get_lang(conn, "edit") + '''</h2>
+                        <h3>''' + get_lang(conn, "image_paste") + '''</h3>
+                        <sup>''' + get_lang(conn, 'only_korean') + '''</sup> <sup>''' + get_lang(conn, 'unavailable_in_monaco') + '''</sup>
                         <hr class="main_hr">
                         ''' + set_data_main["main_css_image_paste"] + '''
                         <select name="main_css_image_paste">
                             ''' + set_data["main_css_image_paste"] + '''
                         </select>
-                        <h3>''' + load_lang("monaco_editor") + '''</h3>
+                        <h3>''' + get_lang(conn, "monaco_editor") + '''</h3>
                         ''' + set_data_main["main_css_monaco"] + '''
                         <select name="main_css_monaco">
                             ''' + set_data["main_css_monaco"] + '''
                         </select>
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('save') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 '''),
-                menu = [['setting', load_lang('return')]]
+                menu = [['setting', get_lang(conn, 'return')]]
             ))

+ 10 - 10
route/main_setting_top_menu.py

@@ -4,8 +4,8 @@ def main_setting_top_menu():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
         
         if flask.request.method == 'POST':
             curs.execute(db_change("select name from other where name = 'top_menu'"))
@@ -16,16 +16,16 @@ def main_setting_top_menu():
 
             conn.commit()
 
-            admin_check(None, 'edit_set (top_menu)')
+            admin_check(conn, None, 'edit_set (top_menu)')
 
-            return redirect('/setting/top_menu')
+            return redirect(conn, '/setting/top_menu')
         else:
             curs.execute(db_change("select data from other where name = 'top_menu'"))
             db_data = curs.fetchall()
             db_data = db_data[0][0] if db_data else ''
             
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('top_menu_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'top_menu_setting'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <span>
                         EX)
@@ -39,13 +39,13 @@ def main_setting_top_menu():
                         /w/FrontPage
                     </span>
                     <hr class="main_hr">
-                    ''' + load_lang('not_support_skin_warning') + '''
+                    ''' + get_lang(conn, 'not_support_skin_warning') + '''
                     <hr class="main_hr">
                     <form method="post">
-                        <textarea class="opennamu_textarea_500" placeholder="''' + load_lang('enter_top_menu_setting') + '''" name="content" id="content">''' + html.escape(db_data) + '''</textarea>
+                        <textarea class="opennamu_textarea_500" placeholder="''' + get_lang(conn, 'enter_top_menu_setting') + '''" name="content" id="content">''' + html.escape(db_data) + '''</textarea>
                         <hr class="main_hr">
-                        <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
+                        <button id="opennamu_save_button" type="submit">''' + get_lang(conn, 'save') + '''</button>
                     </form>
                 ''',
-                menu = [['setting', load_lang('return')]]
+                menu = [['setting', get_lang(conn, 'return')]]
             ))

+ 8 - 8
route/main_sys_restart.py

@@ -2,11 +2,11 @@ from .tool.func import *
 
 def main_sys_restart():
     with get_db_connect() as conn:
-        if admin_check() != 1:
-            return re_error('/error/3')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
-            admin_check(None, 'restart')
+            admin_check(conn, None, 'restart')
 
             print('Restart')
 
@@ -30,14 +30,14 @@ def main_sys_restart():
                 except:
                     pass
             else:
-                return re_error('/error/33')
+                return re_error(conn, '/error/33')
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('wiki_restart'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'wiki_restart'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
-                        <button type="submit">''' + load_lang('restart') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'restart') + '''</button>
                     </form>
                 ''',
-                menu = [['manager', load_lang('return')]]
+                menu = [['manager', get_lang(conn, 'return')]]
             ))

+ 7 - 7
route/main_sys_shutdown.py

@@ -2,11 +2,11 @@ from .tool.func import *
 
 def main_sys_shutdown():
     with get_db_connect() as conn:
-        if admin_check() != 1:
-            return re_error('/error/3')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
-            admin_check(None, 'shutdown')
+            admin_check(conn, None, 'shutdown')
 
             conn.commit()
 
@@ -14,12 +14,12 @@ def main_sys_shutdown():
 
             os._exit(0)
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('wiki_shutdown'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'wiki_shutdown'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
-                        <button type="submit">''' + load_lang('shutdown') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'shutdown') + '''</button>
                     </form>
                 ''',
-                menu = [['manager', load_lang('return')]]
+                menu = [['manager', get_lang(conn, 'return')]]
             ))

+ 13 - 13
route/main_sys_update.py

@@ -7,11 +7,11 @@ def main_sys_update():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/error/3')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
-            admin_check(None, 'update')
+            admin_check(conn, None, 'update')
 
             curs.execute(db_change('select data from other where name = "update"'))
             up_data = curs.fetchall()
@@ -29,7 +29,7 @@ def main_sys_update():
                     if for_a != 0:
                         break
                 else:
-                    return redirect('/restart')
+                    return redirect(conn, '/restart')
                 
                 print('Error : update failed')
             elif platform.system() == 'Windows':
@@ -42,27 +42,27 @@ def main_sys_update():
                     os.system('rd /s /q opennamu-' + up_data)
                     os.system('del update.zip')
 
-                    return redirect('/restart')
+                    return redirect(conn, '/restart')
                 else:
                     print('Error : update failed')
 
-            return re_error('/error/34')
+            return re_error(conn, '/error/34')
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('update'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-                data = load_lang('update_warning') + '''
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'update'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
+                data = get_lang(conn, 'update_warning') + '''
                     <hr class="main_hr">
                     <ul class="opennamu_ul">
-                        <li id="ver_send_2">''' + load_lang('version') + ''' : </li>
-                        <li id="ver_send">''' + load_lang('lastest') + ''' : </li>
+                        <li id="ver_send_2">''' + get_lang(conn, 'version') + ''' : </li>
+                        <li id="ver_send">''' + get_lang(conn, 'lastest') + ''' : </li>
                     </ul>
                     <a href="https://github.com/openNAMU/openNAMU">(Beta)</a> <a href="https://github.com/openNAMU/openNAMU/tree/stable">(Stable)</a>
                     <hr class="main_hr">
                     <form method="post">
-                        <button type="submit">''' + load_lang('update') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'update') + '''</button>
                     </form>
                     <!-- JS : opennamu_do_insert_version -->
                 ''',
-                menu = [['manager', load_lang('return')]]
+                menu = [['manager', get_lang(conn, 'return')]]
             ))
 

+ 39 - 39
route/main_tool_admin.py

@@ -2,59 +2,59 @@ from .tool.func import *
 
 def main_tool_admin():
     with get_db_connect() as conn:
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('admin_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-            data = render_simple_set('''
-                <h2>''' + load_lang('admin') + '''</h2>
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'admin_tool'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
+            data = render_simple_set(conn, '''
+                <h2>''' + get_lang(conn, 'admin') + '''</h2>
                 <ul class="opennamu_ul">
-                    <li><a href="/manager/2">''' + load_lang('acl_change') + '''</a></li>
-                    <li><a href="/manager/3">''' + load_lang('check_user') + '''</a></li>
-                    <li><a href="/auth/give/ban">''' + load_lang('ban') + '''</a></li>
-                    <li><a href="/auth/give/ban_multiple">''' + load_lang('multiple_ban') + '''</a></li>
-                    <li><a href="/manager/17">''' + load_lang('release') + '''</a></li>
-                    <li><a href="/manager/5">''' + load_lang('authorize') + '''</a></li>
+                    <li><a href="/manager/2">''' + get_lang(conn, 'acl_change') + '''</a></li>
+                    <li><a href="/manager/3">''' + get_lang(conn, 'check_user') + '''</a></li>
+                    <li><a href="/auth/give/ban">''' + get_lang(conn, 'ban') + '''</a></li>
+                    <li><a href="/auth/give/ban_multiple">''' + get_lang(conn, 'multiple_ban') + '''</a></li>
+                    <li><a href="/manager/17">''' + get_lang(conn, 'release') + '''</a></li>
+                    <li><a href="/manager/5">''' + get_lang(conn, 'authorize') + '''</a></li>
                 </ul>
-                <h2>''' + load_lang('owner') + '''</h2>
+                <h2>''' + get_lang(conn, 'owner') + '''</h2>
                 <ul class="opennamu_ul">
-                    <li><a href="/auth/list">''' + load_lang('admin_group_list') + '''</a></li>
-                    <li><a href="/delete_multiple">''' + load_lang('many_delete') + '''</a></li>
-                    <li><a href="/app_submit">''' + load_lang('application_list') + '''</a></li>
-                    <li><a href="/register">''' + load_lang('add_user') + '''</a></li>
-                    <li><a href="/setting">''' + load_lang('setting') + '''</a></li>
-                    <li><a href="/manager/18">''' + load_lang('user_fix') + '''</a></li>
+                    <li><a href="/auth/list">''' + get_lang(conn, 'admin_group_list') + '''</a></li>
+                    <li><a href="/delete_multiple">''' + get_lang(conn, 'many_delete') + '''</a></li>
+                    <li><a href="/app_submit">''' + get_lang(conn, 'application_list') + '''</a></li>
+                    <li><a href="/register">''' + get_lang(conn, 'add_user') + '''</a></li>
+                    <li><a href="/setting">''' + get_lang(conn, 'setting') + '''</a></li>
+                    <li><a href="/manager/18">''' + get_lang(conn, 'user_fix') + '''</a></li>
                 </ul>
-                <h3>''' + load_lang('filter') + '''</h3>
+                <h3>''' + get_lang(conn, 'filter') + '''</h3>
                 <ul class="opennamu_ul">
-                    <li><a href="/filter/edit_filter">''' + load_lang('edit_filter_list') + '''</a></li>
-                    <li><a href="/filter/inter_wiki">''' + load_lang('interwiki_list') + '''</a></li>
-                    <li><a href="/filter/edit_top">''' + load_lang('edit_tool_list') + '''</a></li>
-                    <li><a href="/filter/image_license">''' + load_lang('image_license_list') + '''</a></li>
-                    <li><a href="/filter/email_filter">''' + load_lang('email_filter_list') + '''</a></li>
-                    <li><a href="/filter/name_filter">''' + load_lang('id_filter_list') + '''</a></li>
-                    <li><a href="/filter/file_filter">''' + load_lang('file_filter_list') + '''</a></li>
-                    <li><a href="/filter/extension_filter">''' + load_lang('extension_filter_list') + '''</a></li>
-                    <li><a href="/filter/document">''' + load_lang('document_filter_list') + '''</a></li>
-                    <li><a href="/filter/outer_link">''' + load_lang('outer_link_filter_list') + '''</a> (''' + load_lang('beta') + ''')
-                    <li><a href="/filter/template">''' + load_lang('template_document_list') + '''</a> (''' + load_lang('beta') + ''')
+                    <li><a href="/filter/edit_filter">''' + get_lang(conn, 'edit_filter_list') + '''</a></li>
+                    <li><a href="/filter/inter_wiki">''' + get_lang(conn, 'interwiki_list') + '''</a></li>
+                    <li><a href="/filter/edit_top">''' + get_lang(conn, 'edit_tool_list') + '''</a></li>
+                    <li><a href="/filter/image_license">''' + get_lang(conn, 'image_license_list') + '''</a></li>
+                    <li><a href="/filter/email_filter">''' + get_lang(conn, 'email_filter_list') + '''</a></li>
+                    <li><a href="/filter/name_filter">''' + get_lang(conn, 'id_filter_list') + '''</a></li>
+                    <li><a href="/filter/file_filter">''' + get_lang(conn, 'file_filter_list') + '''</a></li>
+                    <li><a href="/filter/extension_filter">''' + get_lang(conn, 'extension_filter_list') + '''</a></li>
+                    <li><a href="/filter/document">''' + get_lang(conn, 'document_filter_list') + '''</a></li>
+                    <li><a href="/filter/outer_link">''' + get_lang(conn, 'outer_link_filter_list') + '''</a> (''' + get_lang(conn, 'beta') + ''')
+                    <li><a href="/filter/template">''' + get_lang(conn, 'template_document_list') + '''</a> (''' + get_lang(conn, 'beta') + ''')
                 </ul>
-                <h3>''' + load_lang('server') + '''</h2>
+                <h3>''' + get_lang(conn, 'server') + '''</h2>
                 <ul class="opennamu_ul">
-                    <li><a href="/restart">''' + load_lang('wiki_restart') + '''</a></li>
-                    <li><a href="/shutdown">''' + load_lang('wiki_shutdown') + '''</a></li>
-                    <li><a href="/update">''' + load_lang('update') + '''</a></li>
+                    <li><a href="/restart">''' + get_lang(conn, 'wiki_restart') + '''</a></li>
+                    <li><a href="/shutdown">''' + get_lang(conn, 'wiki_shutdown') + '''</a></li>
+                    <li><a href="/update">''' + get_lang(conn, 'update') + '''</a></li>
                 </ul>
-                <h2>''' + load_lang('version') + '''</h2>
+                <h2>''' + get_lang(conn, 'version') + '''</h2>
                 <ul class="opennamu_ul">
-                    <li id="ver_send_2">''' + load_lang('version') + ''' : </li>
-                    <li id="ver_send">''' + load_lang('lastest') + ''' : </li>
+                    <li id="ver_send_2">''' + get_lang(conn, 'version') + ''' : </li>
+                    <li id="ver_send">''' + get_lang(conn, 'lastest') + ''' : </li>
                 </ul>
-                <h3>''' + load_lang('skin_info') + '''</h3>
+                <h3>''' + get_lang(conn, 'skin_info') + '''</h3>
                 <ul class="opennamu_ul">
-                    <li><a href="/api/skin_info?all=true">''' + load_lang('skin_info') + '''</a></li>
+                    <li><a href="/api/skin_info?all=true">''' + get_lang(conn, 'skin_info') + '''</a></li>
                     <div id="ver_send_3"></div>
                 </ul>
                 <!-- JS : opennamu_do_insert_version -->
                 <!-- JS : opennamu_do_insert_version_skin -->
             '''),
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 33 - 33
route/main_tool_other.py

@@ -2,53 +2,53 @@ from .tool.func import *
 
 def main_tool_other():
     with get_db_connect() as conn:
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('other_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-            data = render_simple_set('''
-                <h2>''' + load_lang('user_tool') + '''</h2>
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'other_tool'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
+            data = render_simple_set(conn, '''
+                <h2>''' + get_lang(conn, 'user_tool') + '''</h2>
                 <ul class="opennamu_ul">
-                    <li><a href="/manager/6">''' + load_lang('user_tool') + '''</a></li>
+                    <li><a href="/manager/6">''' + get_lang(conn, 'user_tool') + '''</a></li>
                 </ul>
-                <h2>''' + load_lang('list') + '''</h2>
-                <h3>''' + load_lang('admin') + '''</h3>
+                <h2>''' + get_lang(conn, 'list') + '''</h2>
+                <h3>''' + get_lang(conn, 'admin') + '''</h3>
                 <ul class="opennamu_ul">               
-                    <li><a href="/list/admin">''' + load_lang('admin_list') + '''</a></li>
-                    <li><a href="/list/admin/auth_use">''' + load_lang('authority_use_list') + '''</a></li>
+                    <li><a href="/list/admin">''' + get_lang(conn, 'admin_list') + '''</a></li>
+                    <li><a href="/list/admin/auth_use">''' + get_lang(conn, 'authority_use_list') + '''</a></li>
                 </ul>
-                <h3>''' + load_lang('discussion') + '''</h3>
+                <h3>''' + get_lang(conn, 'discussion') + '''</h3>
                 <ul class="opennamu_ul">
-                    <li><a href="/recent_discuss">''' + load_lang('recent_discussion') + '''</a></li>
+                    <li><a href="/recent_discuss">''' + get_lang(conn, 'recent_discussion') + '''</a></li>
                 </ul>
-                <h3>''' + load_lang('document') + '''</h3>
+                <h3>''' + get_lang(conn, 'document') + '''</h3>
                 <ul class="opennamu_ul">
-                    <li><a href="/recent_change">''' + load_lang('recent_change') + '''</a></li>
-                    <li><a href="/list/document/all">''' + load_lang('all_document_list') + '''</a></li>
-                    <li><a href="/list/document/acl">''' + load_lang('acl_document_list') + '''</a></li>
-                    <li><a href="/list/document/need">''' + load_lang('need_document') + '''</a></li>
-                    <li><a href="/list/document/long">''' + load_lang('long_page') + '''</a></li>
-                    <li><a href="/list/document/short">''' + load_lang('short_page') + '''</a></li>
-                    <li><a href="/list/document/old">''' + load_lang('old_page') + '''</a></li>
-                    <li><a href="/list/document/no_link">''' + load_lang('no_link_document_list') + '''</a></li>
-                </ul>
-                <h3>''' + load_lang('user') + '''</h3>
+                    <li><a href="/recent_change">''' + get_lang(conn, 'recent_change') + '''</a></li>
+                    <li><a href="/list/document/all">''' + get_lang(conn, 'all_document_list') + '''</a></li>
+                    <li><a href="/list/document/acl">''' + get_lang(conn, 'acl_document_list') + '''</a></li>
+                    <li><a href="/list/document/need">''' + get_lang(conn, 'need_document') + '''</a></li>
+                    <li><a href="/list/document/long">''' + get_lang(conn, 'long_page') + '''</a></li>
+                    <li><a href="/list/document/short">''' + get_lang(conn, 'short_page') + '''</a></li>
+                    <li><a href="/list/document/old">''' + get_lang(conn, 'old_page') + '''</a></li>
+                    <li><a href="/list/document/no_link">''' + get_lang(conn, 'no_link_document_list') + '''</a></li>
+                </ul>
+                <h3>''' + get_lang(conn, 'user') + '''</h3>
                 <ul class="opennamu_ul">
-                    <li><a href="/block_log">''' + load_lang('recent_ban') + '''</a></li>
-                    <li><a href="/list/user">''' + load_lang('member_list') + '''</a></li>
+                    <li><a href="/block_log">''' + get_lang(conn, 'recent_ban') + '''</a></li>
+                    <li><a href="/list/user">''' + get_lang(conn, 'member_list') + '''</a></li>
                 </ul>
-                <h3>''' + load_lang('other') + '''</h3>
+                <h3>''' + get_lang(conn, 'other') + '''</h3>
                 <ul class="opennamu_ul">
-                    <li><a href="/list/file">''' + load_lang('image_file_list') + '''</a></li>
-                    <li><a href="/vote">''' + load_lang('vote_list') + '''</a></li>
-                    <li><a href="/bbs/main">''' + load_lang('bbs_main') + '''</a></li>
+                    <li><a href="/list/file">''' + get_lang(conn, 'image_file_list') + '''</a></li>
+                    <li><a href="/vote">''' + get_lang(conn, 'vote_list') + '''</a></li>
+                    <li><a href="/bbs/main">''' + get_lang(conn, 'bbs_main') + '''</a></li>
                 </ul>
-                <h2>''' + load_lang('other') + '''</h2>
+                <h2>''' + get_lang(conn, 'other') + '''</h2>
                 <ul class="opennamu_ul">
-                    <li><a href="/upload">''' + load_lang('upload') + '''</a></li>
-                    <li><a href="/manager/10">''' + load_lang('search') + '''</a></li>
+                    <li><a href="/upload">''' + get_lang(conn, 'upload') + '''</a></li>
+                    <li><a href="/manager/10">''' + get_lang(conn, 'search') + '''</a></li>
                 </ul>
-                <h2>''' + load_lang('admin') + '''</h2>
+                <h2>''' + get_lang(conn, 'admin') + '''</h2>
                 <ul class="opennamu_ul">
-                    <li><a href="/manager/1">''' + load_lang('admin_tool') + '''</a></li>
+                    <li><a href="/manager/1">''' + get_lang(conn, 'admin_tool') + '''</a></li>
                 </ul>
             '''),
             menu = 0

+ 29 - 29
route/main_tool_redirect.py

@@ -1,30 +1,30 @@
 from .tool.func import *
 
-def main_tool_redirect(num = 1, add_2 = ''):
+def main_tool_redirect(conn, num = 1, add_2 = ''):
     with get_db_connect() as conn:
         curs = conn.cursor()
 
         title_list = {
-            0 : [load_lang('document_name'), '/acl', load_lang('acl')],
-            1 : [0, '/list/user/check', load_lang('check')],
-            2 : [load_lang('file_name'), '/filter/file_filter/add', load_lang('file_filter_add')],
-            3 : [0, '/auth/give', load_lang('authorize')],
-            4 : [0, '/user', load_lang('user_tool')],
-            6 : [load_lang('name'), '/auth/list/add', load_lang('add_admin_group')],
-            7 : [load_lang('name'), '/filter/edit_filter/add', load_lang('edit_filter_add')],
-            8 : [load_lang('document_name'), '/search', load_lang('search')],
-            9 : [0, '/block_log/user', load_lang('blocked_user')],
-            10 : [0, '/block_log/admin', load_lang('blocked_admin')],
-            11 : [load_lang('document_name'), '/watch_list', load_lang('add_watchlist')],
-            12 : [load_lang('compare_target'), '/list/user/check', load_lang('compare_target')],
-            13 : [load_lang('document_name'), '/edit', load_lang('load')],
-            14 : [load_lang('document_name'), '/star_doc', load_lang('add_star_doc')],
-            15 : [load_lang('name_or_ip_or_regex'), '/auth/give/ban', load_lang('release')],
-            16 : [0, '/auth/give/fix', load_lang('user_fix')],
+            0 : [get_lang(conn, 'document_name'), '/acl', get_lang(conn, 'acl')],
+            1 : [0, '/list/user/check', get_lang(conn, 'check')],
+            2 : [get_lang(conn, 'file_name'), '/filter/file_filter/add', get_lang(conn, 'file_filter_add')],
+            3 : [0, '/auth/give', get_lang(conn, 'authorize')],
+            4 : [0, '/user', get_lang(conn, 'user_tool')],
+            6 : [get_lang(conn, 'name'), '/auth/list/add', get_lang(conn, 'add_admin_group')],
+            7 : [get_lang(conn, 'name'), '/filter/edit_filter/add', get_lang(conn, 'edit_filter_add')],
+            8 : [get_lang(conn, 'document_name'), '/search', get_lang(conn, 'search')],
+            9 : [0, '/block_log/user', get_lang(conn, 'blocked_user')],
+            10 : [0, '/block_log/admin', get_lang(conn, 'blocked_admin')],
+            11 : [get_lang(conn, 'document_name'), '/watch_list', get_lang(conn, 'add_watchlist')],
+            12 : [get_lang(conn, 'compare_target'), '/list/user/check', get_lang(conn, 'compare_target')],
+            13 : [get_lang(conn, 'document_name'), '/edit', get_lang(conn, 'load')],
+            14 : [get_lang(conn, 'document_name'), '/star_doc', get_lang(conn, 'add_star_doc')],
+            15 : [get_lang(conn, 'name_or_ip_or_regex'), '/auth/give/ban', get_lang(conn, 'release')],
+            16 : [0, '/auth/give/fix', get_lang(conn, 'user_fix')],
         }
         
         if num == 1:
-            return redirect('/manager')
+            return redirect(conn, '/manager')
         elif num - 1 <= len(title_list):
             num -= 2
 
@@ -33,22 +33,22 @@ def main_tool_redirect(num = 1, add_2 = ''):
                 if add_2 != '':
                     if num != 12:
                         flask.session['edit_load_document'] = add_1
-                        return redirect('/edit_from/' + url_pas(add_2))
+                        return redirect(conn, '/edit_from/' + url_pas(add_2))
                     else:
-                        return redirect(title_list[num][1] + '/' + url_pas(add_2) + '/normal/1/' + url_pas(add_1))
+                        return redirect(conn, title_list[num][1] + '/' + url_pas(add_2) + '/normal/1/' + url_pas(add_1))
                 elif flask.request.form.get('regex', '') != '':
-                    return redirect('/auth/give/ban_regex/' + url_pas(add_1))
+                    return redirect(conn, '/auth/give/ban_regex/' + url_pas(add_1))
                 else:
-                    return redirect(title_list[num][1] + '/' + url_pas(add_1))
+                    return redirect(conn, title_list[num][1] + '/' + url_pas(add_1))
             else:
                 if title_list[num][0] == 0:
-                    placeholder = load_lang('user_name')
+                    placeholder = get_lang(conn, 'user_name')
                 else:
                     placeholder = title_list[num][0]
 
                 plus = ''
                 if num == 15:
-                    plus = '<input type="checkbox" name="regex"> ' + load_lang('regex') + '<hr class="main_hr">'
+                    plus = '<input type="checkbox" name="regex"> ' + get_lang(conn, 'regex') + '<hr class="main_hr">'
 
                 top_plus = ''
                 if num == 13:
@@ -60,18 +60,18 @@ def main_tool_redirect(num = 1, add_2 = ''):
                             '<hr class="main_hr">' + \
                         ''
 
-                return easy_minify(flask.render_template(skin_check(),
-                    imp = [title_list[num][2], wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                return easy_minify(conn, flask.render_template(skin_check(conn),
+                    imp = [title_list[num][2], wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                     data = '''
                         <form method="post">
                             ''' + top_plus + '''
                             <input placeholder="''' + placeholder + '''" id="data_field" name="name" type="text">
                             <hr class="main_hr">
                             ''' + plus + '''
-                            <button type="submit">''' + load_lang('go') + '''</button>
+                            <button type="submit">''' + get_lang(conn, 'go') + '''</button>
                         </form>
                     ''',
-                    menu = [['manager', load_lang('return')]]
+                    menu = [['manager', get_lang(conn, 'return')]]
                 ))
         else:
-            return redirect()
+            return redirect(conn)

+ 2 - 2
route/main_view_file.py

@@ -9,14 +9,14 @@ def main_view_file(data = ''):
             curs.execute(db_change("select data from other where name = 'robot_default'"))
             db_data = curs.fetchall()
             if db_data and db_data[0][0] != '':
-                return flask.Response(get_default_robots_txt(), mimetype = 'text/plain')
+                return flask.Response(get_default_robots_txt(conn), mimetype = 'text/plain')
             else:
                 curs.execute(db_change("select data from other where name = 'robot'"))
                 db_data = curs.fetchall()
                 if db_data:
                     return flask.Response(db_data[0][0], mimetype = 'text/plain')
                 else:
-                    return flask.Response(get_default_robots_txt(), mimetype = 'text/plain')
+                    return flask.Response(get_default_robots_txt(conn), mimetype = 'text/plain')
         elif os.path.exists(data):
             if re.search(r'\.txt$', data, flags = re.I):
                 return flask.send_from_directory('./', data, mimetype = 'text/plain')

+ 1 - 1
route/main_view_image.py

@@ -10,6 +10,6 @@ def main_view_image(name = ''):
             if mime_type == 'svg':
                 mime_type = 'svg+xml'
 
-            return flask.send_from_directory('./' + load_image_url(), name, mimetype = 'image/' + mime_type)
+            return flask.send_from_directory('./' + load_image_url(conn), name, mimetype = 'image/' + mime_type)
         else:
             return main_func_error_404()

+ 5 - 5
route/n_w_watch_list.py

@@ -4,7 +4,7 @@ from .go_api_w_watch_list import api_w_watch_list
 
 def w_watch_list(db_set, name, num = 1, do_type = 'watch_list'):
     with get_db_connect() as conn:
-        data = '<a href="/doc_watch_list/1/' + url_pas(name) + '">(' + load_lang('watchlist') + ')</a> <a href="/doc_star_doc/1/' + url_pas(name) + '">(' + load_lang('star_doc') + ')</a>'
+        data = '<a href="/doc_watch_list/1/' + url_pas(name) + '">(' + get_lang(conn, 'watchlist') + ')</a> <a href="/doc_star_doc/1/' + url_pas(name) + '">(' + get_lang(conn, 'star_doc') + ')</a>'
         data += '<ul class="opennamu_ul">'
         
         list_data = json.loads(api_w_watch_list(db_set, name, do_type, num).data)
@@ -13,10 +13,10 @@ def w_watch_list(db_set, name, num = 1, do_type = 'watch_list'):
         data += '</ul>'
         data += '<script>opennamu_do_ip_render();</script>'
 
-        data += get_next_page_bottom('/doc_' + do_type + '/{}/' + url_pas(name), num, list_data)
+        data += get_next_page_bottom(conn, '/doc_' + do_type + '/{}/' + url_pas(name), num, list_data)
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang(do_type if do_type == 'star_doc' else 'watchlist') + ')', 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, do_type if do_type == 'star_doc' else 'watchlist') + ')', 0])],
             data = data,
-            menu = [['w/' + url_pas(name), load_lang('return')]]
+            menu = [['w/' + url_pas(name), get_lang(conn, 'return')]]
         ))

+ 17 - 17
route/recent_app_submit.py

@@ -9,26 +9,26 @@ def recent_app_submit_2():
         curs.execute(db_change('select data from other where name = "requires_approval"'))
         requires_approval = curs.fetchall()
         if requires_approval and requires_approval[0][0] != 'on':
-            div += load_lang('approval_requirement_disabled')
+            div += get_lang(conn, 'approval_requirement_disabled')
 
         if flask.request.method == 'GET':
             curs.execute(db_change('select data from user_set where name = "application"'))
             db_data = curs.fetchall()
             if db_data:
                 div += '' + \
-                    load_lang('all_register_num') + ' : ' + str(len(db_data)) + \
+                    get_lang(conn, 'all_register_num') + ' : ' + str(len(db_data)) + \
                     '<hr class="main_hr">' + \
                 ''
 
                 div += '''
                     <table id="main_table_set">
                         <tr id="main_table_top_tr">
-                            <td id="main_table_width_half">''' + load_lang('id') + '''</td>
-                            <td id="main_table_width_half">''' + load_lang('email') + '''</td>
+                            <td id="main_table_width_half">''' + get_lang(conn, 'id') + '''</td>
+                            <td id="main_table_width_half">''' + get_lang(conn, 'email') + '''</td>
                         </tr>
                         <tr id="main_table_top_tr">
-                            <td>''' + load_lang('approval_question') + '''</td>
-                            <td>''' + load_lang('answer') + '''</td>
+                            <td>''' + get_lang(conn, 'approval_question') + '''</td>
+                            <td>''' + get_lang(conn, 'answer') + '''</td>
                         </tr>                        
                 '''
 
@@ -70,12 +70,12 @@ def recent_app_submit_2():
                                             id="opennamu_save_button"
                                             name="approve" 
                                             value="''' + application['id'] + '''">
-                                        ''' + load_lang('approve') + '''
+                                        ''' + get_lang(conn, 'approve') + '''
                                     </button>
                                     <button type="submit" 
                                             name="decline" 
                                             value="''' + application['id'] + '''">
-                                        ''' + load_lang('decline') + '''
+                                        ''' + get_lang(conn, 'decline') + '''
                                     </button>
                                 </td>
                             </tr>
@@ -84,26 +84,26 @@ def recent_app_submit_2():
 
                 div += '</table>'
             else:
-                div += load_lang('no_applications_now')
+                div += get_lang(conn, 'no_applications_now')
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('application_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'application_list'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
                 data = div,
-                menu = [['other', load_lang('return')]]
+                menu = [['other', get_lang(conn, 'return')]]
             ))
         else:
-            if admin_check(None, 'app submit') != 1:
-                return re_error('/ban')
+            if admin_check(conn, None, 'app submit') != 1:
+                return re_error(conn, '/ban')
 
             if flask.request.form.get('approve', '') != '':
                 curs.execute(db_change('select data from user_set where id = ? and name = "application"'), [flask.request.form.get('approve', '')])
                 application = curs.fetchall()
                 if not application:
-                    return re_error('/error/26')
+                    return re_error(conn, '/error/26')
                 else:
                     application = json.loads(application[0][0])
 
-                add_user(application['id'], application['pw'], application['email'], application['encode'])
+                add_user(conn, application['id'], application['pw'], application['email'], application['encode'])
 
                 curs.execute(db_change("insert into user_set (name, id, data) values ('approval_question', ?, ?)"), [application['id'], application['question']])
                 curs.execute(db_change("insert into user_set (name, id, data) values ('approval_question_answer', ?, ?)"), [application['id'], application['answer']])
@@ -114,4 +114,4 @@ def recent_app_submit_2():
                 curs.execute(db_change('delete from user_set where id = ? and name = "application"'), [flask.request.form.get('decline', '')])
                 conn.commit()
 
-            return redirect('/app_submit')
+            return redirect(conn, '/app_submit')

+ 29 - 29
route/recent_block.py

@@ -10,49 +10,49 @@ def recent_block(name = 'Test', tool = 'all', num = 1):
             <table id="main_table_set">
                 <tbody>
                     <tr id="main_table_top_tr">
-                        <td id="main_table_width">''' + load_lang('blocked') + '''</td>
-                        <td id="main_table_width">''' + load_lang('admin') + '''</td>
-                        <td id="main_table_width">''' + load_lang('period') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'blocked') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'admin') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'period') + '''</td>
                     </tr>
         '''
 
         div = '' + \
-            '<a href="/block_log">(' + load_lang('all') + ')</a> ' + \
-            '<a href="/manager/11">(' + load_lang('blocked') + ')</a> ' + \
-            '<a href="/manager/12">(' + load_lang('admin') + ')</a> ' + \
-            '<a href="/block_log/ongoing">(' + load_lang('in_progress') + ')</a> ' + \
-            '<a href="/block_log/regex">(' + load_lang('regex') + ')</a>' + \
+            '<a href="/block_log">(' + get_lang(conn, 'all') + ')</a> ' + \
+            '<a href="/manager/11">(' + get_lang(conn, 'blocked') + ')</a> ' + \
+            '<a href="/manager/12">(' + get_lang(conn, 'admin') + ')</a> ' + \
+            '<a href="/block_log/ongoing">(' + get_lang(conn, 'in_progress') + ')</a> ' + \
+            '<a href="/block_log/regex">(' + get_lang(conn, 'regex') + ')</a>' + \
             '<hr class="main_hr">' + \
         '' + div
 
         if tool == 'all':
             sub = 0
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
 
             curs.execute(db_change("select why, block, blocker, end, today, band, ongoing from rb order by today desc limit ?, 50"), [sql_num])
         elif tool == 'ongoing':
-            sub = '(' + load_lang('in_progress') + ')'
-            menu = [['other', load_lang('return')]]
+            sub = '(' + get_lang(conn, 'in_progress') + ')'
+            menu = [['other', get_lang(conn, 'return')]]
 
             curs.execute(db_change("select why, block, blocker, end, today, band, ongoing from rb where ongoing = '1' order by end desc limit ?, 50"), [sql_num])
         elif tool == 'regex':
-            sub = '(' + load_lang('regex') + ')'
-            menu = [['other', load_lang('return')]]
+            sub = '(' + get_lang(conn, 'regex') + ')'
+            menu = [['other', get_lang(conn, 'return')]]
 
             curs.execute(db_change("select why, block, blocker, end, today, band, ongoing from rb where band = 'regex' order by today desc limit ?, 50"), [sql_num])
         elif tool == 'user':
-            sub = '(' + load_lang('blocked') + ')'
-            menu = [['other', load_lang('return')]]
+            sub = '(' + get_lang(conn, 'blocked') + ')'
+            menu = [['other', get_lang(conn, 'return')]]
 
             curs.execute(db_change("select why, block, blocker, end, today, band, ongoing from rb where block = ? order by today desc limit ?, 50"), [name, sql_num])
         else:
-            sub = '(' + load_lang('admin') + ')'
-            menu = [['other', load_lang('return')]]
+            sub = '(' + get_lang(conn, 'admin') + ')'
+            menu = [['other', get_lang(conn, 'return')]]
 
             curs.execute(db_change("select why, block, blocker, end, today, band, ongoing from rb where blocker = ? order by today desc limit ?, 50"), [name, sql_num])
 
         data_list = curs.fetchall()
-        all_ip = ip_pas([i[1] for i in data_list] + [i[2] for i in data_list])
+        all_ip = ip_pas(conn, [i[1] for i in data_list] + [i[2] for i in data_list])
         for data in data_list:
             why = '<br>' if data[0] == '' else html.escape(data[0])
             if why == 'edit filter':
@@ -61,18 +61,18 @@ def recent_block(name = 'Test', tool = 'all', num = 1):
             if data[5] == 'regex':
                 ip = data[1]
                 if data[6] == '1':
-                    ip = '<s>' + ip + '</s> <a href="/auth/give/ban_regex/' + url_pas(data[1]) + '">(' + load_lang('release') + ')</a>'
+                    ip = '<s>' + ip + '</s> <a href="/auth/give/ban_regex/' + url_pas(data[1]) + '">(' + get_lang(conn, 'release') + ')</a>'
                 else:
-                    ip += ' <a href="/auth/give/ban_regex/' + url_pas(data[1]) + '">(' + load_lang('ban') + ')</a>'
+                    ip += ' <a href="/auth/give/ban_regex/' + url_pas(data[1]) + '">(' + get_lang(conn, 'ban') + ')</a>'
 
-                ip += ' (' + load_lang('regex') + ')'
+                ip += ' (' + get_lang(conn, 'regex') + ')'
             else:
                 ip = all_ip[data[1]]
 
             if data[3] == '':
-                end = load_lang('limitless')
+                end = get_lang(conn, 'limitless')
             elif data[3] == 'release':
-                end = load_lang('release')
+                end = get_lang(conn, 'release')
             else:
                 end = data[3]
 
@@ -81,7 +81,7 @@ def recent_block(name = 'Test', tool = 'all', num = 1):
             else:
                 admin = all_ip[data[2]]
 
-            start = load_lang('start') + ' : ' + (data[4] if data[4] != '' else '0')
+            start = get_lang(conn, 'start') + ' : ' + (data[4] if data[4] != '' else '0')
             div += '''
                 <tr>
                     <td>''' + ip + '''</td>
@@ -89,7 +89,7 @@ def recent_block(name = 'Test', tool = 'all', num = 1):
                     <td>
                         ''' + start + '''
                         <br>
-                        ''' + load_lang('end') + ' : ' + end + '''
+                        ''' + get_lang(conn, 'end') + ' : ' + end + '''
                     </td>
                 </tr>
                 <tr>
@@ -101,12 +101,12 @@ def recent_block(name = 'Test', tool = 'all', num = 1):
         div += '</table>'
 
         if tool == 'all':
-            div += next_fix('/block_log/', num, data_list)
+            div += next_fix(conn, '/block_log/', num, data_list)
         else:
-            div += next_fix('/block_log/' + url_pas(tool) + '/' + url_pas(name) + '/', num, data_list)
+            div += next_fix(conn, '/block_log/' + url_pas(tool) + '/' + url_pas(name) + '/', num, data_list)
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('recent_ban'), wiki_set(), wiki_custom(), wiki_css([sub, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'recent_ban'), wiki_set(conn), wiki_custom(conn), wiki_css([sub, 0])],
             data = div,
             menu = menu
         ))

+ 38 - 38
route/recent_change.py

@@ -28,21 +28,21 @@ def recent_change(name = '', tool = '', num = 1, set_type = 'normal'):
         curs = conn.cursor()
 
         ip = ip_check()
-        all_admin = admin_check('all', None, ip)
-        owner = admin_check(None, None, ip)
+        all_admin = admin_check(conn, 'all', None, ip)
+        owner = admin_check(conn, None, None, ip)
 
         option_list = [
-            ['normal', load_lang('normal')],
-            ['edit', load_lang('edit')],
-            ['move', load_lang('move')],
-            ['delete', load_lang('delete')],
-            ['revert', load_lang('revert')],
-            ['r1', load_lang('new_doc')],
-            ['edit_request', load_lang('edit_request')]
+            ['normal', get_lang(conn, 'normal')],
+            ['edit', get_lang(conn, 'edit')],
+            ['move', get_lang(conn, 'move')],
+            ['delete', get_lang(conn, 'delete')],
+            ['revert', get_lang(conn, 'revert')],
+            ['r1', get_lang(conn, 'new_doc')],
+            ['edit_request', get_lang(conn, 'edit_request')]
         ]
 
         if flask.request.method == 'POST':
-            return redirect('/diff/' + flask.request.form.get('b', '1') + '/' + flask.request.form.get('a', '1') + '/' + url_pas(name))
+            return redirect(conn, '/diff/' + flask.request.form.get('b', '1') + '/' + flask.request.form.get('a', '1') + '/' + url_pas(name))
         else:
             ban = ''
             select = ''
@@ -58,11 +58,11 @@ def recent_change(name = '', tool = '', num = 1, set_type = 'normal'):
 
             if tool == 'history':
                 div += '''
-                    <td id="main_table_width">''' + load_lang('version') + '''</td>
-                    <td id="main_table_width">''' + load_lang('editor') + '''</td>
-                    <td id="main_table_width">''' + load_lang('time') + '''</td>
+                    <td id="main_table_width">''' + get_lang(conn, 'version') + '''</td>
+                    <td id="main_table_width">''' + get_lang(conn, 'editor') + '''</td>
+                    <td id="main_table_width">''' + get_lang(conn, 'time') + '''</td>
                 '''
-                sub = '(' + load_lang('history') + ')'
+                sub = '(' + get_lang(conn, 'history') + ')'
 
                 set_type = '' if set_type == 'edit' else set_type
                 if set_type != 'normal':
@@ -73,11 +73,11 @@ def recent_change(name = '', tool = '', num = 1, set_type = 'normal'):
                 data_list = curs.fetchall()
             elif tool == 'record':
                 div +=  '''
-                    <td id="main_table_width">''' + load_lang('document_name') + '''</td>
-                    <td id="main_table_width">''' + load_lang('editor') + '''</td>
-                    <td id="main_table_width">''' + load_lang('time') + '''</td>
+                    <td id="main_table_width">''' + get_lang(conn, 'document_name') + '''</td>
+                    <td id="main_table_width">''' + get_lang(conn, 'editor') + '''</td>
+                    <td id="main_table_width">''' + get_lang(conn, 'time') + '''</td>
                 '''
-                sub = '(' + load_lang('edit_record') + ')'
+                sub = '(' + get_lang(conn, 'edit_record') + ')'
                 set_type = '' if set_type == 'edit' else set_type
 
                 if set_type != 'normal':
@@ -88,9 +88,9 @@ def recent_change(name = '', tool = '', num = 1, set_type = 'normal'):
                 data_list = curs.fetchall()
             else:
                 div +=  '''
-                    <td id="main_table_width">''' + load_lang('document_name') + '''</td>
-                    <td id="main_table_width">''' + load_lang('editor') + '''</td>
-                    <td id="main_table_width">''' + load_lang('time') + '''</td>
+                    <td id="main_table_width">''' + get_lang(conn, 'document_name') + '''</td>
+                    <td id="main_table_width">''' + get_lang(conn, 'editor') + '''</td>
+                    <td id="main_table_width">''' + get_lang(conn, 'time') + '''</td>
                 '''
                 sub = ''
                 set_type = '' if set_type == 'edit' else set_type
@@ -112,7 +112,7 @@ def recent_change(name = '', tool = '', num = 1, set_type = 'normal'):
 
             div += '</tr>'
 
-            all_ip = ip_pas([i[3] for i in data_list])
+            all_ip = ip_pas(conn, [i[3] for i in data_list])
             for data in data_list:
                 select += '<option value="' + data[0] + '">' + data[0] + '</option>'
                 send = data[4]
@@ -125,7 +125,7 @@ def recent_change(name = '', tool = '', num = 1, set_type = 'normal'):
                     leng = '<span style="color:gray;">(' + data[5] + ')</span>'
 
                 ip = all_ip[data[3]]
-                m_tool = '<a href="/history_tool/' + data[0] + '/' + url_pas(data[1]) + '">(' + load_lang('tool') + ')</a>'
+                m_tool = '<a href="/history_tool/' + data[0] + '/' + url_pas(data[1]) + '">(' + get_lang(conn, 'tool') + ')</a>'
 
                 style = ['', '']
                 date = data[2]
@@ -135,7 +135,7 @@ def recent_change(name = '', tool = '', num = 1, set_type = 'normal'):
                     if data[7] == 'r1':
                         type_data = ' (' + data[7] + ')'
                     else:
-                        type_data = ' (' + load_lang(data[7]) + ')'
+                        type_data = ' (' + get_lang(conn, data[7]) + ')'
 
                 send += type_data
 
@@ -186,25 +186,25 @@ def recent_change(name = '', tool = '', num = 1, set_type = 'normal'):
                     ' '.join(['<a href="/history_page/1/' + for_a[0] + '/' + url_pas(name) + '">(' + for_a[1] + ')</a> ' for for_a in option_list]) + \
                     '<hr class="main_hr">' + div + \
                 ''
-                menu = [['w/' + url_pas(name), load_lang('return')]]
+                menu = [['w/' + url_pas(name), get_lang(conn, 'return')]]
 
                 if set_type == 'normal':
                     div = '''
                         <form method="post">
                             <select name="a">''' + select + '''</select> <select name="b">''' + select + '''</select>
-                            <button type="submit">''' + load_lang('compare') + '''</button>
+                            <button type="submit">''' + get_lang(conn, 'compare') + '''</button>
                         </form>
                         <hr class="main_hr">
                     ''' + div
 
                 if admin == 1:
                     menu += [
-                        ['history_add/' + url_pas(name), load_lang('history_add')],
-                        ['history_reset/' + url_pas(name), load_lang('history_reset')]
+                        ['history_add/' + url_pas(name), get_lang(conn, 'history_add')],
+                        ['history_reset/' + url_pas(name), get_lang(conn, 'history_reset')]
                     ]
 
                 title = name
-                div += get_next_page_bottom('/history_page/{}/' + set_type + '/' + url_pas(name), num, data_list)
+                div += get_next_page_bottom(conn, '/history_page/{}/' + set_type + '/' + url_pas(name), num, data_list)
             elif tool == 'record':
                 div = '' + \
                     ' '.join(['<a href="/record/1/' + for_a[0] + '/' + url_pas(name) + '">(' + for_a[1] + ')</a> ' for for_a in option_list]) + \
@@ -212,29 +212,29 @@ def recent_change(name = '', tool = '', num = 1, set_type = 'normal'):
                 ''
 
                 title = name
-                menu = [['user/' + url_pas(name), load_lang('user_tool')]]
+                menu = [['user/' + url_pas(name), get_lang(conn, 'user_tool')]]
                 if admin == 1:
-                    menu += [['record/reset/' + url_pas(name), load_lang('record_reset')]]
+                    menu += [['record/reset/' + url_pas(name), get_lang(conn, 'record_reset')]]
 
-                div += get_next_page_bottom('/record/{}/' + url_pas(name), num, data_list)
+                div += get_next_page_bottom(conn, '/record/{}/' + url_pas(name), num, data_list)
             else:
                 div = '' + \
                     ' '.join(['<a href="/recent_change/1/' + for_a[0] + '">(' + for_a[1] + ')</a> ' for for_a in option_list]) + \
-                    '<a href="/recent_change/1/user">(' + load_lang('user_document') + ')</a> ' + \
+                    '<a href="/recent_change/1/user">(' + get_lang(conn, 'user_document') + ')</a> ' + \
                     '<hr class="main_hr">' + div + \
                 ''
 
-                menu = [['other', load_lang('return')], ['recent_edit_request', load_lang('edit_request')]]
-                title = load_lang('recent_change')
+                menu = [['other', get_lang(conn, 'return')], ['recent_edit_request', get_lang(conn, 'edit_request')]]
+                title = get_lang(conn, 'recent_change')
 
                 if all_admin == 1:
-                    div += get_next_page_bottom('/recent_change/{}/' + set_type, num, data_list)
+                    div += get_next_page_bottom(conn, '/recent_change/{}/' + set_type, num, data_list)
 
             if sub == '':
                 sub = 0
 
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [title, wiki_set(), wiki_custom(), wiki_css([sub, 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [title, wiki_set(conn), wiki_custom(conn), wiki_css([sub, 0])],
                 data = div,
                 menu = menu
             ))

+ 15 - 15
route/recent_discuss.py

@@ -5,30 +5,30 @@ def recent_discuss(tool):
         curs = conn.cursor()
 
         div = ''
-        admin_auth = admin_check(3)
+        admin_auth = admin_check(conn, 3)
 
         if tool == 'normal':
-            div += '<a href="/recent_discuss/close">(' + load_lang('close_discussion') + ')</a> '
-            div += '<a href="/recent_discuss/open">(' + load_lang('open_discussion_list') + ')</a>'
+            div += '<a href="/recent_discuss/close">(' + get_lang(conn, 'close_discussion') + ')</a> '
+            div += '<a href="/recent_discuss/open">(' + get_lang(conn, 'open_discussion_list') + ')</a>'
 
             m_sub = 0
         elif tool == 'close':
-            div += '<a href="/recent_discuss">(' + load_lang('normal') + ')</a>'
+            div += '<a href="/recent_discuss">(' + get_lang(conn, 'normal') + ')</a>'
 
-            m_sub = ' (' + load_lang('closed') + ')'
+            m_sub = ' (' + get_lang(conn, 'closed') + ')'
         else:
-            div += '<a href="/recent_discuss">(' + load_lang('normal') + ')</a>'
+            div += '<a href="/recent_discuss">(' + get_lang(conn, 'normal') + ')</a>'
 
-            m_sub = ' (' + load_lang('open_discussion_list') + ')'
+            m_sub = ' (' + get_lang(conn, 'open_discussion_list') + ')'
 
         div +=  '''
                 <hr class="main_hr">
                 <table id="main_table_set">
                     <tbody>
                         <tr id="main_table_top_tr">
-                            <td id="main_table_width">''' + load_lang('discussion_name') + '''</td>
-                            <td id="main_table_width">''' + load_lang('editor') + '''</td>
-                            <td id="main_table_width">''' + load_lang('time') + '''</td>
+                            <td id="main_table_width">''' + get_lang(conn, 'discussion_name') + '''</td>
+                            <td id="main_table_width">''' + get_lang(conn, 'editor') + '''</td>
+                            <td id="main_table_width">''' + get_lang(conn, 'time') + '''</td>
                         </tr>
                 '''
 
@@ -50,7 +50,7 @@ def recent_discuss(tool):
             else:
                 last_editor += ['']
 
-        last_editor_ip_pas = ip_pas(last_editor)
+        last_editor_ip_pas = ip_pas(conn, last_editor)
 
         count = 0
         for data in db_data:
@@ -59,7 +59,7 @@ def recent_discuss(tool):
                     '<td>' + \
                         '<a href="/thread/' + data[3] + '">' + html.escape(data[1]) + '</a> ' + \
                         '<a href="/topic/' + url_pas(data[0]) + '">(' + html.escape(data[0]) + ')</a>' + \
-                        (' <a href="/thread/' + data[3] + '/tool">(' + load_lang('tool') + ')</a>' if admin_auth == 1 else '') + \
+                        (' <a href="/thread/' + data[3] + '/tool">(' + get_lang(conn, 'tool') + ')</a>' if admin_auth == 1 else '') + \
                     '</td>' + \
                     '<td>' + last_editor_ip_pas[last_editor[count]] + '</td>' + \
                     '<td>' + data[2] + '</td>' + \
@@ -73,8 +73,8 @@ def recent_discuss(tool):
             '</table>' + \
         ''
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('recent_discussion'), wiki_set(), wiki_custom(), wiki_css([m_sub, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'recent_discussion'), wiki_set(conn), wiki_custom(conn), wiki_css([m_sub, 0])],
             data = div,
-            menu = [['other', load_lang('return')]]
+            menu = [['other', get_lang(conn, 'return')]]
         ))

+ 6 - 6
route/recent_edit_request.py

@@ -11,9 +11,9 @@ def recent_edit_request(db_set):
             <table id="main_table_set">
                 <tbody>
                     <tr id="main_table_top_tr">
-                        <td id="main_table_width">''' + load_lang('discussion_name') + '''</td>
-                        <td id="main_table_width">''' + load_lang('editor') + '''</td>
-                        <td id="main_table_width">''' + load_lang('time') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'discussion_name') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'editor') + '''</td>
+                        <td id="main_table_width">''' + get_lang(conn, 'time') + '''</td>
                     </tr>
         '''
 
@@ -49,8 +49,8 @@ def recent_edit_request(db_set):
             '</table>' + \
         ''
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('recent_edit_request'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'recent_edit_request'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
             data = div,
-            menu = [['recent_change', load_lang('return')]]
+            menu = [['recent_change', get_lang(conn, 'return')]]
         ))

+ 10 - 10
route/recent_history_add.py

@@ -7,17 +7,17 @@ def recent_history_add(name = 'Test', do_type = ''):
         curs = conn.cursor()
 
         ip = ip_check()
-        if admin_check() != 1:
-            return re_error('/ban')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/ban')
 
         if flask.request.method == 'POST':
-            admin_check(None, 'history_add (' + name + ')')
+            admin_check(conn, None, 'history_add (' + name + ')')
 
             today = get_time()
             content = flask.request.form.get('content', '')
             leng = '+' + str(len(content))
 
-            history_plus(
+            history_plus(conn, 
                 name,
                 content,
                 today,
@@ -29,20 +29,20 @@ def recent_history_add(name = 'Test', do_type = ''):
 
             conn.commit()
 
-            return redirect('/history/' + url_pas(name))
+            return redirect(conn, '/history/' + url_pas(name))
         else:            
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('history_add'), wiki_set(), wiki_custom(), wiki_css(['(' + name + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [get_lang(conn, 'history_add'), wiki_set(conn), wiki_custom(conn), wiki_css(['(' + name + ')', 0])],
                 data = '''
                     <form method="post">
-                        <input placeholder="''' + load_lang('why') + '''" name="send">
+                        <input placeholder="''' + get_lang(conn, 'why') + '''" name="send">
                         <hr class="main_hr">
                         
-                        <input placeholder="''' + load_lang('name') + '''" name="get_ip">
+                        <input placeholder="''' + get_lang(conn, 'name') + '''" name="get_ip">
                         <hr class="main_hr">
 
                         ''' + edit_editor(curs, ip) + '''
                     </form>
                 ''',
-                menu = [['history/' + url_pas(name), load_lang('return')]]
+                menu = [['history/' + url_pas(name), get_lang(conn, 'return')]]
             ))

+ 9 - 9
route/recent_history_delete.py

@@ -6,25 +6,25 @@ def recent_history_delete(name = 'Test', rev = 1):
 
         num = str(rev)
 
-        if admin_check() != 1:
-            return re_error('/error/3')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
-            admin_check(None, 'history delete ' + name + ' r' + num)
+            admin_check(conn, None, 'history delete ' + name + ' r' + num)
 
             curs.execute(db_change("delete from history where id = ? and title = ?"), [num, name])
             conn.commit()
 
-            return redirect('/history/' + url_pas(name))
+            return redirect(conn, '/history/' + url_pas(name))
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('history_delete') + ') (r' + num + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'history_delete') + ') (r' + num + ')', 0])],
                 data = '''
                     <form method="post">
-                        <span>''' + load_lang('delete_warning') + '''</span>
+                        <span>''' + get_lang(conn, 'delete_warning') + '''</span>
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('delete') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'delete') + '''</button>
                     </form>
                 ''',
-                menu = [['history/' + url_pas(name), load_lang('return')]]
+                menu = [['history/' + url_pas(name), get_lang(conn, 'return')]]
             ))

+ 2 - 2
route/recent_history_hidden.py

@@ -6,7 +6,7 @@ def recent_history_hidden(name = 'Test', rev = 1):
 
         num = str(rev)
 
-        if admin_check(6, 'history_hidden (' + name + '#' + num + ')') == 1:
+        if admin_check(conn, 6, 'history_hidden (' + name + '#' + num + ')') == 1:
             curs.execute(db_change("select title from history where title = ? and id = ? and hide = 'O'"), [name, num])
             if curs.fetchall():
                 curs.execute(db_change("update history set hide = '' where title = ? and id = ?"), [name, num])
@@ -15,4 +15,4 @@ def recent_history_hidden(name = 'Test', rev = 1):
 
             conn.commit()
 
-        return redirect('/history/' + url_pas(name))
+        return redirect(conn, '/history/' + url_pas(name))

+ 9 - 9
route/recent_history_reset.py

@@ -4,25 +4,25 @@ def recent_history_reset(name = 'Test'):
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/error/3')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
-            admin_check(None, 'history reset ' + name)
+            admin_check(conn, None, 'history reset ' + name)
 
             curs.execute(db_change("delete from history where title = ?"), [name])
             conn.commit()
 
-            return redirect('/history/' + url_pas(name))
+            return redirect(conn, '/history/' + url_pas(name))
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('history_reset') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'history_reset') + ')', 0])],
                 data = '''
                     <form method="post">
-                        <span>''' + load_lang('delete_warning') + '''</span>
+                        <span>''' + get_lang(conn, 'delete_warning') + '''</span>
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('reset') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'reset') + '''</button>
                     </form>
                 ''',
-                menu = [['history/' + url_pas(name), load_lang('return')]]
+                menu = [['history/' + url_pas(name), get_lang(conn, 'return')]]
             ))

+ 10 - 10
route/recent_history_send.py

@@ -6,11 +6,11 @@ def recent_history_send(name = 'Test', rev = 1):
 
         num = str(rev)
 
-        if admin_check() != 1:
-            return re_error('/error/3')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
-            admin_check(None, 'send edit ' + name + ' r' + num)
+            admin_check(conn, None, 'send edit ' + name + ' r' + num)
 
             curs.execute(db_change("select send from history where title = ? and id = ?"), [name, num])
             if curs.fetchall():
@@ -22,25 +22,25 @@ def recent_history_send(name = 'Test', rev = 1):
 
             conn.commit()
 
-            return redirect('/history/' + url_pas(name))
+            return redirect(conn, '/history/' + url_pas(name))
         else:
             curs.execute(db_change("select send from history where title = ? and id = ?"), [name, num])
             send = curs.fetchall()
             if send:
                 send = send[0][0]
 
-                return easy_minify(flask.render_template(skin_check(),
-                    imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('send_edit') + ') (r' + num + ')', 0])],
+                return easy_minify(conn, flask.render_template(skin_check(conn),
+                    imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'send_edit') + ') (r' + num + ')', 0])],
                     data = '''
                         <form method="post">
-                            <span>''' + load_lang('delete_warning') + '''</span>
+                            <span>''' + get_lang(conn, 'delete_warning') + '''</span>
                             <hr class="main_hr">
                             <input value="''' + html.escape(send) + '''" name="send">
                             <hr class="main_hr">
-                            <button type="submit">''' + load_lang('edit') + '''</button>
+                            <button type="submit">''' + get_lang(conn, 'edit') + '''</button>
                         </form>
                     ''',
-                    menu = [['history/' + url_pas(name), load_lang('return')]]
+                    menu = [['history/' + url_pas(name), get_lang(conn, 'return')]]
                 ))
             else:
-                return redirect('/history/' + url_pas(name))
+                return redirect(conn, '/history/' + url_pas(name))

+ 17 - 17
route/recent_history_tool.py

@@ -7,43 +7,43 @@ def recent_history_tool(name = 'Test', rev = 1):
         num = str(rev)
 
         data = '' + \
-            '<h2>' + load_lang('tool') + '</h2>' + \
+            '<h2>' + get_lang(conn, 'tool') + '</h2>' + \
             '<ul class="opennamu_ul">' + \
-                '<li><a href="/raw_rev/' + num + '/' + url_pas(name) + '">' + load_lang('raw') + '</a></li>' + \
+                '<li><a href="/raw_rev/' + num + '/' + url_pas(name) + '">' + get_lang(conn, 'raw') + '</a></li>' + \
         ''
 
-        data += '<li><a href="/revert/' + num + '/' + url_pas(name) + '">' + load_lang('revert') + ' (r' + num + ')</a></li>'
+        data += '<li><a href="/revert/' + num + '/' + url_pas(name) + '">' + get_lang(conn, 'revert') + ' (r' + num + ')</a></li>'
         if rev - 1 > 0:
-            data += '<li><a href="/revert/' + str(rev - 1) + '/' + url_pas(name) + '">' + load_lang('revert') + ' (r' + str(rev - 1) + ')</a></li>'
+            data += '<li><a href="/revert/' + str(rev - 1) + '/' + url_pas(name) + '">' + get_lang(conn, 'revert') + ' (r' + str(rev - 1) + ')</a></li>'
 
         if rev - 1 > 0:
-            data += '<li><a href="/diff/' + str(rev - 1) + '/' + num + '/' + url_pas(name) + '">' + load_lang('compare') + '</a></li>'
+            data += '<li><a href="/diff/' + str(rev - 1) + '/' + num + '/' + url_pas(name) + '">' + get_lang(conn, 'compare') + '</a></li>'
 
-        data += '<li><a href="/history/' + url_pas(name) + '">' + load_lang('history') + '</a></li>'
+        data += '<li><a href="/history/' + url_pas(name) + '">' + get_lang(conn, 'history') + '</a></li>'
         data += '</ul>'
 
-        if admin_check(6) == 1:
-            data += '<h3>' + load_lang('admin') + '</h3>'
+        if admin_check(conn, 6) == 1:
+            data += '<h3>' + get_lang(conn, 'admin') + '</h3>'
             data += '<ul class="opennamu_ul">'
             curs.execute(db_change('select title from history where title = ? and id = ? and hide = "O"'), [name, num])
             data += '<li><a href="/history_hidden/' + num + '/' + url_pas(name) + '">'
             if curs.fetchall():
-                data += load_lang('hide_release') 
+                data += get_lang(conn, 'hide_release') 
             else:
-                data += load_lang('hide')
+                data += get_lang(conn, 'hide')
 
             data += '</a></li>'
             data += '</ul>'
 
-        if admin_check() == 1:
-            data += '<h3>' + load_lang('owner') + '</h3>'
+        if admin_check(conn) == 1:
+            data += '<h3>' + get_lang(conn, 'owner') + '</h3>'
             data += '<ul class="opennamu_ul">'
-            data += '<li><a href="/history_delete/' + num + '/' + url_pas(name) + '">' + load_lang('history_delete') + '</a></li>'
-            data += '<li><a href="/history_send/' + num + '/' + url_pas(name) + '">' + load_lang('send_edit') + '</a></li>'
+            data += '<li><a href="/history_delete/' + num + '/' + url_pas(name) + '">' + get_lang(conn, 'history_delete') + '</a></li>'
+            data += '<li><a href="/history_send/' + num + '/' + url_pas(name) + '">' + get_lang(conn, 'send_edit') + '</a></li>'
             data += '</ul>'
 
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(r' + num + ')', 0])],
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(r' + num + ')', 0])],
             data = data,
-            menu = [['history/' + url_pas(name), load_lang('return')]]
+            menu = [['history/' + url_pas(name), get_lang(conn, 'return')]]
         ))

+ 9 - 9
route/recent_record_reset.py

@@ -4,25 +4,25 @@ def recent_record_reset(name = 'Test'):
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        if admin_check() != 1:
-            return re_error('/error/3')
+        if admin_check(conn) != 1:
+            return re_error(conn, '/error/3')
 
         if flask.request.method == 'POST':
-            admin_check(None, 'record reset ' + name)
+            admin_check(conn, None, 'record reset ' + name)
 
             curs.execute(db_change("delete from history where ip = ?"), [name])
             conn.commit()
 
-            return redirect('/record/' + url_pas(name))
+            return redirect(conn, '/record/' + url_pas(name))
         else:
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('record_reset') + ')', 0])],
+            return easy_minify(conn, flask.render_template(skin_check(conn),
+                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'record_reset') + ')', 0])],
                 data = '''
                     <form method="post">
-                        <span>''' + load_lang('delete_warning') + '''</span>
+                        <span>''' + get_lang(conn, 'delete_warning') + '''</span>
                         <hr class="main_hr">
-                        <button type="submit">''' + load_lang('reset') + '''</button>
+                        <button type="submit">''' + get_lang(conn, 'reset') + '''</button>
                     </form>
                 ''',
-                menu = [['record/' + url_pas(name), load_lang('return')]]
+                menu = [['record/' + url_pas(name), get_lang(conn, 'return')]]
             ))

Some files were not shown because too many files changed in this diff