2du 5 лет назад
Родитель
Сommit
1ccab5524e
83 измененных файлов с 458 добавлено и 610 удалено
  1. 33 16
      app.py
  2. 68 72
      emergency_tool.py
  3. 4 4
      route/__init__.py
  4. 1 1
      route/alarm.py
  5. 1 1
      route/application_submitted.py
  6. 1 1
      route/applications.py
  7. 1 1
      route/edit.py
  8. 1 1
      route/edit_delete.py
  9. 1 1
      route/edit_many_delete.py
  10. 1 1
      route/edit_move.py
  11. 1 1
      route/edit_revert.py
  12. 1 1
      route/give_acl.py
  13. 26 25
      route/give_admin.py
  14. 1 1
      route/give_admin_groups.py
  15. 2 2
      route/give_delete_admin_group.py
  16. 1 1
      route/give_history_add.py
  17. 1 1
      route/give_user_ban.py
  18. 2 2
      route/give_user_check.py
  19. 1 1
      route/give_user_check_delete.py
  20. 1 1
      route/inter_wiki.py
  21. 1 1
      route/inter_wiki_plus.py
  22. 1 1
      route/list_acl.py
  23. 2 5
      route/list_admin.py
  24. 1 1
      route/list_admin_use.py
  25. 1 1
      route/list_give.py
  26. 1 1
      route/list_image_file.py
  27. 1 1
      route/list_long_page.py
  28. 1 1
      route/list_not_close_topic.py
  29. 1 1
      route/list_old_page.py
  30. 1 1
      route/list_please.py
  31. 1 1
      route/list_title_index.py
  32. 1 1
      route/list_user.py
  33. 1 1
      route/list_user_topic.py
  34. 1 1
      route/login.py
  35. 1 1
      route/login_2fa.py
  36. 2 2
      route/login_check_key.py
  37. 2 2
      route/login_need_email.py
  38. 25 6
      route/login_pw_change.py
  39. 1 1
      route/login_register.py
  40. 1 1
      route/main_error_404.py
  41. 1 1
      route/main_file.py
  42. 3 2
      route/main_manager.py
  43. 1 1
      route/main_other.py
  44. 8 6
      route/main_restart.py
  45. 8 8
      route/main_setting.py
  46. 25 0
      route/main_shutdown.py
  47. 12 0
      route/main_test_func.py
  48. 2 2
      route/main_update.py
  49. 1 1
      route/main_upload.py
  50. 1 1
      route/recent_block.py
  51. 1 1
      route/recent_changes.py
  52. 1 1
      route/recent_discuss.py
  53. 1 1
      route/recent_history_delete.py
  54. 1 1
      route/recent_history_tool.py
  55. 1 1
      route/search_deep.py
  56. 159 131
      route/tool/func.py
  57. 1 1
      route/topic.py
  58. 1 1
      route/topic_acl.py
  59. 1 1
      route/topic_admin.py
  60. 1 1
      route/topic_change.py
  61. 1 1
      route/topic_close_list.py
  62. 1 1
      route/topic_delete.py
  63. 1 1
      route/topic_stop.py
  64. 1 1
      route/topic_tool.py
  65. 1 1
      route/user_count_edit.py
  66. 1 1
      route/user_custom_head_view.py
  67. 1 1
      route/user_info.py
  68. 2 2
      route/user_setting.py
  69. 1 1
      route/user_tool.py
  70. 1 1
      route/view_diff_data.py
  71. 1 1
      route/view_down.py
  72. 1 1
      route/view_raw.py
  73. 1 1
      route/view_read.py
  74. 1 1
      route/view_xref.py
  75. 1 1
      route/vote.py
  76. 1 1
      route/vote_add.py
  77. 1 1
      route/vote_end.py
  78. 1 1
      route/vote_select.py
  79. 1 1
      route/watch_list.py
  80. 10 0
      test.sql
  81. 2 2
      version.json
  82. 0 223
      views/main_css/js/shotcuts.js
  83. 0 37
      views/main_css/js/shotcuts_set.js

+ 33 - 16
app.py

@@ -1,13 +1,19 @@
 # Init
 from route import *
 
+# 전반적으로 전부 수정 필요
+raise
+
 # Init-Version
 version_list = json.loads(open('version.json', encoding = 'utf8').read())
 
 # Init-DB
 if os.path.exists(os.path.join('data', 'set.json')):
     db_set_list = ['db', 'db_type']
-    set_data = json.loads(open(os.path.join('data', 'set.json'), encoding = 'utf8').read())
+    set_data = json.loads(open(
+        os.path.join('data', 'set.json'), 
+        encoding = 'utf8'
+    ).read())
     for i in db_set_list:
         if not i in set_data:
             print('Please delete set.json')
@@ -118,7 +124,7 @@ create_data['data'] = ['title', 'data', 'type']
 create_data['history'] = ['id', 'title', 'data', 'date', 'ip', 'send', 'leng', 'hide', 'type']
 create_data['rc'] = ['id', 'title', 'date', 'type']
 create_data['rd'] = ['title', 'sub', 'code', 'date', 'band', 'stop', 'agree', 'acl']
-create_data['user'] = ['id', 'pw', 'acl', 'date', 'encode']
+# create_data['user'] = ['id', 'pw', 'acl', 'date', 'encode']
 create_data['user_set'] = ['name', 'id', 'data']
 create_data['user_application'] = ['id', 'pw', 'date', 'encode', 'question', 'answer', 'ip', 'ua', 'token', 'email']
 create_data['topic'] = ['id', 'data', 'date', 'ip', 'block', 'top', 'code']
@@ -180,16 +186,20 @@ logging.basicConfig(level = logging.ERROR)
 app = flask.Flask(__name__, template_folder = './')
 app.config['JSON_AS_ASCII'] = False
 
-flask_reggie.Reggie(app)
-
 class EverythingConverter(werkzeug.routing.PathConverter):
     regex = '.*?'
 
+class RegexConverter(werkzeug.routing.BaseConverter):
+    def __init__(self, url_map, *items):
+        super(RegexConverter, self).__init__(url_map)
+        self.regex = items[0]
+
 app.jinja_env.filters['md5_replace'] = md5_replace
 app.jinja_env.filters['load_lang'] = load_lang
 app.jinja_env.filters['cut_100'] = cut_100
 
 app.url_map.converters['everything'] = EverythingConverter
+app.url_map.converters['regex'] = RegexConverter
 
 # Init-DB_Data
 curs.execute(db_change('select name from alist where acl = "owner"'))
@@ -410,15 +420,6 @@ def give_acl(name = None):
 def give_admin(name = None):
     return give_admin_2(conn, name)
 
-# Func-server
-@app.route('/restart', methods=['POST', 'GET'])
-def server_restart():
-    return server_restart_2(conn)
-
-@app.route('/update', methods=['GET', 'POST'])
-def server_now_update():
-    return server_now_update_2(conn, version_list['beta']['r_ver'])
-
 # Func-view
 @app.route('/xref/<everything:name>')
 def view_xref(name = None):
@@ -690,6 +691,14 @@ def api_sitemap():
     return api_sitemap_2(conn)
 
 # Func-main
+@app.route('/restart', methods=['POST', 'GET'])
+def main_restart():
+    return main_restart_2(conn)
+
+@app.route('/update', methods=['GET', 'POST'])
+def main_update():
+    return main_update_2(conn, version_list['beta']['r_ver'])
+
 @app.route('/random')
 def main_title_random():
     return main_title_random_2(conn)
@@ -725,8 +734,16 @@ def main_skin_set():
 def main_views(name = None):
     return main_views_2(conn, name)
 
-@app.route('/<data>')
-def main_file(data = None):
+@app.route('/test_func')
+def main_test_func():
+	return main_test_func_2(conn)
+
+@app.route('/shutdown')
+def main_shutdown():
+    return main_shutdown_2(conn)
+
+@app.route('/<regex("easter_egg\.html|\.(?:txt|xml)$"):data>')
+def main_file(data = ''):
     return main_file_2(conn, data)
 
 @app.errorhandler(404)
@@ -739,7 +756,7 @@ app.secret_key = rep_key
 class NoLoggingWSGIRequestHandler(wsgiref.simple_server.WSGIRequestHandler):
     def log_message(self, format, *args):
         pass
