فهرست منبع

Merge pull request #1446 from openNAMU/dev

Dev
잉여개발기 (SPDV) 4 سال پیش
والد
کامیت
6a1278aa12
53فایلهای تغییر یافته به همراه2469 افزوده شده و 2271 حذف شده
  1. 84 153
      app.py
  2. 11 2
      lang/en-US.json
  3. 11 2
      lang/ko-KR.json
  4. 1 1
      route/api_sitemap.py
  5. 12 25
      route/edit.py
  6. 15 14
      route/edit_backlink_reset.py
  7. 60 65
      route/edit_delete.py
  8. 42 41
      route/edit_delete_file.py
  9. 35 24
      route/edit_delete_mutiple.py
  10. 158 146
      route/edit_move.py
  11. 73 66
      route/edit_revert.py
  12. 1 1
      route/filter_inter_wiki.py
  13. 0 8
      route/main_func_easter_egg.py
  14. 18 765
      route/main_func_setting.py
  15. 97 0
      route/main_func_setting_acl.py
  16. 145 0
      route/main_func_setting_external.py
  17. 99 0
      route/main_func_setting_head.py
  18. 220 0
      route/main_func_setting_main.py
  19. 60 0
      route/main_func_setting_main_logo.py
  20. 126 0
      route/main_func_setting_phrase.py
  21. 67 0
      route/main_func_setting_robot.py
  22. 1 3
      route/main_search.py
  23. 66 0
      route/main_search_deep.py
  24. 17 0
      route/main_search_goto.py
  25. 1 1
      route/main_tool_admin.py
  26. 1 1
      route/recent_change.py
  27. 55 54
      route/recent_discuss.py
  28. 3 3
      route/recent_history_tool.py
  29. 0 65
      route/search_deep.py
  30. 0 16
      route/search_goto.py
  31. 125 9
      route/tool/func.py
  32. 1 1
      route/topic.py
  33. 1 1
      route/user_alarm_delete.py
  34. 35 0
      route/user_count.py
  35. 0 34
      route/user_count_edit.py
  36. 177 176
      route/user_setting.py
  37. 7 7
      route/user_setting_head.py
  38. 67 0
      route/user_setting_pw.py
  39. 0 66
      route/user_setting_pw_change.py
  40. 49 48
      route/user_watch_list.py
  41. 24 25
      route/user_watch_list_name.py
  42. 56 55
      route/view_diff.py
  43. 13 12
      route/view_down.py
  44. 190 187
      route/view_read.py
  45. 52 51
      route/view_xref.py
  46. 2 2
      version.json
  47. 14 14
      views/main_css/css/main.css
  48. 1 2
      views/main_css/js/func/shortcut.js
  49. 89 45
      views/main_css/js/render/markdown.js
  50. 11 11
      views/main_css/js/render/wiki.js
  51. 54 49
      views/main_css/js/render_onmark.js
  52. 0 9
      views/main_css/js/route/main_skin_set.js
  53. 22 11
      views/main_css/js/route/thread.js

+ 84 - 153
app.py

@@ -112,7 +112,7 @@ set_init_always(version_list['beta']['c_ver'])
 
 # Init-Route
 class EverythingConverter(werkzeug.routing.PathConverter):
-    regex = '.*?'
+    regex = r'.*?'
 
 class RegexConverter(werkzeug.routing.BaseConverter):
     def __init__(self, url_map, *items):
@@ -145,32 +145,7 @@ print('----')
 
 # Init-DB_Data
 server_set = {}
-server_set_var = {
-    'host' : {
-        'display' : 'Host',
-        'require' : 'conv',
-        'default' : '0.0.0.0'
-    }, 'port' : {
-        'display' : 'Port',
-        'require' : 'conv',
-        'default' : '3000'
-    }, 'language' : {
-        'display' : 'Language',
-        'require' : 'select',
-        'default' : 'ko-KR',
-        'list' : ['ko-KR', 'en-US']
-    }, 'markup' : {
-        'display' : 'Markup',
-        'require' : 'select',
-        'default' : 'namumark',
-        'list' : ['namumark', 'markdown', 'custom', 'raw']
-    }, 'encode' : {
-        'display' : 'Encryption method',
-        'require' : 'select',
-        'default' : 'sha3',
-        'list' : ['sha3', 'sha256']
-    }
-}
+server_set_var = get_init_set_list()
 server_set_env = {
     'host' : os.getenv('NAMU_HOST'),
     'port' : os.getenv('NAMU_PORT'),
@@ -255,42 +230,42 @@ if os.path.exists('custom.py'):
 # Func
 # Func-inter_wiki
 app.route('/inter_wiki', defaults = { 'tool' : 'inter_wiki' })(filter_inter_wiki)
-app.route('/inter_wiki/del/<name>', defaults = { 'tool' : 'del_inter_wiki' })(filter_inter_wiki_delete)
+app.route('/inter_wiki/del/<everything:name>', defaults = { 'tool' : 'del_inter_wiki' })(filter_inter_wiki_delete)
 app.route('/inter_wiki/add', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_inter_wiki' })(filter_inter_wiki_add)
-app.route('/inter_wiki/add/<name>', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_inter_wiki' })(filter_inter_wiki_add)
+app.route('/inter_wiki/add/<everything:name>', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_inter_wiki' })(filter_inter_wiki_add)
 
 app.route('/filter/document/list')(filter_document)
-app.route('/filter/document/add/<name>', methods = ['POST', 'GET'])(filter_document_add)
+app.route('/filter/document/add/<everything:name>', methods = ['POST', 'GET'])(filter_document_add)
 app.route('/filter/document/add', methods = ['POST', 'GET'])(filter_document_add)
 app.route('/filter/document/del/<name>')(filter_document_delete)
 
 app.route('/edit_top', defaults = { 'tool' : 'edit_top' })(filter_inter_wiki)
-app.route('/edit_top/del/<name>', defaults = { 'tool' : 'del_edit_top' })(filter_inter_wiki_delete)
+app.route('/edit_top/del/<everything:name>', defaults = { 'tool' : 'del_edit_top' })(filter_inter_wiki_delete)
 app.route('/edit_top/add', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_edit_top' })(filter_inter_wiki_add)
 
 app.route('/image_license', defaults = { 'tool' : 'image_license' })(filter_inter_wiki)
-app.route('/image_license/del/<name>', defaults = { 'tool' : 'del_image_license' })(filter_inter_wiki_delete)
+app.route('/image_license/del/<everything:name>', defaults = { 'tool' : 'del_image_license' })(filter_inter_wiki_delete)
 app.route('/image_license/add', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_image_license' })(filter_inter_wiki_add)
 
 app.route('/edit_filter', defaults = { 'tool' : 'edit_filter' })(filter_inter_wiki)
-app.route('/edit_filter/del/<name>', defaults = { 'tool' : 'del_edit_filter' })(filter_inter_wiki_delete)
+app.route('/edit_filter/del/<everything:name>', defaults = { 'tool' : 'del_edit_filter' })(filter_inter_wiki_delete)
 app.route('/edit_filter/add', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_edit_filter' })(filter_inter_wiki_add)
-app.route('/edit_filter/add/<name>', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_edit_filter' })(filter_inter_wiki_add)
+app.route('/edit_filter/add/<everything:name>', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_edit_filter' })(filter_inter_wiki_add)
 
 app.route('/email_filter', defaults = { 'tool' : 'email_filter' })(filter_inter_wiki)
-app.route('/email_filter/del/<name>', defaults = { 'tool' : 'del_email_filter' })(filter_inter_wiki_delete)
+app.route('/email_filter/del/<everything:name>', defaults = { 'tool' : 'del_email_filter' })(filter_inter_wiki_delete)
 app.route('/email_filter/add', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_email_filter' })(filter_inter_wiki_add)
 
 app.route('/file_filter', defaults = { 'tool' : 'file_filter' })(filter_inter_wiki)
-app.route('/file_filter/del/<name>', defaults = { 'tool' : 'del_file_filter' })(filter_inter_wiki_delete)
+app.route('/file_filter/del/<everything:name>', defaults = { 'tool' : 'del_file_filter' })(filter_inter_wiki_delete)
 app.route('/file_filter/add', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_file_filter' })(filter_inter_wiki_add)
 
 app.route('/name_filter', defaults = { 'tool' : 'name_filter' })(filter_inter_wiki)
-app.route('/name_filter/del/<name>', defaults = { 'tool' : 'del_name_filter' })(filter_inter_wiki_delete)
+app.route('/name_filter/del/<everything:name>', defaults = { 'tool' : 'del_name_filter' })(filter_inter_wiki_delete)
 app.route('/name_filter/add', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_name_filter' })(filter_inter_wiki_add)
 
 app.route('/extension_filter', defaults = { 'tool' : 'extension_filter' })(filter_inter_wiki)
-app.route('/extension_filter/del/<name>', defaults = { 'tool' : 'del_extension_filter' })(filter_inter_wiki_delete)
+app.route('/extension_filter/del/<everything:name>', defaults = { 'tool' : 'del_extension_filter' })(filter_inter_wiki_delete)
 app.route('/extension_filter/add', methods = ['POST', 'GET'], defaults = { 'tool' : 'plus_extension_filter' })(filter_inter_wiki_add)
 
 # Func-list
@@ -387,6 +362,10 @@ def give_admin_groups(name = None):
 def give_delete_admin_group(name = None):
     return give_delete_admin_group_2(load_db.db_get(), name)
 
+@app.route('/app_submit', methods = ['POST', 'GET'])
+def recent_app_submit():
+    return recent_app_submit_2(load_db.db_get())
+
 # /auth/history
 # ongoing 반영 필요
 @app.route('/block_log')
@@ -441,94 +420,47 @@ def recent_record_reset(name = 'Test'):
 def recent_record_topic(name = 'Test'):
     return recent_record_topic_2(load_db.db_get(), name)
 
-# 거처를 고심중
-@app.route('/app_submit', methods = ['POST', 'GET'])
-def recent_app_submit():
-    return recent_app_submit_2(load_db.db_get())
-
-# Func-search
-@app.route('/search', methods=['POST'])
-def search():
-    return search_2(load_db.db_get())
-
-@app.route('/goto', methods=['POST'])
-@app.route('/goto/<everything:name>', methods=['POST'])
-def search_goto(name = 'test'):
-    return search_goto_2(load_db.db_get(), name)
-
-@app.route('/search/<everything:name>')
-def search_deep(name = 'test'):
-    return search_deep_2(load_db.db_get(), name)
-
 # Func-view
-@app.route('/xref/<everything:name>')
-def view_xref(name = 'Test'):
-    return view_xref_2(load_db.db_get(), name)
-
-@app.route('/xref/this/<everything:name>')
-def view_xref_this(name = 'Test'):
-    return view_xref_2(load_db.db_get(), name, xref_type = '2')
+app.route('/xref/<everything:name>')(view_xref)
+app.route('/xref_this/<everything:name>', defaults = { 'xref_type' : 2 })(view_xref)
 
 app.route('/raw/<everything:name>')(view_raw_2)
-app.route('/raw/<everything:name>/doc_acl', defaults = { 'doc_acl' : 1 })(view_raw_2)
-app.route('/raw/<everything:name>/doc_rev/<int:num>')(view_raw_2)
+app.route('/raw_acl/<everything:name>', defaults = { 'doc_acl' : 1 })(view_raw_2)
+app.route('/raw_rev/<int:num>/<everything:name>')(view_raw_2)
 
-@app.route('/diff/<int(signed = True):num_a>/<int(signed = True):num_b>/<everything:name>')
-def view_diff(name = 'Test', num_a = 1, num_b = 1):
-    return view_diff_2(load_db.db_get(), name, num_a, num_b)
+app.route('/diff/<int(signed = True):num_a>/<int(signed = True):num_b>/<everything:name>')(view_diff)
 
-@app.route('/down/<everything:name>')
-def view_down(name = None):
-    return view_down_2(load_db.db_get(), name)
+app.route('/down/<everything:name>')(view_down)
 
-@app.route('/w/<everything:name>/doc_rev/<int(signed = True):doc_rev>')
-@app.route('/w/<everything:name>/doc_from/<everything:doc_from>')
-@app.route('/w/<everything:name>')
-def view_read(name = 'Test', doc_rev = 0, doc_from = ''):
-    return view_read_2(load_db.db_get(), name, doc_rev, doc_from)
+# everything 다음에 추가 붙은 경우에 대해서 재검토 필요 (진행중)
+app.route('/w_rev/<int(signed = True):doc_rev>/<everything:name>')(view_read)
+app.route('/w_from/<everything:name>')(view_read)
+app.route('/w/<everything:name>')(view_read)
 
-# Func-edit
-@app.route('/revert/<everything:name>', methods = ['POST', 'GET'])
-def edit_revert(name = None):
-    return edit_revert_2(load_db.db_get(), name)
+app.route('/random')(main_func_random)
 
+# Func-edit
 app.route('/edit/<everything:name>', methods = ['POST', 'GET'])(edit)
 app.route('/edit/<everything:name>/doc_from/<everything:name_load>', methods = ['POST', 'GET'])(edit)
 app.route('/edit/<everything:name>/doc_section/<int:section>', methods = ['POST', 'GET'])(edit)
 
-# 개편 예정
-@app.route('/backlink_reset/<everything:name>')
-def edit_backlink_reset(name = 'Test'):
-    return edit_backlink_reset_2(load_db.db_get(), name)
+app.route('/upload', methods = ['POST', 'GET'])(main_func_upload)
 
-@app.route('/delete/<everything:name>', methods = ['POST', 'GET'])
-def edit_delete(name = None):
-    return edit_delete_2(load_db.db_get(), name)
+# 개편 예정
+app.route('/xref_reset/<everything:name>')(edit_backlink_reset)
 
-@app.route('/delete/doc_file/<everything:name>', methods = ['POST', 'GET'])
-def edit_delete_file(name = 'test.jpg'):
-    return edit_delete_file_2(load_db.db_get(), name)
+app.route('/delete/<everything:name>', methods = ['POST', 'GET'])(edit_delete)
+app.route('/delete_file/<everything:name>', methods = ['POST', 'GET'])(edit_delete_file)
+app.route('/delete_mutiple', methods = ['POST', 'GET'])(edit_delete_mutiple)
 
-@app.route('/delete/doc_mutiple', methods = ['POST', 'GET'])
-def edit_delete_mutiple():
-    return edit_delete_mutiple_2(load_db.db_get())
+app.route('/revert/<int:num>/<everything:name>', methods = ['POST', 'GET'])(edit_revert)
 
-@app.route('/move/<everything:name>', methods = ['POST', 'GET'])
-def edit_move(name = None):
-    return edit_move_2(load_db.db_get(), name)
+app.route('/move/<everything:name>', methods = ['POST', 'GET'])(edit_move)
 
 # Func-topic
-@app.route('/recent_discuss')
-def recent_discuss():
-    return recent_discuss_2(load_db.db_get(), 'normal')
-
-@app.route('/recent_discuss/close')
-def recent_discuss_close():
-    return recent_discuss_2(load_db.db_get(), 'close')
-
-@app.route('/recent_discuss/open')
-def recent_discuss_open():
-    return recent_discuss_2(load_db.db_get(), 'open')
+app.route('/recent_discuss', defaults = { 'tool' : 'normal' })(recent_discuss)
+app.route('/recent_discuss/close', defaults = { 'tool' : 'close' })(recent_discuss)
+app.route('/recent_discuss/open', defaults = { 'tool' : 'open' })(recent_discuss)
 
 app.route('/thread/<int:topic_num>', methods = ['POST', 'GET'])(topic)
 app.route('/topic/<everything:name>', methods = ['POST', 'GET'])(topic_list)
@@ -546,27 +478,10 @@ app.route('/thread/<int:topic_num>/comment/<int:num>/raw')(view_raw_2)
 app.route('/thread/<int:topic_num>/comment/<int:num>/delete', methods = ['POST', 'GET'])(topic_comment_delete)
 
 # Func-user
-@app.route('/change', methods = ['POST', 'GET'])
-def user_setting():
-    return user_setting_2(load_db.db_get(), server_set_var)
-
-@app.route('/change/email', methods = ['POST', 'GET'])
-def user_setting_email():
-    return user_setting_email_2(load_db.db_get())
-
-app.route('/change/email/delete')(user_setting_email_delete)
-
-@app.route('/change/email/check', methods = ['POST', 'GET'])
-def user_setting_email_check():
-    return user_setting_email_check_2(load_db.db_get())
-
+app.route('/change', methods = ['POST', 'GET'])(user_setting)
 app.route('/change/key')(user_setting_key)
 app.route('/change/key/delete')(user_setting_key_delete)
-
-@app.route('/change/pw', methods = ['POST', 'GET'])
-def user_setting_pw_change():
-    return user_setting_pw_change_2(load_db.db_get())
-
+app.route('/change/pw', methods = ['POST', 'GET'])(user_setting_pw)
 app.route('/change/head', methods=['GET', 'POST'])(user_setting_head)
 
 app.route('/user')(user_info)
@@ -574,29 +489,34 @@ app.route('/user/<name>')(user_info)
 
 app.route('/challenge')(user_challenge)
 
-@app.route('/count')
-@app.route('/count/<name>')
-def user_count_edit(name = None):
-    return user_count_edit_2(load_db.db_get(), name)
-    
+app.route('/count')(user_count)
+app.route('/count/<name>')(user_count)
+
 app.route('/alarm')(user_alarm)
-app.route('/alarm/delete')(user_alarm_del)
-    
-@app.route('/watch_list')
-def user_watch_list():
-    return user_watch_list_2(load_db.db_get(), 'watch_list')
+app.route('/alarm/delete')(user_alarm_delete)
+
+app.route('/watch_list', defaults = { 'tool' : 'watch_list' })(user_watch_list)
+app.route('/watch_list/<everything:name>', defaults = { 'tool' : 'watch_list' })(user_watch_list_name)
+
+app.route('/star_doc', defaults = { 'tool' : 'star_doc' })(user_watch_list)
+app.route('/star_doc/<everything:name>', defaults = { 'tool' : 'star_doc' })(user_watch_list_name)
+
+# 하위 호환용 S
+app.route('/skin_set')(main_func_skin_set)
+app.route('/main_skin_set')(main_func_skin_set)
+# 하위 호환용 E
 
-@app.route('/watch_list/<everything:name>')
-def user_watch_list_name(name = 'Test'):
-    return user_watch_list_name_2(load_db.db_get(), 'watch_list', name)
+# 개편 보류중 S
+@app.route('/change/email', methods = ['POST', 'GET'])
+def user_setting_email():
+    return user_setting_email_2(load_db.db_get())
 
-@app.route('/star_doc')
-def user_star_doc():
-    return user_watch_list_2(load_db.db_get(), 'star_doc')
+app.route('/change/email/delete')(user_setting_email_delete)
 
-@app.route('/star_doc/<everything:name>')
-def user_star_doc_name(name = 'Test'):
-    return user_watch_list_name_2(load_db.db_get(), 'star_doc', name)
+@app.route('/change/email/check', methods = ['POST', 'GET'])
+def user_setting_email_check():
+    return user_setting_email_check_2(load_db.db_get())
+# 개편 보류중 E
 
 # Func-login
 # 개편 예정
@@ -688,13 +608,24 @@ app.route('/manager', methods = ['POST', 'GET'])(main_tool_admin)
 app.route('/manager/<int:num>', methods = ['POST', 'GET'])(main_tool_admin)
 app.route('/manager/<int:num>/<add_2>', methods = ['POST', 'GET'])(main_tool_admin)
 
-app.route('/random')(main_func_random)
-app.route('/upload', methods = ['POST', 'GET'])(main_func_upload)
-app.route('/setting', defaults = { 'db_set' : data_db_set['type'] })(main_func_setting)
-app.route('/setting/<int:num>', methods = ['POST', 'GET'], defaults = { 'db_set' : data_db_set['type'] })(main_func_setting)
-app.route('/skin_set')(main_func_skin_set)
-app.route('/main_skin_set')(main_func_skin_set)
-app.route('/easter_egg.xml')(main_func_easter_egg)
+app.route('/search', methods=['POST'])(main_search)
+app.route('/search/<everything:name>')(main_search_deep)
+app.route('/goto', methods=['POST'])(main_search_goto)
+app.route('/goto/<everything:name>', methods=['POST'])(main_search_goto)
+
+app.route('/setting')(main_func_setting)
+app.route('/setting/main', defaults = { 'db_set' : data_db_set['type'] }, methods = ['POST', 'GET'])(main_func_setting_main)
+app.route('/setting/main/logo', methods = ['POST', 'GET'])(main_func_setting_main_logo)
+app.route('/setting/phrase', methods = ['POST', 'GET'])(main_func_setting_phrase)
+app.route('/setting/head', defaults = { 'num' : 3 }, methods = ['POST', 'GET'])(main_func_setting_head)
+app.route('/setting/head/<skin_name>', defaults = { 'num' : 3 }, methods = ['POST', 'GET'])(main_func_setting_head)
+app.route('/setting/body/top', defaults = { 'num' : 4 }, methods = ['POST', 'GET'])(main_func_setting_head)
+app.route('/setting/body/top/<skin_name>', defaults = { 'num' : 4 }, methods = ['POST', 'GET'])(main_func_setting_head)
+app.route('/setting/body/bottom', defaults = { 'num' : 7 }, methods = ['POST', 'GET'])(main_func_setting_head)
+app.route('/setting/body/bottom/<skin_name>', defaults = { 'num' : 7 }, methods = ['POST', 'GET'])(main_func_setting_head)
+app.route('/setting/robot', methods = ['POST', 'GET'])(main_func_setting_robot)
+app.route('/setting/external', methods = ['POST', 'GET'])(main_func_setting_external)
+app.route('/setting/acl', methods = ['POST', 'GET'])(main_func_setting_acl)
 
 # views -> view
 app.route('/view/<everything:name>')(main_view)

+ 11 - 2
lang/en-US.json

@@ -105,7 +105,10 @@
         "empty" : "Empty",
         "domain" : "Domain",
         "result" : "Result",
-        "incomplete" : "Incomplete",
+        "not_working" : "Not working",
+        "alpha" : "Alpha",
+        "beta" : "Beta",
+        "example" : "Example",
         "_comment_1.1_" : "Time",
             "second" : "Second(s)",
             "hour" : "Hour(s)",
@@ -264,6 +267,7 @@
                 "login_set" : "Login-related settings",
                 "server_set" : "Server-related settings",
                 "edit_set" : "Edit-related settings",
+                "communication_set" : "Communication-related settings",
     
                 "wiki_name" : "Wiki[s] name",
                 "wiki_logo" : "Wiki[s] logo",
@@ -285,6 +289,10 @@
                 "approval_question": "Registeration questions",
                 "backup_where" : "Backup location",
                 "ua_get_off" : "Turn off members information collection",
+                "edit_bottom_compulsion" : "Edit reason required",
+                "enable_comment_function" : "Using the comment function",
+                "enable_challenge_function" : "Using the challenge function",
+                "tls_method" : "TLS method",
             "_comment_2.2.3_" : "Text",
                 "register_text" : "Terms of sign-up",
                 "non_login_alert" : "Non-login alert",
@@ -448,6 +456,7 @@
             "restart_fail_error" : "Restart failed. Please try restarting manually.",
             "same_email_error" : "There are users using the same email.",
             "input_email_error" : "There is a problem with the input value.",
+            "error_edit_send_request" : "Entering a reason is required.",
         "_comment_3.2_" : "Warning",
             "http_warning" : "Warning: If you are not on HTTPS connection, your information can be leaked. The users themselves have responsibility to any problems that happen because of this.",
             "user_head_warning" : "User data will be deleted if you close the browser or when you sign in.",
@@ -466,4 +475,4 @@
     
             "challenge_title_thousandth_discussion" : "I think, therefore I am.",
             "challenge_info_thousandth_discussion" : "Post the 1000th discussion thread"
-}
+}

+ 11 - 2
lang/ko-KR.json

@@ -415,7 +415,7 @@
     "key_change": "키 변경",
     "key_delete": "키 삭제",
     "email_delete": "이메일 삭제",
-    "incomplete": "미완성",
+    "not_working": "작동 안함",
     "topic_text": "토론 기본 문구",
     "hcaptcha": "hCAPTCHA",
     "captcha": "CAPTCHA",
@@ -430,5 +430,14 @@
     "challenge_title_thousandth_discussion": "나는 생각한다. 고로 존재한다.",
     "challenge_info_thousandth_discussion": "1000번째 토론 스레드를 올리세요.",
     "challenge": "도전과제",
-    "user_title": "칭호"
+    "user_title": "칭호",
+    "alpha": "알파",
+    "beta": "베타",
+    "example": "예시",
+    "communication_set": "커뮤니케이션 기능 설정",
+    "edit_bottom_compulsion": "편집 사유 필수",
+    "enable_comment_function": "댓글 기능 사용",
+    "enable_challenge_function": "도전과제 기능 사용",
+    "error_edit_send_request": "편집 사유가 필요합니다.",
+    "tls_method": "TLS 방식"
 }

+ 1 - 1
route/api_sitemap.py

@@ -9,7 +9,7 @@ def api_sitemap():
                 '<?xml version="1.0" encoding="UTF-8"?>\n' + \
                 '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n' + \
             ''
-            domain = load_domain()
+            domain = load_domain('full')
 
             curs.execute(db_change("select title from data"))
             all_data = curs.fetchall()

+ 12 - 25
route/edit.py

@@ -6,7 +6,7 @@ def edit(name = 'Test', name_load = 0, section = 0):
     
         ip = ip_check()
         if acl_check(name) == 1:
-            return redirect('/raw/' + url_pas(name) + '/doc_acl')
+            return redirect('/raw_acl/' + url_pas(name))
         
         curs.execute(db_change("select id from history where title = ? order by id + 0 desc"), [name])
         doc_ver = curs.fetchall()
@@ -25,18 +25,21 @@ def edit(name = 'Test', name_load = 0, section = 0):
             else:
                 captcha_post('', 0)
     
-            if slow_edit_check() == 1:
+            if do_edit_slow_check() == 1:
                 return re_error('/error/24')
     
             today = get_time()
             content = flask.request.form.get('content', '').replace('\r\n', '\n')
+            send = flask.request.form.get('send', '')
+            agree = flask.request.form.get('copyright_agreement', '')
             
-            if edit_filter_do(content) == 1:
+            if do_edit_filter(content) == 1:
                 return re_error('/error/21')
-                
-            curs.execute(db_change('select data from other where name = "copyright_checkbox_text"'))
-            copyright_checkbox_text_d = curs.fetchall()
-            if copyright_checkbox_text_d and copyright_checkbox_text_d[0][0] != '' and flask.request.form.get('copyright_agreement', '') != 'yes':
+
+            if do_edit_send_check(send) == 1:
+                return re_error('/error/37')
+
+            if do_edit_text_bottom_check_box_check(agree) == 1:
                 return re_error('/error/29')
             
             curs.execute(db_change("select data from data where title = ?"), [name])
@@ -64,7 +67,7 @@ def edit(name = 'Test', name_load = 0, section = 0):
                 content,
                 today,
                 ip,
-                flask.request.form.get('send', ''),
+                send,
                 leng
             )
             
@@ -117,21 +120,6 @@ def edit(name = 'Test', name_load = 0, section = 0):
                 '<hr class="main_hr">' + \
             ''
     
-            curs.execute(db_change('select data from other where name = "edit_bottom_text"'))
-            sql_d = curs.fetchall()
-            b_text = ('<hr class="main_hr">' + sql_d[0][0]) if sql_d and sql_d[0][0] != '' else ''
-            
-            curs.execute(db_change('select data from other where name = "copyright_checkbox_text"'))
-            sql_d = curs.fetchall()
-            if sql_d and sql_d[0][0] != '':
-                cccb_text = '' + \
-                    '<hr class="main_hr">' + \
-                    '<input type="checkbox" name="copyright_agreement" value="yes"> ' + sql_d[0][0] + \
-                    '<hr class="main_hr">' + \
-                ''
-            else:
-                cccb_text = ''
-    
             curs.execute(db_change('select data from other where name = "edit_help"'))
             sql_d = curs.fetchall()
             p_text = html.escape(sql_d[0][0]) if sql_d and sql_d[0][0] != '' else load_lang('default_edit_help')
@@ -207,7 +195,7 @@ def edit(name = 'Test', name_load = 0, section = 0):
                                 name="ver" 
                                 value="''' + doc_ver + '''">
                         <hr class="main_hr">
-                        ''' + captcha_get() + ip_warning() + cccb_text + '''
+                        ''' + captcha_get() + ip_warning() + get_edit_text_bottom_check_box() + get_edit_text_bottom() + '''
                         <button id="save"
                                 type="submit" 
                                 onclick="
@@ -222,7 +210,6 @@ def edit(name = 'Test', name_load = 0, section = 0):
                                     load_preview(\'''' + url_pas(name) + '''\');
                                 ">''' + load_lang('preview') + '''</button>
                     </form>
-                    ''' + b_text + '''
                     <hr class="main_hr">
                     <div id="see_preview"></div>
                     <script>

+ 15 - 14
route/edit_backlink_reset.py

@@ -1,18 +1,19 @@
 from .tool.func import *
 
-def edit_backlink_reset_2(conn, name):
-    curs = conn.cursor()
+def edit_backlink_reset(name = 'Test'):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
 
-    curs.execute(db_change("select data from data where title = ?"), [name])
-    old = curs.fetchall()
-    if old:
-        curs.execute(db_change("delete from back where link = ?"), [name])
-        curs.execute(db_change("delete from back where title = ? and type = 'no'"), [name])
-        
-        render_set(
-            doc_name = name,
-            doc_data = old[0][0],
-            data_type = 'backlink'
-        )
+        curs.execute(db_change("select data from data where title = ?"), [name])
+        old = curs.fetchall()
+        if old:
+            curs.execute(db_change("delete from back where link = ?"), [name])
+            curs.execute(db_change("delete from back where title = ? and type = 'no'"), [name])
 
-    return redirect('/xref/' + url_pas(name))
+            render_set(
+                doc_name = name,
+                doc_data = old[0][0],
+                data_type = 'backlink'
+            )
+
+        return redirect('/xref/' + url_pas(name))

+ 60 - 65
route/edit_delete.py

@@ -1,79 +1,74 @@
 from .tool.func import *
 
-def edit_delete_2(conn, name):
-    curs = conn.cursor()
+def edit_delete(name):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
 
-    ip = ip_check()
-    if acl_check(name) == 1:
-        return re_error('/ban')
+        ip = ip_check()
+        if acl_check(name) == 1:
+            return re_error('/ban')
 
-    curs.execute(db_change("select title from data where title = ?"), [name])
-    if not curs.fetchall():
-        return redirect('/w/' + url_pas(name))
+        curs.execute(db_change("select title from data where title = ?"), [name])
+        if not curs.fetchall():
+            return redirect('/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')
-        else:
-            captcha_post('', 0)
+        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')
+            else:
+                captcha_post('', 0)
 
-        if slow_edit_check() == 1:
-            return re_error('/error/24')
+            if do_edit_slow_check() == 1:
+                return re_error('/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_text_bottom_check_box_check(agree) == 1:
+                return re_error('/error/29')
 
-        curs.execute(db_change("select data from data where title = ?"), [name])
-        data = curs.fetchall()
-        if data:
-            today = get_time()
-            leng = '-' + str(len(data[0][0]))
+            curs.execute(db_change("select data from data where title = ?"), [name])
+            data = curs.fetchall()
+            if data:
+                today = get_time()
+                leng = '-' + str(len(data[0][0]))
 
-            history_plus(
-                name,
-                '',
-                today,
-                ip,
-                flask.request.form.get('send', ''),
-                leng,
-                t_check = 'delete',
-                mode = 'delete'
-            )
+                history_plus(
+                    name,
+                    '',
+                    today,
+                    ip,
+                    send,
+                    leng,
+                    t_check = 'delete',
+                    mode = 'delete'
+                )
 
-            curs.execute(db_change("select title, link from back where title = ? and not type = 'cat' and not type = 'no'"), [name])
-            for data in curs.fetchall():
-                curs.execute(db_change("insert into back (title, link, type) values (?, ?, 'no')"), [data[0], data[1]])
+                curs.execute(db_change("select title, link from back where title = ? and not type = 'cat' and not type = 'no'"), [name])
+                for data in curs.fetchall():
+                    curs.execute(db_change("insert into back (title, link, type) values (?, ?, 'no')"), [data[0], data[1]])
 
-            curs.execute(db_change("delete from back where link = ?"), [name])
-            curs.execute(db_change("delete from data where title = ?"), [name])
-            conn.commit()
+                curs.execute(db_change("delete from back where link = ?"), [name])
+                curs.execute(db_change("delete from data where title = ?"), [name])
+                conn.commit()
 
-        file_check = re.search(r'^file:(.+)\.(.+)$', name)
-        if file_check:
-            '''
-            file_check = file_check.groups()
-            file_directory = os.path.join(
-                load_image_url(), 
-                sha224_replace(file_check[0]) + '.' + file_check[1]
-            )
-            if os.path.exists(file_directory):
-                os.remove(file_directory)
-            '''
-            
-            pass
-        else:
             curs.execute(db_change('select data from other where name = "count_all_title"'))
             curs.execute(db_change("update other set data = ? where name = 'count_all_title'"), [str(int(curs.fetchall()[0][0]) - 1)])
 
-        return redirect('/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])],
-            data = '''
-                <form method="post">
-                    ''' + ip_warning() + '''
-                    <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
-                    <hr class="main_hr">
-                    ''' + captcha_get() + '''
-                    <button type="submit">''' + load_lang('delete') + '''</button>
-                </form>
-            ''',
-            menu = [['w/' + url_pas(name), load_lang('return')]]
-        ))
+            return redirect('/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])],
+                data = '''
+                    <form method="post">
+                        <input placeholder="''' + load_lang('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>
+                    </form>
+                ''',
+                menu = [['w/' + url_pas(name), load_lang('return')]]
+            ))

+ 42 - 41
route/edit_delete_file.py

@@ -1,43 +1,44 @@
 from .tool.func import *
 
-def edit_delete_file_2(conn, name):
-    curs = conn.cursor()
-
-    ip = ip_check()
-    if admin_check() == 0:
-        return re_error('/ban')
-
-    mime_type = re.search(r'([^.]+)$', name)
-    if mime_type:
-        mime_type = mime_type.group(1).lower()
-    else:
-        mime_type = 'jpg'
-
-    file_name = re.sub(r'\.([^.]+)$', '', name)
-    file_name = re.sub(r'^file:', '', file_name)
-    
-    file_all_name = sha224_replace(file_name) + '.' + mime_type
-    file_directory = os.path.join(load_image_url(), file_all_name)
-    
-    if not os.path.exists(file_directory):
-        return redirect('/w/' + url_pas(name))
-
-    if flask.request.method == 'POST':
-        admin_check(None, 'file del (' + name + ')')
-        os.remove(file_directory)
-
-        return redirect('/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])],
-            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">
-                    <button type="submit">''' + load_lang('file_delete') + '''</button>
-                </form>
-            ''',
-            menu = [['w/' + url_pas(name), load_lang('return')]]
-        ))
+def edit_delete_file(name = 'test.jpg'):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        ip = ip_check()
+        if admin_check() == 0:
+            return re_error('/ban')
+
+        mime_type = re.search(r'([^.]+)$', name)
+        if mime_type:
+            mime_type = mime_type.group(1).lower()
+        else:
+            mime_type = 'jpg'
+
+        file_name = re.sub(r'\.([^.]+)$', '', name)
+        file_name = re.sub(r'^file:', '', file_name)
+
+        file_all_name = sha224_replace(file_name) + '.' + mime_type
+        file_directory = os.path.join(load_image_url(), file_all_name)
+
+        if not os.path.exists(file_directory):
+            return redirect('/w/' + url_pas(name))
+
+        if flask.request.method == 'POST':
+            admin_check(None, 'file del (' + name + ')')
+            os.remove(file_directory)
+
+            return redirect('/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])],
+                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">
+                        <button type="submit">''' + load_lang('file_delete') + '''</button>
+                    </form>
+                ''',
+                menu = [['w/' + url_pas(name), load_lang('return')]]
+            ))

+ 35 - 24
route/edit_delete_mutiple.py

@@ -1,30 +1,41 @@
 from .tool.func import *
 from . import edit_delete
 
-def edit_delete_mutiple_2(conn):
-    curs = conn.cursor()
+def edit_delete_mutiple():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
 
-    ip = ip_check()
-    if admin_check() != 1:
-        return re_error('/ban')
+        ip = ip_check()
+        if admin_check() != 1:
+            return re_error('/ban')
 
-    if flask.request.method == 'POST':
-        all_title = re.findall(r'([^\n]+)\n', flask.request.form.get('content', '').replace('\r\n', '\n') + '\n')
-        for name in all_title:
-            edit_delete.edit_delete_2(conn, name)
+        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_text_bottom_check_box_check(agree) == 1:
+                return re_error('/error/29')
+            
+            all_title = re.findall(r'([^\n]+)\n', flask.request.form.get('content', '').replace('\r\n', '\n') + '\n')
+            for name in all_title:
+                edit_delete.edit_delete(name)
 
-        return redirect('/recent_changes')
-    else:
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('many_delete'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-            data = '''
-                <form method="post">
-                    <textarea rows="25" placeholder="''' + load_lang('many_delete_help') + '''" name="content"></textarea>
-                    <hr class=\"main_hr\">
-                    <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
-                    <hr class=\"main_hr\">
-                    <button type="submit">''' + load_lang('delete') + '''</button>
-                </form>
-            ''',
-            menu = [['manager/1', load_lang('return')]]
-        ))
+            return redirect('/recent_changes')
+        else:
+            return easy_minify(flask.render_template(skin_check(),
+                imp = [load_lang('many_delete'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                data = '''
+                    <form method="post">
+                        <textarea rows="25" placeholder="''' + load_lang('many_delete_help') + '''" name="content"></textarea>
+                        <hr class="main_hr">
+                        <input placeholder="''' + load_lang('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>
+                    </form>
+                ''',
+                menu = [['manager/1', load_lang('return')]]
+            ))

+ 158 - 146
route/edit_move.py

@@ -1,33 +1,142 @@
 from .tool.func import *
 
-def edit_move_2(conn, name):
-    curs = conn.cursor()
+def edit_move(name):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
 
-    if acl_check(name) == 1:
-        return re_error('/ban')
-
-    if flask.request.method == 'POST':
-        move_title = flask.request.form.get('title', 'test')
-        if acl_check(move_title) == 1:
+        if acl_check(name) == 1:
             return re_error('/ban')
 
-        if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
-            return re_error('/error/13')
-        else:
-            captcha_post('', 0)
+        if flask.request.method == 'POST':
+            move_title = flask.request.form.get('title', 'test')
+            if acl_check(move_title) == 1:
+                return re_error('/ban')
 
-        if slow_edit_check() == 1:
-            return re_error('/error/24')
+            if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
+                return re_error('/error/13')
+            else:
+                captcha_post('', 0)
+
+            if do_edit_slow_check() == 1:
+                return re_error('/error/24')
+            
+            send = flask.request.form.get('send', '')
+            agree = flask.request.form.get('copyright_agreement', '')
+            time = get_time()
+            ip = ip_check()
+            
+            if do_edit_send_check(send) == 1:
+                return re_error('/error/37')
+            
+            if do_edit_text_bottom_check_box_check(agree) == 1:
+                return re_error('/error/29')
+
+            curs.execute(db_change("select title from history where title = ?"), [move_title])
+            if curs.fetchall():
+                if flask.request.form.get('move_option', 'normal') == 'merge' and admin_check(None, 'merge documents') == 1:
+                    curs.execute(db_change("select data from data where title = ?"), [move_title])
+                    data = curs.fetchall()
+                    if data:
+                        curs.execute(db_change("delete from data where title = ?"), [move_title])
+                        curs.execute(db_change("delete from back where link = ?"), [move_title])
 
-        curs.execute(db_change("select title from history where title = ?"), [move_title])
-        if curs.fetchall():
-            if flask.request.form.get('move_option', 'normal') == 'merge' and admin_check(None, 'merge documents') == 1:
-                curs.execute(db_change("select data from data where title = ?"), [move_title])
-                data = curs.fetchall()
-                if data:
-                    curs.execute(db_change("delete from data where title = ?"), [move_title])
-                    curs.execute(db_change("delete from back where link = ?"), [move_title])
+                    curs.execute(db_change("select data from data where title = ?"), [name])
+                    data = curs.fetchall()
+                    if data:
+                        curs.execute(db_change("update data set title = ? where title = ?"), [move_title, name])
+                        curs.execute(db_change("update back set link = ? where link = ?"), [move_title, name])
+
+                        data_in = data[0][0]
+                    else:
+                        data_in = ''
 
+                    history_plus(
+                        name,
+                        data_in,
+                        time,
+                        ip,
+                        send,
+                        '0',
+                        t_check = 'merge <a>' + name + '</a> - <a>' + move_title + '</a> move',
+                        mode = 'move'
+                    )
+
+                    curs.execute(db_change("update back set type = 'no' where title = ? and not type = 'cat' and not type = 'no'"), [name])
+                    curs.execute(db_change("delete from back where title = ? and not type = 'cat' and type = 'no'"), [move_title])
+
+                    curs.execute(db_change("select id from history where title = ? order by id + 0 desc limit 1"), [move_title])
+                    data = curs.fetchall()
+
+                    num = data[0][0]
+
+                    curs.execute(db_change("select id from history where title = ? order by id + 0 asc"), [name])
+                    data = curs.fetchall()
+                    for move in data:
+                        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]
+                        ])
+
+                    conn.commit()
+
+                    return redirect('/w/' + url_pas(move_title))
+                elif flask.request.form.get('move_option', 'normal') == 'reverse':
+                    var_name = ''
+                    i = 0
+                    while 1:
+                        curs.execute(db_change("select title from history where title = ?"), ['test ' + str(i)])
+                        if not curs.fetchall():
+                            curs.execute(db_change("select data from data where title = ?"), [name])
+                            data = curs.fetchall()
+                            if data:
+                                curs.execute(db_change("update data set title = ? where title = ?"), ['test ' + str(i), name])
+                                curs.execute(db_change("update back set link = ? where link = ?"), ['test ' + str(i), name])
+
+                            curs.execute(db_change("update history set title = ? where title = ?"), ['test ' + str(i), name])
+                            curs.execute(db_change("update rc set title = ? where title = ?"), ['test ' + str(i), name])
+
+                            break
+                        else:
+                            i += 1
+
+                    for title_name in [[move_title, name], ['test ' + str(i), move_title]]:
+                        curs.execute(db_change("select data from data where title = ?"), [title_name[0]])
+                        data = curs.fetchall()
+                        if data:
+                            curs.execute(db_change("update data set title = ? where title = ?"), [title_name[1], title_name[0]])
+                            curs.execute(db_change("update back set link = ? where link = ?"), [title_name[1], title_name[0]])
+
+                            data_in = data[0][0]
+                        else:
+                            data_in = ''
+
+                        history_plus(
+                            title_name[0],
+                            data_in,
+                            time,
+                            ip,
+                            send,
+                            '0',
+                            t_check = '<a>' + (title_name[0] if title_name[0] != 'test ' + str(i) else name) + '</a> - <a>' + title_name[1] + '</a> move',
+                            mode = 'move'
+                        )
+
+                        curs.execute(db_change("update history set title = ? where title = ?"), [title_name[1], title_name[0]])
+                        curs.execute(db_change("update rc set title = ? where title = ?"), [title_name[1], title_name[0]])
+                        conn.commit()
+
+                    return redirect('/w/' + url_pas(move_title))
+                else:
+                    return re_error('/error/19')
+            else:
                 curs.execute(db_change("select data from data where title = ?"), [name])
                 data = curs.fetchall()
                 if data:
@@ -41,138 +150,41 @@ def edit_move_2(conn, name):
                 history_plus(
                     name,
                     data_in,
-                    get_time(),
-                    ip_check(),
-                    flask.request.form.get('send', ''),
+                    time,
+                    ip,
+                    send,
                     '0',
-                    t_check = 'merge <a>' + name + '</a> - <a>' + move_title + '</a> move',
+                    t_check = '<a>' + name + '</a> - <a>' + move_title + '</a> move',
                     mode = 'move'
                 )
 
                 curs.execute(db_change("update back set type = 'no' where title = ? and not type = 'cat' and not type = 'no'"), [name])
                 curs.execute(db_change("delete from back where title = ? and not type = 'cat' and type = 'no'"), [move_title])
 
-                curs.execute(db_change("select id from history where title = ? order by id + 0 desc limit 1"), [move_title])
-                data = curs.fetchall()
-
-                num = data[0][0]
-
-                curs.execute(db_change("select id from history where title = ? order by id + 0 asc"), [name])
-                data = curs.fetchall()
-                for move in data:
-                    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]
-                    ])
-
+                curs.execute(db_change("update history set title = ? where title = ?"), [move_title, name])
+                curs.execute(db_change("update rc set title = ? where title = ?"), [move_title, name])
                 conn.commit()
 
                 return redirect('/w/' + url_pas(move_title))
-            elif flask.request.form.get('move_option', 'normal') == 'reverse':
-                var_name = ''
-                i = 0
-                while 1:
-                    curs.execute(db_change("select title from history where title = ?"), ['test ' + str(i)])
-                    if not curs.fetchall():
-                        curs.execute(db_change("select data from data where title = ?"), [name])
-                        data = curs.fetchall()
-                        if data:
-                            curs.execute(db_change("update data set title = ? where title = ?"), ['test ' + str(i), name])
-                            curs.execute(db_change("update back set link = ? where link = ?"), ['test ' + str(i), name])
-
-                        curs.execute(db_change("update history set title = ? where title = ?"), ['test ' + str(i), name])
-                        curs.execute(db_change("update rc set title = ? where title = ?"), ['test ' + str(i), name])
-
-                        break
-                    else:
-                        i += 1
-
-                for title_name in [[move_title, name], ['test ' + str(i), move_title]]:
-                    curs.execute(db_change("select data from data where title = ?"), [title_name[0]])
-                    data = curs.fetchall()
-                    if data:
-                        curs.execute(db_change("update data set title = ? where title = ?"), [title_name[1], title_name[0]])
-                        curs.execute(db_change("update back set link = ? where link = ?"), [title_name[1], title_name[0]])
-
-                        data_in = data[0][0]
-                    else:
-                        data_in = ''
-
-                    history_plus(
-                        title_name[0],
-                        data_in,
-                        get_time(),
-                        ip_check(),
-                        flask.request.form.get('send', ''),
-                        '0',
-                        t_check = '<a>' + (title_name[0] if title_name[0] != 'test ' + str(i) else name) + '</a> - <a>' + title_name[1] + '</a> move',
-                        mode = 'move'
-                    )
-
-                    curs.execute(db_change("update history set title = ? where title = ?"), [title_name[1], title_name[0]])
-                    curs.execute(db_change("update rc set title = ? where title = ?"), [title_name[1], title_name[0]])
-                    conn.commit()
-
-                return redirect('/w/' + url_pas(move_title))
-            else:
-                return re_error('/error/19')
         else:
-            curs.execute(db_change("select data from data where title = ?"), [name])
-            data = curs.fetchall()
-            if data:
-                curs.execute(db_change("update data set title = ? where title = ?"), [move_title, name])
-                curs.execute(db_change("update back set link = ? where link = ?"), [move_title, name])
-
-                data_in = data[0][0]
-            else:
-                data_in = ''
-
-            history_plus(
-                name,
-                data_in,
-                get_time(),
-                ip_check(),
-                flask.request.form.get('send', ''),
-                '0',
-                t_check = '<a>' + name + '</a> - <a>' + move_title + '</a> move',
-                mode = 'move'
-            )
-
-            curs.execute(db_change("update back set type = 'no' where title = ? and not type = 'cat' and not type = 'no'"), [name])
-            curs.execute(db_change("delete from back where title = ? and not type = 'cat' and type = 'no'"), [move_title])
-
-            curs.execute(db_change("update history set title = ? where title = ?"), [move_title, name])
-            curs.execute(db_change("update rc set title = ? where title = ?"), [move_title, name])
-            conn.commit()
-
-            return redirect('/w/' + url_pas(move_title))
-    else:
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('move') + ')', 0])],
-            data = '''
-                <form method="post">
-                    ''' + ip_warning() + '''
-                    <input placeholder="''' + load_lang('document_name') + '" value="' + name + '''" name="title" type="text">
-                    <hr class=\"main_hr\">
-                    <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
-                    <hr class=\"main_hr\">
-                    <select name="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 admin_check() == 1 else '') + '''
-                    </select>
-                    <hr class=\"main_hr\">
-                    ''' + captcha_get() + '''
-                    <button type="submit">''' + load_lang('move') + '''</button>
-                </form>
-            ''',
-            menu = [['w/' + url_pas(name), load_lang('return')]]
-        ))
+            return easy_minify(flask.render_template(skin_check(),
+                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('move') + ')', 0])],
+                data = '''
+                    <form method="post">
+                        ''' + ip_warning() + '''
+                        <input placeholder="''' + load_lang('document_name') + '" value="' + name + '''" name="title" type="text">
+                        <hr class="main_hr">
+                        <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
+                        <hr class="main_hr">
+                        <select name="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 admin_check() == 1 else '') + '''
+                        </select>
+                        <hr class="main_hr">
+                        ''' + captcha_get() + ip_warning() + get_edit_text_bottom_check_box() + get_edit_text_bottom() + '''
+                        <button type="submit">''' + load_lang('move') + '''</button>
+                    </form>
+                ''',
+                menu = [['w/' + url_pas(name), load_lang('return')]]
+            ))

+ 73 - 66
route/edit_revert.py

@@ -1,82 +1,89 @@
 from .tool.func import *
 
-def edit_revert_2(conn, name):
-    curs = conn.cursor()
+def edit_revert(name, num):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
 
-    num = int(number_check(flask.request.args.get('num', '1')))
+        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')
 
-    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 acl_check(name) == 1:
-        return re_error('/ban')
+        if acl_check(name) == 1:
+            return re_error('/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))
 
-    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')
-        else:
-            captcha_post('', 0)
+        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')
+            else:
+                captcha_post('', 0)
 
-        if slow_edit_check() == 1:
-            return re_error('/error/24')
+            if do_edit_slow_check() == 1:
+                return re_error('/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_text_bottom_check_box_check(agree) == 1:
+                return re_error('/error/29')
 
-        curs.execute(db_change("select data from history where title = ? and id = ?"), [name, str(num)])
-        data = curs.fetchall()
-        if data:
-            if edit_filter_do(data[0][0]) == 1:
+            if do_edit_filter(data[0][0]) == 1:
                 return re_error('/error/21')
 
-        curs.execute(db_change("delete from back where link = ?"), [name])
-        conn.commit()
+            curs.execute(db_change("delete from back where link = ?"), [name])
 
-        if data:
-            curs.execute(db_change("select data from data where title = ?"), [name])
-            data_old = curs.fetchall()
-            if data_old:
-                leng = leng_check(len(data_old[0][0]), len(data[0][0]))
-                curs.execute(db_change("update data set data = ? where title = ?"), [data[0][0], name])
-            else:
-                leng = '+' + str(len(data[0][0]))
-                curs.execute(db_change("insert into data (title, data) values (?, ?)"), [name, data[0][0]])
+            if data:
+                curs.execute(db_change("select data from data where title = ?"), [name])
+                data_old = curs.fetchall()
+                if data_old:
+                    leng = leng_check(len(data_old[0][0]), len(data[0][0]))
+                    curs.execute(db_change("update data set data = ? where title = ?"), [data[0][0], name])
+                else:
+                    leng = '+' + str(len(data[0][0]))
+                    curs.execute(db_change("insert into data (title, data) values (?, ?)"), [name, data[0][0]])
 
-            history_plus(
-                name,
-                data[0][0],
-                get_time(),
-                ip_check(),
-                flask.request.form.get('send', ''),
-                leng,
-                t_check = 'r' + str(num),
-                mode = 'revert'
-            )
+                history_plus(
+                    name,
+                    data[0][0],
+                    get_time(),
+                    ip_check(),
+                    flask.request.form.get('send', ''),
+                    leng,
+                    t_check = 'r' + str(num),
+                    mode = 'revert'
+                )
 
-            render_set(
-                doc_name = name,
-                doc_data = data[0][0],
-                data_type = 'backlink'
-            )
+                render_set(
+                    doc_name = name,
+                    doc_data = data[0][0],
+                    data_type = 'backlink'
+                )
 
             conn.commit()
 
-        return redirect('/w/' + url_pas(name))
-    else:
-        curs.execute(db_change("select title from history where title = ? and id = ?"), [name, str(num)])
-        if not curs.fetchall():
             return redirect('/w/' + url_pas(name))
-
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('revert') + ')', 0])],
-            data =  '''
-                    <form method="post">
-                        <span>r''' + flask.request.args.get('num', '0') + '''</span>
-                        <hr class=\"main_hr\">
-                        ''' + ip_warning() + '''
-                        <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
-                        <hr class=\"main_hr\">
-                        ''' + captcha_get() + '''
-                        <button type="submit">''' + load_lang('revert') + '''</button>
-                    </form>
-                    ''',
-            menu = [['history/' + url_pas(name), load_lang('history')], ['recent_changes', load_lang('recent_change')]]
-        ))
+        else:
+            if data:
+                preview = '<pre>' + 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])],
+                data =  '''
+                        <form method="post">
+                            <input placeholder="''' + load_lang('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>
+                        </form>
+                        ''' + preview,
+                menu = [['history/' + url_pas(name), load_lang('history')], ['recent_changes', load_lang('recent_change')]]
+            ))

+ 1 - 1
route/filter_inter_wiki.py

@@ -63,7 +63,7 @@ def filter_inter_wiki(tool):
             div += '</td>'
 
             if tool == 'inter_wiki':
-                div += '<td><a id="out_link" href="' + html.escape(data[1]) + '">' + html.escape(data[1]) + '</a></td>'
+                div += '<td><a class="opennamuLinkOut" href="' + html.escape(data[1]) + '">' + html.escape(data[1]) + '</a></td>'
             else:
                 div += '<td>' + html.escape(data[1]) + '</td>'
 

+ 0 - 8
route/main_func_easter_egg.py

@@ -1,8 +0,0 @@
-from .tool.func import *
-
-def main_func_easter_egg(conn):
-    return easy_minify(flask.render_template(skin_check(),
-        imp = ['easter_egg.html', wiki_set(), wiki_custom(), wiki_css([0, 0])],
-        data = open('./views/main_css/file/easter_egg.html', encoding='utf8').read(),
-        menu = 0
-    ))

+ 18 - 765
route/main_func_setting.py

@@ -1,767 +1,20 @@
 from .tool.func import *
 
-def main_func_setting(db_set, num = 0):
-    with get_db_connect() as conn:
-        curs = conn.cursor()
-
-        if not (num == 0 or num == 8) and admin_check() != 1:
-            return re_error('/ban')
-
-        if num == 0:
-            li_list = [
-                [1, load_lang('main_setting')],
-                [2, load_lang('text_setting')],
-                [5, 'robots.txt'],
-                [6, load_lang('ext_api_req_set')],
-                [3, load_lang('main_head')],
-                [4, load_lang('main_body')],
-                [7, load_lang('main_bottom_body')]
-            ]
-
-            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="inside_ul">' + li_data + '</ul>',
-                menu = [['manager', load_lang('return')]]
-            ))
-        elif num == 1:
-            setting_list = {
-                0 : ['name', 'Wiki'],
-                2 : ['frontpage', 'FrontPage'],
-                4 : ['upload', '2'],
-                5 : ['skin', ''],
-                7 : ['reg', ''],
-                8 : ['ip_view', ''],
-                9 : ['back_up', '0'],
-                10 : ['port', '3000'],
-                11 : ['key', load_random_key()],
-                12 : ['update', 'stable'],
-                15 : ['encode', 'sha3'],
-                16 : ['host', '0.0.0.0'],
-                19 : ['slow_edit', '0'],
-                20 : ['requires_approval', ''],
-                21 : ['backup_where', ''],
-                22 : ['domain', flask.request.host_url],
-                23 : ['ua_get', ''],
-                24 : ['enable_comment', ''],
-                25 : ['enable_challenge', '']
-            }
-
-            if flask.request.method == 'POST':
-                for i in setting_list:
-                    curs.execute(db_change("update other set data = ? where name = ?"), [
-                        flask.request.form.get(setting_list[i][0], setting_list[i][1]),
-                        setting_list[i][0]
-                    ])
-
-                conn.commit()
-
-                admin_check(None, 'edit_set (' + str(num) + ')')
-
-                return redirect('/setting/1')
-            else:
-                d_list = {}
-                for i in setting_list:
-                    curs.execute(db_change('select data from other where name = ?'), [setting_list[i][0]])
-                    db_data = curs.fetchall()
-                    if not db_data:
-                        curs.execute(db_change('insert into other (name, data) values (?, ?)'), [setting_list[i][0], setting_list[i][1]])
-
-                    d_list[i] = db_data[0][0] if db_data else setting_list[i][1]
-                else:
-                    conn.commit()
-
-                acl_div = ['']
-                encode_data = ['sha256', 'sha3']
-                for acl_data in encode_data:
-                    if acl_data == d_list[15]:
-                        acl_div[0] = '<option value="' + acl_data + '">' + acl_data + '</option>' + acl_div[0]
-                    else:
-                        acl_div[0] += '<option value="' + acl_data + '">' + acl_data + '</option>'
-
-                check_box_div = ['', '', '', '', '', '', '']
-                for i in range(0, len(check_box_div)):
-                    if i == 0:
-                        acl_num = 7
-                    elif i == 1:
-                        acl_num = 8
-                    elif i == 3:
-                        acl_num = 20
-                    elif i == 4:
-                        acl_num = 23
-                    elif i == 5:
-                        acl_num = 24
-                    elif i == 6:
-                        acl_num = 25
-
-                    if d_list[acl_num]:
-                        check_box_div[i] = 'checked="checked"'
-
-                branch_div = ''
-                branch_list = ['stable', 'dev', 'beta']
-                for i in branch_list:
-                    if d_list[12] == i:
-                        branch_div = '<option value="' + i + '">' + i + '</option>' + branch_div
-                    else:
-                        branch_div += '<option value="' + i + '">' + i + '</option>'
-
-                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 = '''
-                        <form method="post" id="main_set_data">
-                            <h2>1. ''' + load_lang('basic_set') + '''</h2>
-                            <span>''' + load_lang('wiki_name') + '''</span>
-                            <hr class="main_hr">
-                            <input name="name" value="''' + html.escape(d_list[0]) + '''">
-                            <hr class="main_hr">
-
-                            <span><a href="/setting/9">(''' + load_lang('wiki_logo') + ''')</a></span>
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('main_page') + '''</span>
-                            <hr class="main_hr">
-                            <input name="frontpage" value="''' + html.escape(d_list[2]) + '''">
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('domain') + '''</span> (EX : http://2du.pythonanywhere.com/)
-                            <hr class="main_hr">
-                            <input name="''' + setting_list[22][0] + '''" value="''' + html.escape(d_list[22]) + '''">
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('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>
-                            <hr class="main_hr">
-                            <input name="port" value="''' + html.escape(d_list[10]) + '''">
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('wiki_secret_key') + '''</span>
-                            <hr class="main_hr">
-                            <input type="password" name="key" value="''' + html.escape(d_list[11]) + '''">
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('encryption_method') + '''</span>
-                            <hr class="main_hr">
-                            <select name="encode">''' + acl_div[0] + '''</select>
-                            
-                            <h3>1.1. ''' + load_lang('communication_function') + '''</h3>
-                            <input type="checkbox" name="enable_comment" ''' + check_box_div[5] + '''> ''' + load_lang('enable_comment_function') + '''
-                            <hr class="main_hr">
-                            
-                            <input type="checkbox" name="enable_challenge" ''' + check_box_div[6] + '''> ''' + load_lang('enable_challenge_function') + '''
-                            <hr class="main_hr">
-
-                            <h2>2. ''' + load_lang('design_set') + '''</h2>
-                            <span>''' + load_lang('wiki_skin') + '''</span>
-                            <hr class="main_hr">
-                            <select name="skin">''' + load_skin(d_list[5] if d_list[5] != '' else 'tenshi') + '''</select>
-
-                            <h2>3. ''' + load_lang('login_set') + '''</h2>
-                            <input type="checkbox" name="reg" ''' + check_box_div[0] + '''> ''' + load_lang('no_register') + '''
-                            <hr class="main_hr">
-
-                            <input type="checkbox" name="ip_view" ''' + check_box_div[1] + '''> ''' + load_lang('hide_ip') + '''
-                            <hr class="main_hr">
-
-                            <input type="checkbox" name="requires_approval" ''' + check_box_div[3] + '''> ''' + load_lang('requires_approval') + '''
-                            <hr class="main_hr">
-
-                            <input type="checkbox" name="ua_get" ''' + check_box_div[4] + '''> ''' + load_lang('ua_get_off') + '''
-
-                            <h2>4. ''' + load_lang('server_set') + '''</h2>
-                            <span>''' + load_lang('max_file_size') + ''' (MB)</span>
-                            <hr class="main_hr">
-                            <input name="upload" value="''' + html.escape(d_list[4]) + '''">
-                            <hr class="main_hr">
-                            
-                            <span>''' + load_lang('update_branch') + '''</span>
-                            <hr class="main_hr">
-                            <select name="update">''' + branch_div + '''</select>
-                            
-                            <span ''' + sqlite_only + '''>
-                                <h3>4.1. ''' + load_lang('sqlite') + '''</h3>
-                                <span>
-                                    ''' + load_lang('backup_interval') + ' (' + load_lang('hour') + ') (' + load_lang('off') + ' : 0) ' + \
-                                    '(' + load_lang('restart_required') + ''')</span>
-                                <hr class="main_hr">
-                                <input name="back_up" value="''' + html.escape(d_list[9]) + '''">
-                                <hr class="main_hr">
-
-                                <span>
-                                    ''' + load_lang('backup_where') + ' (' + load_lang('empty') + ' : ' + load_lang('default') + ') ' + \
-                                    '(' + load_lang('restart_required') + ''') (''' + load_lang('example') + ''' : ./data/backup.db)
-                                </span>
-                                <hr class="main_hr">
-                                <input name="backup_where" value="''' + html.escape(d_list[21]) + '''">
-                                <hr class="main_hr">
-                            </span>
-
-                            <h2>5. ''' + load_lang('edit_set') + '''</h2>
-                            <span><a href="/setting/8">(''' + load_lang('main_acl_setting') + ''')</a></span>
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('slow_edit') + ' (' + load_lang('second') + ') (' + load_lang('off') + ''' : 0)</span>
-                            <hr class="main_hr">
-                            <input name="''' + setting_list[19][0] + '''" value="''' + html.escape(d_list[19]) + '''">
-
-                            <hr class="main_hr">
-                            <button id="save" type="submit">''' + load_lang('save') + '''</button>
-                        </form>
-                        <script>simple_render('main_set_data');</script>
-                    ''',
-                    menu = [['setting', load_lang('return')]]
-                ))
-        elif num == 2:
-            i_list = [
-                'contract',
-                'no_login_warning',
-                'edit_bottom_text',
-                'copyright_checkbox_text',
-                'check_key_text',
-                'email_title',
-                'email_text',
-                'email_insert_text',
-                'password_search_text',
-                'reset_user_text',
-                'error_401',
-                'error_404',
-                'approval_question',
-                'edit_help',
-                'upload_help',
-                'upload_default',
-                'license',
-                'topic_text'
-            ]
-            if flask.request.method == 'POST':
-                for i in i_list:
-                    curs.execute(db_change("update other set data = ? where name = ?"), [
-                        flask.request.form.get(i, ''),
-                        i
-                    ])
-
-                conn.commit()
-
-                admin_check(None, 'edit_set (' + str(num) + ')')
-
-                return redirect('/setting/2')
-            else:
-                d_list = []
-
-                for i in i_list:
-                    curs.execute(db_change('select data from other where name = ?'), [i])
-                    sql_d = curs.fetchall()
-                    if sql_d:
-                        d_list += [sql_d[0][0]]
-                    else:
-                        curs.execute(db_change('insert into other (name, data) values (?, ?)'), [i, ''])
-
-                        d_list += ['']
-
-                conn.commit()
-
-                return easy_minify(flask.render_template(skin_check(),
-                    imp = [load_lang('text_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-                    data = '''
-                        <form method="post" id="main_set_data">
-                            <h2>1. ''' + load_lang('register_text') + ''' (HTML)</h2>
-                            <textarea rows="3" name="''' + i_list[0] + '''">''' + html.escape(d_list[0]) + '''</textarea>
-
-                            <h2>2. ''' + load_lang('non_login_alert') + ''' (HTML)</h2>
-                            <textarea rows="3" name="''' + i_list[1] + '''">''' + html.escape(d_list[1]) + '''</textarea>
-
-                            <h2>3. ''' + load_lang('edit_bottom_text') + ''' (HTML)</h2>
-                            <textarea rows="3" name="''' + i_list[2] + '''">''' + html.escape(d_list[2]) + '''</textarea>
-
-                            <h2>4. ''' + load_lang('copyright_checkbox_text') + ''' (HTML)</h2>
-                            <textarea rows="3" name="''' + i_list[3] + '''">''' + html.escape(d_list[3]) + '''</textarea>
-
-                            <h2>5. ''' + load_lang('check_key_text') + ''' (HTML)</h2>
-                            <textarea rows="3" name="''' + i_list[4] + '''">''' + html.escape(d_list[4]) + '''</textarea>
-
-                            <h2>6. ''' + load_lang('email_title') + '''</h2>
-                            <textarea rows="3" name="''' + i_list[5] + '''">''' + html.escape(d_list[5]) + '''</textarea>
-
-                            <h2>7. ''' + load_lang('email_text') + '''</h2>
-                            <textarea rows="3" name="''' + i_list[6] + '''">''' + html.escape(d_list[6]) + '''</textarea>
-
-                            <h2>8. ''' + load_lang('email_insert_text') + '''</h2>
-                            <textarea rows="3" name="''' + i_list[7] + '''">''' + html.escape(d_list[7]) + '''</textarea>
-
-                            <h2>9. ''' + load_lang('password_search_text') + '''</h2>
-                            <textarea rows="3" name="''' + i_list[8] + '''">''' + html.escape(d_list[8]) + '''</textarea>
-
-                            <h2>10. ''' + load_lang('reset_user_text') + '''</h2>
-                            <textarea rows="3" name="''' + i_list[9] + '''">''' + html.escape(d_list[9]) + '''</textarea>
-
-                            <h2>11. ''' + load_lang('error_401') + '''</h2>
-                            <textarea rows="3" name="''' + i_list[10] + '''">''' + html.escape(d_list[10]) + '''</textarea>
-
-                            <h2>12. ''' + load_lang('error_404') + '''</h2>
-                            <textarea rows="3" name="''' + i_list[11] + '''">''' + html.escape(d_list[11]) + '''</textarea>
-
-                            <h2>13. ''' + load_lang('approval_question') + '''</h2>
-                            <sup>(1)</sup>
-                            <hr class="main_hr">
-                            <textarea rows="3" name="''' + i_list[12] + '''">''' + html.escape(d_list[12]) + '''</textarea>
-
-                            <h2>14. ''' + load_lang('edit_help') + '''</h2>
-                            <textarea rows="3" name="''' + i_list[13] + '''">''' + html.escape(d_list[13]) + '''</textarea>
-
-                            <h2>15. ''' + load_lang('upload_help') + ''' (HTML)</h2>
-                            <textarea rows="3" name="''' + i_list[14] + '''">''' + html.escape(d_list[14]) + '''</textarea>
-
-                            <h2>16. ''' + load_lang('upload_default') + '''</h2>
-                            <textarea rows="3" name="''' + i_list[15] + '''">''' + html.escape(d_list[15]) + '''</textarea>
-
-                            <h2>17. ''' + load_lang('bottom_text') + ''' (HTML)</h2>
-                            <textarea rows="3" name="''' + i_list[16] + '''">''' + html.escape(d_list[16]) + '''</textarea>
-                            
-                            <h2>18. ''' + load_lang('topic_text') + '''</h2>
-                            <textarea rows="3" name="''' + i_list[17] + '''">''' + html.escape(d_list[17]) + '''</textarea>
-
-                            <hr class="main_hr">
-                            <button id="save" type="submit">''' + load_lang('save') + '''</button>
-                        </form>
-                        <ul id="footnote_data">
-                            <li><a href="#note_1" id="note_1_end">(1)</a> ''' + load_lang('approval_question_visible_only_when_approval_on') + '''</li>
-                        </ul>
-                        <script>simple_render('main_set_data');</script>
-                    ''',
-                    menu = [['setting', load_lang('return')]]
-                ))
-        elif num == 3 or num == 4 or num == 7:
-            if flask.request.method == 'POST':
-                if num == 4:
-                    info_d = 'body'
-                    end_r = '4'
-                    coverage = ''
-                elif num == 7:
-                    info_d = 'bottom_body'
-                    end_r = '7'
-                    coverage = ''
-                else:
-                    info_d = 'head'
-                    end_r = '3'
-                    if flask.request.args.get('skin', '') == '':
-                        coverage = ''
-                    else:
-                        coverage = flask.request.args.get('skin', '')
-
-                curs.execute(db_change("select name from other where name = ? and coverage = ?"), [info_d, coverage])
-                if curs.fetchall():
-                    curs.execute(db_change("update other set data = ? where name = ? and coverage = ?"), [
-                        flask.request.form.get('content', ''),
-                        info_d,
-                        coverage
-                    ])
-                else:
-                    curs.execute(db_change("insert into other (name, data, coverage) values (?, ?, ?)"), [info_d, flask.request.form.get('content', ''), coverage])
-
-                conn.commit()
-
-                admin_check(None, 'edit_set (' + str(num) + ')')
-
-                return redirect('/setting/' + end_r + '?skin=' + flask.request.args.get('skin', ''))
-            else:
-                if num == 4:
-                    curs.execute(db_change("select data from other where name = 'body'"))
-                    title = '_body'
-                    start = ''
-                    plus = '''
-                        <button id="preview" type="button" onclick="load_raw_preview(\'content\', \'see_preview\')">''' + load_lang('preview') + '''</button>
-                        <hr class="main_hr">
-                        <div id="see_preview"></div>
-                    '''
-                elif num == 7:
-                    curs.execute(db_change("select data from other where name = 'bottom_body'"))
-                    title = '_bottom_body'
-                    start = ''
-                    plus = '''
-                        <button id="preview" type="button" onclick="load_raw_preview(\'content\', \'see_preview\')">''' + load_lang('preview') + '''</button>
-                        <hr class="main_hr">
-                        <div id="see_preview"></div>
-                    '''
-                else:
-                    curs.execute(db_change("select data from other where name = 'head' and coverage = ?"), [flask.request.args.get('skin', '')])
-                    title = '_head'
-                    start = '' + \
-                        '<a href="?">(' + load_lang('all') + ')</a> ' + \
-                        ' '.join(['<a href="?skin=' + i + '">(' + i + ')</a>' for i in load_skin('', 1)]) + '''
-                        <hr class="main_hr">
-                        <span>&lt;style&gt;CSS&lt;/style&gt;<br>&lt;script&gt;JS&lt;/script&gt;</span>
-                        <hr class="main_hr">
-                    '''
-                    plus = ''
-
-                head = curs.fetchall()
-                if head:
-                    data = head[0][0]
-                else:
-                    data = ''
-
-                if flask.request.args.get('skin', '') != '':
-                    sub_plus = ' (' + flask.request.args.get('skin', '') + ')'
-                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])],
-                    data = '''
-                        <form method="post">
-                            ''' + start + '''
-                            <textarea rows="25" placeholder="''' + load_lang('enter_html') + '''" name="content" id="content">''' + html.escape(data) + '''</textarea>
-                            <hr class="main_hr">
-                            <button id="save" type="submit">''' + load_lang('save') + '''</button>
-                            ''' + plus + '''
-                        </form>
-                    ''',
-                    menu = [['setting', load_lang('return')]]
-                ))
-        elif num == 5:
-            if flask.request.method == 'POST':
-                curs.execute(db_change("select name from other where name = 'robot'"))
-                if curs.fetchall():
-                    curs.execute(db_change("update other set data = ? where name = 'robot'"), [flask.request.form.get('content', '')])
-                else:
-                    curs.execute(db_change("insert into other (name, data) values ('robot', ?)"), [flask.request.form.get('content', '')])
-
-                conn.commit()
-
-                fw = open('./robots.txt', 'w', encoding='utf8')
-                fw.write(re.sub('\r\n', '\n', flask.request.form.get('content', '')))
-                fw.close()
-
-                admin_check(None, 'edit_set (' + str(num) + ')')
-
-                return redirect('/setting/5')
-            else:
-                if not os.path.exists('robots.txt'):
-                    curs.execute(db_change('select data from other where name = "robot"'))
-                    robot_test = curs.fetchall()
-                    if robot_test:
-                        fw_test = open('./robots.txt', 'w', encoding='utf8')
-                        fw_test.write(re.sub('\r\n', '\n', robot_test[0][0]))
-                        fw_test.close()
-                    else:
-                        fw_test = open('./robots.txt', 'w', encoding='utf8')
-                        fw_test.write('User-agent: *\nDisallow: /\nAllow: /$\nAllow: /w/')
-                        fw_test.close()
-
-                        curs.execute(db_change('insert into other (name, data) values ("robot", "User-agent: *\nDisallow: /\nAllow: /$\nAllow: /w/")'))
-
-                curs.execute(db_change("select data from other where name = 'robot'"))
-                robot = curs.fetchall()
-                if robot:
-                    data = robot[0][0]
-                else:
-                    data = ''
-
-                f = open('./robots.txt', encoding='utf8')
-                lines = f.readlines()
-                f.close()
-
-                if not data or data == '':
-                    data = ''.join(lines)
-
-                return easy_minify(flask.render_template(skin_check(),
-                    imp = ['robots.txt', wiki_set(), wiki_custom(), wiki_css([0, 0])],
-                    data = '''
-                        <a href="/robots.txt">(''' + load_lang('view') + ''')</a>
-                        <hr class="main_hr">
-                        <form method="post">
-                            <textarea rows="25" name="content">''' + html.escape(data) + '''</textarea>
-                            <hr class="main_hr">
-                            <button id="save" type="submit">''' + load_lang('save') + '''</button>
-                        </form>
-                    ''',
-                    menu = [['setting', load_lang('return')]]
-                ))
-        elif num == 6:
-            i_list = [
-                'recaptcha',
-                'sec_re',
-                'smtp_server',
-                'smtp_port',
-                'smtp_security',
-                'smtp_email',
-                'smtp_pass',
-                'recaptcha_ver',
-                'oauth_client_id',
-                'email_have'
-            ]
-
-            if flask.request.method == 'POST':
-                for data in i_list:
-                    into_data = flask.request.form.get(data, '')
-
-                    curs.execute(db_change("update other set data = ? where name = ?"), [into_data, data])
-
-                conn.commit()
-
-                admin_check(None, 'edit_set (' + str(num) + ')')
-
-                return redirect('/setting/6')
-            else:
-                d_list = []
-
-                x = 0
-
-                for i in i_list:
-                    curs.execute(db_change('select data from other where name = ?'), [i])
-                    sql_d = curs.fetchall()
-                    if sql_d:
-                        d_list += [sql_d[0][0]]
-                    else:
-                        curs.execute(db_change('insert into other (name, data) values (?, ?)'), [i, ''])
-
-                        d_list += ['']
-
-                    x += 1
-
-                conn.commit()
-
-                security_radios = ''
-                for i in ['tls', 'starttls', 'plain']:
-                    if d_list[4] == i:
-                        security_radios = '<option value="' + i + '">' + i + '</option>' + security_radios
-                    else:
-                        security_radios += '<option value="' + i + '">' + i + '</option>'
-
-                re_ver_list = {
-                    '' : 'reCAPTCHA v2',
-                    'v3' : 'reCAPTCHA v3',
-                    'h' : 'hCAPTCHA'
-                }
-                re_ver = ''
-                for i in re_ver_list:
-                    if d_list[7] == i:
-                        re_ver = '<option value="' + i + '">' + re_ver_list[i] + '</option>' + re_ver
-                    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 = '''
-                        <form method="post" id="main_set_data">
-                            <h2>1. ''' + 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>
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('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>
-                            <hr class="main_hr">
-                            <input name="sec_re" value="''' + html.escape(d_list[1]) + '''">
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('version') + '''</span>
-                            <hr class="main_hr">
-                            <select name="recaptcha_ver">
-                                ''' + re_ver + '''
-                            </select>
-
-                            <h2>2. ''' + load_lang('email_setting') + '''</h1>
-                            <input type="checkbox" name="email_have" ''' + ('checked' if d_list[9] != '' else '')  + '''> ''' + \
-                                 load_lang('email_required') + '''
-
-                            <h2>2.1. ''' + load_lang('smtp_setting') + '''</h1>
-                            <a href="https://support.google.com/mail/answer/7126229">(Google)</a>
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('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>
-                            <hr class="main_hr">
-                            <input name="smtp_port" value="''' + html.escape(d_list[3]) + '''">
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('smtp_security') + '''</span>
-                            <hr class="main_hr">
-                            <select name="recaptcha_ver">
-                                ''' + security_radios + '''
-                            </select>
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('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>
-                            <hr class="main_hr">
-                            <input type="password" name="smtp_pass" value="''' + html.escape(d_list[6]) + '''">
-
-                            <h2>3. ''' + load_lang('oauth') + ''' (''' + load_lang('incomplete') + ''')</h2>
-                            <a href="https://developers.google.com/identity/protocols/oauth2">(Google)</a>
-                            <hr class="main_hr">
-
-                            <span>''' + load_lang('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="save" type="submit">''' + load_lang('save') + '''</button>
-                        </form>
-                        <script>simple_render('main_set_data');</script>
-                    ''',
-                    menu = [['setting', load_lang('return')]]
-                ))
-        elif num == 8:
-            i_list = {
-                1 : 'edit',
-                2 : 'discussion',
-                3 : 'upload_acl',
-                4 : 'all_view_acl',
-                5 : 'many_upload_acl',
-                6 : 'vote_acl'
-            }
-
-            if flask.request.method == 'POST':
-                if admin_check(None, 'edit_set (' + str(num) + ')') != 1:
-                    return re_error('/ban')
-                else:
-                    for i in i_list:
-                        curs.execute(db_change("update other set data = ? where name = ?"), [
-                            flask.request.form.get(i_list[i], 'normal'),
-                            i_list[i]
-                        ])
-
-                    conn.commit()
-
-                    return redirect('/setting/8')
-            else:
-                d_list = {}
-
-                if admin_check() != 1:
-                    disable = 'disabled'
-                else:
-                    disable = ''
-
-                for i in i_list:
-                    curs.execute(db_change('select data from other where name = ?'), [i_list[i]])
-                    sql_d = curs.fetchall()
-                    if sql_d:
-                        d_list[i] = sql_d[0][0]
-                    else:
-                        curs.execute(db_change('insert into other (name, data) values (?, ?)'), [i_list[i], 'normal'])
-
-                        d_list[i] = 'normal'
-
-                conn.commit()
-
-                acl_div = []
-                for i in range(0, len(i_list)):
-                    acl_div += ['']
-
-                acl_list = get_acl_list()
-                for i in range(0, len(i_list)):
-                    for data_list in acl_list:
-                        if data_list == d_list[i + 1]:
-                            check = 'selected="selected"'
-                        else:
-                            check = ''
-
-                        acl_div[i] += '<option value="' + data_list + '" ' + check + '>' + (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 = '''
-                        <form method="post">
-                            <a href="/acl/TEST#exp">(''' + load_lang('reference') + ''')</a>
-                            <hr class="main_hr">
-                            <span>''' + load_lang('document_acl') + '''</span> 
-                            <hr class="main_hr">
-                            <select ''' + disable + ''' name="edit">''' + acl_div[0] + '''</select>
-                            <hr class="main_hr">
-                            <span>''' + load_lang('discussion_acl') + '''</span>
-                            <hr class="main_hr">
-                            <select ''' + disable + ''' name="discussion">''' + acl_div[1] + '''</select>
-                            <hr class="main_hr">
-                            <span>''' + load_lang('upload_acl') + '''</span>
-                            <hr class="main_hr">
-                            <select ''' + disable + ''' name="upload_acl">''' + acl_div[2] + '''</select>
-                            <hr class="main_hr">
-                            <span>''' + load_lang('view_acl') + '''</span>
-                            <hr class="main_hr">
-                            <select ''' + disable + ''' name="all_view_acl">''' + acl_div[3] + '''</select>
-                            <hr class="main_hr">
-                            <span>''' + load_lang('many_upload_acl') + '''</span>
-                            <hr class="main_hr">
-                            <select ''' + disable + ''' name="many_upload_acl">''' + acl_div[4] + '''</select>
-                            <hr class="main_hr">
-                            <span>''' + load_lang('vote_acl') + '''</span>
-                            <hr class="main_hr">
-                            <select ''' + disable + ''' name="vote_acl">''' + acl_div[5] + '''</select>
-                            <hr class="main_hr">
-                            <button id="save" type="submit">''' + load_lang('save') + '''</button>
-                        </form>
-                    ''',
-                    menu = [['setting', load_lang('return')]]
-                ))
-        elif num == 9:
-            skin_list = [0] + load_skin('', 1)
-            i_list = []
-            for i in skin_list:
-                i_list += [['logo', '' if i == 0 else i]]
-
-            if flask.request.method == 'POST':
-                for i in i_list:
-                    curs.execute(db_change("update other set data = ? where name = ? and coverage = ?"), [
-                        flask.request.form.get(('main_css' if i[1] == '' else i[1]), ''),
-                        i[0], 
-                        i[1]
-                    ])
-
-                conn.commit()
-
-                admin_check(None, 'edit_set (' + str(num) + ')')
-
-                return redirect('/setting/9')
-            else:
-                d_list = []
-                for i in i_list:
-                    curs.execute(db_change('select data from other where name = ? and coverage = ?'), [i[0], i[1]])
-                    sql_d = curs.fetchall()
-                    if sql_d:
-                        d_list += [sql_d[0][0]]
-                    else:
-                        curs.execute(db_change('insert into other (name, data, coverage) values (?, ?, ?)'), [i[0], '', i[1]])
-
-                        d_list += ['']
-                        
-                conn.commit()
-
-                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)' + \
-                        '<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])],
-                    data = '''
-                        <form method="post">
-                            ''' + end_data + '''
-                            <button id="save" type="submit">''' + load_lang('save') + '''</button>
-                        </form>
-                    ''',
-                    menu = [['setting', load_lang('return')]]
-                ))
-        else:
-            return redirect()
+def main_func_setting():
+    li_list = [
+        ['main', load_lang('main_setting')],
+        ['phrase', load_lang('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')]
+    ]
+
+    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="inside_ul">' + li_data + '</ul>',
+        menu = [['manager', load_lang('return')]]
+    ))

+ 97 - 0
route/main_func_setting_acl.py

@@ -0,0 +1,97 @@
+from .tool.func import *
+
+def main_func_setting_acl():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        i_list = {
+            1 : 'edit',
+            2 : 'discussion',
+            3 : 'upload_acl',
+            4 : 'all_view_acl',
+            5 : 'many_upload_acl',
+            6 : 'vote_acl'
+        }
+
+        if flask.request.method == 'POST':
+            if admin_check(None, 'edit_set (acl)') != 1:
+                return re_error('/ban')
+            else:
+                for i in i_list:
+                    curs.execute(db_change("update other set data = ? where name = ?"), [
+                        flask.request.form.get(i_list[i], 'normal'),
+                        i_list[i]
+                    ])
+
+                conn.commit()
+
+                return redirect('/setting/acl')
+        else:
+            d_list = {}
+
+            if admin_check() != 1:
+                disable = 'disabled'
+            else:
+                disable = ''
+
+            for i in i_list:
+                curs.execute(db_change('select data from other where name = ?'), [i_list[i]])
+                sql_d = curs.fetchall()
+                if sql_d:
+                    d_list[i] = sql_d[0][0]
+                else:
+                    curs.execute(db_change('insert into other (name, data) values (?, ?)'), [i_list[i], 'normal'])
+
+                    d_list[i] = 'normal'
+
+            conn.commit()
+
+            acl_div = []
+            for i in range(0, len(i_list)):
+                acl_div += ['']
+
+            acl_list = get_acl_list()
+            for i in range(0, len(i_list)):
+                for data_list in acl_list:
+                    if data_list == d_list[i + 1]:
+                        check = 'selected="selected"'
+                    else:
+                        check = ''
+
+                    acl_div[i] += '<option value="' + data_list + '" ' + check + '>' + (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 = '''
+                    <form method="post">
+                        <a href="/acl/TEST#exp">(''' + load_lang('reference') + ''')</a>
+                        <hr class="main_hr">
+                        <span>''' + load_lang('document_acl') + '''</span> 
+                        <hr class="main_hr">
+                        <select ''' + disable + ''' name="edit">''' + acl_div[0] + '''</select>
+                        <hr class="main_hr">
+                        <span>''' + load_lang('discussion_acl') + '''</span>
+                        <hr class="main_hr">
+                        <select ''' + disable + ''' name="discussion">''' + acl_div[1] + '''</select>
+                        <hr class="main_hr">
+                        <span>''' + load_lang('upload_acl') + '''</span>
+                        <hr class="main_hr">
+                        <select ''' + disable + ''' name="upload_acl">''' + acl_div[2] + '''</select>
+                        <hr class="main_hr">
+                        <span>''' + load_lang('view_acl') + '''</span>
+                        <hr class="main_hr">
+                        <select ''' + disable + ''' name="all_view_acl">''' + acl_div[3] + '''</select>
+                        <hr class="main_hr">
+                        <span>''' + load_lang('many_upload_acl') + '''</span>
+                        <hr class="main_hr">
+                        <select ''' + disable + ''' name="many_upload_acl">''' + acl_div[4] + '''</select>
+                        <hr class="main_hr">
+                        <span>''' + load_lang('vote_acl') + '''</span>
+                        <hr class="main_hr">
+                        <select ''' + disable + ''' name="vote_acl">''' + acl_div[5] + '''</select>
+                        <hr class="main_hr">
+                        <button id="save" type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                ''',
+                menu = [['setting', load_lang('return')]]
+            ))

+ 145 - 0
route/main_func_setting_external.py

@@ -0,0 +1,145 @@
+from .tool.func import *
+
+def main_func_setting_external():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if admin_check() != 1:
+            return re_error('/ban')
+        
+        i_list = [
+            'recaptcha',
+            'sec_re',
+            'smtp_server',
+            'smtp_port',
+            'smtp_security',
+            'smtp_email',
+            'smtp_pass',
+            'recaptcha_ver',
+            'oauth_client_id',
+            'email_have'
+        ]
+
+        if flask.request.method == 'POST':
+            for data in i_list:
+                into_data = flask.request.form.get(data, '')
+
+                curs.execute(db_change("update other set data = ? where name = ?"), [into_data, data])
+
+            conn.commit()
+
+            admin_check(None, 'edit_set (external)')
+
+            return redirect('/setting/external')
+        else:
+            d_list = []
+
+            x = 0
+
+            for i in i_list:
+                curs.execute(db_change('select data from other where name = ?'), [i])
+                sql_d = curs.fetchall()
+                if sql_d:
+                    d_list += [sql_d[0][0]]
+                else:
+                    curs.execute(db_change('insert into other (name, data) values (?, ?)'), [i, ''])
+
+                    d_list += ['']
+
+                x += 1
+
+            conn.commit()
+
+            security_radios = ''
+            for i in ['tls', 'starttls', 'plain']:
+                if d_list[4] == i:
+                    security_radios = '<option value="' + i + '">' + i + '</option>' + security_radios
+                else:
+                    security_radios += '<option value="' + i + '">' + i + '</option>'
+
+            re_ver_list = {
+                '' : 'reCAPTCHA v2',
+                'v3' : 'reCAPTCHA v3',
+                'h' : 'hCAPTCHA'
+            }
+            re_ver = ''
+            for i in re_ver_list:
+                if d_list[7] == i:
+                    re_ver = '<option value="' + i + '">' + re_ver_list[i] + '</option>' + re_ver
+                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 = '''
+                    <form method="post" id="main_set_data">
+                        <h2>1. ''' + 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>
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('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>
+                        <hr class="main_hr">
+                        <input name="sec_re" value="''' + html.escape(d_list[1]) + '''">
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('version') + '''</span>
+                        <hr class="main_hr">
+                        <select name="recaptcha_ver">
+                            ''' + re_ver + '''
+                        </select>
+
+                        <h2>2. ''' + load_lang('email_setting') + '''</h1>
+                        <input type="checkbox" name="email_have" ''' + ('checked' if d_list[9] != '' else '')  + '''> ''' + \
+                             load_lang('email_required') + '''
+
+                        <h2>2.1. ''' + load_lang('smtp_setting') + '''</h1>
+                        <a href="https://support.google.com/mail/answer/7126229">(Google)</a>
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('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>
+                        <hr class="main_hr">
+                        <input name="smtp_port" value="''' + html.escape(d_list[3]) + '''">
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('smtp_security') + '''</span>
+                        <hr class="main_hr">
+                        <select name="smtp_security">
+                            ''' + security_radios + '''
+                        </select>
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('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>
+                        <hr class="main_hr">
+                        <input type="password" name="smtp_pass" value="''' + html.escape(d_list[6]) + '''">
+
+                        <h2>3. ''' + load_lang('oauth') + ''' (''' + load_lang('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>
+                        <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="save" type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                    <script>simple_render('main_set_data');</script>
+                ''',
+                menu = [['setting', load_lang('return')]]
+            ))

+ 99 - 0
route/main_func_setting_head.py

@@ -0,0 +1,99 @@
+from .tool.func import *
+
+def main_func_setting_head(num, skin_name = ''):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if admin_check() != 1:
+            return re_error('/ban')
+        
+        if flask.request.method == 'POST':
+            if num == 4:
+                info_d = 'body'
+                end_r = 'body/top'
+                coverage = ''
+            elif num == 7:
+                info_d = 'bottom_body'
+                end_r = 'body/bottom'
+                coverage = ''
+            else:
+                info_d = 'head'
+                end_r = 'head'
+                if skin_name == '':
+                    coverage = ''
+                else:
+                    coverage = skin_name
+
+            curs.execute(db_change("select name from other where name = ? and coverage = ?"), [info_d, coverage])
+            if curs.fetchall():
+                curs.execute(db_change("update other set data = ? where name = ? and coverage = ?"), [
+                    flask.request.form.get('content', ''),
+                    info_d,
+                    coverage
+                ])
+            else:
+                curs.execute(db_change("insert into other (name, data, coverage) values (?, ?, ?)"), [info_d, flask.request.form.get('content', ''), coverage])
+
+            conn.commit()
+
+            admin_check(None, 'edit_set (' + info_d + ')')
+
+            if skin_name == '':
+                return redirect('/setting/' + end_r)
+            else:
+                return redirect('/setting/' + end_r + '/' + skin_name)
+        else:
+            if num == 4:
+                curs.execute(db_change("select data from other where name = 'body'"))
+                title = '_body'
+                start = ''
+                plus = '''
+                    <button id="preview" type="button" onclick="load_raw_preview(\'content\', \'see_preview\')">''' + load_lang('preview') + '''</button>
+                    <hr class="main_hr">
+                    <div id="see_preview"></div>
+                '''
+            elif num == 7:
+                curs.execute(db_change("select data from other where name = 'bottom_body'"))
+                title = '_bottom_body'
+                start = ''
+                plus = '''
+                    <button id="preview" type="button" onclick="load_raw_preview(\'content\', \'see_preview\')">''' + load_lang('preview') + '''</button>
+                    <hr class="main_hr">
+                    <div id="see_preview"></div>
+                '''
+            else:
+                curs.execute(db_change("select data from other where name = 'head' and coverage = ?"), [skin_name])
+                title = '_head'
+                start = '' + \
+                    '<a href="?">(' + load_lang('all') + ')</a> ' + \
+                    ' '.join(['<a href="/setting/head/' + i + '">(' + i + ')</a>' for i in load_skin('', 1)]) + '''
+                    <hr class="main_hr">
+                    <span>&lt;style&gt;CSS&lt;/style&gt;<br>&lt;script&gt;JS&lt;/script&gt;</span>
+                    <hr class="main_hr">
+                '''
+                plus = ''
+
+            head = curs.fetchall()
+            if head:
+                data = head[0][0]
+            else:
+                data = ''
+
+            if skin_name != '':
+                sub_plus = ' (' + skin_name + ')'
+            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])],
+                data = '''
+                    <form method="post">
+                        ''' + start + '''
+                        <textarea rows="25" placeholder="''' + load_lang('enter_html') + '''" name="content" id="content">''' + html.escape(data) + '''</textarea>
+                        <hr class="main_hr">
+                        <button id="save" type="submit">''' + load_lang('save') + '''</button>
+                        ''' + plus + '''
+                    </form>
+                ''',
+                menu = [['setting', load_lang('return')]]
+            ))