-
+	
 if __name__ == "__main__":    
     wsgiref.simple_server.make_server(
         server_set['host'], 

+ 68 - 72
emergency_tool.py

@@ -9,96 +9,92 @@ while 1:
         break
 
 if data_db_load == 'Y':
-    # DB
-    while 1:
-        try:
-            set_data = json.loads(open('data/set.json', encoding = 'utf8').read())
-            if not 'db_type' in set_data:
-                try:
-                    os.remove('data/set.json')
-                except:
-                    print('Please delete set.json')
-                    print('----')
-                    raise
-            else:
-                print('DB name : ' + set_data['db'])
-                print('DB type : ' + set_data['db_type'])
-
-                break
-        except:
-            if os.getenv('NAMU_DB') != None or os.getenv('NAMU_DB_TYPE') != None:
-                set_data = {
-                    "db" : os.getenv('NAMU_DB') if os.getenv('NAMU_DB') else 'data',
-                    "db_type" : os.getenv('NAMU_DB_TYPE') if os.getenv('NAMU_DB_TYPE') else 'sqlite'
-                }
-
-                print('DB name : ' + set_data['db'])
-                print('DB type : ' + set_data['db_type'])
-
-                break
-            else:
-                new_json = ['', '']
-                normal_db_type = ['sqlite', 'mysql']
+    # Init-DB
+    if os.path.exists(os.path.join('data', 'set.json')):
+        db_set_list = ['db', 'db_type']
+        set_data = json.loads(open(os.path.join('data', 'set.json'), encoding = 'utf8').read())
+        for i in db_set_list:
+            if not i in set_data:
+                print('Please delete set.json')
+                print('----')
+                raise
+
+        print('DB name : ' + set_data['db'])
+        print('DB type : ' + set_data['db_type'])
+    elif os.getenv('NAMU_DB') or os.getenv('NAMU_DB_TYPE'):
+        set_data = {}
+
+        if os.getenv('NAMU_DB'):
+            set_data['db'] = os.getenv('NAMU_DB')
+        else:
+            set_data['db'] = 'data'
 
-                print('DB type (sqlite) [sqlite, mysql] : ', end = '')
-                new_json[0] = str(input())
-                if new_json[0] == '' or not new_json[0] in normal_db_type:
-                    new_json[0] = 'sqlite'
+        if os.getenv('NAMU_DB_TYPE'):
+            set_data['db'] = os.getenv('NAMU_DB_TYPE')
+        else:
+            set_data['db'] = 'sqlite'
 
-                all_src = []
-                for i_data in os.listdir("."):
-                    f_src = re.search(r"(.+)\.db$", i_data)
-                    if f_src:
-                        all_src += [f_src.group(1)]
+        print('DB name : ' + set_data['db'])
+        print('DB type : ' + set_data['db_type'])
+    else:
+        set_data = {}
+        normal_db_type = ['sqlite', 'mysql']
 
-                if all_src != [] and new_json[0] != 'mysql':
-                    print('DB name (data) [' + ', '.join(all_src) + '] : ', end = '')
-                else:
-                    print('DB name (data) : ', end = '')
+        print('DB type (' + normal_db_type[0] + ') [' + ', '.join(normal_db_type) + '] : ', end = '')
+        data_get = str(input())
+        if data_get == '' or not data_get in normal_db_type:
+            set_data['db_type'] = 'sqlite'
+        else:
+            set_data['db_type'] = data_get
 
-                new_json[1] = str(input())
-                if new_json[1] == '':
-                    new_json[1] = 'data'
+        all_src = []
+        if set_data['db_type'] == 'sqlite':
+            for i_data in os.listdir("."):
+                f_src = re.search(r"(.+)\.db$", i_data)
+                if f_src:
+                    all_src += [f_src.group(1)]
 
-                with open('data/set.json', 'w', encoding = 'utf8') as f:
-                    f.write('{ "db" : "' + new_json[1] + '", "db_type" : "' + new_json[0] + '" }')
+        print('DB name (data) [' + ', '.join(all_src) + '] : ', end = '')
 
-                set_data = json.loads(open('data/set.json', encoding = 'utf8').read())
+        data_get = str(input())
+        if data_get == '':
+            set_data['db'] = 'data'
+        else:
+            set_data['db'] = data_get
 
-                break
+        with open(os.path.join('data', 'set.json'), 'w', encoding = 'utf8') as f:
+            f.write(json.dumps(set_data))
 
     db_data_get(set_data['db_type'])
 
     if set_data['db_type'] == 'mysql':
-        try:
-            set_data_mysql = json.loads(open('data/mysql.json', encoding = 'utf8').read())
-        except:
-            new_json = {}
+        if not os.path.exists(os.path.join('data', 'mysql.json')):
+            db_set_list = ['user', 'password', 'host', 'port']
+            set_data = json.loads(open(os.path.join('data', 'mysql.json'), encoding = 'utf8').read())
+            for i in db_set_list:
+                if not i in set_data:
+                    print('Please delete mysql.json')
+                    print('----')
+                    raise
 
-            while 1:
-                print('DB user ID : ', end = '')
-                new_json['user'] = str(input())
-                if new_json['user'] != '':
-                    break
+            print('DB user ID : ', end = '')
+            set_data_mysql['user'] = str(input())
 
-            while 1:
-                print('DB password : ', end = '')
-                new_json['password'] = str(input())
-                if new_json['password'] != '':
-                    break
+            print('DB password : ', end = '')
+            set_data_mysql['password'] = str(input())
 
             print('DB host (localhost) : ', end = '')
-            new_json['host'] = str(input())
-            new_json['host'] = 'localhost' if new_json['host'] == '' else new_json['host']
+            set_data_mysql['host'] = str(input())
+            if set_data_mysql['host'] == '':
+                set_data_mysql['host'] = 'localhost'
 
             print('DB port (3306) : ', end = '')
-            new_json['port'] = str(input())
-            new_json['port'] = '3306' if new_json['port'] == '' else new_json['port']
-
-            with open('data/mysql.json', 'w', encoding = 'utf8') as f:
-                f.write(json.dumps(new_json))
+            set_data_mysql['port'] = str(input())
+            if set_data_mysql['port'] == '':
+                set_data_mysql['port'] = '3306'
 
-            set_data_mysql = new_json
+            with open(os.path.join('data', 'mysql.json'), 'w', encoding = 'utf8') as f:
+                f.write(json.dumps(set_data_mysql))
 
         conn = pymysql.connect(
             host = set_data_mysql['host'] if 'host' in set_data_mysql else 'localhost',

+ 4 - 4
route/__init__.py

@@ -51,6 +51,10 @@ from .main_error_404 import *
 from .main_title_random import *
 from .main_image_view import *
 from .main_manager import *
+from .main_test_func import *
+from .main_shutdown import *
+from .main_restart import *
+from .main_update import *
 
 # Import-api
 from .api_topic_sub import *
@@ -119,10 +123,6 @@ from .edit_revert import *
 from .edit_move import *
 from .edit_many_delete import *
 
-# Import-server
-from .server_restart import *
-from .server_now_update import *
-
 # Import-view
 from .view_xref import *
 from .view_raw import *

+ 1 - 1
route/alarm.py

@@ -22,7 +22,7 @@ def alarm_2(conn):
     data += '</ul>' + next_fix('/alarm?num=', num, data_list)
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('notice'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('notice'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = data,
         menu = [['user', load_lang('return')]]
     ))

+ 1 - 1
route/application_submitted.py

@@ -4,7 +4,7 @@ def application_submitted_2(conn):
     curs = conn.cursor()
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('application_submitted'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('application_submitted'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = '<p>' + load_lang('waiting_for_approval') + '</p>',
         menu = [['user', load_lang('return')]]
     ))

+ 1 - 1
route/applications.py

@@ -66,7 +66,7 @@ def applications_2(conn):
             div += load_lang('no_applications_now')
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('application_list'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('application_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = div,
             menu = [['other', load_lang('return')]]
         ))

+ 1 - 1
route/edit.py

@@ -176,7 +176,7 @@ def edit_2(conn, name):
          }
 
         return easy_minify(flask.render_template(skin_check(), 
-            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('edit') + ')', 0])],
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('edit') + ')', 0])],
             data =  editor_top_text + add_get_file + '''
                 <span   id="server_set"
                         style="display: none;">''' + json.dumps(server_set) + '''</span>

+ 1 - 1
route/edit_delete.py

@@ -61,7 +61,7 @@ def edit_delete_2(conn, name):
         return redirect('/w/' + url_pas(name))
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('delete') + ')', 0])],
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('delete') + ')', 0])],
             data = '''
                 <form method="post">
                     ''' + ip_warring() + '''

+ 1 - 1
route/edit_many_delete.py

@@ -16,7 +16,7 @@ def edit_many_delete_2(conn):
         return redirect('/recent_changes')
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('many_delete'), wiki_set(), custom(), other2([0, 0])],
+            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>

+ 1 - 1
route/edit_move.py