+ 220 - 0
route/main_func_setting_main.py

@@ -0,0 +1,220 @@
+from .tool.func import *
+
+def main_func_setting_main(db_set):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if admin_check() != 1:
+            return re_error('/ban')
+        
+        setting_list = {
+            0 : ['name', 'Wiki'],
+            2 : ['frontpage', 'FrontPage'],
+            4 : ['upload', '2'],
+            5 : ['skin', ''],
+            7 : ['reg', ''],
+            8 : ['ip_view', ''],
+            9 : ['back_up', '0'],
+            10 : ['port', '3000'],
+            11 : ['key', load_random_key()],
+            12 : ['update', 'stable'],
+            15 : ['encode', 'sha3'],
+            16 : ['host', '0.0.0.0'],
+            19 : ['slow_edit', '0'],
+            20 : ['requires_approval', ''],
+            21 : ['backup_where', ''],
+            22 : ['domain', flask.request.host],
+            23 : ['ua_get', ''],
+            24 : ['enable_comment', ''],
+            25 : ['enable_challenge', ''],
+            26 : ['edit_bottom_compulsion', ''],
+            27 : ['http_select', 'http']
+        }
+
+        if flask.request.method == 'POST':
+            for i in setting_list:
+                curs.execute(db_change("update other set data = ? where name = ?"), [
+                    flask.request.form.get(setting_list[i][0], setting_list[i][1]),
+                    setting_list[i][0]
+                ])
+
+            conn.commit()
+
+            admin_check(None, 'edit_set (main)')
+
+            return redirect('/setting/main')
+        else:
+            d_list = {}
+            for i in setting_list:
+                curs.execute(db_change('select data from other where name = ?'), [setting_list[i][0]])
+                db_data = curs.fetchall()
+                if not db_data:
+                    curs.execute(db_change('insert into other (name, data) values (?, ?)'), [setting_list[i][0], setting_list[i][1]])
+
+                d_list[i] = db_data[0][0] if db_data else setting_list[i][1]
+            else:
+                conn.commit()
+
+            encode_select = ''
+            encode_select_data = ['sha256', 'sha3']
+            for encode_select_one in encode_select_data:
+                if encode_select_one == d_list[15]:
+                    encode_select = '<option value="' + encode_select_one + '">' + encode_select_one + '</option>' + encode_select
+                else:
+                    encode_select += '<option value="' + encode_select_one + '">' + encode_select_one + '</option>'
+                    
+            tls_select = ''
+            tls_select_data = ['http', 'https']
+            for tls_select_one in tls_select_data:
+                if tls_select_one == d_list[27]:
+                    tls_select = '<option value="' + tls_select_one + '">' + tls_select_one + '</option>' + tls_select
+                else:
+                    tls_select += '<option value="' + tls_select_one + '">' + tls_select_one + '</option>'
+
+            check_box_div = ['', '', '', '', '', '', '', '']
+            for i in range(0, len(check_box_div)):
+                if i == 0:
+                    acl_num = 7
+                elif i == 1:
+                    acl_num = 8
+                elif i == 3:
+                    acl_num = 20
+                elif i == 4:
+                    acl_num = 23
+                elif i == 5:
+                    acl_num = 24
+                elif i == 6:
+                    acl_num = 25
+                elif i == 7:
+                    acl_num = 26
+
+                if d_list[acl_num]:
+                    check_box_div[i] = 'checked="checked"'
+
+            branch_div = ''
+            branch_list = ['stable', 'dev', 'beta']
+            for i in branch_list:
+                if d_list[12] == i:
+                    branch_div = '<option value="' + i + '">' + i + '</option>' + branch_div
+                else:
+                    branch_div += '<option value="' + i + '">' + i + '</option>'
+
+            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 = '''
+                    <form method="post" id="main_set_data">
+                        <h2>1. ''' + load_lang('basic_set') + '''</h2>
+                        <span>''' + load_lang('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>
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('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>
+                        <hr class="main_hr">
+                        <select name="http_select">''' + tls_select + '''</select>
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('domain') + '''</span> (EX : 2du.pythonanywhere.com)
+                        <hr class="main_hr">
+                        <input name="domain" value="''' + html.escape(d_list[22]) + '''">
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('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>
+                        <hr class="main_hr">
+                        <input name="port" value="''' + html.escape(d_list[10]) + '''">
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('wiki_secret_key') + '''</span>
+                        <hr class="main_hr">
+                        <input type="password" name="key" value="''' + html.escape(d_list[11]) + '''">
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('encryption_method') + '''</span>
+                        <hr class="main_hr">
+                        <select name="encode">''' + encode_select + '''</select>
+
+                        <h3>1.1. ''' + load_lang('communication_set') + '''</h3>
+                        <input type="checkbox" name="enable_comment" ''' + check_box_div[5] + '''> ''' + load_lang('enable_comment_function') + ''' (''' + load_lang('not_working') + ''')
+                        <hr class="main_hr">
+
+                        <input type="checkbox" name="enable_challenge" ''' + check_box_div[6] + '''> ''' + load_lang('enable_challenge_function') + ''' (''' + load_lang('not_working') + ''')
+                        <hr class="main_hr">
+
+                        <h2>2. ''' + load_lang('design_set') + '''</h2>
+                        <span>''' + load_lang('wiki_skin') + '''</span>
+                        <hr class="main_hr">
+                        <select name="skin">''' + load_skin(d_list[5] if d_list[5] != '' else 'tenshi') + '''</select>
+
+                        <h2>3. ''' + load_lang('login_set') + '''</h2>
+                        <input type="checkbox" name="reg" ''' + check_box_div[0] + '''> ''' + load_lang('no_register') + '''
+                        <hr class="main_hr">
+
+                        <input type="checkbox" name="ip_view" ''' + check_box_div[1] + '''> ''' + load_lang('hide_ip') + '''
+                        <hr class="main_hr">
+
+                        <input type="checkbox" name="requires_approval" ''' + check_box_div[3] + '''> ''' + load_lang('requires_approval') + '''
+                        <hr class="main_hr">
+
+                        <input type="checkbox" name="ua_get" ''' + check_box_div[4] + '''> ''' + load_lang('ua_get_off') + '''
+
+                        <h2>4. ''' + load_lang('server_set') + '''</h2>
+                        <span>''' + load_lang('max_file_size') + ''' (MB)</span>
+                        <hr class="main_hr">
+                        <input name="upload" value="''' + html.escape(d_list[4]) + '''">
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('update_branch') + '''</span>
+                        <hr class="main_hr">
+                        <select name="update">''' + branch_div + '''</select>
+
+                        <span ''' + sqlite_only + '''>
+                            <h3>4.1. ''' + load_lang('sqlite_only') + '''</h3>
+                            <span>
+                                ''' + load_lang('backup_interval') + ' (' + load_lang('hour') + ') (' + load_lang('off') + ' : 0) ' + \
+                                '(' + load_lang('restart_required') + ''')</span>
+                            <hr class="main_hr">
+                            <input name="back_up" value="''' + html.escape(d_list[9]) + '''">
+                            <hr class="main_hr">
+
+                            <span>
+                                ''' + load_lang('backup_where') + ' (' + load_lang('empty') + ' : ' + load_lang('default') + ') ' + \
+                                '(' + load_lang('restart_required') + ''') (''' + load_lang('example') + ''' : ./data/backup.db)
+                            </span>
+                            <hr class="main_hr">
+                            <input name="backup_where" value="''' + html.escape(d_list[21]) + '''">
+                            <hr class="main_hr">
+                        </span>
+
+                        <h2>5. ''' + load_lang('edit_set') + '''</h2>
+                        <span><a href="/setting/acl">(''' + load_lang('main_acl_setting') + ''')</a></span>
+                        <hr class="main_hr">
+
+                        <span>''' + load_lang('slow_edit') + ' (' + load_lang('second') + ') (' + load_lang('off') + ''' : 0)</span>
+                        <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') + ''' (''' + load_lang('beta') + ''')
+
+                        <hr class="main_hr">
+                        <button id="save" type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                    <script>simple_render('main_set_data');</script>
+                ''',
+                menu = [['setting', load_lang('return')]]
+            ))

+ 60 - 0
route/main_func_setting_main_logo.py

@@ -0,0 +1,60 @@
+from .tool.func import *
+
+def main_func_setting_main_logo():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+        
+        if admin_check() != 1:
+            return re_error('/ban')
+
+        skin_list = [0] + load_skin('', 1)
+        i_list = []
+        for i in skin_list:
+            i_list += [['logo', '' if i == 0 else i]]
+
+        if flask.request.method == 'POST':
+            for i in i_list:
+                curs.execute(db_change("update other set data = ? where name = ? and coverage = ?"), [
+                    flask.request.form.get(('main_css' if i[1] == '' else i[1]), ''),
+                    i[0], 
+                    i[1]
+                ])
+
+            conn.commit()
+
+            admin_check(None, 'edit_set (logo)')
+
+            return redirect('/setting/main/logo')
+        else:
+            d_list = []
+            for i in i_list:
+                curs.execute(db_change('select data from other where name = ? and coverage = ?'), [i[0], i[1]])
+                sql_d = curs.fetchall()
+                if sql_d:
+                    d_list += [sql_d[0][0]]
+                else:
+                    curs.execute(db_change('insert into other (name, data, coverage) values (?, ?, ?)'), [i[0], '', i[1]])
+
+                    d_list += ['']
+
+            conn.commit()
+
+            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)' + \
+                    '<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])],
+                data = '''
+                    <form method="post">
+                        ''' + end_data + '''
+                        <button id="save" type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                ''',
+                menu = [['setting/main', load_lang('return')]]
+            ))

+ 126 - 0
route/main_func_setting_phrase.py

@@ -0,0 +1,126 @@
+from .tool.func import *
+
+def main_func_setting_phrase():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if admin_check() != 1:
+            return re_error('/ban')
+        
+        i_list = [
+            'contract',
+            'no_login_warning',
+            'edit_bottom_text',
+            'copyright_checkbox_text',
+            'check_key_text',
+            'email_title',
+            'email_text',
+            'email_insert_text',
+            'password_search_text',
+            'reset_user_text',
+            'error_401',
+            'error_404',
+            'approval_question',
+            'edit_help',
+            'upload_help',
+            'upload_default',
+            'license',
+            'topic_text'
+        ]
+        if flask.request.method == 'POST':
+            for i in i_list:
+                curs.execute(db_change("update other set data = ? where name = ?"), [
+                    flask.request.form.get(i, ''),
+                    i
+                ])
+
+            conn.commit()
+
+            admin_check(None, 'edit_set (phrase)')
+
+            return redirect('/setting/phrase')
+        else:
+            d_list = []
+
+            for i in i_list:
+                curs.execute(db_change('select data from other where name = ?'), [i])
+                sql_d = curs.fetchall()
+                if sql_d:
+                    d_list += [sql_d[0][0]]
+                else:
+                    curs.execute(db_change('insert into other (name, data) values (?, ?)'), [i, ''])
+
+                    d_list += ['']
+
+            conn.commit()
+
+            return easy_minify(flask.render_template(skin_check(),
+                imp = [load_lang('text_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                data = '''
+                    <form method="post" id="main_set_data">
+                        <h2>1. ''' + load_lang('register_text') + ''' (HTML)</h2>
+                        <textarea rows="3" name="''' + i_list[0] + '''">''' + html.escape(d_list[0]) + '''</textarea>
+
+                        <h2>2. ''' + load_lang('non_login_alert') + ''' (HTML)</h2>
+                        <textarea rows="3" name="''' + i_list[1] + '''">''' + html.escape(d_list[1]) + '''</textarea>
+
+                        <h2>3. ''' + load_lang('edit_bottom_text') + ''' (HTML)</h2>
+                        <textarea rows="3" name="''' + i_list[2] + '''">''' + html.escape(d_list[2]) + '''</textarea>
+
+                        <h2>4. ''' + load_lang('copyright_checkbox_text') + ''' (HTML)</h2>
+                        <textarea rows="3" name="''' + i_list[3] + '''">''' + html.escape(d_list[3]) + '''</textarea>
+
+                        <h2>5. ''' + load_lang('check_key_text') + ''' (HTML)</h2>
+                        <textarea rows="3" name="''' + i_list[4] + '''">''' + html.escape(d_list[4]) + '''</textarea>
+
+                        <h2>6. ''' + load_lang('email_title') + '''</h2>
+                        <textarea rows="3" name="''' + i_list[5] + '''">''' + html.escape(d_list[5]) + '''</textarea>
+
+                        <h2>7. ''' + load_lang('email_text') + '''</h2>
+                        <textarea rows="3" name="''' + i_list[6] + '''">''' + html.escape(d_list[6]) + '''</textarea>
+
+                        <h2>8. ''' + load_lang('email_insert_text') + '''</h2>
+                        <textarea rows="3" name="''' + i_list[7] + '''">''' + html.escape(d_list[7]) + '''</textarea>
+
+                        <h2>9. ''' + load_lang('password_search_text') + '''</h2>
+                        <textarea rows="3" name="''' + i_list[8] + '''">''' + html.escape(d_list[8]) + '''</textarea>
+
+                        <h2>10. ''' + load_lang('reset_user_text') + '''</h2>
+                        <textarea rows="3" name="''' + i_list[9] + '''">''' + html.escape(d_list[9]) + '''</textarea>
+
+                        <h2>11. ''' + load_lang('error_401') + '''</h2>
+                        <textarea rows="3" name="''' + i_list[10] + '''">''' + html.escape(d_list[10]) + '''</textarea>
+
+                        <h2>12. ''' + load_lang('error_404') + '''</h2>
+                        <textarea rows="3" name="''' + i_list[11] + '''">''' + html.escape(d_list[11]) + '''</textarea>
+
+                        <h2>13. ''' + load_lang('approval_question') + '''</h2>
+                        <sup>(1)</sup>
+                        <hr class="main_hr">
+                        <textarea rows="3" name="''' + i_list[12] + '''">''' + html.escape(d_list[12]) + '''</textarea>
+
+                        <h2>14. ''' + load_lang('edit_help') + '''</h2>
+                        <textarea rows="3" name="''' + i_list[13] + '''">''' + html.escape(d_list[13]) + '''</textarea>
+
+                        <h2>15. ''' + load_lang('upload_help') + ''' (HTML)</h2>
+                        <textarea rows="3" name="''' + i_list[14] + '''">''' + html.escape(d_list[14]) + '''</textarea>
+
+                        <h2>16. ''' + load_lang('upload_default') + '''</h2>
+                        <textarea rows="3" name="''' + i_list[15] + '''">''' + html.escape(d_list[15]) + '''</textarea>
+
+                        <h2>17. ''' + load_lang('bottom_text') + ''' (HTML)</h2>
+                        <textarea rows="3" name="''' + i_list[16] + '''">''' + html.escape(d_list[16]) + '''</textarea>
+
+                        <h2>18. ''' + load_lang('topic_text') + '''</h2>
+                        <textarea rows="3" name="''' + i_list[17] + '''">''' + html.escape(d_list[17]) + '''</textarea>
+
+                        <hr class="main_hr">
+                        <button id="save" type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                    <ul id="footnote_data">
+                        <li><a href="#note_1" id="note_1_end">(1)</a> ''' + load_lang('approval_question_visible_only_when_approval_on') + '''</li>
+                    </ul>
+                    <script>simple_render('main_set_data');</script>
+                ''',
+                menu = [['setting', load_lang('return')]]
+            ))

+ 67 - 0
route/main_func_setting_robot.py

@@ -0,0 +1,67 @@
+from .tool.func import *
+
+def main_func_setting_robot():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if admin_check() != 1:
+            return re_error('/ban')
+        
+        if flask.request.method == 'POST':
+            curs.execute(db_change("select name from other where name = 'robot'"))
+            if curs.fetchall():
+                curs.execute(db_change("update other set data = ? where name = 'robot'"), [flask.request.form.get('content', '')])
+            else:
+                curs.execute(db_change("insert into other (name, data) values ('robot', ?)"), [flask.request.form.get('content', '')])
+
+            conn.commit()
+
+            fw = open('./robots.txt', 'w', encoding='utf8')
+            fw.write(re.sub('\r\n', '\n', flask.request.form.get('content', '')))
+            fw.close()
+
+            admin_check(None, 'edit_set (robot)')
+
+            return redirect('/setting/robot')
+        else:
+            if not os.path.exists('robots.txt'):
+                curs.execute(db_change('select data from other where name = "robot"'))
+                robot_test = curs.fetchall()
+                if robot_test:
+                    fw_test = open('./robots.txt', 'w', encoding='utf8')
+                    fw_test.write(re.sub('\r\n', '\n', robot_test[0][0]))
+                    fw_test.close()
+                else:
+                    fw_test = open('./robots.txt', 'w', encoding='utf8')
+                    fw_test.write('User-agent: *\nDisallow: /\nAllow: /$\nAllow: /w/')
+                    fw_test.close()
+
+                    curs.execute(db_change('insert into other (name, data) values ("robot", "User-agent: *\nDisallow: /\nAllow: /$\nAllow: /w/")'))
+
+            curs.execute(db_change("select data from other where name = 'robot'"))
+            robot = curs.fetchall()
+            if robot:
+                data = robot[0][0]
+            else:
+                data = ''
+
+            f = open('./robots.txt', encoding='utf8')
+            lines = f.readlines()
+            f.close()
+
+            if not data or data == '':
+                data = ''.join(lines)
+
+            return easy_minify(flask.render_template(skin_check(),
+                imp = ['robots.txt', wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                data = '''
+                    <a href="/robots.txt">(''' + load_lang('view') + ''')</a>
+                    <hr class="main_hr">
+                    <form method="post">
+                        <textarea rows="25" name="content">''' + html.escape(data) + '''</textarea>
+                        <hr class="main_hr">
+                        <button id="save" type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                ''',
+                menu = [['setting', load_lang('return')]]
+            ))

+ 1 - 3
route/search.py → route/main_search.py

@@ -1,6 +1,4 @@
 from .tool.func import *
 
-def search_2(conn):
-    curs = conn.cursor()
-
+def main_search():
     return redirect('/search/' + url_pas(flask.request.form.get('search', 'test')))

+ 66 - 0
route/main_search_deep.py

@@ -0,0 +1,66 @@
+from .tool.func import *
+
+def main_search_deep(name = 'Test'):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if name == '':
+            return redirect()
+
+        num = int(number_check(flask.request.args.get('num', '1')))
+        sql_num = (num * 50 - 50) if num * 50 > 0 else 0
+
+        div = '<ul class="inside_ul">'
+
+        div_plus = ''
+        test = ''
+
+        curs.execute(db_change("select title from data where title = ?"), [name])
+        link_id = '' if curs.fetchall() else 'id="not_thing"'
+
+        div = '''
+            <ul class="inside_ul">
+                <li>
+                    <a ''' + link_id + ' href="/w/' + url_pas(name) + '">' + html.escape(name) + '''</a>
+                </li>
+            </ul>
+            <hr class="main_hr">
+            <ul class="inside_ul">
+        '''
+
+        curs.execute(db_change('select data from other where name = "count_all_title"'))
+        if int(curs.fetchall()[0][0]) < 30000:
+            curs.execute(db_change("" + \
+                "select distinct title, case " + \
+                "when title like ? then 'title' else 'data' end from data " + \
+                "where (title like ? or data like ?) order by case " + \
+                "when title like ? then 1 else 2 end limit ?, 50"),
+                ['%' + name + '%', '%' + name + '%', '%' + name + '%', '%' + name + '%', sql_num]
+            )
+            all_list = curs.fetchall()
+            if all_list:
+                test = all_list[0][1]
+
+                for data in all_list:
+                    if data[1] != test:
+                        div_plus += '</ul><hr class="main_hr"><ul class="inside_ul">'
+
+                        test = data[1]
+
+                    div_plus += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a> (' + data[1] + ')</li>'
+        else:
+            curs.execute(db_change("select title from data where title like ? order by title limit ?, 50"),
+                ['%' + name + '%', sql_num]
+            )
+            all_list = curs.fetchall()
+            for data in all_list:
+                div_plus += '<li><a href="/w/' + url_pas(data[0]) + '">' + data[0] + '</a> (title)</li>'
+
+        div += div_plus + '</ul>'
+        div += next_fix('/search/' + url_pas(name) + '?num=', num, all_list)
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('search') + ')', 0])],
+            data = div,
+            menu = 0
+        ))

+ 17 - 0
route/main_search_goto.py

@@ -0,0 +1,17 @@
+from .tool.func import *
+
+def main_search_goto(name = 'Test'):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if flask.request.form.get('search', None):
+            data = flask.request.form.get('search', 'Test')
+        else:
+            data = name
+
+        curs.execute(db_change("select title from data where title = ?"), [data])
+        t_data = curs.fetchall()
+        if t_data:
+            return redirect('/w/' + url_pas(data))
+        else:
+            return redirect('/search/' + url_pas(data))

+ 1 - 1
route/main_tool_admin.py

@@ -36,7 +36,7 @@ def main_tool_admin(num = 1, add_2 = ''):
                     <h2>2. ''' + load_lang('owner') + '''</h2>
                     <ul class="inside_ul">
                         <li><a href="/admin_group">''' + load_lang('admin_group_list') + '''</a></li>
-                        <li><a href="/delete/doc_mutiple">''' + load_lang('many_delete') + '''</a></li>
+                        <li><a href="/delete_mutiple">''' + load_lang('many_delete') + '''</a></li>
                         <li><a href="/app_submit">''' + load_lang('application_list') + '''</a></li>
                         <li><a href="/api/sitemap.xml">''' + load_lang('get_sitemap') + '''</a></li>
                         <li><a href="/register">''' + load_lang('add_user') + '''</a></li>

+ 1 - 1
route/recent_change.py

@@ -116,7 +116,7 @@ def recent_change_2(conn, name, tool):
                     style[1] = 'id="toron_color_grey"'
 
             if tool == 'history':
-                title = '<a href="/w/' + url_pas(name) + '/doc_rev/' + data[0] + '">r' + data[0] + '</a> '
+                title = '<a href="/w_rev/' + data[0] + '/' + url_pas(name) + '">r' + data[0] + '</a> '
             else:
                 title = '<a href="/w/' + url_pas(data[1]) + '">' + html.escape(data[1]) + '</a> '
                 if int(data[0]) < 2:

+ 55 - 54
route/recent_discuss.py

@@ -1,56 +1,57 @@
 from .tool.func import *
 
-def recent_discuss_2(conn, tool):
-    curs = conn.cursor()
-
-    div = ''
-
-    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>'
-
-        m_sub = 0
-    elif tool == 'close':
-        div += '<a href="/recent_discuss">(' + load_lang('normal') + ')</a>'
-
-        m_sub = ' (' + load_lang('closed') + ')'
-    else:
-        div += '<a href="/recent_discuss">(' + load_lang('normal') + ')</a>'
-        
-        m_sub = ' (' + load_lang('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_half">''' + load_lang('discussion_name') + '''</td>
-                        <td id="main_table_width_half">''' + load_lang('time') + '''</td>
-                    </tr>
-            '''
-
-    if tool == 'normal':
-        curs.execute(db_change("select title, sub, date, code from rd where not stop = 'O' order by date desc limit 50"))
-    elif tool == 'close':
-        curs.execute(db_change("select title, sub, date, code from rd where stop = 'O' order by date desc limit 50"))
-    else:
-        curs.execute(db_change('select title, sub, date, code from rd where stop != "O" order by date asc limit 50'))
-
-    for data in curs.fetchall():
-        div += '' + \
-            '<tr>' + \
-                '<td>' + \
-                    '<a href="/thread/' + data[3] + '">' + html.escape(data[1]) + '</a> ' + \
-                    '<a href="/topic/' + url_pas(data[0]) + '">(' + html.escape(data[0]) + ')</a>' + \
-                '</td>' + \
-                '<td>' + data[2] + '</td>' + \
-            '</tr>' + \
-        ''
-
-    div += '</tbody></table>'
-
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('recent_discussion'), wiki_set(), wiki_custom(), wiki_css([m_sub, 0])],
-        data = div,
-        menu = 0
-    ))
+def recent_discuss(tool):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        div = ''
+
+        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>'
+
+            m_sub = 0
+        elif tool == 'close':
+            div += '<a href="/recent_discuss">(' + load_lang('normal') + ')</a>'
+
+            m_sub = ' (' + load_lang('closed') + ')'
+        else:
+            div += '<a href="/recent_discuss">(' + load_lang('normal') + ')</a>'
+
+            m_sub = ' (' + load_lang('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_half">''' + load_lang('discussion_name') + '''</td>
+                            <td id="main_table_width_half">''' + load_lang('time') + '''</td>
+                        </tr>
+                '''
+
+        if tool == 'normal':
+            curs.execute(db_change("select title, sub, date, code from rd where not stop = 'O' order by date desc limit 50"))
+        elif tool == 'close':
+            curs.execute(db_change("select title, sub, date, code from rd where stop = 'O' order by date desc limit 50"))
+        else:
+            curs.execute(db_change('select title, sub, date, code from rd where stop != "O" order by date asc limit 50'))
+
+        for data in curs.fetchall():
+            div += '' + \
+                '<tr>' + \
+                    '<td>' + \
+                        '<a href="/thread/' + data[3] + '">' + html.escape(data[1]) + '</a> ' + \
+                        '<a href="/topic/' + url_pas(data[0]) + '">(' + html.escape(data[0]) + ')</a>' + \
+                    '</td>' + \
+                    '<td>' + data[2] + '</td>' + \
+                '</tr>' + \
+            ''
+
+        div += '</tbody></table>'
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [load_lang('recent_discussion'), wiki_set(), wiki_custom(), wiki_css([m_sub, 0])],
+            data = div,
+            menu = 0
+        ))

+ 3 - 3
route/recent_history_tool.py

@@ -8,12 +8,12 @@ def recent_history_tool_2(conn, name, rev):
     data = '' + \
         '<h2>' + load_lang('tool') + '</h2>' + \
         '<ul class="inside_ul">' + \
-            '<li><a href="/raw/' + url_pas(name) + '/doc_rev/' + num + '">' + load_lang('raw') + '</a></li>' + \
+            '<li><a href="/raw_rev/' + num + '/' + url_pas(name) + '">' + load_lang('raw') + '</a></li>' + \
     ''
 
-    data += '<li><a href="/revert/' + url_pas(name) + '?num=' + num + '">' + load_lang('revert') + ' | r' + num + '</a></li>'
+    data += '<li><a href="/revert/' + num + '/' + url_pas(name) + '">' + load_lang('revert') + ' | r' + num + '</a></li>'
     if rev - 1 > 0:
-        data += '<li><a href="/revert/' + url_pas(name) + '?num=' + str(rev - 1) + '">' + load_lang('revert') + ' | r' + str(rev - 1) + '</a></li>'
+        data += '<li><a href="/revert/' + str(rev - 1) + '/' + url_pas(name) + '">' + load_lang('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>'

+ 0 - 65
route/search_deep.py

@@ -1,65 +0,0 @@
-from .tool.func import *
-
-def search_deep_2(conn, name):
-    curs = conn.cursor()
-
-    if name == '':
-        return redirect()
-
-    num = int(number_check(flask.request.args.get('num', '1')))
-    sql_num = (num * 50 - 50) if num * 50 > 0 else 0
-
-    div = '<ul class="inside_ul">'
-
-    div_plus = ''
-    test = ''
-
-    curs.execute(db_change("select title from data where title = ?"), [name])
-    link_id = '' if curs.fetchall() else 'id="not_thing"'
-
-    div = '''
-        <ul class="inside_ul">
-            <li>
-                <a ''' + link_id + ' href="/w/' + url_pas(name) + '">' + html.escape(name) + '''</a>
-            </li>
-        </ul>
-        <hr class=\"main_hr\">
-        <ul class="inside_ul">
-    '''
-
-    curs.execute(db_change('select data from other where name = "count_all_title"'))
-    if int(curs.fetchall()[0][0]) < 30000:
-        curs.execute(db_change("" + \
-            "select distinct title, case " + \
-            "when title like ? then 'title' else 'data' end from data " + \
-            "where (title like ? or data like ?) order by case " + \
-            "when title like ? then 1 else 2 end limit ?, 50"),
-            ['%' + name + '%', '%' + name + '%', '%' + name + '%', '%' + name + '%', sql_num]
-        )
-        all_list = curs.fetchall()
-        if all_list:
-            test = all_list[0][1]
-
-            for data in all_list:
-                if data[1] != test:
-                    div_plus += '</ul><hr class=\"main_hr\"><ul class="inside_ul">'
-
-                    test = data[1]
-
-                div_plus += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a> (' + data[1] + ')</li>'
-    else:
-        curs.execute(db_change("select title from data where title like ? order by title limit ?, 50"),
-            ['%' + name + '%', sql_num]
-        )
-        all_list = curs.fetchall()
-        for data in all_list:
-            div_plus += '<li><a href="/w/' + url_pas(data[0]) + '">' + data[0] + '</a> (title)</li>'
-
-    div += div_plus + '</ul>'
-    div += next_fix('/search/' + url_pas(name) + '?num=', num, all_list)
-
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('search') + ')', 0])],
-        data = div,
-        menu = 0
-    ))