@@ -156,7 +156,7 @@ def edit_move_2(conn, name):
             return redirect('/w/' + url_pas(move_title))
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('move') + ')', 0])],
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('move') + ')', 0])],
             data = '''
                 <form method="post">
                     ''' + ip_warring() + '''

+ 1 - 1
route/edit_revert.py

@@ -66,7 +66,7 @@ def edit_revert_2(conn, name):
             return redirect('/w/' + url_pas(name))
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('revert') + ')', 0])],
+            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>

+ 1 - 1
route/give_acl.py

@@ -113,7 +113,7 @@ def give_acl_2(conn, name):
         '''
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('acl') + ')', 0])],
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('acl') + ')', 0])],
             data = '''
                 <form method="post">
                     <a href="/setting/8">(''' + load_lang('main_acl_setting') + ''')</a>

+ 26 - 25
route/give_admin.py

@@ -5,32 +5,38 @@ def give_admin_2(conn, name):
 
     owner = admin_check()
 
-    curs.execute(db_change("select acl from user where id = ?"), [name])
-    user = curs.fetchall()
-    if not user:
+    curs.execute(db_change("select data from user_set where id = ? and name = 'acl'"), [name])
+    user_acl = curs.fetchall()
+    if not user_acl:
         return re_error('/error/2')
     else:
-        if owner != 1:
-            curs.execute(db_change('select name from alist where name = ? and acl = "owner"'), [user[0][0]])
-            if curs.fetchall():
-                return re_error('/error/3')
+        user_acl = user_acl[0][0]
+    
+    if owner != 1:
+        curs.execute(db_change('select name from alist where name = ? and acl = "owner"'), [user_acl])
+        if curs.fetchall():
+            return re_error('/error/3')
 
-            if ip_check() == name:
-                return re_error('/error/3')
+        if ip_check() == name:
+            return re_error('/error/3')
 
     if flask.request.method == 'POST':
         if admin_check(7, 'admin (' + name + ')') != 1:
             return re_error('/error/3')
 
-        if owner != 1:
-            curs.execute(db_change('select name from alist where name = ? and acl = "owner"'), [flask.request.form.get('select', None)])
-            if curs.fetchall():
-                return re_error('/error/3')
-
-        if flask.request.form.get('select', None) == 'X':
-            curs.execute(db_change("update user set acl = 'user' where id = ?"), [name])
+        if flask.request.form.get('select', 'X') == 'X':
+            select_data = 'user'
         else:
-            curs.execute(db_change("update user set acl = ? where id = ?"), [flask.request.form.get('select', None), name])
+            select_data = flask.request.form.get('select', 'X')
+        
+        curs.execute(db_change('select name from alist where name = ? and acl = "owner"'), [select_data])
+        if owner != 1 and curs.fetchall():
+            return re_error('/error/3')
+            
+        curs.execute(db_change("update user_set set data = ? where id = ? and name = 'acl'"), [
+            select_data, 
+            name
+        ])
 
         conn.commit()
 
@@ -46,19 +52,14 @@ def give_admin_2(conn, name):
             if user[0][0] == data[0]:
                 div += '<option value="' + data[0] + '" selected="selected">' + data[0] + '</option>'
             else:
-                if owner != 1:
-                    curs.execute(db_change('select name from alist where name = ? and acl = "owner"'), [data[0]])
-                    if not curs.fetchall():
-                        div += '<option value="' + data[0] + '">' + data[0] + '</option>'
-                else:
-                    div += '<option value="' + data[0] + '">' + data[0] + '</option>'
+                div += '<option value="' + data[0] + '">' + data[0] + '</option>'
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('authorize') + ')', 0])],
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('authorize') + ')', 0])],
             data =  '''
                     <form method="post">
                         <select name="select">''' + div + '''</select>
-                        <hr class=\"main_hr\">
+                        <hr class="main_hr">
                         <button type="submit">''' + load_lang('save') + '''</button>
                     </form>
                     ''',

+ 1 - 1
route/give_admin_groups.py

@@ -40,7 +40,7 @@ def give_admin_groups_2(conn, name):
         data += ''
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('admin_group') + ')', 0])],
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('admin_group') + ')', 0])],
             data = '''
                 <form method="post">
                     ''' + data + '''

+ 2 - 2
route/give_delete_admin_group.py

@@ -10,14 +10,14 @@ def give_delete_admin_group_2(conn, name):
         admin_check(None, 'alist del ' + name)
 
         curs.execute(db_change("delete from alist where name = ?"), [name])
-        curs.execute(db_change("update user set acl = 'user' where acl = ?"), [name])
+        curs.execute(db_change("update user_set set data = 'user' where name = 'acl' and data = ?"), [name])
 
         conn.commit()
 
         return redirect('/give_log')
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang("delete_admin_group"), wiki_set(), custom(), other2(['(' + name + ')', 0])],
+            imp = [load_lang("delete_admin_group"), wiki_set(), wiki_custom(), wiki_css(['(' + name + ')', 0])],
             data = '''
                 <form method=post>
                     <button type=submit>''' + load_lang('start') + '''</button>

+ 1 - 1
route/give_history_add.py

@@ -30,7 +30,7 @@ def give_history_add_2(conn, name):
         return redirect('/history/' + url_pas(name))
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('history_add'), wiki_set(), custom(), other2(['(' + name + ')', 0])],
+            imp = [load_lang('history_add'), wiki_set(), wiki_custom(), wiki_css(['(' + name + ')', 0])],
             data = '''
                 <form method="post">
                     <script>do_stop_exit();</script>

+ 1 - 1
route/give_user_ban.py

@@ -105,7 +105,7 @@ def give_user_ban_2(conn, name):
             ''' + plus
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [main_name, wiki_set(), custom(), other2([now, 0])],
+            imp = [main_name, wiki_set(), wiki_custom(), wiki_css([now, 0])],
             data = '''
                 <form method="post" ''' + action + '''>
                     ''' + data + '''

+ 2 - 2
route/give_user_check.py

@@ -147,7 +147,7 @@ def give_user_check_2(conn, name):
         )
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('check'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('check'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = div,
             menu = [['manager', load_lang('return')]]
         ))
@@ -172,7 +172,7 @@ def give_user_check_2(conn, name):
             )
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('simple_check') + ')', 0])],
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('simple_check') + ')', 0])],
             data = div,
             menu = [['check/' + url_pas(name), load_lang('return')]]
         ))

+ 1 - 1
route/give_user_check_delete.py

@@ -28,7 +28,7 @@ def give_user_check_delete_2(conn):
             return redirect('/check/' + url_pas(user_id if return_type == '0' else user_ip))
         else:
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('check'), wiki_set(), custom(), other2(['(' + load_lang('delete') + ')', 0])],
+                imp = [load_lang('check'), wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('delete') + ')', 0])],
                 data = '''
                     ''' + load_lang('name') + ''' : ''' + user_id + '''
                     <hr class="main_hr">

+ 1 - 1
route/inter_wiki.py

@@ -100,7 +100,7 @@ def inter_wiki_2(conn, tools):
             div += '<a href="/' + plus_link + '">(' + load_lang('add') + ')</a>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [title, wiki_set(), custom(), other2([0, 0])],
+        imp = [title, wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = div,
         menu = [['manager/1', load_lang('return')]]
     ))

+ 1 - 1
route/inter_wiki_plus.py

@@ -223,7 +223,7 @@ def inter_wiki_plus_2(conn, tools, name):
             '''
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [title, wiki_set(), custom(), other2([get_sub, 0])],
+            imp = [title, wiki_set(), wiki_custom(), wiki_css([get_sub, 0])],
             data =  '''
                     <form method="post">
                         ''' + form_data + '''

+ 1 - 1
route/list_acl.py

@@ -31,7 +31,7 @@ def list_acl_2(conn):
     div += next_fix('/acl_list?num=', num, list_data)
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('acl_document_list'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('acl_document_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = div,
         menu = [['other', load_lang('return')]]
     ))

+ 2 - 5
route/list_admin.py

@@ -5,19 +5,16 @@ def list_admin_2(conn):
 
     div = '<ul class="inside_ul">'
 
-    curs.execute(db_change("select id, acl, date from user where not acl = 'user' order by date desc"))
+    curs.execute(db_change("select id, data from user_set where name = 'acl' and not data = 'user'"))
     for data in curs.fetchall():
         name = ip_pas(data[0]) + ' <a href="/admin_plus/' + url_pas(data[1]) + '">(' + data[1] + ')</a>'
 
-        if data[2] != '':
-            name += ' (' + data[2] + ')'
-
         div += '<li>' + name + '</li>'
 
     div += '</ul>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('admin_list'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('admin_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = div,
         menu = [['other', load_lang('return')]]
     ))

+ 1 - 1
route/list_admin_use.py

@@ -30,7 +30,7 @@ def list_admin_use_2(conn):
         list_data += next_fix('/admin_log?num=', num, get_list)
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('authority_use_list'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('authority_use_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '''
                 <form method="post">
                     <input name="search" id="admin_log_search"> <button type="submit">''' + load_lang('search') + '''</button>

+ 1 - 1
route/list_give.py

@@ -21,7 +21,7 @@ def list_give_2(conn):
     list_data += '</ul><hr class=\"main_hr\"><a href="/manager/8">(' + load_lang('add') + ')</a>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('admin_group_list'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('admin_group_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = list_data,
         menu = [['manager', load_lang('return')]]
     ))    

+ 1 - 1
route/list_image_file.py

@@ -20,7 +20,7 @@ def list_image_file_2(conn):
     list_data += next_fix('/image_file_list?num=', num, data_list)
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('image_file_list'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('image_file_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = list_data,
         menu = [['other', load_lang('return')]]
     ))    

+ 1 - 1
route/list_long_page.py

@@ -18,7 +18,7 @@ def list_long_page_2(conn, tool):
     div += '</ul>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang(title), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang(title), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = div,
         menu = [['other', load_lang('return')]]
     ))

+ 1 - 1
route/list_not_close_topic.py

@@ -13,7 +13,7 @@ def list_not_close_topic_2(conn):
     div += '</ul>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('open_discussion_list'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('open_discussion_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = div,
         menu = [['manager', load_lang('return')]]
     ))

+ 1 - 1
route/list_old_page.py

@@ -31,7 +31,7 @@ def list_old_page_2(conn):
     div += '</ul>' + next_fix('/old_page?num=', num, n_list)
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('old_page'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('old_page'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = div,
         menu = [['other', load_lang('return')]]
     ))

+ 1 - 1
route/list_please.py

@@ -20,7 +20,7 @@ def list_please_2(conn):
     div += '</ul>' + next_fix('/please?num=', num, data_list)
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('need_document'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('need_document'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = div,
         menu = [['other', load_lang('return')]]
     ))

+ 1 - 1
route/list_title_index.py

@@ -72,7 +72,7 @@ def list_title_index_2(conn):
     sub = ' (' + str(num) + ')'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('all_document_list'), wiki_set(), custom(), other2([sub, 0])],
+        imp = [load_lang('all_document_list'), wiki_set(), wiki_custom(), wiki_css([sub, 0])],
         data = data,
         menu = [['other', load_lang('return')]]
     ))