+ 0 - 16
route/search_goto.py

@@ -1,16 +0,0 @@
-from .tool.func import *
-
-def search_goto_2(conn, name):
-    curs = conn.cursor()
-
-    if flask.request.form.get('search', None):
-        data = flask.request.form.get('search', 'test')
-    else:
-        data = name
-
-    curs.execute(db_change("select title from data where title = ?"), [data])
-    t_data = curs.fetchall()
-    if t_data:
-        return redirect('/w/' + url_pas(data))
-    else:
-        return redirect('/search/' + url_pas(data))

+ 125 - 9
route/tool/func.py

@@ -106,6 +106,36 @@ def do_db_set(db_set):
     global_db_set = db_set
     
 # Func-init
+def get_init_set_list(need = 'all'):
+    init_set_list = {
+        'host' : {
+            'display' : 'Host',
+            'require' : 'conv',
+            'default' : '0.0.0.0'
+        }, 'port' : {
+            'display' : 'Port',
+            'require' : 'conv',
+            'default' : '3000'
+        }, 'language' : {
+            'display' : 'Language',
+            'require' : 'select',
+            'default' : 'ko-KR',
+            'list' : ['ko-KR', 'en-US']
+        }, 'markup' : {
+            'display' : 'Markup',
+            'require' : 'select',
+            'default' : 'namumark',
+            'list' : ['namumark', 'markdown', 'custom', 'raw']
+        }, 'encode' : {
+            'display' : 'Encryption method',
+            'require' : 'select',
+            'default' : 'sha3',
+            'list' : ['sha3', 'sha256']
+        }
+    }
+    
+    return init_set_list
+
 class get_db_connect_old:
     def __init__(self, db_set):
         self.db_set = db_set
@@ -204,7 +234,7 @@ class class_check_json:
         if os.getenv('NAMU_DB') or os.getenv('NAMU_DB_TYPE'):
             set_data = {}
             set_data['db'] = os.getenv('NAMU_DB') if os.getenv('NAMU_DB') else 'data'
-            set_data['db'] = os.getenv('NAMU_DB_TYPE') if os.getenv('NAMU_DB_TYPE') else 'sqlite'
+            set_data['db_type'] = os.getenv('NAMU_DB_TYPE') if os.getenv('NAMU_DB_TYPE') else 'sqlite'
         else:
             if os.path.exists(os.path.join('data', 'set.json')):
                 db_set_list = ['db', 'db_type']
@@ -540,6 +570,24 @@ def update(ver_num, set_data):
         curs.execute(db_change(
             'delete from acl where title like "file:%" and data = "admin" and type like "decu%"'
         ))
+        
+    if ver_num < 3500106:
+        curs.execute(db_change("select data from other where name = 'domain'"))
+        db_data = curs.fetchall()
+        if db_data and db_data[0][0] != '':
+            db_data = db_data[0][0]
+            db_data = re.match(r'[^/]+\/\/([^/]+)', db_data)
+            if db_data:
+                db_data = db_data.group(1)
+                curs.execute(db_change(
+                    "update other set data = ? where name = 'domain'"
+                ), [
+                    db_data
+                ])
+            else:
+                curs.execute(db_change(
+                    "update other set data = '' where name = 'domain'"
+                ))
     
     conn.commit()
     
@@ -678,7 +726,7 @@ def check_int(data):
         return ''
     
 def redirect(data = '/'):
-    return flask.redirect(flask.request.host_url[:-1] + data)
+    return flask.redirect(load_domain('full') + data)
     
 def get_acl_list(type_d = 'normal'):
     if type_d == 'user':
@@ -696,12 +744,25 @@ def load_image_url():
     
     return image_where
 
-def load_domain():
+def load_domain(data_type = 'normal'):
     curs = conn.cursor()
+    
+    domain = ''
+    
+    if data_type == 'full':
+        curs.execute(db_change("select data from other where name = 'http_select'"))
+        db_data = curs.fetchall()
+        domain += db_data[0][0] if db_data and db_data[0][0] != '' else 'http'
+        domain += '://'
 
-    curs.execute(db_change("select data from other where name = 'domain'"))
-    domain = curs.fetchall()
-    domain = domain[0][0] if domain and domain[0][0] != '' else flask.request.host_url
+        curs.execute(db_change("select data from other where name = 'domain'"))
+        db_data = curs.fetchall()
+        domain += db_data[0][0] if db_data and db_data[0][0] != '' else flask.request.host
+        domain += '/'
+    else:
+        curs.execute(db_change("select data from other where name = 'domain'"))
+        db_data = curs.fetchall()
+        domain += db_data[0][0] if db_data and db_data[0][0] != '' else flask.request.host
 
     return domain
 
@@ -1627,7 +1688,60 @@ def ip_pas(raw_ip, type_data = 0):
         return end_ip
         
 # Func-edit
-def slow_edit_check():
+def get_edit_text_bottom():
+    curs = conn.cursor()
+    
+    b_text = ''
+    
+    curs.execute(db_change('select data from other where name = "edit_bottom_text"'))
+    db_data= curs.fetchall()
+    if db_data and db_data[0][0] != '':
+        b_text = '' + \
+            '<hr class="main_hr">' + \
+            db_data[0][0] + \
+            '<hr class="main_hr">' + \
+        ''
+
+    return b_text
+
+def get_edit_text_bottom_check_box():
+    curs = conn.cursor()
+    
+    cccb_text = ''
+
+    curs.execute(db_change('select data from other where name = "copyright_checkbox_text"'))
+    sql_d = curs.fetchall()
+    if sql_d and sql_d[0][0] != '':
+        cccb_text = '' + \
+            '<hr class="main_hr">' + \
+            '<input type="checkbox" name="copyright_agreement" value="yes"> ' + sql_d[0][0] + \
+            '<hr class="main_hr">' + \
+        ''
+        
+    return cccb_text
+
+def do_edit_text_bottom_check_box_check(data):
+    curs = conn.cursor()
+    
+    curs.execute(db_change('select data from other where name = "copyright_checkbox_text"'))
+    db_data = curs.fetchall()
+    if db_data and db_data[0][0] != '':
+        if data != 'yes':
+            return 1
+        
+    return 0
+
+def do_edit_send_check(data):
+    curs = conn.cursor()
+    
+    curs.execute(db_change('select data from other where name = "edit_bottom_compulsion"'))
+    db_data = curs.fetchall()
+    if db_data and db_data[0][0] != '' and data == '':
+        return 1
+    
+    return 0
+
+def do_edit_slow_check():
     curs = conn.cursor()
 
     curs.execute(db_change("select data from other where name = 'slow_edit'"))
@@ -1652,7 +1766,7 @@ def slow_edit_check():
 
     return 0
 
-def edit_filter_do(data):
+def do_edit_filter(data):
     curs = conn.cursor()
 
     if admin_check(1) != 1:
@@ -1986,6 +2100,8 @@ def re_error(data):
             data = load_lang('same_email_error')
         elif num == 36:
             data = load_lang('input_email_error')
+        elif num == 37:
+            data = load_lang('error_edit_send_request')
         else:
             data = '???'
 
@@ -2021,4 +2137,4 @@ def re_error(data):
                      '</ul>' + \
                 '',
                 menu = 0
-            )), 400
+            )), 400

+ 1 - 1
route/topic.py

@@ -130,7 +130,7 @@ def topic(topic_num = 0):
                     <hr class="main_hr">
                     <form style="''' + display + '''" method="post">
                         ''' + data_input_topic_name + '''
-                        <textarea id="textarea_edit_view" class="topic_content" placeholder="''' + topic_text + '''" name="content"></textarea>
+                        <textarea id="textarea_edit_view" class="opennamu_comment_textarea" placeholder="''' + topic_text + '''" name="content"></textarea>
                         <hr class="main_hr">
                         ''' + captcha_get() + (ip_warning() if display == '' else '') + '''
                         <input style="display: none;" name="topic" value="''' + name + '''">

+ 1 - 1
route/user_alarm_del.py → route/user_alarm_delete.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def user_alarm_del():
+def user_alarm_delete():
     with get_db_connect() as conn:
         curs = conn.cursor()
     

+ 35 - 0
route/user_count.py

@@ -0,0 +1,35 @@
+from .tool.func import *
+
+def user_count(name = None):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if name == None:
+            that = ip_check()
+        else:
+            that = name
+
+        curs.execute(db_change("select count(*) from history where ip = ?"), [that])
+        count = curs.fetchall()
+        if count:
+            data = count[0][0]
+        else:
+            data = 0
+
+        curs.execute(db_change("select count(*) from topic where ip = ?"), [that])
+        count = curs.fetchall()
+        if count:
+            t_data = count[0][0]
+        else:
+            t_data = 0
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [load_lang('count'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            data = '''
+                <ul class="inside_ul">
+                    <li><a href="/record/''' + url_pas(that) + '''">''' + load_lang('edit_record') + '''</a> : ''' + str(data) + '''</li>
+                    <li><a href="/record/topic/''' + url_pas(that) + '''">''' + load_lang('discussion_record') + '''</a> : ''' + str(t_data) + '''</a></li>
+                </ul>
+            ''',
+            menu = [['user', load_lang('return')]]
+        ))

+ 0 - 34
route/user_count_edit.py

@@ -1,34 +0,0 @@
-from .tool.func import *
-
-def user_count_edit_2(conn, name):
-    curs = conn.cursor()
-
-    if name == None:
-        that = ip_check()
-    else:
-        that = name
-
-    curs.execute(db_change("select count(*) from history where ip = ?"), [that])
-    count = curs.fetchall()
-    if count:
-        data = count[0][0]
-    else:
-        data = 0
-
-    curs.execute(db_change("select count(*) from topic where ip = ?"), [that])
-    count = curs.fetchall()
-    if count:
-        t_data = count[0][0]
-    else:
-        t_data = 0
-
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('count'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-        data = '''
-            <ul class="inside_ul">
-                <li><a href="/record/''' + url_pas(that) + '''">''' + load_lang('edit_record') + '''</a> : ''' + str(data) + '''</li>
-                <li><a href="/record/topic/''' + url_pas(that) + '''">''' + load_lang('discussion_record') + '''</a> : ''' + str(t_data) + '''</a></li>
-            </ul>
-        ''',
-        menu = [['user', load_lang('return')]]
-    ))

+ 177 - 176
route/user_setting.py

@@ -1,184 +1,185 @@
 from .tool.func import *
 
-def user_setting_2(conn, server_set_var):
-    curs = conn.cursor()
-
-    support_language = ['default'] + server_set_var['language']['list']
-    ip = ip_check()
-
-    if ban_check() == 1:
-        return re_error('/ban')
-
-    if ip_or_user(ip) == 0:
-        if flask.request.method == 'POST':
-            auto_list = [
-                ['skin', flask.request.form.get('skin', '')], 
-                ['lang', flask.request.form.get('lang', '')],
-                ['user_title', flask.request.form.get('user_title', '')]
-            ]
-                
-            twofa_turn_on = 0 
-            twofa_on = flask.request.form.get('2fa', '')
-            if twofa_on != '':
-                twofa_turn_on = 1
-                twofa_pw = flask.request.form.get('2fa_pw', '')
-                if twofa_pw != '':
-                    twofa_pw = pw_encode(twofa_pw)
-                    curs.execute(db_change("select data from user_set where id = ? and name = 'encode'"), [ip])
-                    twofa_encode = curs.fetchall()[0][0]
-                    auto_list += [['2fa', 'on'], ['2fa_pw', twofa_pw], ['2fa_pw_encode', twofa_encode]]
+def user_setting():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        support_language = ['default'] + get_init_set_list()['language']['list']
+        ip = ip_check()
+
+        if ban_check() == 1:
+            return re_error('/ban')
+
+        if ip_or_user(ip) == 0:
+            if flask.request.method == 'POST':
+                auto_list = [
+                    ['skin', flask.request.form.get('skin', '')], 
+                    ['lang', flask.request.form.get('lang', '')],
+                    ['user_title', flask.request.form.get('user_title', '')]
+                ]
+
+                twofa_turn_on = 0 
+                twofa_on = flask.request.form.get('2fa', '')
+                if twofa_on != '':
+                    twofa_turn_on = 1
+                    twofa_pw = flask.request.form.get('2fa_pw', '')
+                    if twofa_pw != '':
+                        twofa_pw = pw_encode(twofa_pw)
+                        curs.execute(db_change("select data from user_set where id = ? and name = 'encode'"), [ip])
+                        twofa_encode = curs.fetchall()[0][0]
+                        auto_list += [['2fa', 'on'], ['2fa_pw', twofa_pw], ['2fa_pw_encode', twofa_encode]]
+                    else:
+                        auto_list += [['2fa', 'on']]
                 else:
-                    auto_list += [['2fa', 'on']]
+                    auto_list += [['2fa', '']]
+
+                for auto_data in auto_list:
+                    curs.execute(db_change('select data from user_set where name = ? and id = ?'), [auto_data[0], ip])
+                    if curs.fetchall():
+                        curs.execute(db_change("update user_set set data = ? where name = ? and id = ?"), [auto_data[1], auto_data[0], ip])
+                    else:
+                        curs.execute(db_change("insert into user_set (name, id, data) values (?, ?, ?)"), [auto_data[0], ip, auto_data[1]])
+
+                conn.commit()
+
+                return redirect('/change')
             else:
-                auto_list += [['2fa', '']]
-                
-            for auto_data in auto_list:
-                curs.execute(db_change('select data from user_set where name = ? and id = ?'), [auto_data[0], ip])
-                if curs.fetchall():
-                    curs.execute(db_change("update user_set set data = ? where name = ? and id = ?"), [auto_data[1], auto_data[0], ip])
-                else:
-                    curs.execute(db_change("insert into user_set (name, id, data) values (?, ?, ?)"), [auto_data[0], ip, auto_data[1]])
+                curs.execute(db_change('select data from user_set where name = "email" and id = ?'), [ip])
+                data = curs.fetchall()
+                email = data[0][0] if data and data[0][0] != '' else '-'
 
-            conn.commit()
+                curs.execute(db_change('select data from user_set where name = "random_key" and id = ?'), [ip])
+                data = curs.fetchall()
+                ramdom_key = data[0][0] if data and data[0][0] != '' else '-'
 
-            return redirect('/change')
-        else:
-            curs.execute(db_change('select data from user_set where name = "email" and id = ?'), [ip])
-            data = curs.fetchall()
-            email = data[0][0] if data and data[0][0] != '' else '-'
-            
-            curs.execute(db_change('select data from user_set where name = "random_key" and id = ?'), [ip])
-            data = curs.fetchall()
-            ramdom_key = data[0][0] if data and data[0][0] != '' else '-'
-            
-            curs.execute(db_change('select data from user_set where name = "skin" and id = ?'), [ip])
-            data = curs.fetchall()
-            div2 = load_skin(data[0][0] if data else '', 0, 1)
-
-            curs.execute(db_change('select data from user_set where name = "lang" and id = ?'), [ip])
-            data = curs.fetchall()
-            data = [['default']] if not data else data
-            div3 = ''
-            for lang_data in support_language:
-                see_data = lang_data if lang_data != 'default' else load_lang('default')
-                
-                if data and data[0][0] == lang_data:
-                    div3 = '<option value="' + lang_data + '">' + see_data + '</option>' + div3
-                else:
-                    div3 += '<option value="' + lang_data + '">' + see_data + '</option>'
-            
-            # 여기 잘못 짬
-            curs.execute(db_change('select data from user_set where name = "user_title" and id = ?'), [ip])
-            data = curs.fetchall()
-            data = [['']] if not data else data
-            user_title_list = get_user_title_list()
-            div4 = ''
-            for user_title in user_title_list:                
-                if data and data[0][0] == user_title:
-                    div4 = '<option value="' + user_title + '">' + user_title_list[user_title] + '</option>' + div4
-                else:
-                    div4 += '<option value="' + user_title + '">' + user_title_list[user_title] + '</option>'
-
-            curs.execute(db_change('select data from user_set where name = "2fa" and id = ?'), [ip])
-            fa_data = curs.fetchall()
-            fa_data = fa_data[0][0] if fa_data and fa_data[0][0] != '' else ''
-            fa_data_select = ''
-            fa_data_sp_list = [['off', ''], ['pw', 'on']]
-            for fa_data_get in fa_data_sp_list:
-                fa_data_selected = ''
-                if fa_data == fa_data_get[1]:
-                    fa_data_selected = 'selected'
-                
-                fa_data_select += '<option ' + fa_data_selected + ' value="' + fa_data_get[1] + '">' + fa_data_get[0] + '</option>'
-
-            curs.execute(db_change('select data from user_set where name = "2fa_pw" and id = ?'), [ip])
-            fa_data_pw = curs.fetchall()
-            fa_data_pw = load_lang('2fa_password_change') if fa_data_pw else load_lang('2fa_password')
-
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('user_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-                data = '''
-                    <form method="post">
-                        <div id="get_user_info"></div>
-                        <script>load_user_info("''' + ip + '''");</script>
-                        <hr class="main_hr">
-                        <a href="/change/pw">(''' + load_lang('password_change') + ''')</a>
-                        <hr class="main_hr">
-                        <span>''' + load_lang('email') + ''' : ''' + email + '''</span> <a href="/change/email">(''' + load_lang('email_change') + ''')</a> <a href="/change/email/delete">(''' + load_lang('email_delete') + ''')</a>
-                        <hr class="main_hr">
-                        <span>''' + load_lang('password_instead_key') + ''' : ''' + ramdom_key + ''' <a href="/change/key">(''' + load_lang('key_change') + ''')</a> <a href="/change/key/delete">(''' + load_lang('key_delete') + ''')</a></span>
-                        <h2>''' + load_lang('main') + '''</h2>
-                        <span>''' + load_lang('skin') + '''</span>
-                        <hr class="main_hr">
-                        <select name="skin">''' + div2 + '''</select>
-                        <hr class="main_hr">
-                        <span>''' + load_lang('language') + '''</span>
-                        <hr class="main_hr">
-                        <select name="lang">''' + div3 + '''</select>
-                        <hr class="main_hr">
-                        <span>''' + load_lang('user_title') + '''</span>
-                        <hr class="main_hr">
-                        <select name="user_title">''' + div4 + '''</select>
-                        <h2>''' + load_lang('2fa') + '''</h2>
-                        <select name="2fa"
-                                id="twofa_check_input"
-                                onchange="do_twofa_check(0);">''' + fa_data_select + '''</select>
-                        <div id="fa_plus_content">
+                curs.execute(db_change('select data from user_set where name = "skin" and id = ?'), [ip])
+                data = curs.fetchall()
+                div2 = load_skin(data[0][0] if data else '', 0, 1)
+
+                curs.execute(db_change('select data from user_set where name = "lang" and id = ?'), [ip])
+                data = curs.fetchall()
+                data = [['default']] if not data else data
+                div3 = ''
+                for lang_data in support_language:
+                    see_data = lang_data if lang_data != 'default' else load_lang('default')
+
+                    if data and data[0][0] == lang_data:
+                        div3 = '<option value="' + lang_data + '">' + see_data + '</option>' + div3
+                    else:
+                        div3 += '<option value="' + lang_data + '">' + see_data + '</option>'
+
+                # 여기 잘못 짬
+                curs.execute(db_change('select data from user_set where name = "user_title" and id = ?'), [ip])
+                data = curs.fetchall()
+                data = [['']] if not data else data
+                user_title_list = get_user_title_list()
+                div4 = ''
+                for user_title in user_title_list:                
+                    if data and data[0][0] == user_title:
+                        div4 = '<option value="' + user_title + '">' + user_title_list[user_title] + '</option>' + div4
+                    else:
+                        div4 += '<option value="' + user_title + '">' + user_title_list[user_title] + '</option>'
+
+                curs.execute(db_change('select data from user_set where name = "2fa" and id = ?'), [ip])
+                fa_data = curs.fetchall()
+                fa_data = fa_data[0][0] if fa_data and fa_data[0][0] != '' else ''
+                fa_data_select = ''
+                fa_data_sp_list = [['off', ''], ['pw', 'on']]
+                for fa_data_get in fa_data_sp_list:
+                    fa_data_selected = ''
+                    if fa_data == fa_data_get[1]:
+                        fa_data_selected = 'selected'
+
+                    fa_data_select += '<option ' + fa_data_selected + ' value="' + fa_data_get[1] + '">' + fa_data_get[0] + '</option>'
+
+                curs.execute(db_change('select data from user_set where name = "2fa_pw" and id = ?'), [ip])
+                fa_data_pw = curs.fetchall()
+                fa_data_pw = load_lang('2fa_password_change') if fa_data_pw else load_lang('2fa_password')
+
+                return easy_minify(flask.render_template(skin_check(),
+                    imp = [load_lang('user_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                    data = '''
+                        <form method="post">
+                            <div id="get_user_info"></div>
+                            <script>load_user_info("''' + ip + '''");</script>
+                            <hr class="main_hr">
+                            <a href="/change/pw">(''' + load_lang('password_change') + ''')</a>
                             <hr class="main_hr">
-                            <input type="password" name="2fa_pw" placeholder="''' + fa_data_pw + '''">
-                        </div>
-                        <hr class="main_hr">
-                        <button type="submit">''' + load_lang('save') + '''</button>
-                        ''' + http_warning() + '''
-                        <script>do_twofa_check(1);</script>
-                    </form>
-                ''',
-                menu = [['user', load_lang('return')]]
-            ))
-    else:
-        if flask.request.method == 'POST':
-            flask.session['skin'] = flask.request.form.get('skin', '')
-            flask.session['lang'] = flask.request.form.get('lang', '')
-            
-            return redirect('/change')
+                            <span>''' + load_lang('email') + ''' : ''' + email + '''</span> <a href="/change/email">(''' + load_lang('email_change') + ''')</a> <a href="/change/email/delete">(''' + load_lang('email_delete') + ''')</a>
+                            <hr class="main_hr">
+                            <span>''' + load_lang('password_instead_key') + ''' : ''' + ramdom_key + ''' <a href="/change/key">(''' + load_lang('key_change') + ''')</a> <a href="/change/key/delete">(''' + load_lang('key_delete') + ''')</a></span>
+                            <h2>''' + load_lang('main') + '''</h2>
+                            <span>''' + load_lang('skin') + '''</span>
+                            <hr class="main_hr">
+                            <select name="skin">''' + div2 + '''</select>
+                            <hr class="main_hr">
+                            <span>''' + load_lang('language') + '''</span>
+                            <hr class="main_hr">
+                            <select name="lang">''' + div3 + '''</select>
+                            <hr class="main_hr">
+                            <span>''' + load_lang('user_title') + '''</span>
+                            <hr class="main_hr">
+                            <select name="user_title">''' + div4 + '''</select>
+                            <h2>''' + load_lang('2fa') + '''</h2>
+                            <select name="2fa"
+                                    id="twofa_check_input"
+                                    onchange="do_twofa_check(0);">''' + fa_data_select + '''</select>
+                            <div id="fa_plus_content">
+                                <hr class="main_hr">
+                                <input type="password" name="2fa_pw" placeholder="''' + fa_data_pw + '''">
+                            </div>
+                            <hr class="main_hr">
+                            <button type="submit">''' + load_lang('save') + '''</button>
+                            ''' + http_warning() + '''
+                            <script>do_twofa_check(1);</script>
+                        </form>
+                    ''',
+                    menu = [['user', load_lang('return')]]
+                ))
         else:
-            div2 = load_skin(
-                ('' if not 'skin' in flask.session else flask.session['skin']), 
-                0, 
-                1
-            )
-
-            data = [['default']] if not 'lang' in flask.session else [[flask.session['lang']]]
-            div3 = ''
-            for lang_data in support_language:
-                see_data = lang_data if lang_data != 'default' else load_lang('default')
-                
-                if data and data[0][0] == lang_data:
-                    div3 = '<option value="' + lang_data + '">' + see_data + '</option>' + div3
-                else:
-                    div3 += '<option value="' + lang_data + '">' + see_data + '</option>'
-            
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('user_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-                data = '''
-                    <form method="post">
-                        <div id="get_user_info"></div>
-                        <script>load_user_info("''' + ip + '''");</script>
-                        <hr class="main_hr">
-                        <h2>''' + load_lang('main') + '''</h2>
-                        <span>''' + load_lang('skin') + '''</span>
-                        <hr class="main_hr">
-                        <select name="skin">''' + div2 + '''</select>
-                        <hr class="main_hr">
-                        <span>''' + load_lang('language') + '''</span>
-                        <hr class="main_hr">
-                        <select name="lang">''' + div3 + '''</select>
-                        <hr class="main_hr">
-                        <button type="submit">''' + load_lang('save') + '''</button>
-                        ''' + http_warning() + '''
-                        <hr class="main_hr">
-                        <span>''' + load_lang('user_head_warning') + '''</span>
-                    </form>
-                ''',
-                menu = [['user', load_lang('return')]]
-            ))
+            if flask.request.method == 'POST':
+                flask.session['skin'] = flask.request.form.get('skin', '')
+                flask.session['lang'] = flask.request.form.get('lang', '')
+
+                return redirect('/change')
+            else:
+                div2 = load_skin(
+                    ('' if not 'skin' in flask.session else flask.session['skin']), 
+                    0, 
+                    1
+                )
+
+                data = [['default']] if not 'lang' in flask.session else [[flask.session['lang']]]
+                div3 = ''
+                for lang_data in support_language:
+                    see_data = lang_data if lang_data != 'default' else load_lang('default')
+
+                    if data and data[0][0] == lang_data:
+                        div3 = '<option value="' + lang_data + '">' + see_data + '</option>' + div3
+                    else:
+                        div3 += '<option value="' + lang_data + '">' + see_data + '</option>'
+
+                return easy_minify(flask.render_template(skin_check(),
+                    imp = [load_lang('user_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                    data = '''
+                        <form method="post">
+                            <div id="get_user_info"></div>
+                            <script>load_user_info("''' + ip + '''");</script>
+                            <hr class="main_hr">
+                            <h2>''' + load_lang('main') + '''</h2>
+                            <span>''' + load_lang('skin') + '''</span>
+                            <hr class="main_hr">
+                            <select name="skin">''' + div2 + '''</select>
+                            <hr class="main_hr">
+                            <span>''' + load_lang('language') + '''</span>
+                            <hr class="main_hr">
+                            <select name="lang">''' + div3 + '''</select>
+                            <hr class="main_hr">
+                            <button type="submit">''' + load_lang('save') + '''</button>
+                            ''' + http_warning() + '''
+                            <hr class="main_hr">
+                            <span>''' + load_lang('user_head_warning') + '''</span>
+                        </form>
+                    ''',
+                    menu = [['user', load_lang('return')]]
+                ))

+ 7 - 7
route/user_setting_head.py

@@ -3,9 +3,9 @@ from .tool.func import *
 def user_setting_head():
     with get_db_connect() as conn:
         curs = conn.cursor()
-        
+
         ip = ip_check()
-        
+    
         if flask.request.method == 'POST':
             get_data = flask.request.form.get('content', '')
             if ip_or_user(ip) == 0:
@@ -14,16 +14,16 @@ def user_setting_head():
                     curs.execute(db_change("update user_set set data = ? where id = ? and name = 'custom_css'"), [get_data, ip])
                 else:
                     curs.execute(db_change("insert into user_set (id, name, data) values (?, 'custom_css', ?)"), [ip, get_data])
-        
+
                 conn.commit()
         
             flask.session['head'] = get_data
-        
+
             return redirect('/change/head')
         else:
             if ip_or_user(ip) == 0:
                 start = ''
-        
+
                 curs.execute(db_change("select data from user_set where id = ? and name = 'custom_css'"), [ip])
                 head_data = curs.fetchall()
                 data = head_data[0][0] if head_data else ''
@@ -33,7 +33,7 @@ def user_setting_head():
                     '<hr class="main_hr">' + \
                 ''
                 data = flask.session['head'] if 'head' in flask.session else ''
-        
+
             start += '' + \
                 '<span>' + \
                     '&lt;style&gt;CSS&lt;/style&gt;' + \
@@ -42,7 +42,7 @@ def user_setting_head():
                 '</span>' + \
                 '<hr class="main_hr">' + \
             ''
-        
+
             return easy_minify(flask.render_template(skin_check(),
                 imp = [load_lang(data = 'user_head', safe = 1), wiki_set(), wiki_custom(), wiki_css([0, 0])],
                 data = start + '''

+ 67 - 0
route/user_setting_pw.py

@@ -0,0 +1,67 @@
+from .tool.func import *
+
+def user_setting_pw():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if ban_check() == 1:
+            return re_error('/ban')
+
+        ip = ip_check()
+        if ip_or_user(ip) != 0:
+            return redirect('/login')
+
+        if flask.request.method == 'POST':
+            now_pw = flask.request.form.get('pw4', None)
+            new_pw = flask.request.form.get('pw2', None)
+            re_pw = flask.request.form.get('pw3', None)
+            if now_pw and new_pw and re_pw:
+                if new_pw != re_pw:
+                    return re_error('/error/20')
+
+                curs.execute(db_change("" + \
+                    "select name, data from user_set " + \
+                    "where id = ? and (name = 'encode' or name = 'pw')" + \
+                ""), [
+                    flask.session['id']
+                ])
+                sql_data = curs.fetchall()
+                if not sql_data:
+                    return re_error('/error/2')
+                else:
+                    user = {}
+                    for i in sql_data:
+                        user[i[0]] = i[1]
+
+                if pw_check(
+                    now_pw,
+                    user['pw'], 
+                    user['encode'], 
+                    ip
+                ) != 1:
+                    return re_error('/error/10')
+
+                curs.execute(db_change(
+                    "update user_set set data = ? where id = ? and name = 'pw'"
+                ), [
+                    pw_encode(new_pw), 
+                    ip
+                ])
+
+            return redirect('/user')
+        else:
+            return easy_minify(flask.render_template(skin_check(),
+                imp = [load_lang('password_change'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                data = '''
+                    <form method="post">
+                        <input placeholder="''' + load_lang('now_password') + '''" name="pw4" type="password">
+                        <hr class="main_hr">
+                        <input placeholder="''' + load_lang('new_password') + '''" name="pw2" type="password">
+                        <hr class="main_hr">
+                        <input placeholder="''' + load_lang('password_confirm') + '''" name="pw3" type="password">
+                        <hr class="main_hr">
+                        <button type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                ''',
+                menu = [['change', load_lang('return')]]
+            ))

+ 0 - 66
route/user_setting_pw_change.py

@@ -1,66 +0,0 @@
-from .tool.func import *
-
-def user_setting_pw_change_2(conn):
-    curs = conn.cursor()
-
-    if ban_check() == 1:
-        return re_error('/ban')
-
-    ip = ip_check()
-    if ip_or_user(ip) != 0:
-        return redirect('/login')
-
-    if flask.request.method == 'POST':
-        now_pw = flask.request.form.get('pw4', None)
-        new_pw = flask.request.form.get('pw2', None)
-        re_pw = flask.request.form.get('pw3', None)
-        if now_pw and new_pw and re_pw:
-            if new_pw != re_pw:
-                return re_error('/error/20')
-
-            curs.execute(db_change("" + \
-                "select name, data from user_set " + \
-                "where id = ? and (name = 'encode' or name = 'pw')" + \
-            ""), [
-                flask.session['id']
-            ])
-            sql_data = curs.fetchall()
-            if not sql_data:
-                return re_error('/error/2')
-            else:
-                user = {}
-                for i in sql_data:
-                    user[i[0]] = i[1]
-
-            if pw_check(
-                now_pw,
-                user['pw'], 
-                user['encode'], 
-                ip
-            ) != 1:
-                return re_error('/error/10')
-
-            curs.execute(db_change(
-                "update user_set set data = ? where id = ? and name = 'pw'"
-            ), [
-                pw_encode(new_pw), 
-                ip
-            ])
-
-        return redirect('/user')
-    else:
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('password_change'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-            data = '''
-                <form method="post">
-                    <input placeholder="''' + load_lang('now_password') + '''" name="pw4" type="password">
-                    <hr class="main_hr">
-                    <input placeholder="''' + load_lang('new_password') + '''" name="pw2" type="password">
-                    <hr class="main_hr">
-                    <input placeholder="''' + load_lang('password_confirm') + '''" name="pw3" type="password">
-                    <hr class="main_hr">
-                    <button type="submit">''' + load_lang('save') + '''</button>
-                </form>
-            ''',
-            menu = [['change', load_lang('return')]]
-        ))

+ 49 - 48
route/user_watch_list.py

@@ -1,57 +1,58 @@
 from .tool.func import *
 
-def user_watch_list_2(conn, tool):
-    curs = conn.cursor()
+def user_watch_list(tool):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
 
-    if tool == 'watch_list':
-        div = load_lang("msg_whatchlist_lmt") + ' : 10 <hr class="main_hr">'
-    else:
-        div = ''
-
-    ip = ip_check()
-
-    if ip_or_user(ip) != 0:
-        return redirect('/login')
+        if tool == 'watch_list':
+            div = load_lang("msg_whatchlist_lmt") + ' : 10 <hr class="main_hr">'
+        else:
+            div = ''
 
-    if tool == 'watch_list':
-        curs.execute(db_change("select title from scan where type = '' and user = ?"), [ip])
+        ip = ip_check()
 
-        title_name = load_lang('watchlist')
-    else:
-        curs.execute(db_change("select title from scan where type = 'star' and user = ?"), [ip])
+        if ip_or_user(ip) != 0:
+            return redirect('/login')
 
-        title_name = load_lang('star_doc')
+        if tool == 'watch_list':
+            curs.execute(db_change("select title from scan where type = '' and user = ?"), [ip])
 
-    data = curs.fetchall()
-    for data_list in data:
-        if tool == 'star_doc':
-            curs.execute(db_change("select date from history where title = ? order by id + 0 desc limit 1"), [data_list[0]])
-            get_data = curs.fetchall()
-            if get_data:
-                plus = '(' + get_data[0][0] + ') '
+            title_name = load_lang('watchlist')
+        else:
+            curs.execute(db_change("select title from scan where type = 'star' and user = ?"), [ip])
+
+            title_name = load_lang('star_doc')
+
+        data = curs.fetchall()
+        for data_list in data:
+            if tool == 'star_doc':
+                curs.execute(db_change("select date from history where title = ? order by id + 0 desc limit 1"), [data_list[0]])
+                get_data = curs.fetchall()
+                if get_data:
+                    plus = '(' + get_data[0][0] + ') '
+                else:
+                    plus = ''
             else:
                 plus = ''
-        else:
-            plus = ''
-
-        div += '' + \
-            '<li>' + \
-                '<a href="/w/' + url_pas(data_list[0]) + '">' + html.escape(data_list[0]) + '</a> ' + \
-                plus + \
-                '<a href="/' + ('star_doc' if tool == 'star_doc' else 'watch_list') + '/' + url_pas(data_list[0]) + '">(' + load_lang('delete') + ')</a>' + \
-            '</li>' + \
-        ''
-
-    if data:
-        div = '' + \
-            '<ul class="inside_ul">' + div + '</ul>' + \
-            '<hr class="main_hr">' + \
-        ''
-
-    div += '<a href="/manager/' + ('13' if tool == 'watch_list' else '16') + '">(' + load_lang('add') + ')</a>'
-
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [title_name, wiki_set(), wiki_custom(), wiki_css([0, 0])],
-        data = div,
-        menu = [['user', load_lang('return')]]
-    ))
+
+            div += '' + \
+                '<li>' + \
+                    '<a href="/w/' + url_pas(data_list[0]) + '">' + html.escape(data_list[0]) + '</a> ' + \
+                    plus + \
+                    '<a href="/' + ('star_doc' if tool == 'star_doc' else 'watch_list') + '/' + url_pas(data_list[0]) + '">(' + load_lang('delete') + ')</a>' + \
+                '</li>' + \
+            ''
+
+        if data:
+            div = '' + \
+                '<ul class="inside_ul">' + div + '</ul>' + \
+                '<hr class="main_hr">' + \
+            ''
+
+        div += '<a href="/manager/' + ('13' if tool == 'watch_list' else '16') + '">(' + load_lang('add') + ')</a>'
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [title_name, wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            data = div,
+            menu = [['user', load_lang('return')]]
+        ))

+ 24 - 25
route/user_watch_list_name.py

@@ -1,33 +1,32 @@
 from .tool.func import *
 
-def user_watch_list_name_2(conn, tool, name):
-    curs = conn.cursor()
-    
-    print(tool, name)
+def user_watch_list_name(tool, name = 'Test'):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
 
-    ip = ip_check()
-    if ip_or_user(ip) != 0:
-        return redirect('/login')
+        ip = ip_check()
+        if ip_or_user(ip) != 0:
+            return redirect('/login')
 
-    if tool == 'watch_list':
-        curs.execute(db_change("select count(*) from scan where user = ?"), [ip])
-        count = curs.fetchall()
-        if count and count[0][0] > 9:
-            return re_error('/error/28')
+        if tool == 'watch_list':
+            curs.execute(db_change("select count(*) from scan where user = ?"), [ip])
+            count = curs.fetchall()
+            if count and count[0][0] > 9:
+                return re_error('/error/28')
 
-        type_data = ''
-    else:
-        type_data = 'star'
+            type_data = ''
+        else:
+            type_data = 'star'
 
-    curs.execute(db_change("select title from scan where user = ? and title = ? and type = ?"), [ip, name, type_data])
-    if curs.fetchall():
-        curs.execute(db_change("delete from scan where user = ? and title = ? and type = ?"), [ip, name, type_data])
-    else:
-        curs.execute(db_change("insert into scan (user, title, type) values (?, ?, ?)"), [ip, name, type_data])
+        curs.execute(db_change("select title from scan where user = ? and title = ? and type = ?"), [ip, name, type_data])
+        if curs.fetchall():
+            curs.execute(db_change("delete from scan where user = ? and title = ? and type = ?"), [ip, name, type_data])
+        else:
+            curs.execute(db_change("insert into scan (user, title, type) values (?, ?, ?)"), [ip, name, type_data])
 
-    conn.commit()
+        conn.commit()
 
-    if tool == 'watch_list':
-        return redirect('/watch_list')
-    else:
-        return redirect('/star_doc')
+        if tool == 'watch_list':
+            return redirect('/watch_list')
+        else:
+            return redirect('/star_doc')

+ 56 - 55
route/view_diff.py

@@ -1,58 +1,59 @@
 from .tool.func import *
 
-def view_diff_2(conn, name, num_a, num_b):
-    curs = conn.cursor()
-    
-    first = str(num_a)
-    second = str(num_b)
-
-    if acl_check(name, 'render') == 1:
-        return re_error('/ban')
-
-    curs.execute(db_change("select title from history where title = ? and (id = ? or id = ?) and hide = 'O'"), [name, first, second])
-    if curs.fetchall() and admin_check(6) != 1:
-        return re_error('/error/3')
-
-    curs.execute(db_change("select data from history where id = ? and title = ?"), [first, name])
-    first_raw_data = curs.fetchall()
-        
-    curs.execute(db_change("select data from history where id = ? and title = ?"), [second, name])
-    second_raw_data = curs.fetchall()
-    if first_raw_data and second_raw_data:
-        first_raw_data = first_raw_data[0][0].replace('\r', '')
-        second_raw_data = second_raw_data[0][0].replace('\r', '')
-
-        if first_raw_data == second_raw_data:
-            result = ''
+def view_diff(name = 'Test', num_a = 1, num_b = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        first = str(num_a)
+        second = str(num_b)
+
+        if acl_check(name, 'render') == 1:
+            return re_error('/ban')
+
+        curs.execute(db_change("select title from history where title = ? and (id = ? or id = ?) and hide = 'O'"), [name, first, second])
+        if curs.fetchall() and admin_check(6) != 1:
+            return re_error('/error/3')
+
+        curs.execute(db_change("select data from history where id = ? and title = ?"), [first, name])
+        first_raw_data = curs.fetchall()
+
+        curs.execute(db_change("select data from history where id = ? and title = ?"), [second, name])
+        second_raw_data = curs.fetchall()
+        if first_raw_data and second_raw_data:
+            first_raw_data = first_raw_data[0][0].replace('\r', '')
+            second_raw_data = second_raw_data[0][0].replace('\r', '')
+
+            if first_raw_data == second_raw_data:
+                result = ''
+            else:
+                i = 1
+                change_count = 0
+                diff_data = diff_match_patch().diff_prettyHtml(
+                    diff_match_patch().diff_main(first_raw_data, second_raw_data)
+                )
+                end_data = ''
+
+                diff_data = diff_data.replace('&para;<br>', '\n')
+                diff_data = diff_data.replace('<span>', '')
+                diff_data = diff_data.replace('</span>', '')
+
+                re_data = re.findall(r'(?:(?:(?:(?!\n).)*)(?:\n)|(?:(?:(?!\n).)+)$)', diff_data)
+                for re_in_data in re_data:
+                    change_find_start = len(re.findall(r'<(?:del|ins) ', re_in_data))
+                    change_find_end = len(re.findall(r'<\/(?:del|ins)>', re_in_data))
+
+                    change_count += (change_find_start - change_find_end)
+                    if change_count != 0 or change_find_start != 0 or change_find_end != 0:
+                        end_data += str(i) + ' : ' + re_in_data
+
+                    i += 1
+
+                result = '<pre>' + end_data + '</pre>'
+
+            return easy_minify(flask.render_template(skin_check(),
+                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('compare') + ')', 0])],
+                data = result,
+                menu = [['history/' + url_pas(name), load_lang('return')]]
+            ))
         else:
-            i = 1
-            change_count = 0
-            diff_data = diff_match_patch().diff_prettyHtml(
-                diff_match_patch().diff_main(first_raw_data, second_raw_data)
-            )
-            end_data = ''
-
-            diff_data = diff_data.replace('&para;<br>', '\n')
-            diff_data = diff_data.replace('<span>', '')
-            diff_data = diff_data.replace('</span>', '')
-            
-            re_data = re.findall(r'(?:(?:(?:(?!\n).)*)(?:\n)|(?:(?:(?!\n).)+)$)', diff_data)
-            for re_in_data in re_data:
-                change_find_start = len(re.findall(r'<(?:del|ins) ', re_in_data))
-                change_find_end = len(re.findall(r'<\/(?:del|ins)>', re_in_data))
-
-                change_count += (change_find_start - change_find_end)
-                if change_count != 0 or change_find_start != 0 or change_find_end != 0:
-                    end_data += str(i) + ' : ' + re_in_data
-                
-                i += 1
-                
-            result = '<pre>' + end_data + '</pre>'
-
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('compare') + ')', 0])],
-            data = result,
-            menu = [['history/' + url_pas(name), load_lang('return')]]
-        ))
-    else:
-        return redirect('/history/' + url_pas(name))
+            return redirect('/history/' + url_pas(name))

+ 13 - 12
route/view_down.py

@@ -1,18 +1,19 @@
 from .tool.func import *
 
-def view_down_2(conn, name):
-    curs = conn.cursor()
+def view_down(name = 'Test'):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
 
-    div = '<ul class="inside_ul">'
+        div = '<ul class="inside_ul">'
 
-    curs.execute(db_change("select title from data where title like ?"), [name + '/%'])
-    for data in curs.fetchall():
-        div += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a></li>'
+        curs.execute(db_change("select title from data where title like ?"), [name + '/%'])
+        for data in curs.fetchall():
+            div += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a></li>'
 
-    div += '</ul>'
+        div += '</ul>'
 
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('sub') + ')', 0])],
-        data = div,
-        menu = [['w/' + url_pas(name), load_lang('return')]]
-    ))
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('sub') + ')', 0])],
+            data = div,
+            menu = [['w/' + url_pas(name), load_lang('return')]]
+        ))

+ 190 - 187
route/view_read.py

@@ -1,196 +1,199 @@
 from .tool.func import *
 
-def view_read_2(conn, name, doc_rev, doc_from):
-    curs = conn.cursor()
-
-    sub = 0
-    menu = []
-    
-    user_doc = ''
-    category_doc = ''
-    file_data = ''
-    
-    ip = ip_check()
-    
-    name_doc_pass = doc_from
-    uppage = re.sub(r"/([^/]+)$", '', name)
-    uppage = 0 if uppage == name else uppage
-    num = str(doc_rev)        
-
-    curs.execute(db_change("select sub from rd where title = ? and not stop = 'O' order by date desc"), [name])
-    topic = 1 if curs.fetchall() else 0
-
-    curs.execute(db_change("select title from data where title like ?"), [name + '/%'])
-    down = 1 if curs.fetchall() else 0
-    
-    if re.search(r'^category:', name):
+def view_read(name = 'Test', doc_rev = 0, doc_from = ''):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        sub = 0
+        menu = []
+
+        user_doc = ''
         category_doc = ''