+ 1 - 1
route/list_user.py

@@ -16,7 +16,7 @@ def list_user_2(conn):
     list_data += '</ul>' + next_fix('/user_log?num=', num, user_list)
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('member_list'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('member_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = list_data,
         menu = [['other', load_lang('return')]]
     ))

+ 1 - 1
route/list_user_topic.py

@@ -46,7 +46,7 @@ def list_user_topic_2(conn, name):
     div += next_fix('/topic_record/' + url_pas(name) + '?num=', num, data_list)
     
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('discussion_record'), wiki_set(), custom(), other2([sub, 0])],
+        imp = [load_lang('discussion_record'), wiki_set(), wiki_custom(), wiki_css([sub, 0])],
         data = div,
         menu = [
             ['other', load_lang('other')], 

+ 1 - 1
route/login.py

@@ -48,7 +48,7 @@ def login_2(conn):
             return redirect('/user')
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('login'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('login'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data =  '''
                     <form method="post">
                         <input placeholder="''' + load_lang('id') + '''" name="id" type="text">

+ 1 - 1
route/login_2fa.py

@@ -48,7 +48,7 @@ def login_2fa_2(conn):
         return redirect('/user')
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('login'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('login'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data =  '''
                     <form method="post">
                         <input placeholder="''' + load_lang('2fa_password') + '''" name="pw" type="password">

+ 2 - 2
route/login_check_key.py

@@ -31,7 +31,7 @@ def login_check_key_2(conn, tool):
                 curs.execute(db_change("update user_set set data = '' where name = '2fa' and id = ?"), [user_id])
 
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('reset_user_ok'), wiki_set(), custom(), other2([0, 0])],
+                imp = [load_lang('reset_user_ok'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
                 data = b_text + load_lang('id') + ' : ' + user_id + '<br>' + load_lang('password') + ' : ' + user_pw,
                 menu = [['user', load_lang('return')]]
             ))
@@ -126,7 +126,7 @@ def login_check_key_2(conn, tool):
         b_text = (sql_d[0][0] + '<hr class="main_hr">') if sql_d and sql_d[0][0] != '' else ''
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('check_key'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('check_key'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '''
                 <form method="post">
                     ''' + b_text + '''

+ 2 - 2
route/login_need_email.py

@@ -78,7 +78,7 @@ def login_need_email_2(conn, tool):
             b_text = (sql_d[0][0] + '<hr class="main_hr">') if sql_d and sql_d[0][0] != '' else ''
 
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('password_search'), wiki_set(), custom(), other2([0, 0])],
+                imp = [load_lang('password_search'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
                 data = b_text + '''
                     <form method="post">
                         <input placeholder="''' + load_lang('id') + '''" name="id" type="text">
@@ -99,7 +99,7 @@ def login_need_email_2(conn, tool):
             b_text = (sql_d[0][0] + '<hr class="main_hr">') if sql_d and sql_d[0][0] != '' else ''
 
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('email'), wiki_set(), custom(), other2([0, 0])],
+                imp = [load_lang('email'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
                 data = '''
                     <a href="/email_filter">(''' + load_lang('email_filter_list') + ''')</a>
                     <hr class="main_hr">

+ 25 - 6
route/login_pw_change.py

@@ -18,20 +18,39 @@ def login_pw_change_2(conn):
             if new_pw != re_pw:
                 return re_error('/error/20')
 
-            curs.execute(db_change("select pw, encode from user where id = ?"), [flask.session['id']])
-            user = curs.fetchall()
-            if not user:
+            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[0][0], user[0][1], ip) != 1:
+            if pw_check(
+                now_pw,
+                user['pw'], 
+                user['encode'], 
+                ip
+            ) != 1:
                 return re_error('/error/10')
 
-            curs.execute(db_change("update user set pw = ? where id = ?"), [pw_encode(new_pw), ip])
+            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(), custom(), other2([0, 0])],
+            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">

+ 1 - 1
route/login_register.py

@@ -109,7 +109,7 @@ def login_register_2(conn):
                 '''
                 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('register'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('register'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '''
                 <form method="post">
                     ''' + contract + '''

+ 1 - 1
route/main_error_404.py

@@ -6,4 +6,4 @@ def main_error_404_2(conn):
     if os.path.exists('404.html') and flask.request.path != '/':
         return open('404.html', encoding='utf8').read()
     else:
-        return redirect('/w/' + url_pas(wiki_set(2)))
+        return redirect('/w/' + wiki_set(2))

+ 1 - 1
route/main_file.py

@@ -6,7 +6,7 @@ def main_file_2(conn, data):
 
     if data == 'easter_egg.html':
         return easy_minify(flask.render_template(skin_check(),
-            imp = ['easter_egg.html', wiki_set(), custom(), other2([0, 0])],
+            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
         ))

+ 3 - 2
route/main_manager.py

@@ -24,7 +24,7 @@ def main_manager_2(conn, num, r_ver):
 
     if num == 1:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('admin_tool'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('admin_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '''
                 <h2>''' + load_lang('admin') + '''</h2>
                 <ul class="inside_ul">
@@ -59,6 +59,7 @@ def main_manager_2(conn, num, r_ver):
                 <h2>''' + load_lang('server') + '''</h2>
                 <ul class="inside_ul">
                     <li><a href="/restart">''' + load_lang('wiki_restart') + '''</a></li>
+                    <li><a href="/shutdown">''' + load_lang('wiki_shutdown') + '''</a></li>
                     <li><a href="/update">''' + load_lang('update') + '''</a></li>
                 </ul>
                 <br>
@@ -96,7 +97,7 @@ def main_manager_2(conn, num, r_ver):
                 plus = '<input type="checkbox" name="regex"> ' + load_lang('regex') + '<hr class="main_hr">'
 
             return easy_minify(flask.render_template(skin_check(),
-                imp = [title_list[(num - 2)][2], wiki_set(), custom(), other2([0, 0])],
+                imp = [title_list[(num - 2)][2], wiki_set(), wiki_custom(), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
                         <input placeholder="''' + placeholder + '''" name="name" type="text">

+ 1 - 1
route/main_other.py

@@ -4,7 +4,7 @@ def main_other_2(conn):
     curs = conn.cursor()
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('other_tool'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('other_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = '''
             <h2>''' + load_lang('record') + '''</h2>
             <ul class="inside_ul">

+ 8 - 6
route/server_restart.py → route/main_restart.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def server_restart_2(conn):
+def main_restart_2(conn):
     curs = conn.cursor()
 
     if admin_check() != 1:
@@ -15,13 +15,15 @@ def server_restart_2(conn):
         try:
             os.execl(sys.executable, sys.executable, *sys.argv)
         except:
-            try:
-                os.execl(sys.executable, '"' + sys.executable + '"', *sys.argv)
-            except:
-                return re_error('/error/33')
+            pass
+        
+        try:
+            os.execl(sys.executable, '"' + sys.executable + '"', *sys.argv)
+        except:
+            return re_error('/error/33')
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('wiki_restart'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('wiki_restart'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '''
                 <form method="post">
                     <button type="submit">''' + load_lang('restart') + '''</button>

+ 8 - 8
route/main_setting.py

@@ -20,7 +20,7 @@ def main_setting_2(conn, num, db_set):
         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(), custom(), other2([0, 0])],
+            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')]]
         ))
@@ -124,7 +124,7 @@ def main_setting_2(conn, num, db_set):
             sqlite_only = 'style="display:none;"' if db_set != 'sqlite' else ''
 
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('main_setting'), wiki_set(), custom(), other2([0, 0])],
+                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>
@@ -272,7 +272,7 @@ def main_setting_2(conn, num, db_set):
             conn.commit()
 
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('text_setting'), wiki_set(), custom(), other2([0, 0])],
+                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>
@@ -414,7 +414,7 @@ def main_setting_2(conn, num, db_set):
                 sub_plus = ''
 
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang(data = 'main' + title, safe = 1), wiki_set(), custom(), other2(['(HTML)' + sub_plus, 0])],
+                imp = [load_lang(data = 'main' + title, safe = 1), wiki_set(), wiki_custom(), wiki_css(['(HTML)' + sub_plus, 0])],
                 data = '''
                     <form method="post">
                         ''' + start + '''
@@ -473,7 +473,7 @@ def main_setting_2(conn, num, db_set):
                 data = ''.join(lines)
 
             return easy_minify(flask.render_template(skin_check(),
-                imp = ['robots.txt', wiki_set(), custom(), other2([0, 0])],
+                imp = ['robots.txt', wiki_set(), wiki_custom(), wiki_css([0, 0])],
                 data = '''
                     <a href="/robots.txt">(''' + load_lang('view') + ''')</a>
                     <hr class="main_hr">
@@ -540,7 +540,7 @@ def main_setting_2(conn, num, db_set):
                 re_ver += '<option value="v3">v3</option><option value="">v2</option>'
 
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('ext_api_req_set'), wiki_set(), custom(), other2([0, 0])],
+                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('recaptcha') + '''</h2>
@@ -667,7 +667,7 @@ def main_setting_2(conn, num, db_set):
                     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(), custom(), other2([0, 0])],
+                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>
@@ -742,7 +742,7 @@ def main_setting_2(conn, num, db_set):
                 ''
             
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('wiki_logo'), wiki_set(), custom(), other2([0, 0])],
+                imp = [load_lang('wiki_logo'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
                         ''' + end_data + '''

+ 25 - 0
route/main_shutdown.py

@@ -0,0 +1,25 @@
+from .tool.func import *
+
+def main_shutdown_2(conn):
+    curs = conn.cursor()
+    
+    if admin_check() != 1:
+        return re_error('/error/3')
+
+    if flask.request.method == 'POST':
+        admin_check(None, 'shutdown')
+
+        print('----')
+        print('shutdown')
+
+        raise
+    else:
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [load_lang('wiki_shutdown'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            data = '''
+                <form method="post">
+                    <button type="submit">''' + load_lang('shutdown') + '''</button>
+                </form>
+            ''',
+            menu = [['manager', load_lang('return')]]
+        ))

+ 12 - 0
route/main_test_func.py

@@ -0,0 +1,12 @@
+import time
+from .tool.func import *
+
+def main_test_func_2(conn):
+    test_start = time.time()
+
+    for _ in range(0, 10000):
+        load_lang('edit')
+        
+    end_time = "time :" + str(time.time() - test_start) + '\n'
+
+    return end_time

+ 2 - 2
route/server_now_update.py → route/main_update.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def server_now_update_2(conn, r_ver):
+def main_update_2(conn, r_ver):
     curs = conn.cursor()
 
     if admin_check() != 1:
@@ -43,7 +43,7 @@ def server_now_update_2(conn, r_ver):
         return re_error('/error/34')
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('update'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('update'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = load_lang('update_warring') + '''
                 <hr class=\"main_hr\">
                 <ul class="inside_ul">

+ 1 - 1
route/main_upload.py

@@ -135,7 +135,7 @@ def main_upload_2(conn):
         upload_default = html.escape(db_data[0][0]) if db_data and db_data[0][0] != '' else ''
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('upload'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('upload'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '''
                 <a href="/file_filter">(''' + load_lang('file_filter_list') + ''')</a>
                 ''' + upload_help + '''

+ 1 - 1
route/recent_block.py

@@ -140,7 +140,7 @@ def recent_block_2(conn, name, tool):
     div += next_fix('/block_log?num=', num, data_list) if not name else next_fix('/' + url_pas(tool) + '/' + url_pas(name) + '?num=', num, data_list)
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('recent_ban'), wiki_set(), custom(), other2([sub, 0])],
+        imp = [load_lang('recent_ban'), wiki_set(), wiki_custom(), wiki_css([sub, 0])],
         data = div,
         menu = menu
     ))

+ 1 - 1
route/recent_changes.py

@@ -200,7 +200,7 @@ def recent_changes_2(conn, name, tool):
             sub = 0
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [title, wiki_set(), custom(), other2([sub, 0])],
+            imp = [title, wiki_set(), wiki_custom(), wiki_css([sub, 0])],
             data = div,
             menu = menu
         ))

+ 1 - 1
route/recent_discuss.py

@@ -38,7 +38,7 @@ def recent_discuss_2(conn):
     div += '</tbody></table>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('recent_discussion'), wiki_set(), custom(), other2([m_sub, 0])],
+        imp = [load_lang('recent_discussion'), wiki_set(), wiki_custom(), wiki_css([m_sub, 0])],
         data = div,
         menu = 0
     ))

+ 1 - 1
route/recent_history_delete.py

@@ -17,7 +17,7 @@ def recent_history_delete_2(conn, name):
         return redirect('/history/' + url_pas(name))
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), custom(), other2(['(r' + num + ')', 0])],
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(r' + num + ')', 0])],
             data = '''
                 <form method="post">
                     <button type="submit">''' + load_lang('history_delete') + '''</button>

+ 1 - 1
route/recent_history_tool.py

@@ -35,7 +35,7 @@ def recent_history_tool_2(conn, name):
     data += '</ul>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), custom(), other2(['(r' + num + ')', 0])],
+        imp = [name, wiki_set(), wiki_custom(), wiki_css(['(r' + num + ')', 0])],
         data = data,
         menu = [['history/' + url_pas(name), load_lang('return')]]
     ))

+ 1 - 1
route/search_deep.py

@@ -59,7 +59,7 @@ def search_deep_2(conn, name):
     div += next_fix('/search/' + url_pas(name) + '?num=', num, all_list)
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), custom(), other2(['(' + load_lang('search') + ')', 0])],
+        imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('search') + ')', 0])],
         data = div,
         menu = 0
     ))

+ 159 - 131
route/tool/func.py

@@ -41,6 +41,18 @@ if data_up_date == 1:
             'python' + ('3' if platform.system() != 'Windows' else '') + ' ' + \
             '-m pip install --upgrade --user -r requirements.txt'
         )
+        
+        print('----')
+        try:
+            os.execl(sys.executable, sys.executable, *sys.argv)
+        except:
+            pass
+
+        try:
+            os.execl(sys.executable, '"' + sys.executable + '"', *sys.argv)
+        except:
+            print('Error : restart failed')
+            raise
     else:
         print('Error : automatic installation is not supported.')
         print('Help : try "python3 -m pip install -r requirements.txt"')
@@ -58,7 +70,6 @@ import werkzeug.routing
 import werkzeug.debug
         
 import flask
-import flask_reggie
         
 import requests
 
@@ -71,6 +82,7 @@ if sys.version_info < (3, 6):
    
 # Init-Global
 global_lang = {}
+global_wiki_set = {}
 
 data_css_ver = '94'
 data_css = ''
@@ -190,7 +202,7 @@ def update(ver_num, set_data):
                 curs.execute(db_change("update other set data = '' where name = 'sec_re'"))
     
     if ver_num < 3172800 and set_data['db_type'] == 'mysql':
-        get_data_mysql = json.loads(open('data/mysql.json').read())
+        get_data_mysql = json.loads(open('data/mysql.json', encoding = 'utf8').read())
         
         with open('data/mysql.json', 'w') as f:
             f.write('{ "user" : "' + get_data_mysql['user'] + '", "password" : "' + get_data_mysql['password'] + '", "host" : "localhost" }')
@@ -285,6 +297,14 @@ def update(ver_num, set_data):
     
     if ver_num < 3300301:
         curs.execute(db_change('delete from html_filter where kind = "regex_filter" and html is null'))
+        
+    if ver_num < 3302302:
+        curs.execute(db_change('select id, pw, acl, date, encode from user'))
+        for i in curs.fetchall():
+            curs.execute(db_change("insert into user_set (name, id, data) values (?, ?, ?)"), ['pw', i[0], i[1]])
+            curs.execute(db_change("insert into user_set (name, id, data) values (?, ?, ?)"), ['acl', i[0], i[2]])
+            curs.execute(db_change("insert into user_set (name, id, data) values (?, ?, ?)"), ['date', i[0], i[3]])
+            curs.execute(db_change("insert into user_set (name, id, data) values (?, ?, ?)"), ['encode', i[0], i[4]])
     
     conn.commit()
 
@@ -458,70 +478,82 @@ def pw_check(data, data2, type_d = 'no', id_d = ''):
 def easy_minify(data, tool = None):
     return data
 
-def load_lang(data, num = 2, safe = 0):
+def load_lang(data, safe = 0):
     global global_lang
 
-    for i in range(0, 2):
-        if i == 0:
-            ip = ip_check()
-            if ip_or_user(ip) == 0:
-                curs.execute(db_change('select data from user_set where name = "lang" and id = ?'), [ip])
-                rep_data = curs.fetchall()
-            else:
-                if 'lang' in flask.session:
-                    rep_data = [[flask.session['lang']]]
-                else:
-                    continue
-        else:
-            curs.execute(db_change("select data from other where name = 'language'"))
-            rep_data = curs.fetchall()
+    ip = ip_check()
+    if ip_or_user(ip) == 0:
+        curs.execute(db_change('select data from user_set where name = "lang" and id = ?'), [ip])
+        rep_data = curs.fetchall()                    
+    elif 'lang' in flask.session:
+        rep_data = [[flask.session['lang']]]
+    else:
+        curs.execute(db_change("select data from other where name = 'language'"))
+        rep_data = curs.fetchall()
+
+    if not rep_data or rep_data[0][0] in ('', 'default'):
+        curs.execute(db_change("select data from other where name = 'language'"))
+        rep_data = curs.fetchall()
+
+    if rep_data:
+        lang_name = rep_data[0][0]
+    else:
+        lang_name = 'en-US'
         
-        if rep_data and rep_data[0][0] != '' and rep_data[0][0] != 'default':
-            try:
-                if not rep_data[0][0] in global_lang:
-                    lang = json.loads(open(os.path.join('lang', rep_data[0][0] + '.json'), encoding='utf8').read())
-                    global_lang[rep_data[0][0]] = lang
-                else:
-                    lang = global_lang[rep_data[0][0]]
-            except:
-                continue
+    if lang_name in global_lang:
+        lang = global_lang[lang_name]
+    else:
+        lang_list = os.listdir('lang')
+        if (lang_name + '.json') in lang_list:
+            lang = json.loads(open(
+                os.path.join('lang', lang_name + '.json'), 
+                encoding = 'utf8'
+            ).read())
+            global_lang[lang_name] = lang
+        else:
+            lang = {}
 
-            if data in lang:
-                return lang[data] if safe == 1 else html.escape(lang[data])
-            else:
-                continue
+    if data in lang:
+        if safe == 1:
+            return lang[data] 
         else:
-            continue
-    
-    return html.escape(data + ' (' + rep_data[0][0] + ')')
+            return html.escape(lang[data])
+
+    return html.escape(data + ' (' + lang_name + ')')
 
 def skin_check(set_n = 0):
+    # 개편 필요?
     skin_list = load_skin('tenshi', 1)
     skin = skin_list[0]
-    check_list = []
     ip = ip_check()
     
-    if ip_or_user(ip) == 0:
-        curs.execute(db_change('select data from user_set where name = "skin" and id = ?'), [ip])
-        skin_exist = curs.fetchall()
-        check_list += skin_exist
+    user_need_skin = ''
+    
+    if 'skin' in flask.session:
+        user_need_skin = flask.session['skin']
     else:
-        if 'skin' in flask.session:
-            check_list += [[flask.session['skin']]]
-            
-    curs.execute(db_change('select data from other where name = "skin"'))
-    skin_exist = curs.fetchall()
-    check_list += skin_exist
+        if ip_or_user(ip) == 0:
+            curs.execute(db_change('select data from user_set where name = "skin" and id = ?'), [ip])
+            skin_exist = curs.fetchall()
+            if skin_exist:
+                user_need_skin = skin_exist[0][0]            
+                flask.session['skin'] = user_need_skin
+
+    if user_need_skin == '':
+        curs.execute(db_change('select data from other where name = "skin"'))
+        skin_exist = curs.fetchall()
+        if skin_exist:
+            user_need_skin = skin_exist[0][0]
     
-    for i in check_list:
-        if i[0] != '' and i[0] in skin_list:
-            skin = i[0]
-            
-            break
+    if user_need_skin != '' and user_need_skin in skin_list:
+        skin = user_need_skin
 
-    return './views/' + skin + '/index.html' if set_n == 0 else skin
-
-def other2(data):
+    if set_n == 0:
+        return './views/' + skin + '/index.html'
+    else:
+        return skin
+    
+def wiki_css(data):
     global data_css
     global data_css_ver
 
@@ -615,7 +647,7 @@ def wiki_set(num = 1):
 
     return data_list
 
-def custom():
+def wiki_custom():
     ip = ip_check()
     if ip_or_user(ip) == 0:
         user_icon = 1
@@ -681,41 +713,26 @@ def load_skin(data = '', set_n = 0, default = 0):
     # default == 0 -> 디폴트 미포함
     # default == 1 -> 디폴트 포함
 
-    skin_return_data = '' if set_n == 0 else []
-    system_file = ['main_css']
-    skin_list_get = os.listdir(os.path.abspath('views'))
+    if set_n == 0:
+        skin_return_data = ''
+    else:
+        skin_return_data = []
 
+    skin_list_get = os.listdir('views')
     if default == 1:
         skin_list_get += ['default']
 
-    if data == '':
-        curs.execute(db_change('select data from user_set where name = "skin" and id = ?'), [ip_check()])
-        data = curs.fetchall()
-        if not data:
-            curs.execute(db_change('select data from other where name = "skin"'))
-            data = curs.fetchall()
-            if not data or data[0][0] == '':
-                if default == 1:
-                    data = [['default']]
-                else:
-                    data = [['tenshi']]
-    else:
-        data = [[data]]
-
     for skin_data in skin_list_get:
-        see_data = skin_data if skin_data != 'default' else load_lang('default')
+        if skin_data != 'default':
+            see_data = skin_data
+        else:
+            see_data = load_lang('default')
 
-        if not skin_data in system_file:
-            if data[0][0] == skin_data:
-                if set_n == 0:
-                    skin_return_data = '<option value="' + skin_data + '">' + see_data + '</option>' + skin_return_data
-                else:
-                    skin_return_data = [skin_data] + skin_return_data
+        if skin_data != 'main_css':
+            if set_n == 0:
+                skin_return_data += '<option value="' + skin_data + '">' + see_data + '</option>'
             else:
-                if set_n == 0:
-                    skin_return_data += '<option value="' + skin_data + '">' + see_data + '</option>'
-                else:
-                    skin_return_data += [skin_data]                    
+                skin_return_data += [skin_data]                    
 
     return skin_return_data
 
@@ -797,34 +814,36 @@ def send_email(who, title, data):
 
 def captcha_get():
     data = ''
-
+    
     if ip_or_user() != 0:
         curs.execute(db_change('select data from other where name = "recaptcha"'))
         recaptcha = curs.fetchall()
-        if recaptcha and recaptcha[0][0] != '':
-            curs.execute(db_change('select data from other where name = "sec_re"'))
-            sec_re = curs.fetchall()
-            if sec_re and sec_re[0][0] != '':
-                curs.execute(db_change('select data from other where name = "recaptcha_ver"'))
-                rec_ver = curs.fetchall()
-                if not rec_ver or rec_ver[0][0] == '':
-                    data += '' + \
-                        '<script src="https://www.google.com/recaptcha/api.js" async defer></script>' + \
-                        '<div class="g-recaptcha" data-sitekey="' + recaptcha[0][0] + '"></div>' + \
-                        '<hr class="main_hr">' + \
-                    ''
-                else:
-                    data += '' + \
-                        '<script src="https://www.google.com/recaptcha/api.js?render=' + recaptcha[0][0] + '"></script>' + \
-                        '<input type="hidden" id="g-recaptcha" name="g-recaptcha">' + \
-                        '<script type="text/javascript">' + \
-                            'grecaptcha.ready(function() {' + \
-                                'grecaptcha.execute(\'' + recaptcha[0][0] + '\', {action: \'homepage\'}).then(function(token) {' + \
-                                    'document.getElementById(\'g-recaptcha\').value = token;' + \
-                                '});' + \
+        
+        curs.execute(db_change('select data from other where name = "sec_re"'))
+        sec_re = curs.fetchall()
+        
+        curs.execute(db_change('select data from other where name = "recaptcha_ver"'))
+        rec_ver = curs.fetchall()
+        if  recaptcha and recaptcha[0][0] != '' and \
+            sec_re and sec_re[0][0] != '':
+            if not rec_ver or rec_ver[0][0] == '':
+                data += '' + \
+                    '<script src="https://www.google.com/recaptcha/api.js" async defer></script>' + \
+                    '<div class="g-recaptcha" data-sitekey="' + recaptcha[0][0] + '"></div>' + \
+                    '<hr class="main_hr">' + \
+                ''
+            else:
+                data += '' + \
+                    '<script src="https://www.google.com/recaptcha/api.js?render=' + recaptcha[0][0] + '"></script>' + \
+                    '<input type="hidden" id="g-recaptcha" name="g-recaptcha">' + \
+                    '<script type="text/javascript">' + \
+                        'grecaptcha.ready(function() {' + \
+                            'grecaptcha.execute(\'' + recaptcha[0][0] + '\', {action: \'homepage\'}).then(function(token) {' + \
+                                'document.getElementById(\'g-recaptcha\').value = token;' + \
                             '});' + \
-                        '</script>' + \
-                    ''
+                        '});' + \
+                    '</script>' + \
+                ''
 
     return data
 
@@ -832,24 +851,18 @@ def captcha_post(re_data, num = 1):
     if num == 1:
         curs.execute(db_change('select data from other where name = "sec_re"'))
         sec_re = curs.fetchall()
-        if sec_re and sec_re[0][0] != '' and ip_or_user() != 0 and captcha_get() != '':
-            try:
-                data = urllib.request.urlopen('https://www.google.com/recaptcha/api/siteverify?secret=' + sec_re[0][0] + '&response=' + re_data)
-            except:
-                data = None
-
-            if data and data.getcode() == 200:
-                json_data = json.loads(data.read().decode(data.headers.get_content_charset()))
-                if json_data['success'] == True:
-                    return 0
-                else:
+        if  sec_re and sec_re[0][0] != '' and \
+            ip_or_user() != 0 and captcha_get() != '':
+            data = requests.get(
+                'https://www.google.com/recaptcha/api/siteverify' + \
+                '?secret=' + sec_re[0][0] + '&response=' + re_data
+            )
+            if data.status_code == 200:
+                json_data = json.loads(data.text)
+                if json_data['success'] != True:
                     return 1
-            else:
-                return 0
-        else:
-            return 0
-    else:
-        pass
+
+        return 0
 
 # Func-user
 def ip_or_user(data = ''):
@@ -1194,13 +1207,18 @@ def edit_filter_do(data):
 def add_alarm(who, context):
     curs.execute(db_change('insert into alarm (name, data, date) values (?, ?, ?)'), [who, context, get_time()])
     
-def ua_plus(id, ip, ua, time):
+def ua_plus(u_id, u_ip, u_agent, time):
     curs.execute(db_change("select data from other where name = 'ua_get'"))
     rep_data = curs.fetchall()
     if rep_data and rep_data[0][0] != '':
         pass
     else:
-        curs.execute(db_change("insert into ua_d (name, ip, ua, today, sub) values (?, ?, ?, ?, '')"), [id, ip, ua, time])
+        curs.execute(db_change("insert into ua_d (name, ip, ua, today, sub) values (?, ?, ?, ?, '')"), [
+            u_id, 
+            u_ip, 
+            u_agent, 
+            time
+        ])
 
 def ban_insert(name, end, why, login, blocker, type_d = None):
     now_time = get_time()
@@ -1326,7 +1344,7 @@ def re_error(data):
             end = '<ul class="inside_ul"><li>' + load_lang('authority_error') + '</li></ul>'
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('error'), wiki_set(1), custom(), other2([0, 0])],
+            imp = [load_lang('error'), wiki_set(1), wiki_custom(), wiki_css([0, 0])],
             data = '<h2>' + load_lang('error') + '</h2>' + end,
             menu = 0
         )), 401
@@ -1405,10 +1423,15 @@ def re_error(data):
             data = '???'
 
         if num == 5:
-            get_url = flask.request.path
+            if flask.request.path != '/main_skin_set':
+                title = load_lang('skin_set')
+                tool = [['main_skin_set', load_lang('main_skin_set')]]
+            else:
+                title = load_lang('main_skin_set')
+                tool = [['skin_set', load_lang('skin_set')]]
         
             return easy_minify(flask.render_template(skin_check(),
-                imp = [(load_lang('skin_set') if get_url != '/main_skin_set' else load_lang('main_skin_set')), wiki_set(1), custom(), other2([0, 0])],
+                imp = [title, wiki_set(1), wiki_custom(), wiki_css([0, 0])],
                 data = '' + \
                     '<div id="main_skin_set">' + \
                         '<h2>' + load_lang('error') + '</h2>' + \
@@ -1417,11 +1440,16 @@ def re_error(data):
                         '</ul>' + \
                     '</div>' + \
                     ('<script>main_css_skin_set();</script>' if get_url == '/main_skin_set' else ''),
-                menu = ([['main_skin_set', load_lang('main_skin_set')]] if get_url != '/main_skin_set' else [['skin_set', load_lang('skin_set')]])
+                menu = tool
             ))
         else:
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('error'), wiki_set(1), custom(), other2([0, 0])],
-                data = '<h2>' + load_lang('error') + '</h2><ul class="inside_ul"><li>' + data + '</li></ul>',
+                imp = [load_lang('error'), wiki_set(1), wiki_custom(), wiki_css([0, 0])],
+                data = '' + \
+                     '<h2>' + load_lang('error') + '</h2>' + \
+                     '<ul class="inside_ul">' + \
+                         '<li>' + data + '</li>' + \
+                     '</ul>' + \
+                '',
                 menu = 0
-            )), 400
+            )), 400

+ 1 - 1
route/topic.py

@@ -96,7 +96,7 @@ def topic_2(conn, topic_num):
     else:
         display = 'display: none;' if ban == 1 else ''
         return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('discussion') + ')', 0])],
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('discussion') + ')', 0])],
             data = '''
                 <h2 id="topic_top_title">''' + html.escape(sub) + '''</h2>
                 <div id="top_topic"></div>

+ 1 - 1
route/topic_acl.py

@@ -54,7 +54,7 @@ def topic_acl_2(conn, topic_num):
             acl_html_list += '<option value="' + data_list + '" ' + check + '>' + (data_list if data_list != '' else 'normal') + '</option>'
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('topic_acl_setting'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('topic_acl_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '''
                 <form method="post">
                     <a href="/acl/TEST#exp">(''' + load_lang('reference') + ''')</a>

+ 1 - 1
route/topic_admin.py

@@ -56,7 +56,7 @@ def topic_admin_2(conn, topic_num, num):
         '''
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('discussion_tool'), wiki_set(), custom(), other2(['(#' + num + ')', 0])],
+        imp = [load_lang('discussion_tool'), wiki_set(), wiki_custom(), wiki_css(['(#' + num + ')', 0])],
         data = ban,
         menu = [['thread/' + topic_num + '#' + num, load_lang('return')]]
     ))

+ 1 - 1
route/topic_change.py

@@ -43,7 +43,7 @@ def topic_change_2(conn, topic_num):
         return redirect('/thread/' + topic_num)
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('topic_name_change'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('topic_name_change'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '''
                 <form method="post">
                     ''' + load_lang('document_name') + '''

+ 1 - 1
route/topic_close_list.py

@@ -72,7 +72,7 @@ def topic_close_list_2(conn, name):
         plus = re.sub(r'^<br>', '', plus)
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), custom(), other2(['(' + sub + ')', 0])],
+        imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + sub + ')', 0])],
         data = div + plus,
         menu = menu
     ))

+ 1 - 1
route/topic_delete.py

@@ -16,7 +16,7 @@ def topic_delete_2(conn, topic_num):
         return redirect('/')
     else:
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('topic_delete'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('topic_delete'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '''
                 <hr class=\"main_hr\">
                 <form method="post">

+ 1 - 1
route/topic_stop.py

@@ -67,7 +67,7 @@ def topic_stop_2(conn, topic_num):
         agree_check = 'checked="checked"' if rd_d[0][1] == 'O' else ''
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('topic_setting'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('topic_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '''
                 <form method="post">
                     <select name="stop_d">

+ 1 - 1
route/topic_tool.py

@@ -55,7 +55,7 @@ def topic_tool_2(conn, topic_num):
         '''
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('topic_tool'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('topic_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = data,
         menu = [['thread/' + topic_num, load_lang('return')]]
     ))

+ 1 - 1
route/user_count_edit.py

@@ -23,7 +23,7 @@ def user_count_edit_2(conn, name):
         t_data = 0
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('count'), wiki_set(), custom(), other2([0, 0])],
+        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>

+ 1 - 1
route/user_custom_head_view.py

@@ -43,7 +43,7 @@ def user_custom_head_view_2(conn):
         ''
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang(data = 'user_head', safe = 1), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang(data = 'user_head', safe = 1), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = start + '''
                 <form method="post">
                     <textarea rows="25" cols="100" name="content">''' + data + '''</textarea>

+ 1 - 1
route/user_info.py

@@ -35,7 +35,7 @@ def user_info_2(conn):
             plus += '<li><a href="/pass_find">' + load_lang('password_search') + '</a></li>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('user_tool'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('user_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = '''
             <h2>''' + load_lang('state') + '''</h2>
             <div id="get_user_info"></div>

+ 2 - 2
route/user_setting.py

@@ -70,7 +70,7 @@ def user_setting_2(conn, server_init):
             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(), custom(), other2([0, 0])],
+                imp = [load_lang('user_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
                         <div id="get_user_info"></div>
@@ -122,7 +122,7 @@ def user_setting_2(conn, server_init):
                     div3 += '<option value="' + lang_data + '">' + see_data + '</option>'
             
             return easy_minify(flask.render_template(skin_check(),
-                imp = [load_lang('user_setting'), wiki_set(), custom(), other2([0, 0])],
+                imp = [load_lang('user_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
                 data = '''
                     <form method="post">
                         <div id="get_user_info"></div>

+ 1 - 1
route/user_tool.py

@@ -24,7 +24,7 @@ def user_tool_2(conn, name):
         '''
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), custom(), other2(['(' + load_lang('tool') + ')', 0])],
+        imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('tool') + ')', 0])],
         data = data,
         menu = 0
     ))

+ 1 - 1
route/view_diff_data.py

@@ -50,7 +50,7 @@ def view_diff_data_2(conn, name):
             result = '<pre>' + end_data + '</pre>'
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('compare') + ')', 0])],
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('compare') + ')', 0])],
             data = result,
             menu = [['history/' + url_pas(name), load_lang('return')]]
         ))

+ 1 - 1
route/view_down.py

@@ -12,7 +12,7 @@ def view_down_2(conn, name):
     div += '</ul>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), custom(), other2(['(' + load_lang('sub') + ')', 0])],
+        imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('sub') + ')', 0])],
         data = div,
         menu = [['w/' + url_pas(name), load_lang('return')]]
     ))

+ 1 - 1
route/view_raw.py

@@ -53,7 +53,7 @@ def view_raw_2(conn, name, topic_num, num):
         p_data = '<textarea readonly rows="25">' + p_data + '</textarea>'
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [v_name, wiki_set(), custom(), other2([sub, 0])],
+            imp = [v_name, wiki_set(), wiki_custom(), wiki_css([sub, 0])],
             data = p_data,
             menu = menu
         ))

+ 1 - 1
route/view_read.py

@@ -164,7 +164,7 @@ def view_read_2(conn, name):
         watch_list = 0
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), custom(), other2([sub, r_date, watch_list])],
+        imp = [name, wiki_set(), wiki_custom(), wiki_css([sub, r_date, watch_list])],
         data = div,
         menu = menu
     )), response_data

+ 1 - 1
route/view_xref.py

@@ -44,7 +44,7 @@ def view_xref_2(conn, name):
     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(), custom(), other2(['(' + load_lang('backlink') + ')', 0])],
+        imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('backlink') + ')', 0])],
         data = div,
         menu = [['w/' + url_pas(name), load_lang('return')], ['backlink_reset/' + url_pas(name), load_lang('reset_backlink')]]
     ))

+ 1 - 1
route/vote.py

@@ -35,7 +35,7 @@ def vote_2(conn):
         data += next_fix('/vote?close=y&num=', sql_num_1, data_list)
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('vote_list'), wiki_set(), custom(), other2([sub, 0])],
+        imp = [load_lang('vote_list'), wiki_set(), wiki_custom(), wiki_css([sub, 0])],
         data = data,
         menu = [['other', load_lang('return')]]
     ))

+ 1 - 1
route/vote_add.py

@@ -42,7 +42,7 @@ def vote_add_2(conn):
         acl_data += '</select>'
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('add_vote'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('add_vote'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = '' + \
                 '<form method="post">' + \
                     '<input name="name" placeholder="' + load_lang('name') + '">' + \

+ 1 - 1
route/vote_end.py

@@ -41,7 +41,7 @@ def vote_end_2(conn, num):
         data += '</ul>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('result_vote'), wiki_set(), custom(), other2([0, 0])],
+        imp = [load_lang('result_vote'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = data,
         menu = [['vote', load_lang('return')]]
     ))

+ 1 - 1
route/vote_select.py

@@ -60,7 +60,7 @@ def vote_select_2(conn, num):
         ''
 
         return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('vote'), wiki_set(), custom(), other2([0, 0])],
+            imp = [load_lang('vote'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
             data = data,
             menu = [['vote', load_lang('return')], ['end_vote/' + num, load_lang('result')]]
         ))

+ 1 - 1
route/watch_list.py

@@ -52,7 +52,7 @@ def watch_list_2(conn, tool):
     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(), custom(), other2([0, 0])],
+        imp = [title_name, wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = div,
         menu = [['user', load_lang('return')]]
     ))

+ 10 - 0
test.sql

@@ -0,0 +1,10 @@
+PRAGMA foreign_keys=OFF;
+BEGIN TRANSACTION;
+/****** CORRUPTION ERROR *******/
+/****** database disk image is malformed ******/
+/****** ERROR: database disk image is malformed ******/
+/****** CORRUPTION ERROR *******/
+/****** database disk image is malformed ******/
+/****** ERROR: database disk image is malformed ******/
+/**** ERROR: (11) database disk image is malformed *****/
+COMMIT;

+ 2 - 2
version.json

@@ -1,7 +1,7 @@
 {
     "beta" : {
-        "r_ver" : "v3.3.0-stable-01b (beta-05b) (dev-2021-06-20-01)",
-        "c_ver" : "3300301",
+        "r_ver" : "v3.3.0-stable-01b (beta-05b) (dev-2021-06-23-01)",
+        "c_ver" : "3302302",
         "s_ver" : "12"
     }
 }

+ 0 - 223
views/main_css/js/shotcuts.js

@@ -1,223 +0,0 @@
-/**
- * http://www.openjs.com/scripts/events/keyboard_shortcuts/
- * Version : 2.01.B
- * By Binny V A
- * License : BSD
- */
-shortcut = {
-    'all_shortcuts': {},//All the shortcuts are stored in this array
-    'add': function (shortcut_combination, callback, opt) {
-        //Provide a set of default options
-        var default_options = {
-            'type': 'keydown',
-            'propagate': false,
-            'disable_in_input': false,
-            'target': document,
-            'keycode': false
-        }
-        if (!opt) opt = default_options;
-        else {
-            for (var dfo in default_options) {
-                if (typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];
-            }
-        }
-
-        var ele = opt.target;
-        if (typeof opt.target == 'string') ele = document.getElementById(opt.target);
-        var ths = this;
-        shortcut_combination = shortcut_combination.toLowerCase();
-
-        //The function to be called at keypress
-        var func = function (e) {
-            e = e || window.event;
-
-            if (opt['disable_in_input']) { //Don't enable shortcut keys in Input, Textarea fields
-                var element;
-                if (e.target) element = e.target;
-                else if (e.srcElement) element = e.srcElement;
-                if (element.nodeType == 3) element = element.parentNode;
-
-                if (element.tagName == 'INPUT' || element.tagName == 'TEXTAREA') return;
-            }
-
-            //Find Which key is pressed
-            if (e.keyCode) code = e.keyCode;
-            else if (e.which) code = e.which;
-            var character = String.fromCharCode(code).toLowerCase();
-
-            if (code == 188) character = ","; //If the user presses , when the type is onkeydown
-            if (code == 190) character = "."; //If the user presses , when the type is onkeydown
-
-            var keys = shortcut_combination.split("+");
-            //Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked
-            var kp = 0;
-
-            //Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken
-            var shift_nums = {
-                "`": "~",
-                "1": "!",
-                "2": "@",
-                "3": "#",
-                "4": "$",
-                "5": "%",
-                "6": "^",
-                "7": "&",
-                "8": "*",
-                "9": "(",
-                "0": ")",
-                "-": "_",
-                "=": "+",
-                ";": ":",
-                "'": "\"",
-                ",": "<",
-                ".": ">",
-                "/": "?",
-                "\\": "|"
-            }
-            //Special Keys - and their codes
-            var special_keys = {
-                'esc': 27,
-                'escape': 27,
-                'tab': 9,
-                'space': 32,
-                'return': 13,
-                'enter': 13,
-                'backspace': 8,
-
-                'scrolllock': 145,
-                'scroll_lock': 145,
-                'scroll': 145,
-                'capslock': 20,
-                'caps_lock': 20,
-                'caps': 20,
-                'numlock': 144,
-                'num_lock': 144,
-                'num': 144,
-
-                'pause': 19,
-                'break': 19,
-
-                'insert': 45,
-                'home': 36,
-                'delete': 46,
-                'end': 35,
-
-                'pageup': 33,
-                'page_up': 33,
-                'pu': 33,
-
-                'pagedown': 34,
-                'page_down': 34,
-                'pd': 34,
-
-                'left': 37,
-                'up': 38,
-                'right': 39,
-                'down': 40,
-
-                'f1': 112,
-                'f2': 113,
-                'f3': 114,
-                'f4': 115,
-                'f5': 116,
-                'f6': 117,
-                'f7': 118,
-                'f8': 119,
-                'f9': 120,
-                'f10': 121,
-                'f11': 122,
-                'f12': 123
-            }
-
-            var modifiers = {
-                shift: { wanted: false, pressed: false },
-                ctrl: { wanted: false, pressed: false },
-                alt: { wanted: false, pressed: false },
-                meta: { wanted: false, pressed: false }	//Meta is Mac specific
-            };
-
-            if (e.ctrlKey) modifiers.ctrl.pressed = true;
-            if (e.shiftKey) modifiers.shift.pressed = true;
-            if (e.altKey) modifiers.alt.pressed = true;
-            if (e.metaKey) modifiers.meta.pressed = true;
-
-            for (var i = 0; k = keys[i], i < keys.length; i++) {
-                //Modifiers
-                if (k == 'ctrl' || k == 'control') {
-                    kp++;
-                    modifiers.ctrl.wanted = true;
-
-                } else if (k == 'shift') {
-                    kp++;
-                    modifiers.shift.wanted = true;
-
-                } else if (k == 'alt') {
-                    kp++;
-                    modifiers.alt.wanted = true;
-                } else if (k == 'meta') {
-                    kp++;
-                    modifiers.meta.wanted = true;
-                } else if (k.length > 1) { //If it is a special key
-                    if (special_keys[k] == code) kp++;
-
-                } else if (opt['keycode']) {
-                    if (opt['keycode'] == code) kp++;
-
-                } else { //The special keys did not match
-                    if (character == k) kp++;
-                    else {
-                        if (shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase
-                            character = shift_nums[character];
-                            if (character == k) kp++;
-                        }
-                    }
-                }
-            }
-
-            if (kp == keys.length &&
-						modifiers.ctrl.pressed == modifiers.ctrl.wanted &&
-						modifiers.shift.pressed == modifiers.shift.wanted &&
-						modifiers.alt.pressed == modifiers.alt.wanted &&
-						modifiers.meta.pressed == modifiers.meta.wanted) {
-                callback(e);
-
-                if (!opt['propagate']) { //Stop the event
-                    //e.cancelBubble is supported by IE - this will kill the bubbling process.
-                    e.cancelBubble = true;
-                    e.returnValue = false;
-
-                    //e.stopPropagation works in Firefox.
-                    if (e.stopPropagation) {
-                        e.stopPropagation();
-                        e.preventDefault();
-                    }
-                    return false;
-                }
-            }
-        }
-        this.all_shortcuts[shortcut_combination] = {
-            'callback': func,
-            'target': ele,
-            'event': opt['type']
-        };
-        //Attach the function with the event
-        if (ele.addEventListener) ele.addEventListener(opt['type'], func, false);
-        else if (ele.attachEvent) ele.attachEvent('on' + opt['type'], func);
-        else ele['on' + opt['type']] = func;
-    },
-
-    //Remove the shortcut - just specify the shortcut and I will remove the binding
-    'remove': function (shortcut_combination) {
-        shortcut_combination = shortcut_combination.toLowerCase();
-        var binding = this.all_shortcuts[shortcut_combination];
-        delete (this.all_shortcuts[shortcut_combination])
-        if (!binding) return;
-        var type = binding['event'];
-        var ele = binding['target'];
-        var callback = binding['callback'];
-
-        if (ele.detachEvent) ele.detachEvent('on' + type, callback);
-        else if (ele.removeEventListener) ele.removeEventListener(type, callback, false);
-        else ele['on' + type] = false;
-    }
-}

+ 0 - 37
views/main_css/js/shotcuts_set.js

@@ -1,37 +0,0 @@
-var check = setInterval(function() {
-    try {
-        all_list = [
-            ['F', '/'],
-            ['C', '/recent_changes'],
-            ['D', '/recent_discuss'],
-            ['A', '/random']
-        ];
-
-        all_list.forEach(function(element) {
-            shortcut.add(element[0], function() {
-                window.location.href = element[1];
-            }, {
-                'disable_in_input' : true
-            });
-        });
-
-        all_list_2 = [
-            ['W', '/w'],
-            ['H', '/history'],
-            ['E', '/edit'],
-        ];
-
-        all_list_2.forEach(function(element) {
-            shortcut.add(element[0], function() {
-                href_d = window.location.href.split("/");
-                if(href_d[4]) {
-                    window.location.href = element[1] + '/' + href_d[4];
-                }
-            }, {
-                'disable_in_input' : true
-            });
-        });
-
-        clearInterval(check);
-    } catch { }
-});