-        category_sub = ''
-        
-        curs.execute(db_change("select link from back where title = ? and type = 'cat' order by link asc"), [name])
-        category_sql = curs.fetchall()
-        for data in category_sql:
-            if data[0].startswith('category:'):
-                category_sub += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a></li>'
-            else:
-                category_doc += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a> <a id="inside" href="/xref/' + url_pas(data[0]) + '">(' + load_lang('backlink') + ')</a></li>'
-
-        if category_doc != '':
-            category_doc = '<h2 id="cate_normal">' + load_lang('category_title') + '</h2><ul class="inside_ul">' + category_doc + '</ul>'
-
-        if category_sub != '':
-            category_doc += '<h2 id="cate_under">' + load_lang('under_category') + '</h2><ul class="inside_ul">' + category_sub + '</ul>'
-    elif re.search(r"^user:([^/]*)", name):
-        match = re.search(r"^user:([^/]*)", name)
-        user_name = html.escape(match.group(1))
-        user_doc = '''
-            <div id="get_user_info"></div>
-            <script>load_user_info("''' + user_name + '''");</script>
-            <hr class="main_hr">
-        '''
-        if name == 'user:' + user_name:
-            menu += [['w/' + url_pas(name) + '/' + url_pas(get_time().split()[0]), load_lang('today_doc')]]
-    elif re.search(r"^file:", name):
-        mime_type = re.search(r'([^.]+)$', name)
-        if mime_type:
-            mime_type = mime_type.group(1).lower()
-        else:
-            mime_type = 'jpg'
-            
-        file_name = re.sub(r'\.([^.]+)$', '', name)
-        file_name = re.sub(r'^file:', '', file_name)
-        
-        file_all_name = sha224_replace(file_name) + '.' + mime_type
-        file_path_name = os.path.join(load_image_url(), file_all_name)
-        if os.path.exists(file_path_name):
-            file_size = str(round(os.path.getsize(file_path_name) / 1000, 1))
-            file_data = '''
-                <img src="/image/''' + url_pas(file_all_name) + '''">
-                <h2>DATA</h2>
-                <table>
-                    <tr><td>URL</td><td><a href="/image/''' + url_pas(file_all_name) + '''">LINK</a></td></tr>
-                    <tr><td>VOLUME</td><td>''' + file_size + '''KB</td></tr>
-                </table>
-                <h2>CONTENT</h2>
+        file_data = ''
+
+        ip = ip_check()
+
+        # name_doc_pass = flask.request.cookies.get('opennamu_redirect', '')
+        uppage = re.sub(r"/([^/]+)$", '', name)
+        uppage = 0 if uppage == name else uppage
+        num = str(doc_rev)        
+
+        curs.execute(db_change("select sub from rd where title = ? and not stop = 'O' order by date desc"), [name])
+        topic = 1 if curs.fetchall() else 0
+
+        curs.execute(db_change("select title from data where title like ?"), [name + '/%'])
+        down = 1 if curs.fetchall() else 0
+
+        if re.search(r'^category:', name):
+            category_doc = ''
+            category_sub = ''
+
+            curs.execute(db_change("select link from back where title = ? and type = 'cat' order by link asc"), [name])
+            category_sql = curs.fetchall()
+            for data in category_sql:
+                if data[0].startswith('category:'):
+                    category_sub += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a></li>'
+                else:
+                    category_doc += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a> <a id="inside" href="/xref/' + url_pas(data[0]) + '">(' + load_lang('backlink') + ')</a></li>'
+
+            if category_doc != '':
+                category_doc = '<h2 id="cate_normal">' + load_lang('category_title') + '</h2><ul class="inside_ul">' + category_doc + '</ul>'
+
+            if category_sub != '':
+                category_doc += '<h2 id="cate_under">' + load_lang('under_category') + '</h2><ul class="inside_ul">' + category_sub + '</ul>'
+        elif re.search(r"^user:([^/]*)", name):
+            match = re.search(r"^user:([^/]*)", name)
+            user_name = html.escape(match.group(1))
+            user_doc = '''
+                <div id="get_user_info"></div>
+                <script>load_user_info("''' + user_name + '''");</script>
+                <hr class="main_hr">
             '''
+            if name == 'user:' + user_name:
+                menu += [['w/' + url_pas(name) + '/' + url_pas(get_time().split()[0]), load_lang('today_doc')]]
+        elif re.search(r"^file:", name):
+            mime_type = re.search(r'([^.]+)$', name)
+            if mime_type:
+                mime_type = mime_type.group(1).lower()
+            else:
+                mime_type = 'jpg'
+
+            file_name = re.sub(r'\.([^.]+)$', '', name)
+            file_name = re.sub(r'^file:', '', file_name)
+
+            file_all_name = sha224_replace(file_name) + '.' + mime_type
+            file_path_name = os.path.join(load_image_url(), file_all_name)
+            if os.path.exists(file_path_name):
+                file_size = str(round(os.path.getsize(file_path_name) / 1000, 1))
+                file_data = '''
+                    <img src="/image/''' + url_pas(file_all_name) + '''">
+                    <h2>DATA</h2>
+                    <table>
+                        <tr><td>URL</td><td><a href="/image/''' + url_pas(file_all_name) + '''">LINK</a></td></tr>
+                        <tr><td>VOLUME</td><td>''' + file_size + '''KB</td></tr>
+                    </table>
+                    <h2>CONTENT</h2>
+                '''
+
+                menu += [['delete_file/' + url_pas(name), load_lang('file_delete')]]
+            else:
+                file_data = ''
+
+        if num != '0':
+            curs.execute(db_change("select title from history where title = ? and id = ? and hide = 'O'"), [name, num])
+            if curs.fetchall() and admin_check(6) != 1:
+                return redirect('/history/' + url_pas(name))
 
-            menu += [['delete/doc_file/' + url_pas(name), load_lang('file_delete')]]
+            curs.execute(db_change("select data from history where title = ? and id = ?"), [name, num])
         else:
-            file_data = ''
-            
-    if num != '0':
-        curs.execute(db_change("select title from history where title = ? and id = ? and hide = 'O'"), [name, num])
-        if curs.fetchall() and admin_check(6) != 1:
-            return redirect('/history/' + url_pas(name))
-
-        curs.execute(db_change("select data from history where title = ? and id = ?"), [name, num])
-    else:
-        curs.execute(db_change("select data from data where title = ?"), [name])
-
-    data = curs.fetchall()
-    end_data = render_set(
-        doc_name = name,
-        doc_data = data[0][0] if data else None
-    )
-
-    if end_data == 'HTTP Request 401.3':
-        response_data = 401
-
-        curs.execute(db_change('select data from other where name = "error_401"'))
-        sql_d = curs.fetchall()
-        if sql_d and sql_d[0][0] != '':
-            end_data = '<h2>' + load_lang('error') + '</h2><ul class="inside_ul"><li>' + sql_d[0][0] + '</li></ul>'
+            curs.execute(db_change("select data from data where title = ?"), [name])
+
+        data = curs.fetchall()
+        end_data = render_set(
+            doc_name = name,
+            doc_data = data[0][0] if data else None
+        )
+
+        if end_data == 'HTTP Request 401.3':
+            response_data = 401
+
+            curs.execute(db_change('select data from other where name = "error_401"'))
+            sql_d = curs.fetchall()
+            if sql_d and sql_d[0][0] != '':
+                end_data = '<h2>' + load_lang('error') + '</h2><ul class="inside_ul"><li>' + sql_d[0][0] + '</li></ul>'
+            else:
+                end_data = '<h2>' + load_lang('error') + '</h2><ul class="inside_ul"><li>' + load_lang('authority_error') + '</li></ul>'
+        elif end_data == 'HTTP Request 404':
+            response_data = 404
+
+            curs.execute(db_change('select data from other where name = "error_404"'))
+            sql_d = curs.fetchall()
+            if sql_d and sql_d[0][0] != '':
+                end_data = '<h2>' + load_lang('error') + '</h2><ul class="inside_ul"><li>' + sql_d[0][0] + '</li></ul>'
+            else:
+                end_data = '<h2>' + load_lang('error') + '</h2><ul class="inside_ul"><li>' + load_lang('decument_404_error') + '</li></ul>'
+
+            curs.execute(db_change('' + \
+                'select ip, date, leng, send, id from history ' + \
+                'where title = ? and hide != "O" order by id + 0 desc limit 3' + \
+            ''), [name])
+            sql_d = curs.fetchall()
+            if sql_d:
+                end_data += '<h2>' + load_lang('history') + '</h2><ul class="inside_ul">'
+                for i in sql_d:
+                    if re.search(r"\+", i[2]):
+                        leng = '<span style="color:green;">(' + i[2] + ')</span>'
+                    elif re.search(r"\-", i[2]):
+                        leng = '<span style="color:red;">(' + i[2] + ')</span>'
+                    else:
+                        leng = '<span style="color:gray;">(' + i[2] + ')</span>'
+
+                    end_data += '<li>' + i[1] + ' | r' + i[4] + ' | ' + ip_pas(i[0]) + ' | ' + leng + (' | ' + i[3] if i[3] != '' else '') + '</li>'
+
+                end_data += '<li><a href="/history/' + url_pas(name) + '">(...)</a></li></ul>'
         else:
-            end_data = '<h2>' + load_lang('error') + '</h2><ul class="inside_ul"><li>' + load_lang('authority_error') + '</li></ul>'
-    elif end_data == 'HTTP Request 404':
-        response_data = 404
-
-        curs.execute(db_change('select data from other where name = "error_404"'))
-        sql_d = curs.fetchall()
-        if sql_d and sql_d[0][0] != '':
-            end_data = '<h2>' + load_lang('error') + '</h2><ul class="inside_ul"><li>' + sql_d[0][0] + '</li></ul>'
+            response_data = 200
+
+        if num != '0':
+            menu += [['history/' + url_pas(name), load_lang('history')]]
+            sub = ' (r' + str(num) + ')'
+            acl = 0
+            r_date = 0
         else:
-            end_data = '<h2>' + load_lang('error') + '</h2><ul class="inside_ul"><li>' + load_lang('decument_404_error') + '</li></ul>'
-
-        curs.execute(db_change('' + \
-            'select ip, date, leng, send, id from history ' + \
-            'where title = ? and hide != "O" order by id + 0 desc limit 3' + \
-        ''), [name])
-        sql_d = curs.fetchall()
-        if sql_d:
-            end_data += '<h2>' + load_lang('history') + '</h2><ul class="inside_ul">'
-            for i in sql_d:
-                if re.search(r"\+", i[2]):
-                    leng = '<span style="color:green;">(' + i[2] + ')</span>'
-                elif re.search(r"\-", i[2]):
-                    leng = '<span style="color:red;">(' + i[2] + ')</span>'
-                else:
-                    leng = '<span style="color:gray;">(' + i[2] + ')</span>'
-
-                end_data += '<li>' + i[1] + ' | r' + i[4] + ' | ' + ip_pas(i[0]) + ' | ' + leng + (' | ' + i[3] if i[3] != '' else '') + '</li>'
-
-            end_data += '<li><a href="/history/' + url_pas(name) + '">(...)</a></li></ul>'
-    else:
-        response_data = 200
-
-    if num != '0':
-        menu += [['history/' + url_pas(name), load_lang('history')]]
-        sub = ' (r' + str(num) + ')'
-        acl = 0
-        r_date = 0
-    else:
-        curs.execute(db_change("select title from acl where title = ?"), [name])
-        acl = 1 if curs.fetchall() else 0
-        menu_acl = 1 if acl_check(name) == 1 else 0
-        if response_data == 404:
-            menu += [['edit/' + url_pas(name), load_lang('create'), menu_acl]] 
+            curs.execute(db_change("select title from acl where title = ?"), [name])
+            acl = 1 if curs.fetchall() else 0
+            menu_acl = 1 if acl_check(name) == 1 else 0
+            if response_data == 404:
+                menu += [['edit/' + url_pas(name), load_lang('create'), menu_acl]] 
+            else:
+                menu += [['edit/' + url_pas(name), load_lang('edit'), menu_acl]]
+
+            menu += [
+                ['topic/' + url_pas(name), load_lang('discussion'), topic], 
+                ['history/' + url_pas(name), load_lang('history')], 
+                ['xref/' + url_pas(name), load_lang('backlink')], 
+                ['acl/' + url_pas(name), load_lang('acl'), acl],
+            ]
+
+            """
+            if name_doc_pass != '':
+                menu += [['w/' + url_pas(name), load_lang('pass')]]
+                end_data = '''
+                    <div id="redirect">
+                        <a href="/w/''' + url_pas(name_doc_pass) + '/doc_from/' + url_pas(name) + '">' + name_doc_pass + '</a> ⇨ <b>' + name + '''</b>
+                    </div>
+                    <br>
+                ''' + end_data
+            """
+
+            if uppage != 0:
+                menu += [['w/' + url_pas(uppage), load_lang('upper')]]
+
+            if down:
+                menu += [['down/' + url_pas(name), load_lang('sub')]]
+
+            curs.execute(db_change("select date from history where title = ? order by date desc limit 1"), [name])
+            r_date = curs.fetchall()
+            r_date = r_date[0][0] if r_date else 0
+
+        div = file_data + user_doc + end_data + category_doc
+
+        curs.execute(db_change("select data from other where name = 'body'"))
+        body = curs.fetchall()
+        div = (body[0][0] + div) if body else div
+
+        curs.execute(db_change("select data from other where name = 'bottom_body'"))
+        body = curs.fetchall()
+        div += body[0][0] if body else ''
+
+        if ip_or_user(ip) == 0:
+            curs.execute(db_change("select title from scan where user = ? and title = ?"), [ip, name])
+            watch_list = 2 if curs.fetchall() else 1
         else:
-            menu += [['edit/' + url_pas(name), load_lang('edit'), menu_acl]]
-            
-        menu += [
-            ['topic/' + url_pas(name), load_lang('discussion'), topic], 
-            ['history/' + url_pas(name), load_lang('history')], 
-            ['xref/' + url_pas(name), load_lang('backlink')], 
-            ['acl/' + url_pas(name), load_lang('acl'), acl],
-        ]
-
-        if name_doc_pass != '':
-            menu += [['w/' + url_pas(name), load_lang('pass')]]
-            end_data = '''
-                <div id="redirect">
-                    <a href="/w/''' + url_pas(name_doc_pass) + '/doc_from/' + url_pas(name) + '">' + name_doc_pass + '</a> ⇨ <b>' + name + '''</b>
-                </div>
-                <br>
-            ''' + end_data
-
-        if uppage != 0:
-            menu += [['w/' + url_pas(uppage), load_lang('upper')]]
-
-        if down:
-            menu += [['down/' + url_pas(name), load_lang('sub')]]
-
-        curs.execute(db_change("select date from history where title = ? order by date desc limit 1"), [name])
-        r_date = curs.fetchall()
-        r_date = r_date[0][0] if r_date else 0
-
-    div = file_data + user_doc + end_data + category_doc
-
-    curs.execute(db_change("select data from other where name = 'body'"))
-    body = curs.fetchall()
-    div = (body[0][0] + div) if body else div
-
-    curs.execute(db_change("select data from other where name = 'bottom_body'"))
-    body = curs.fetchall()
-    div += body[0][0] if body else ''
-
-    if ip_or_user(ip) == 0:
-        curs.execute(db_change("select title from scan where user = ? and title = ?"), [ip, name])
-        watch_list = 2 if curs.fetchall() else 1
-    else:
-        watch_list = 0
-
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), wiki_custom(), wiki_css([sub, r_date, watch_list])],
-        data = div,
-        menu = menu
-    )), response_data
+            watch_list = 0
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [name, wiki_set(), wiki_custom(), wiki_css([sub, r_date, watch_list])],
+            data = div,
+            menu = menu
+        )), response_data

+ 52 - 51
route/view_xref.py

@@ -1,53 +1,54 @@
 from .tool.func import *
 
-def view_xref_2(conn, name, xref_type = '1'):
-    curs = conn.cursor()
-
-    if acl_check(name, 'render') == 1:
-        return re_error('/ban')
-
-    num = int(number_check(flask.request.args.get('num', '1')))
-    sql_num = (num * 50 - 50) if num * 50 > 0 else 0
-    
-    if xref_type == '1':
-        div = '<a href="/xref/this/' + url_pas(name) + '">(' + load_lang('link_in_this') + ')</a><hr class="main_hr">'
-        
-        data_sub = '(' + load_lang('backlink') + ')'
-    else:
-        div = '<a href="/xref/' + url_pas(name) + '">(' + load_lang('normal') + ')</a><hr class="main_hr">'
-        
-        data_sub = '(' + load_lang('link_in_this') + ')'
-
-    div += '<ul class="inside_ul">'
-
-    sql_insert = ['link', 'title'] if xref_type == '1' else ['title', 'link']
-    curs.execute(db_change("" + \
-        "select distinct " + sql_insert[0] + ", type from back " + \
-        "where " + sql_insert[1] + " = ? and not type = 'no' and not type = 'nothing'" + \
-        "order by type asc, title asc limit ?, 50" + \
-    ""), [
-        name,
-        sql_num
-    ])
-
-    data_list = curs.fetchall()
-    for data in data_list:
-        div += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a>'
-
-        if data[1]:
-            div += ' (' + data[1] + ')'
-
-        curs.execute(db_change("select title from back where title = ? and type = 'include'"), [data[0]])
-        db_data = curs.fetchall()
-        if db_data:
-            div += ' <a id="inside" href="/xref/' + url_pas(data[0]) + '">(' + load_lang('backlink') + ')</a>'
-
-        div += '</li>'
-
-    div += '</ul>' + next_fix('/xref/' + url_pas(name) + '?change=' + xref_type + '&num=', num, data_list)
-
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), wiki_custom(), wiki_css([data_sub, 0])],
-        data = div,
-        menu = [['w/' + url_pas(name), load_lang('return')], ['backlink_reset/' + url_pas(name), load_lang('reset_backlink')]]
-    ))
+def view_xref(name = 'Test', xref_type = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if acl_check(name, 'render') == 1:
+            return re_error('/ban')
+
+        num = int(number_check(flask.request.args.get('num', '1')))
+        sql_num = (num * 50 - 50) if num * 50 > 0 else 0
+
+        if xref_type == 1:
+            div = '<a href="/xref_this/' + url_pas(name) + '">(' + load_lang('link_in_this') + ')</a><hr class="main_hr">'
+
+            data_sub = '(' + load_lang('backlink') + ')'
+        else:
+            div = '<a href="/xref/' + url_pas(name) + '">(' + load_lang('normal') + ')</a><hr class="main_hr">'
+
+            data_sub = '(' + load_lang('link_in_this') + ')'
+
+        div += '<ul class="inside_ul">'
+
+        sql_insert = ['link', 'title'] if xref_type == 1 else ['title', 'link']
+        curs.execute(db_change("" + \
+            "select distinct " + sql_insert[0] + ", type from back " + \
+            "where " + sql_insert[1] + " = ? and not type = 'no' and not type = 'nothing'" + \
+            "order by type asc, title asc limit ?, 50" + \
+        ""), [
+            name,
+            sql_num
+        ])
+
+        data_list = curs.fetchall()
+        for data in data_list:
+            div += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a>'
+
+            if data[1]:
+                div += ' (' + data[1] + ')'
+
+            curs.execute(db_change("select title from back where title = ? and type = 'include'"), [data[0]])
+            db_data = curs.fetchall()
+            if db_data:
+                div += ' <a id="inside" href="/xref/' + url_pas(data[0]) + '">(' + load_lang('backlink') + ')</a>'
+
+            div += '</li>'
+
+        div += '</ul>' + next_fix('/xref/' + url_pas(name) + '?change=' + str(xref_type) + '&num=', num, data_list)
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [name, wiki_set(), wiki_custom(), wiki_css([data_sub, 0])],
+            data = div,
+            menu = [['w/' + url_pas(name), load_lang('return')], ['xref_reset/' + url_pas(name), load_lang('reset_backlink')]]
+        ))

+ 2 - 2
version.json

@@ -1,7 +1,7 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.4 (stable1) (beta3) (dev9)",
-        "c_ver" : "3500105",
+        "r_ver" : "v3.4.5 (stable1) (beta3) (dev10)",
+        "c_ver" : "3500106",
         "s_ver" : "3500110"
     }
 }

+ 14 - 14
views/main_css/css/main.css

@@ -44,11 +44,11 @@ a {
     color: red;
 }
 
-#inside, #out_link, #out_link::before {
+#inside, #out_link, #out_link::before, .opennamu_link_out {
     color: green;
 }
 
-#out_link::before {
+#out_link::before, .opennamu_link_out::before {
     content: '🅴';
     
     font-weight: lighter;
@@ -74,35 +74,35 @@ a {
 }
 
 /* 토론 관련 */
-#toron {
+.opennamu_comment {
     width: 100%;
 }
 
-#toron_color_green {
+.opennamu_comment_color_green {
     background: palegreen;
 }
 
-#toron_color_blue {
+.opennamu_comment_color_blue {
     background: paleturquoise;
 }
 
-#toron_color_red {
+.opennamu_comment_color_red {
     background: palevioletred;
 }
 
-#toron_color_normal {
+.opennamu_comment_color_default {
     background: palegoldenrod;
 }
 
-#toron_color_grey {
+.opennamu_comment_color_gray {
     background: gainsboro;
 }
 
-#toron_color_not {
+.opennamu_comment_blind {
     display: none;
 }
 
-#topic_scroll {
+.opennamu_comment_scroll {
     max-height: 500px;
     
     overflow: scroll;
@@ -111,16 +111,16 @@ a {
     scrollbar-width: none;
 }
 
-#topic_scroll::-webkit-scrollbar {
+.opennamu_comment_scroll::-webkit-scrollbar {
     display: none;
 }
 
-.topic_content {
+.opennamu_comment_textarea {
     height: 200px;
 }
 
 /* 위키 내용 관련 */
-#toc, .opennamuTOC {
+#toc, .opennamu_TOC {
     border: 1px solid gainsboro;
     padding: 20px;
     
@@ -146,7 +146,7 @@ pre {
     white-space: pre-wrap;
 }
 
-#toc_title, .opennamuTOCtitle {
+#toc_title, .opennamu_TOC_title {
     font-size: 1.2rem;
 }
 

+ 1 - 2
views/main_css/js/func/shortcut.js

@@ -11,7 +11,7 @@ document.onkeypress = function(e) {
         shortcut_check !== 'input' &&
         shortcut_check !== 'textarea'
     ) {
-        let doc_shortcut = /^\/(w|history|edit|acl|topic|xref)\//i;
+        let doc_shortcut = /^\/(w|w_rev|w_from|history|edit|acl|topic|xref)\//i;
 
         shortcut_key_list[e.key] = 1;
         if(shortcut_key_list['f'] === 1) {
@@ -26,7 +26,6 @@ document.onkeypress = function(e) {
 
         if(window.location.pathname.match(doc_shortcut)) {
             let doc_href = window.location.pathname.replace(doc_shortcut, '');
-            doc_href = doc_href.replace(/(?:%2F|\/)(?:doc_from|doc_rev)(?:%2F|\/)(?:((?!%2F|\/).)+)$/, '');
             
             if(shortcut_key_list['w'] === 1) {
                 window.location.pathname = '/w/' + doc_href;

+ 89 - 45
views/main_css/js/render/markdown.js

@@ -9,8 +9,8 @@ class opennamu_render_markdown {
         doc_name
     ) {
         this.doc_data = document.getElementById(render_part_id_add + render_part_id).innerHTML;
-
-        render_part_id_add = render_part_id_add.replace(/_/g, '<underBar>');
+            
+        this.doc_data = this.doc_data.replace(/_/g, '<uBar>');
 
         this.doc_data = this.doc_data.replace(/&amp;/g, '&');
         this.doc_data = '<brStart>\n' + this.doc_data + '\n<brEnd>';
@@ -108,7 +108,7 @@ class opennamu_render_markdown {
             return '<render' + parser_count_str + 'Span>' + x1 + '</render' + parser_count_str + 'Span>';
         });
         
-        this.doc_data = this.doc_data.replace(/__((?:(?!__|\n).)+)__/g, function(match, x1) {
+        this.doc_data = this.doc_data.replace(/<uBar><uBar>((?:(?!<uBar><uBar>|\n).)+)<uBar><uBar>/g, function(match, x1) {
             parser_count += 1;
             let parser_count_str = String(parser_count);
             
@@ -128,7 +128,7 @@ class opennamu_render_markdown {
             return '<render' + parser_count_str + 'Span>' + x1 + '</render' + parser_count_str + 'Span>';
         });
         
-        this.doc_data = this.doc_data.replace(/_([^_\n]+)_/g, function(match, x1) {
+        this.doc_data = this.doc_data.replace(/<uBar>(((?!<uBar>).)+)<uBar>/g, function(match, x1) {
             parser_count += 1;
             let parser_count_str = String(parser_count);
             
@@ -204,8 +204,8 @@ class opennamu_render_markdown {
                 let heading_n_str = String(heading_n);
                 
                 toc_data += '' +
-                    '<a href="#opennamuHeading' + heading_list_str_2 + '">' + heading_list_str + '</a> ' +
-                    '<span id="opennamuTOCcontent' + heading_n_str + '"></span>' +
+                    '<a href="#opennamu_heading_' + heading_list_str_2 + '">' + heading_list_str + '</a> ' +
+                    '<span id="opennamu_TOC_content_' + heading_n_str + '"></span>' +
                     '<br>' +
                 ''
                 
@@ -214,9 +214,9 @@ class opennamu_render_markdown {
 
                 return '' + 
                     '\n<brEnd>' + 
-                    '<h' + heading_level_str + ' id="opennamuHeading' + heading_list_str_2 + '">' + 
-                        '<a href="#opennamuTOC">' + heading_list_str + '</a> ' + 
-                        '<span id="opennamuHeadingContent' + heading_n_str + '">' + heading_data + '</span>' + 
+                    '<h' + heading_level_str + ' id="opennamu_heading_' + heading_list_str_2 + '">' + 
+                        '<a href="#opennamu_TOC">' + heading_list_str + '</a> ' + 
+                        '<span id="opennamu_heading_content_' + heading_n_str + '">' + heading_data + '</span>' + 
                     '</h' + heading_level_str + '>' +
                     '<brStart>\n' +
                 '';
@@ -296,7 +296,7 @@ class opennamu_render_markdown {
                         link_sub = x1;
                     }
                     
-                    parser_data_temp['render' + parser_count_str + 'Span'] = '<a href="' + link_main + '">';
+                    parser_data_temp['render' + parser_count_str + 'Span'] = '<a class="opennamu_link_out" href="' + link_main + '">';
                     parser_data_temp['/render' + parser_count_str + 'Span'] = '</a>';
 
                     return '<render' + parser_count_str + 'Span>' + link_sub + '</render' + parser_count_str + 'Span>';
@@ -326,7 +326,7 @@ class opennamu_render_markdown {
                     link_main = render_main.do_func_xss_decode(link_main);
                     link_main = opennamu_do_url_encode(link_main);
 
-                    parser_data_temp['render' + parser_count_str + 'Span'] = '<a class="' + render_part_id_add + 'opennamuLink" title="' + link_title + '" href="/w/' + link_main + '">';
+                    parser_data_temp['render' + parser_count_str + 'Span'] = '<a class="' + render_part_id_add + 'opennamu_link" title="' + link_title + '" href="/w/' + link_main + '">';
                     parser_data_temp['/render' + parser_count_str + 'Span'] = '</a>';
 
                     return '<render' + parser_count_str + 'Span>' + link_sub + '</render' + parser_count_str + 'Span>';
@@ -336,6 +336,21 @@ class opennamu_render_markdown {
         
         this.doc_data = this.doc_data.replace(/<linkBlink>/g, '[]()');
         
+        this.doc_data = this.doc_data.replace(/&lt;(https?:\/\/(?:(?:(?!&lt;|&gt;).)+))&gt;/g, function(match, x1) {
+            parser_count += 1;
+            let parser_count_str = String(parser_count);
+            
+            let link_main = render_main.do_func_parser_to_text(x1, 'nowikiLink');
+            link_main = render_main.do_func_xss_encode(link_main);
+            
+            let link_sub = x1;
+
+            parser_data_temp['render' + parser_count_str + 'Span'] = '<a class="opennamu_link_out" href="' + link_main + '">';
+            parser_data_temp['/render' + parser_count_str + 'Span'] = '</a>';
+
+            return '<render' + parser_count_str + 'Span>' + link_sub + '</render' + parser_count_str + 'Span>';
+        });
+        
         this.parser_count['parser'] = parser_count;
         this.parser_data_temp = parser_data_temp;
     }
@@ -343,7 +358,7 @@ class opennamu_render_markdown {
     do_part_footnote_list() {
         if(this.parser_data_temp_other['footnote'] !== '') {
             let footnote = '';
-            footnote += '<ul id="footnote<underBar>data">';
+            footnote += '<ul id="footnote_data">';
             footnote += this.parser_data_temp_other['footnote'];
             footnote += '</ul>';
             
@@ -462,7 +477,7 @@ class opennamu_render_markdown {
                 link_main = render_main.do_func_xss_decode(link_main);
                 link_main = opennamu_do_url_encode(link_main);
                 
-                parser_data_temp_other['category'] += '<a class="' + render_part_id_add + 'opennamuLink" title="' + link_title + '" href="/w/' + link_main + '">';
+                parser_data_temp_other['category'] += '<a class="' + render_part_id_add + 'opennamu_link" title="' + link_title + '" href="/w/' + link_main + '">';
                 parser_data_temp_other['category'] += category_data;
                 parser_data_temp_other['category'] += '</a>';
                 parser_data_temp_other['category'] += ' | ';
@@ -471,8 +486,8 @@ class opennamu_render_markdown {
             } else if(x1 === 'toc') {
                 if(parser_data_temp_other['toc'] !== '') {
                     return '' +
-                        '<div class="opennamuTOC">' + 
-                            '<span class="opennamuTOCtitle">' +
+                        '<div id="opennamu_TOC" class="opennamu_TOC">' + 
+                            '<span class="opennamu_TOC_title">' +
                                 'TOC' +
                             '</span>' + 
                             '<br>' + 
@@ -485,7 +500,7 @@ class opennamu_render_markdown {
                 }
             }
             else {
-                return '';
+                return match;
             }
         });
         
@@ -500,6 +515,7 @@ class opennamu_render_markdown {
         let parser_count = this.parser_count['parser'];
         let parser_data_temp = this.parser_data_temp;
 
+        this.doc_data = this.doc_data.replace(/\\\n/g, '\n');
         this.doc_data = this.doc_data.replace(/\\(&#x27;|&quot;|&lt;|&gt;|&amp;|.)/g, function(match, x1) {
             let nowiki_data = x1;
             
@@ -553,37 +569,12 @@ class opennamu_render_markdown {
             return '<nowiki' + parser_count_str + 'Span>' + '</nowiki' + parser_count_str + 'Span>';
         });
         
-        this.doc_data = this.doc_data.replace(
-            /&lt;pre&gt;(?:\n| )*&lt;code&gt;((?:(?:(?!&lt;pre&gt;(?:\n| )*&lt;code&gt;|&lt;\/code&gt;(?:\n| )*&lt;\/pre&gt;).)|\n)+)&lt;\/code&gt;(?:\n| )*&lt;\/pre&gt;/g,
-            function(match, x1) {
-            let nowiki_data = render_main.do_func_parser_to_text(x1, 'nowiki');
-            
-            parser_count += 1;
-            let parser_count_str = String(parser_count);
-            
-            if(nowiki_data.match(/\n/)) {
-                parser_data_temp['nowiki' + parser_count_str + 'Span'] = match;
-                parser_data_temp['/nowiki' + parser_count_str + 'Span'] = '';
-                
-                parser_data_temp['nowiki' + parser_count_str + 'SpanEnd'] = '<pre>' + nowiki_data;
-                parser_data_temp['/nowiki' + parser_count_str + 'SpanEnd'] = '</pre>';
-            } else {
-                parser_data_temp['nowiki' + parser_count_str + 'Span'] = match;
-                parser_data_temp['/nowiki' + parser_count_str + 'Span'] = '';
-                
-                parser_data_temp['nowiki' + parser_count_str + 'SpanEnd'] = '<code>' + nowiki_data;
-                parser_data_temp['/nowiki' + parser_count_str + 'SpanEnd'] = '</code>';
-            }
-            
-            return '<nowiki' + parser_count_str + 'Span>' + '</nowiki' + parser_count_str + 'Span>';
-        });
-        
         this.parser_count['parser'] = parser_count;
         this.parser_data_temp = parser_data_temp;
     }
     
-    do_part_horizon() {
-        let horizone_regex = /\n((?:\*|\* |_|_ ){3,})\n/;
+    do_part_horizon() {        
+        let horizone_regex = /\n((?:\*|\* |-|- ){3,})\n/;
         while(this.doc_data.match(horizone_regex)) {
             this.doc_data = this.doc_data.replace(horizone_regex, function(match, x1, x2) {
                 return '\n<brEnd><hr><brStart>\n';
@@ -591,12 +582,63 @@ class opennamu_render_markdown {
         }
     }
     
+    do_part_blockquote() {
+        let parser_count = this.parser_count['parser'];
+        let parser_data_temp = this.parser_data_temp;
+        
+        let blockquote_regex = /((?:\n&gt;(?:[^\n]+))+)/;
+        while(this.doc_data.match(blockquote_regex)) {
+            this.doc_data = this.doc_data.replace(blockquote_regex, function(match, x1) {
+                let blockquote_data = '<brStart>' + x1;
+                blockquote_data = blockquote_data.replace(/\n&gt;	?/g, '\n');
+
+                parser_count += 1;
+                let parser_count_str = String(parser_count);
+
+                parser_data_temp['render' + parser_count_str + 'Span'] = '<blockquote>';
+                parser_data_temp['/render' + parser_count_str + 'Span'] = '</blockquote>';
+
+                return '\n<brEnd><render' + parser_count_str + 'Span>' + blockquote_data + '</render' + parser_count_str + 'Span>';
+            });
+        }
+        
+        this.parser_count['parser'] = parser_count;
+        this.parser_data_temp = parser_data_temp;
+    }
+    
+    do_part_list() {
+        let parser_count = this.parser_count['parser'];
+        let parser_data_temp = this.parser_data_temp;
+        
+        /*
+        // 여기 파트 개선 필요
+        this.doc_data = this.doc_data.replace(/((?:\n(?: )*\* ?(?:[^\n]+))+)/g, function(match, x1) {
+            let list_data = x1;
+            let list_depth = -1;
+            
+            list_data = list_data.replace(/\n( )*\* ?([^\n]+)/g, function(match, x1, x2) {
+                return '';
+            });
+
+            parser_count += 1;
+            let parser_count_str = String(parser_count);
+
+            parser_data_temp['render' + parser_count_str + 'Span'] = '<ul>';
+            parser_data_temp['/render' + parser_count_str + 'Span'] = '</ul>';
+
+            return '\n<brEnd><render' + parser_count_str + 'Span>' + list_data + '</render' + parser_count_str + 'Span>';
+        });
+        */
+        
+        this.parser_count['parser'] = parser_count;
+        this.parser_data_temp = parser_data_temp;
+    }
+    
     do_part_final() {
         this.doc_data = this.doc_data.replace(/<brStart>\n?/g, '');
         this.doc_data = this.doc_data.replace(/\n?<brEnd>/g, '');
         
-        this.doc_data = this.doc_data.replace(/<underBar>/g, '_');
-        this.render_part_id_add = this.render_part_id_add.replace(/<underBar>/g, '_');
+        this.doc_data = this.doc_data.replace(/<uBar>/g, '_');
         
         this.doc_data = this.doc_data.replace(/\n/g, '<br>');
         
@@ -615,6 +657,8 @@ class opennamu_render_markdown {
     // Main Part
     do_main() {
         this.do_part_nowiki();
+        this.do_part_list();
+        this.do_part_blockquote();
         this.do_part_heading();
         this.do_part_horizon();
         this.do_part_footnote();

+ 11 - 11
views/main_css/js/render/wiki.js

@@ -18,10 +18,10 @@ class opennamu_render_wiki {
         let link_list_sub = [];
         for(
             let for_a = 0;
-            document.getElementsByClassName(this.render_part_id_add + 'opennamuLink')[for_a];
+            document.getElementsByClassName(this.render_part_id_add + 'opennamu_link')[for_a];
             for_a++
         ) {
-            let link_data = document.getElementsByClassName(this.render_part_id_add + 'opennamuLink')[for_a];
+            let link_data = document.getElementsByClassName(this.render_part_id_add + 'opennamu_link')[for_a];
             
             link_list_sub.push(link_data.title);
             
@@ -43,8 +43,8 @@ class opennamu_render_wiki {
                 let xhr_data = JSON.parse(this.responseText);
                 for(let for_a in link_list) {
                     if(!xhr_data[for_a]) {
-                        for(var for_b in link_list[for_a]) {
-                            document.getElementsByClassName(render_part_id_add + 'opennamuLink')[link_list[for_a][for_b]].id = "not_thing";
+                        for(let for_b in link_list[for_a]) {
+                            document.getElementsByClassName(render_part_id_add + 'opennamu_link')[link_list[for_a][for_b]].id = "not_thing";
                         }
                     }
                 }
@@ -53,19 +53,19 @@ class opennamu_render_wiki {
     }
     
     do_part_toc() {
-        if(document.getElementById('opennamuTOCcontent1')) {
+        if(document.getElementById('opennamu_TOC_content_1')) {
             for(
                 let for_a = 1;
-                document.getElementById('opennamuHeadingContent' + String(for_a));
+                document.getElementById('opennamu_heading_content_' + String(for_a));
                 for_a++
             ) {
-                let heading_data = document.getElementById('opennamuHeadingContent' + String(for_a));
-                document.getElementById('opennamuTOCcontent' + String(for_a)).innerHTML = heading_data.innerText;
+                let heading_data = document.getElementById('opennamu_heading_content_' + String(for_a));
+                document.getElementById('opennamu_TOC_content_' + String(for_a)).innerHTML = heading_data.innerText;
 
-                document.getElementById('opennamuHeadingContent' + String(for_a)).id = heading_data.innerText;
+                document.getElementById('opennamu_heading_content_' + String(for_a)).id = heading_data.innerText;
             }
 
-            let toc_data_all = document.getElementsByClassName('opennamuTOC');
+            let toc_data_all = document.getElementsByClassName('opennamu_TOC');
             let toc_data = '';
             for(
                 let for_a = 0;
@@ -76,7 +76,7 @@ class opennamu_render_wiki {
                     toc_data = toc_data_all[0].innerHTML;
                 }
 
-                document.getElementsByClassName('opennamuTOC')[for_a].innerHTML = toc_data;
+                document.getElementsByClassName('opennamu_TOC')[for_a].innerHTML = toc_data;
             }
         }
     }

+ 54 - 49
views/main_css/js/render_onmark.js

@@ -218,25 +218,27 @@ function do_onmark_heading_render(
         ''
         data_js += 'do_onmark_set_toc_name("' + heading_level_string_no_end + '");\n';
         
-        data = data.replace(heading_re, 
-            '\n' +
-            (toc_n === 1 ? '' : '</div>') +
-            '<h' + heading_level + ' class="render_heading_text">' + 
-                '<a href="#toc" id="s-' + heading_level_string_no_end + '">' + heading_level_string + '</a> ' + 
-                '<span id="heading_text_' + heading_level_string_no_end + '">' +
-                    heading_data_text + 
-                '</span> ' +
-                '<a id="edit_load_' + String(toc_n) + '" ' +
-                    'style="font-size: 70%;"' +
-                    'href="/edit/' + do_url_change(name_doc) + '/doc_section/' + String(toc_n) + '">✎</a> ' +
-                '<a href="javascript:void(0);" ' +
-                    'onclick="javascript:do_open_folding(\'' + name_include + 'in_data_' + String(toc_n) + '\', this);"' +
-                    'style="font-size: 70%;">' + (heading_data[2] ? '⊕' : '⊖') + '</a>' +
-            '</h' + heading_level + '>' +
-            '<div   id="' + name_include + 'in_data_' + String(toc_n) + '" ' +
-                    'style="display: ' + (heading_data[2] ? 'none' : 'block') + ';">' +
-            '<end_point>\n'
-       );
+        data = data.replace(heading_re, function() {
+            return '' +
+                '\n' +
+                (toc_n === 1 ? '' : '</div>') +
+                '<h' + heading_level + ' class="render_heading_text">' + 
+                    '<a href="#toc" id="s-' + heading_level_string_no_end + '">' + heading_level_string + '</a> ' + 
+                    '<span id="heading_text_' + heading_level_string_no_end + '">' +
+                        heading_data_text + 
+                    '</span> ' +
+                    '<a id="edit_load_' + String(toc_n) + '" ' +
+                        'style="font-size: 70%;"' +
+                        'href="/edit/' + do_url_change(name_doc) + '/doc_section/' + String(toc_n) + '">✎</a> ' +
+                    '<a href="javascript:void(0);" ' +
+                        'onclick="javascript:do_open_folding(\'' + name_include + 'in_data_' + String(toc_n) + '\', this);"' +
+                        'style="font-size: 70%;">' + (heading_data[2] ? '⊕' : '⊖') + '</a>' +
+                '</h' + heading_level + '>' +
+                '<div   id="' + name_include + 'in_data_' + String(toc_n) + '" ' +
+                        'style="display: ' + (heading_data[2] ? 'none' : 'block') + ';">' +
+                '<end_point>\n' +
+            ''
+        });
     }
     
     if(toc_data !== '') {
@@ -547,14 +549,16 @@ function do_onmark_footnote_render(data, name_include) {
                     '</a> <span id="' + name_include + 'fn-' + String(i) + '">' + footnote_line_data + '</span>' +
                 '</li>' +
             '';
-            data = data.replace(footnote_re, '' +
-                '<sup>' +
-                    '<a href="javascript:do_open_foot(\'' + name_include + '\', \'fn-' + String(i) + '\', 0);" ' +
-                        'id="' + name_include + 'rfn-' + String(i) + '">' +
-                        '(' + footnote_name + ')' +
-                    '</a>' +
-                '</sup><span id="' + name_include + 'dfn-' + String(i) + '"></span>' +
-           '');
+            data = data.replace(footnote_re, function() {
+                return '' +
+                    '<sup>' +
+                        '<a href="javascript:do_open_foot(\'' + name_include + '\', \'fn-' + String(i) + '\', 0);" ' +
+                            'id="' + name_include + 'rfn-' + String(i) + '">' +
+                            '(' + footnote_name + ')' +
+                        '</a>' +
+                    '</sup><span id="' + name_include + 'dfn-' + String(i) + '"></span>' +
+               ''
+            });
             
             i += 1;
         } else {
@@ -562,7 +566,7 @@ function do_onmark_footnote_render(data, name_include) {
                 footnote_end_data = '<ul id="footnote_data">' + footnote_end_data + '</ul>';   
             }
             
-            data = data.replace(footnote_re, footnote_end_data);    
+            data = data.replace(footnote_re, function() { return footnote_end_data });    
             footnote_end_data = '';
         }
     }
@@ -879,10 +883,12 @@ function do_onmark_include_render(data, data_js, name_include, data_nowiki) {
                 include_data = include_data.replace(include_add_re, '');
             }
             
-            data = data.replace(include_re,
-                '<a id="' + name_include + 'include_link" class="include_' + String(i) + '" href="">(' + include_name + ')</a>' +
-                '<div id="' + name_include + 'include_' + String(i) + '"></div>'
-            );
+            data = data.replace(include_re, function() {
+                return '' + 
+                    '<a id="' + name_include + 'include_link" class="include_' + String(i) + '" href="">(' + include_name + ')</a>' +
+                    '<div id="' + name_include + 'include_' + String(i) + '"></div>' +
+                ''
+            });
             
             data_js += 'load_include("' + do_js_safe_change(include_name) + '", "' + name_include + 'include_' + String(i) + '", ' + JSON.stringify(include_add_data) + ');\n'
         }
@@ -1022,7 +1028,7 @@ function do_onmark_table_render_sub(data, data_col) {
             }
         }
         
-        data = data.replace(table_option_re, no_option);
+        data = data.replace(table_option_re, function() { return no_option });
     }
     
     data = data.replace('<lt>', '&lt;');
@@ -1182,15 +1188,17 @@ function do_onmark_list_sub_render(data) {
             '';
         });
 
-        data = data.replace(quote_re, '' +
-            '\n' +
-            '<blockquote>' + 
+        data = data.replace(quote_re, function() {
+            return '' +
+                '\n' +
+                '<blockquote>' + 
+                    '<end_point>\n' +
+                    quote_end_data + 
+                    '\n<start_point>' +
+                '</blockquote>' +
                 '<end_point>\n' +
-                quote_end_data + 
-                '\n<start_point>' +
-            '</blockquote>' +
-            '<end_point>\n' +
-       '');
+           ''
+        });
     }
     
     var list_re = /\n((?:(?:(?: )*)\* ?(?:(?:(?!\n).)+)\n)+)/;
@@ -1209,13 +1217,13 @@ function do_onmark_list_sub_render(data) {
             return '<li style="margin-left: ' + String(list_leng * 20) + 'px">' + x_2 + '</li>';
         });
 
-        data = data.replace(list_re, '\n<ul>' + list_end_data + '</ul><end_point>\n');
+        data = data.replace(list_re, function() { return '\n<ul>' + list_end_data + '</ul><end_point>\n' });
     }
     
     return data;
 }
 
-function do_onmark_list_render(data) {
+function do_onmark_list_render(data) {    
     var wiki_re = /<wiki_s_2 ([^>]+)>((?:(?!<wiki_s_2 |<wiki_e_2>).)+)<wiki_e_2>/s;
     while(1) {
         if(!data.match(wiki_re)) {
@@ -1288,15 +1296,13 @@ function do_onmark_redirect_render(data, data_js, name_doc) {
         if(
             name_include == '' &&
             window.location.search === '' &&
-            window.location.pathname.match(/\/w\//) &&
-            !window.location.pathname.match(/\/doc_from\//)
+            window.location.pathname.match(/\/w\//)
         ) {
-            window.location.href = '/w/' + do_url_change(link_main) + '/doc_from/' + do_url_change(name_doc) + link_sub;
+            window.location.href = '/w_from/' + do_url_change(link_main);
         }
         
         return [
-            '/w/' + do_url_change(link_main) + 
-            '/doc_from/' + do_url_change(name_doc) + 
+            '/w_from/' + do_url_change(link_main), 
             link_sub,
             data_js, 
             1
@@ -1341,7 +1347,6 @@ function do_onmark_render(
     var data_nowiki = {};
         
     name_doc = do_xss_change(name_doc);
-    console.log(name_doc);
 
     let xhr = new XMLHttpRequest();
     xhr.open("GET", "/api/setting/inter_wiki");

+ 0 - 9
views/main_css/js/route/main_skin_set.js

@@ -1,9 +0,0 @@
-"use strict";
-
-function opennamu_do_main_skin_set() {
-
-}
-
-function opennamu_route_main_skin_set() {
-    
-}

+ 22 - 11
views/main_css/js/route/thread.js

@@ -65,16 +65,16 @@ function opennamu_do_thread_make(topic_num, type_do = 'top', some = '', where =
                 }
                 
                 if(blind === 'O') {
-                    color_b = 'toron_color_not';
+                    color_b = 'opennamu_comment_blind';
                 } else {
-                    color_b = 'toron_color';
+                    color_b = 'opennamu_comment_blind_not';
                 }
                 
                 if(blind === 'O') {
                     ip += ' <a href="/admin_log?search=blind%20(code%20' + topic_num + '#' + key + '">(B)</a>';
                     
                     if(admin === '1') {
-                        ip += ' <a href="/thread/' + topic_num + '/comment/' + key + '/raw">(R)</a>';
+                        ip += ' <a href="javascript:opennamu_do_open_comment(\'' + key + '\');">(O)</a>';
                     }
                 }
                 
@@ -83,27 +83,29 @@ function opennamu_do_thread_make(topic_num, type_do = 'top', some = '', where =
                 }
                 
                 if(type_do === 'top') {
-                    color_t = 'toron_color_red';
+                    color_t = 'opennamu_comment_color_red';
                 } else if(blind === '1') {
-                    color_t = 'toron_color_blue';
+                    color_t = 'opennamu_comment_color_blue';
+                } else if(blind === 'O') {
+                    color_t = 'opennamu_comment_color_gray';
                 } else if(ip_o === ip_first) {
-                    color_t = 'toron_color_green';
+                    color_t = 'opennamu_comment_color_green';
                 } else {
-                    color_t = 'toron_color_normal';
+                    color_t = 'opennamu_comment_color_default';
                 }
                 
                 data_a += '' + 
-                    '<table id="toron">' + 
+                    '<table class="opennamu_comment">' + 
                         '<tr>' + 
-                            '<td id="' + color_t + '">' + 
+                            '<td class="' + color_t + '">' + 
                                 '<a href="javascript:void(0);" id="' + key + '">#' + key + '</a> ' + 
                                 ip + 
                                 '<span style="float: right;">' + data_t[key]['date'] + '</span>' + 
                             '</td>' + 
                         '</tr>' + 
                         '<tr>' + 
-                            '<td id="' + color_b + '">' + 
-                                '<div id="topic_scroll">' + data_i_pas + '</div>' + 
+                            '<td class="' + color_b + '" id="opennamu_comment_data_' + key + '">' + 
+                                '<div class="opennamu_comment_scroll">' + data_i_pas + '</div>' + 
                             '</td>' + 
                         '</tr>' +
                     '</table>' + 
@@ -149,4 +151,13 @@ function opennamu_do_thread_make(topic_num, type_do = 'top', some = '', where =
             }
         }
     }
+}
+
+function opennamu_do_open_comment(key) {
+    let elementState = document.getElementById('opennamu_comment_data_' + key).style.display;
+    if(!elementState || elementState === 'none') {
+        document.getElementById('opennamu_comment_data_' + key).style.display = 'block';
+    } else {
+        document.getElementById('opennamu_comment_data_' + key).style.display = 'none';
+    }
 }