2du 4 år sedan
förälder
incheckning
9020c0b473

+ 16 - 44
app.py

@@ -375,50 +375,20 @@ def recent_block(name = 'Test', tool = 'all'):
     return recent_block_2(load_db.db_get(), name, tool)
 
 # Func-history
-@app.route('/recent_change')
-@app.route('/recent_changes')
-def recent_change(name = None):
-    return recent_change_2(load_db.db_get(), name, '')
+app.route('/recent_change')(recent_change)
+app.route('/recent_changes')(recent_change)
 
-@app.route('/record/<name>')
-def recent_record(name = None):
-    return recent_change_2(load_db.db_get(), name, 'record')
+app.route('/record/<name>', defaults = { 'tool' : 'record' })(recent_change)
+app.route('/record/reset/<name>', methods = ['POST', 'GET'])(recent_record_reset)
+app.route('/record/topic/<name>')(recent_record_topic)
 
-@app.route('/history/<everything:name>', methods = ['POST', 'GET'])
-def recent_history(name = None):
-    return recent_change_2(load_db.db_get(), name, 'history')
-
-@app.route('/history/tool/<int(signed = True):rev>/<everything:name>')
-def recent_history_tool(name = 'Test', rev = 1):
-    return recent_history_tool_2(load_db.db_get(), name, rev)
-
-@app.route('/history/delete/<int(signed = True):rev>/<everything:name>', methods = ['POST', 'GET'])
-def recent_history_delete(name = 'Test', rev = 1):
-    return recent_history_delete_2(load_db.db_get(), name, rev)
-
-@app.route('/history/hidden/<int(signed = True):rev>/<everything:name>')
-def recent_history_hidden(name = 'Test', rev = 1):
-    return recent_history_hidden_2(load_db.db_get(), name, rev)
-
-@app.route('/history/send/<int(signed = True):rev>/<everything:name>', methods = ['POST', 'GET'])
-def recent_history_send(name = 'Test', rev = 1):
-    return recent_history_send_2(load_db.db_get(), name, rev)
-
-@app.route('/history/reset/<everything:name>', methods = ['POST', 'GET'])
-def recent_history_reset(name = 'Test'):
-    return recent_history_reset_2(load_db.db_get(), name)
-
-@app.route('/history/add/<everything:name>', methods = ['POST', 'GET'])
-def recent_history_add(name = 'Test'):
-    return recent_history_add_2(load_db.db_get(), name)
-
-@app.route('/record/reset/<name>', methods = ['POST', 'GET'])
-def recent_record_reset(name = 'Test'):
-    return recent_record_reset_2(load_db.db_get(), name)
-
-@app.route('/record/topic/<name>')
-def recent_record_topic(name = 'Test'):
-    return recent_record_topic_2(load_db.db_get(), name)
+app.route('/history/<everything:name>', defaults = { 'tool' : 'history' }, methods = ['POST', 'GET'])(recent_change)
+app.route('/history_tool/<int(signed = True):rev>/<everything:name>')(recent_history_tool)
+app.route('/history_delete/<int(signed = True):rev>/<everything:name>', methods = ['POST', 'GET'])(recent_history_delete)
+app.route('/history_hidden/<int(signed = True):rev>/<everything:name>')(recent_history_hidden)
+app.route('/history_send/<int(signed = True):rev>/<everything:name>', methods = ['POST', 'GET'])(recent_history_send)
+app.route('/history_reset/<everything:name>', methods = ['POST', 'GET'])(recent_history_reset)
+app.route('/history_add/<everything:name>', methods = ['POST', 'GET'])(recent_history_add)
 
 # Func-view
 app.route('/xref/<everything:name>')(view_xref)
@@ -483,6 +453,8 @@ app.route('/change/key')(user_setting_key)
 app.route('/change/key/delete')(user_setting_key_delete)
 app.route('/change/pw', methods = ['POST', 'GET'])(user_setting_pw)
 app.route('/change/head', methods=['GET', 'POST'])(user_setting_head)
+app.route('/change/skin_set')(user_setting_skin_set)
+app.route('/change/skin_set/main')(user_setting_skin_set)
 
 app.route('/user')(user_info)
 app.route('/user/<name>')(user_info)
@@ -502,8 +474,8 @@ 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)
+# /change/skin_set
+app.route('/skin_set')(user_setting_skin_set)
 # 하위 호환용 E
 
 # 개편 보류중 S

+ 2 - 1
lang/en-US.json

@@ -427,7 +427,8 @@
             "no_login_error" : "You are not logged in.",
             "no_exist_user_error" : "The account does not exist.",
             "no_admin_block_error" : "You cannot block or check administrators.",
-            "skin_error" : "The skin you are using does not support individual settings.",
+            "error_skin_set" : "The skin you are using does not support individual settings.",
+            "error_skin_set_old" : "Some older skins may only work by using the old version link.",
             "same_id_exist_error" : "There are users using the same username.",
             "long_id_error" : "Username must be shorter than 20 characters.",
             "id_char_error" : "Only Korean letters and alphabets are allowed for Username.",

+ 2 - 1
lang/ko-KR.json

@@ -159,7 +159,8 @@
     "wiki_skin": "위키 스킨",
     "admin_group": "관리자 그룹",
     "all": "전체",
-    "skin_error": "사용 중인 스킨은 스킨 설정 기능을 지원하지 않습니다.",
+    "error_skin_set": "사용 중인 스킨은 스킨 설정 기능을 지원하지 않습니다.",
+    "error_skin_set_old" : "일부 오래된 스킨은 구버전 링크를 이용해야만 작동할 수도 있습니다.",
     "member": "가입자",
     "backlink": "역링크",
     "no_admin_block_error": "관리자를 검사하거나 차단할 수 없습니다.",

+ 170 - 169
route/recent_change.py

@@ -1,204 +1,205 @@
 from .tool.func import *
 
-def recent_change_2(conn, name, tool):
-    curs = conn.cursor()
-
-    if flask.request.method == 'POST':
-        return redirect(
-            '/diff' + 
-            '/' + flask.request.form.get('b', '1') +
-            '/' + flask.request.form.get('a', '1') +
-            '/' + url_pas(name)
-        )
-    else:
-        ban = ''
-        select = ''
-        sub = ''
-        admin_6 = admin_check(6)
-        admin = admin_check()
-        div = '''
-            <table id="main_table_set">
-                <tbody>
-                    <tr id="main_table_top_tr">
-        '''
-
-        num = int(number_check(flask.request.args.get('num', '1')))
-        sql_num = (num * 50 - 50) if num * 50 > 0 else 0
-
-        if name:
-            if tool == 'history':
-                sub += ' (' + load_lang('history') + ')'
-
-                div += '''
-                    <td id="main_table_width">''' + load_lang('version') + '''</td>
-                    <td id="main_table_width">''' + load_lang('editor') + '''</td>
-                    <td id="main_table_width">''' + load_lang('time') + '''</td>
-                '''
-
-                set_type = flask.request.args.get('set', 'normal')
-                set_type = '' if set_type == 'edit' else set_type
+def recent_change(name = None, tool = ''):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if flask.request.method == 'POST':
+            return redirect(
+                '/diff' + 
+                '/' + flask.request.form.get('b', '1') +
+                '/' + flask.request.form.get('a', '1') +
+                '/' + url_pas(name)
+            )
+        else:
+            ban = ''
+            select = ''
+            sub = ''
+            admin_6 = admin_check(6)
+            admin = admin_check()
+            div = '''
+                <table id="main_table_set">
+                    <tbody>
+                        <tr id="main_table_top_tr">
+            '''
 
-                if set_type != 'normal':
-                    curs.execute(db_change('' + \
-                        'select id, title, date, ip, send, leng, hide from history ' + \
-                        'where title = ? and type = ? ' + \
-                        'order by id + 0 desc ' + \
-                        "limit ?, 50" + \
-                    ''), [name, set_type, sql_num])
+            num = int(number_check(flask.request.args.get('num', '1')))
+            sql_num = (num * 50 - 50) if num * 50 > 0 else 0
+
+            if name:
+                if tool == 'history':
+                    sub += ' (' + load_lang('history') + ')'
+
+                    div += '''
+                        <td id="main_table_width">''' + load_lang('version') + '''</td>
+                        <td id="main_table_width">''' + load_lang('editor') + '''</td>
+                        <td id="main_table_width">''' + load_lang('time') + '''</td>
+                    '''
+
+                    set_type = flask.request.args.get('set', 'normal')
+                    set_type = '' if set_type == 'edit' else set_type
+
+                    if set_type != 'normal':
+                        curs.execute(db_change('' + \
+                            'select id, title, date, ip, send, leng, hide from history ' + \
+                            'where title = ? and type = ? ' + \
+                            'order by id + 0 desc ' + \
+                            "limit ?, 50" + \
+                        ''), [name, set_type, sql_num])
+                    else:
+                        curs.execute(db_change('' + \
+                            'select id, title, date, ip, send, leng, hide from history ' + \
+                            'where title = ? ' + \
+                            'order by id + 0 desc ' + \
+                            "limit ?, 50" + \
+                        ''), [name, sql_num])
+
+                    data_list = curs.fetchall()
                 else:
+                    div +=  '''
+                        <td id="main_table_width">''' + load_lang('document_name') + '''</td>
+                        <td id="main_table_width">''' + load_lang('editor') + '''</td>
+                        <td id="main_table_width">''' + load_lang('time') + '''</td>
+                    '''
+
                     curs.execute(db_change('' + \
                         'select id, title, date, ip, send, leng, hide from history ' + \
-                        'where title = ? ' + \
-                        'order by id + 0 desc ' + \
-                        "limit ?, 50" + \
+                        "where ip = ? order by date desc limit ?, 50" + \
                     ''), [name, sql_num])
-
-                data_list = curs.fetchall()
+                    data_list = curs.fetchall()
             else:
                 div +=  '''
                     <td id="main_table_width">''' + load_lang('document_name') + '''</td>
                     <td id="main_table_width">''' + load_lang('editor') + '''</td>
                     <td id="main_table_width">''' + load_lang('time') + '''</td>
                 '''
+                sub = ''
+                set_type = flask.request.args.get('set', 'normal')
+                set_type = '' if set_type == 'edit' else set_type
 
-                curs.execute(db_change('' + \
-                    'select id, title, date, ip, send, leng, hide from history ' + \
-                    "where ip = ? order by date desc limit ?, 50" + \
-                ''), [name, sql_num])
-                data_list = curs.fetchall()
-        else:
-            div +=  '''
-                <td id="main_table_width">''' + load_lang('document_name') + '''</td>
-                <td id="main_table_width">''' + load_lang('editor') + '''</td>
-                <td id="main_table_width">''' + load_lang('time') + '''</td>
-            '''
-            sub = ''
-            set_type = flask.request.args.get('set', 'normal')
-            set_type = '' if set_type == 'edit' else set_type
-
-            data_list = []
-            curs.execute(db_change('select id, title from rc where type = ? order by date desc'), [set_type])
-            for i in curs.fetchall():
-                curs.execute(db_change('select id, title, date, ip, send, leng, hide from history where id = ? and title = ?'), i)
-                data_list += curs.fetchall()
-
-        div += '</tr>'
-
-        all_ip = ip_pas([i[3] for i in data_list])
-        for data in data_list:
-            select += '<option value="' + data[0] + '">' + data[0] + '</option>'
-            send = data[4]
-
-            if re.search(r"\+", data[5]):
-                leng = '<span style="color:green;">(' + data[5] + ')</span>'
-            elif re.search(r"\-", data[5]):
-                leng = '<span style="color:red;">(' + data[5] + ')</span>'
-            else:
-                leng = '<span style="color:gray;">(' + data[5] + ')</span>'
+                data_list = []
+                curs.execute(db_change('select id, title from rc where type = ? order by date desc'), [set_type])
+                for i in curs.fetchall():
+                    curs.execute(db_change('select id, title, date, ip, send, leng, hide from history where id = ? and title = ?'), i)
+                    data_list += curs.fetchall()
 
-            ip = all_ip[data[3]]
-            m_tool = '<a href="/history/tool/' + data[0] + '/' + url_pas(data[1]) + '">(' + load_lang('tool') + ')</a>'
+            div += '</tr>'
 
-            style = ['', '']
-            date = data[2]
+            all_ip = ip_pas([i[3] for i in data_list])
+            for data in data_list:
+                select += '<option value="' + data[0] + '">' + data[0] + '</option>'
+                send = data[4]
 
-            if data[6] == 'O':
-                if admin == 1:
-                    style[0] = 'id="toron_color_grey"'
-                    style[1] = 'id="toron_color_grey"'
+                if re.search(r"\+", data[5]):
+                    leng = '<span style="color:green;">(' + data[5] + ')</span>'
+                elif re.search(r"\-", data[5]):
+                    leng = '<span style="color:red;">(' + data[5] + ')</span>'
                 else:
-                    ip = ''
-                    ban = ''
-                    date = ''
-                    send = ''
+                    leng = '<span style="color:gray;">(' + data[5] + ')</span>'
 
-                    style[0] = 'style="display: none;"'
-                    style[1] = 'id="toron_color_grey"'
+                ip = all_ip[data[3]]
+                m_tool = '<a href="/history_tool/' + data[0] + '/' + url_pas(data[1]) + '">(' + load_lang('tool') + ')</a>'
 
-            if tool == 'history':
-                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:
-                    title += '<a href="/history/' + url_pas(data[1]) + '">(r' + data[0] + ')</a> '
+                style = ['', '']
+                date = data[2]
+
+                if data[6] == 'O':
+                    if admin == 1:
+                        style[0] = 'id="toron_color_grey"'
+                        style[1] = 'id="toron_color_grey"'
+                    else:
+                        ip = ''
+                        ban = ''
+                        date = ''
+                        send = ''
+
+                        style[0] = 'style="display: none;"'
+                        style[1] = 'id="toron_color_grey"'
+
+                if tool == 'history':
+                    title = '<a href="/w_rev/' + data[0] + '/' + url_pas(name) + '">r' + data[0] + '</a> '
                 else:
-                    title += '<a href="/diff/' + str(int(data[0]) - 1) + '/' + data[0] + '/' + url_pas(data[1]) + '">(r' + data[0] + ')</a> '
+                    title = '<a href="/w/' + url_pas(data[1]) + '">' + html.escape(data[1]) + '</a> '
+                    if int(data[0]) < 2:
+                        title += '<a href="/history/' + url_pas(data[1]) + '">(r' + data[0] + ')</a> '
+                    else:
+                        title += '<a href="/diff/' + str(int(data[0]) - 1) + '/' + data[0] + '/' + url_pas(data[1]) + '">(r' + data[0] + ')</a> '
+
+                div += '''
+                    <tr ''' + style[0] + '''>
+                        <td>''' + title + m_tool + ' ' + leng + '''</td>
+                        <td>''' + ip + ban + '''</td>
+                        <td>''' + date + '''</td>
+                    </tr>
+                    <tr ''' + style[1] + '''>
+                        <td class="send_content" colspan="3">
+                            ''' + (html.escape(send) if send != '' else '<br>') + '''
+                        </td>
+                    </tr>
+                '''
 
             div += '''
-                <tr ''' + style[0] + '''>
-                    <td>''' + title + m_tool + ' ' + leng + '''</td>
-                    <td>''' + ip + ban + '''</td>
-                    <td>''' + date + '''</td>
-                </tr>
-                <tr ''' + style[1] + '''>
-                    <td class="send_content" colspan="3">
-                        ''' + (html.escape(send) if send != '' else '<br>') + '''
-                    </td>
-                </tr>
+                    </tbody>
+                </table>
+                <script>send_render();</script>
             '''
 
-        div += '''
-                </tbody>
-            </table>
-            <script>send_render();</script>
-        '''
-
-        if name:
-            if tool == 'history':
+            if name:
+                if tool == 'history':
+                    div = '' + \
+                        '<a href="?set=normal">(' + load_lang('normal') + ')</a> ' + \
+                        '<a href="?set=edit">(' + load_lang('edit') + ')</a> ' + \
+                        '<a href="?set=move">(' + load_lang('move') + ')</a> ' + \
+                        '<a href="?set=delete">(' + load_lang('delete') + ')</a> ' + \
+                        '<a href="?set=revert">(' + load_lang('revert') + ')</a>' + \
+                        '<hr class="main_hr">' + div + \
+                    ''
+                    menu = [['w/' + url_pas(name), load_lang('return')]]
+
+                    if set_type == 'normal':
+                        div = '''
+                            <form method="post">
+                                <select name="a">''' + select + '''</select> <select name="b">''' + select + '''</select>
+                                <button type="submit">''' + load_lang('compare') + '''</button>
+                            </form>
+                            <hr class="main_hr">
+                        ''' + div
+
+                        if admin == 1:
+                            menu += [
+                                ['history_add/' + url_pas(name), load_lang('history_add')],
+                                ['history_reset/' + url_pas(name), load_lang('history_reset')]
+                            ]
+
+                    title = name
+                    div += next_fix('/history/' + url_pas(name) + '?tool=' + set_type + '&num=', num, data_list)
+                else:
+                    title = load_lang('edit_record')
+                    menu = [
+                        ['other', load_lang('other')], 
+                        ['user', load_lang('user')],
+                        ['record/reset/' + url_pas(name), load_lang('record_reset')]
+                    ]
+                    div += next_fix('/record/' + url_pas(name) + '?num=', num, data_list)
+            else:
                 div = '' + \
                     '<a href="?set=normal">(' + load_lang('normal') + ')</a> ' + \
                     '<a href="?set=edit">(' + load_lang('edit') + ')</a> ' + \
+                    '<a href="?set=user">(' + load_lang('user_document') + ')</a> ' + \
                     '<a href="?set=move">(' + load_lang('move') + ')</a> ' + \
                     '<a href="?set=delete">(' + load_lang('delete') + ')</a> ' + \
                     '<a href="?set=revert">(' + load_lang('revert') + ')</a>' + \
                     '<hr class="main_hr">' + div + \
                 ''
-                menu = [['w/' + url_pas(name), load_lang('return')]]
-                
-                if set_type == 'normal':
-                    div = '''
-                        <form method="post">
-                            <select name="a">''' + select + '''</select> <select name="b">''' + select + '''</select>
-                            <button type="submit">''' + load_lang('compare') + '''</button>
-                        </form>
-                        <hr class=\"main_hr\">
-                    ''' + div
 
-                    if admin == 1:
-                        menu += [
-                            ['history/add/' + url_pas(name), load_lang('history_add')],
-                            ['history/reset/' + url_pas(name), load_lang('history_reset')]
-                        ]
+                menu = 0
+                title = load_lang('recent_change')
 
-                title = name
-                div += next_fix('/history/' + url_pas(name) + '?tool=' + set_type + '&num=', num, data_list)
-            else:
-                title = load_lang('edit_record')
-                menu = [
-                    ['other', load_lang('other')], 
-                    ['user', load_lang('user')],
-                    ['record/reset/' + url_pas(name), load_lang('record_reset')]
-                ]
-                div += next_fix('/record/' + url_pas(name) + '?num=', num, data_list)
-        else:
-            div = '' + \
-                '<a href="?set=normal">(' + load_lang('normal') + ')</a> ' + \
-                '<a href="?set=edit">(' + load_lang('edit') + ')</a> ' + \
-                '<a href="?set=user">(' + load_lang('user_document') + ')</a> ' + \
-                '<a href="?set=move">(' + load_lang('move') + ')</a> ' + \
-                '<a href="?set=delete">(' + load_lang('delete') + ')</a> ' + \
-                '<a href="?set=revert">(' + load_lang('revert') + ')</a>' + \
-                '<hr class="main_hr">' + div + \
-            ''
-
-            menu = 0
-            title = load_lang('recent_change')
-
-        if sub == '':
-            sub = 0
-
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [title, wiki_set(), wiki_custom(), wiki_css([sub, 0])],
-            data = div,
-            menu = menu
-        ))
+            if sub == '':
+                sub = 0
+
+            return easy_minify(flask.render_template(skin_check(),
+                imp = [title, wiki_set(), wiki_custom(), wiki_css([sub, 0])],
+                data = div,
+                menu = menu
+            ))

+ 43 - 42
route/recent_history_add.py

@@ -1,51 +1,52 @@
 from .tool.func import *
 
-def recent_history_add_2(conn, name):
-    curs = conn.cursor()
+def recent_history_add(name = 'Test'):
+    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':
-        admin_check(None, 'history_add (' + name + ')')
+        if flask.request.method == 'POST':
+            admin_check(None, 'history_add (' + name + ')')
 
-        today = get_time()
-        content = flask.request.form.get('content', '')
-        leng = '+' + str(len(content))
+            today = get_time()
+            content = flask.request.form.get('content', '')
+            leng = '+' + str(len(content))
 
-        history_plus(
-            name,
-            content,
-            today,
-            'Add:' + flask.request.form.get('get_ip', ''),
-            flask.request.form.get('send', ''),
-            leng,
-            t_check = 'add',
-            mode = 'add'
-        )
+            history_plus(
+                name,
+                content,
+                today,
+                'Add:' + flask.request.form.get('get_ip', ''),
+                flask.request.form.get('send', ''),
+                leng,
+                t_check = 'add',
+                mode = 'add'
+            )
 
-        conn.commit()
+            conn.commit()
 
-        return redirect('/history/' + url_pas(name))
-    else:
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('history_add'), wiki_set(), wiki_custom(), wiki_css(['(' + name + ')', 0])],
-            data = '''
-                <form method="post">
-                    <script>do_stop_exit();</script>
-                    ''' + edit_button() + '''
-                    <textarea rows="25" id="content" name="content"></textarea>
+            return redirect('/history/' + url_pas(name))
+        else:
+            return easy_minify(flask.render_template(skin_check(),
+                imp = [load_lang('history_add'), wiki_set(), wiki_custom(), wiki_css(['(' + name + ')', 0])],
+                data = '''
+                    <form method="post">
+                        <script>do_stop_exit();</script>
+                        ''' + edit_button() + '''
+                        <textarea rows="25" id="content" name="content"></textarea>
+                        <hr class="main_hr">
+                        <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
+                        <hr class="main_hr">
+                        <input placeholder="''' + load_lang('name') + '''" name="get_ip" type="text">
+                        <hr class="main_hr">
+                        <button id="save" type="submit" onclick="go_save_zone = 1;">''' + load_lang('save') + '''</button>
+                        <button id="preview" type="button" onclick="load_preview(\'''' + url_pas(name) + '\')">' + load_lang('preview') + '''</button>
+                    </form>
                     <hr class="main_hr">
-                    <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
-                    <hr class="main_hr">
-                    <input placeholder="''' + load_lang('name') + '''" name="get_ip" type="text">
-                    <hr class="main_hr">
-                    <button id="save" type="submit" onclick="go_save_zone = 1;">''' + load_lang('save') + '''</button>
-                    <button id="preview" type="button" onclick="load_preview(\'''' + url_pas(name) + '\')">' + load_lang('preview') + '''</button>
-                </form>
-                <hr class="main_hr">
-                <div id="see_preview"></div>
-            ''',
-            menu = [['history/' + url_pas(name), load_lang('return')]]
-        ))
+                    <div id="see_preview"></div>
+                ''',
+                menu = [['history/' + url_pas(name), load_lang('return')]]
+            ))

+ 23 - 22
route/recent_history_delete.py

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

+ 13 - 12
route/recent_history_hidden.py

@@ -1,17 +1,18 @@
 from .tool.func import *
 
-def recent_history_hidden_2(conn, name, rev):
-    curs = conn.cursor()
-    
-    num = str(rev)
+def recent_history_hidden(name = 'Test', rev = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
 
-    if admin_check(6, 'history_hidden (' + name + '#' + num + ')') == 1:
-        curs.execute(db_change("select title from history where title = ? and id = ? and hide = 'O'"), [name, num])
-        if curs.fetchall():
-            curs.execute(db_change("update history set hide = '' where title = ? and id = ?"), [name, num])
-        else:
-            curs.execute(db_change("update history set hide = 'O' where title = ? and id = ?"), [name, num])
+        num = str(rev)
 
-        conn.commit()
+        if admin_check(6, 'history_hidden (' + name + '#' + num + ')') == 1:
+            curs.execute(db_change("select title from history where title = ? and id = ? and hide = 'O'"), [name, num])
+            if curs.fetchall():
+                curs.execute(db_change("update history set hide = '' where title = ? and id = ?"), [name, num])
+            else:
+                curs.execute(db_change("update history set hide = 'O' where title = ? and id = ?"), [name, num])
 
-    return redirect('/history/' + url_pas(name))
+            conn.commit()
+
+        return redirect('/history/' + url_pas(name))

+ 22 - 21
route/recent_history_reset.py

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

+ 43 - 42
route/recent_history_send.py

@@ -1,45 +1,46 @@
 from .tool.func import *
 
-def recent_history_send_2(conn, name, rev):
-    curs = conn.cursor()
-
-    num = str(rev)
-    
-    if admin_check() != 1:
-        return re_error('/error/3')
-
-    if flask.request.method == 'POST':
-        admin_check(None, 'send edit ' + name + ' r' + num)
-
-        curs.execute(db_change("select send from history where title = ? and id = ?"), [name, num])
-        if curs.fetchall():
-            curs.execute(db_change("update history set send = ? where title = ? and id = ?"), [
-                flask.request.form.get('send', ''),
-                name, 
-                num
-            ])
-
-        conn.commit()
-
-        return redirect('/history/' + url_pas(name))
-    else:
-        curs.execute(db_change("select send from history where title = ? and id = ?"), [name, num])
-        send = curs.fetchall()
-        if send:
-            send = send[0][0]
-        
-            return easy_minify(flask.render_template(skin_check(),
-                imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('send_edit') + ') (r' + num + ')', 0])],
-                data = '''
-                    <form method="post">
-                        <span>''' + load_lang('history_delete_warning') + '''</span>
-                        <hr class="main_hr">
-                        <input value="''' + html.escape(send) + '''" name="send">
-                        <hr class="main_hr">
-                        <button type="submit">''' + load_lang('edit') + '''</button>
-                    </form>
-                ''',
-                menu = [['history/' + url_pas(name), load_lang('return')]]
-            ))
+def recent_history_send(name = 'Test', rev = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        num = str(rev)
+
+        if admin_check() != 1:
+            return re_error('/error/3')
+
+        if flask.request.method == 'POST':
+            admin_check(None, 'send edit ' + name + ' r' + num)
+
+            curs.execute(db_change("select send from history where title = ? and id = ?"), [name, num])
+            if curs.fetchall():
+                curs.execute(db_change("update history set send = ? where title = ? and id = ?"), [
+                    flask.request.form.get('send', ''),
+                    name, 
+                    num
+                ])
+
+            conn.commit()
+
+            return redirect('/history/' + url_pas(name))
         else:
-            return redirect('/history/' + url_pas(name))
+            curs.execute(db_change("select send from history where title = ? and id = ?"), [name, num])
+            send = curs.fetchall()
+            if send:
+                send = send[0][0]
+
+                return easy_minify(flask.render_template(skin_check(),
+                    imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('send_edit') + ') (r' + num + ')', 0])],
+                    data = '''
+                        <form method="post">
+                            <span>''' + load_lang('history_delete_warning') + '''</span>
+                            <hr class="main_hr">
+                            <input value="''' + html.escape(send) + '''" name="send">
+                            <hr class="main_hr">
+                            <button type="submit">''' + load_lang('edit') + '''</button>
+                        </form>
+                    ''',
+                    menu = [['history/' + url_pas(name), load_lang('return')]]
+                ))
+            else:
+                return redirect('/history/' + url_pas(name))

+ 47 - 46
route/recent_history_tool.py

@@ -1,51 +1,52 @@
 from .tool.func import *
 
-def recent_history_tool_2(conn, name, rev):
-    curs = conn.cursor()
-
-    num = str(rev)
-
-    data = '' + \
-        '<h2>' + load_lang('tool') + '</h2>' + \
-        '<ul class="inside_ul">' + \
-            '<li><a href="/raw_rev/' + num + '/' + url_pas(name) + '">' + load_lang('raw') + '</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/' + 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>'
-
-    data += '<li><a href="/history/' + url_pas(name) + '">' + load_lang('history') + '</a></li>'
-    data += '</ul>'
-    
-    if admin_check(6) == 1:
-        data += '<h3>admin</h3>'
-        data += '<ul class="inside_ul">'
-        curs.execute(db_change('' + \
-            'select title from history ' + \
-            'where title = ? and id = ? and hide = "O"' + \
-        ''), [name, num])
-        data += '<li><a href="/history/hidden/' + num + '/' + url_pas(name) + '">'
-        if curs.fetchall():
-            data += load_lang('hide_release') 
-        else:
-            data += load_lang('hide')
-            
-        data += '</a></li>'
-        data += '</ul>'
+def recent_history_tool(name = 'Test', rev = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        num = str(rev)
+
+        data = '' + \
+            '<h2>' + load_lang('tool') + '</h2>' + \
+            '<ul class="inside_ul">' + \
+                '<li><a href="/raw_rev/' + num + '/' + url_pas(name) + '">' + load_lang('raw') + '</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/' + str(rev - 1) + '/' + url_pas(name) + '">' + load_lang('revert') + ' | r' + str(rev - 1) + '</a></li>'
 
-    if admin_check() == 1:
-        data += '<h3>owner</h3>'
-        data += '<ul class="inside_ul">'
-        data += '<li><a href="/history/delete/' + num + '/' + url_pas(name) + '">' + load_lang('history_delete') + '</li>'
-        data += '<li><a href="/history/send/' + num + '/' + url_pas(name) + '">' + load_lang('send_edit') + '</li>'
+        if rev - 1 > 0:
+            data += '<li><a href="/diff/' + str(rev - 1) + '/' + num + '/' + url_pas(name) + '">' + load_lang('compare') + '</a></li>'
+
+        data += '<li><a href="/history/' + url_pas(name) + '">' + load_lang('history') + '</a></li>'
         data += '</ul>'
 
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), wiki_custom(), wiki_css(['(r' + num + ')', 0])],
-        data = data,
-        menu = [['history/' + url_pas(name), load_lang('return')]]
-    ))
+        if admin_check(6) == 1:
+            data += '<h3>admin</h3>'
+            data += '<ul class="inside_ul">'
+            curs.execute(db_change('' + \
+                'select title from history ' + \
+                'where title = ? and id = ? and hide = "O"' + \
+            ''), [name, num])
+            data += '<li><a href="/history_hidden/' + num + '/' + url_pas(name) + '">'
+            if curs.fetchall():
+                data += load_lang('hide_release') 
+            else:
+                data += load_lang('hide')
+
+            data += '</a></li>'
+            data += '</ul>'
+
+        if admin_check() == 1:
+            data += '<h3>owner</h3>'
+            data += '<ul class="inside_ul">'
+            data += '<li><a href="/history_delete/' + num + '/' + url_pas(name) + '">' + load_lang('history_delete') + '</li>'
+            data += '<li><a href="/history_send/' + num + '/' + url_pas(name) + '">' + load_lang('send_edit') + '</li>'
+            data += '</ul>'
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [name, wiki_set(), wiki_custom(), wiki_css(['(r' + num + ')', 0])],
+            data = data,
+            menu = [['history/' + url_pas(name), load_lang('return')]]
+        ))

+ 22 - 21
route/recent_record_reset.py

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

+ 47 - 46
route/recent_record_topic.py

@@ -1,48 +1,49 @@
 from .tool.func import *
 
-def recent_record_topic_2(conn, name):
-    curs = conn.cursor()
-
-    num = int(number_check(flask.request.args.get('num', '1')))
-    sql_num = (num * 50 - 50) if num * 50 > 0 else 0
-
-    div = '''
-        <table id="main_table_set">
-            <tr id="main_table_top_tr">
-                <td id="main_table_width">''' + load_lang('discussion_name') + '''</td>
-                <td id="main_table_width">''' + load_lang('writer') + '''</td>
-                <td id="main_table_width">''' + load_lang('time') + '''</td>
-            </tr>
-    '''
-    sub = '(' + html.escape(name) + ')'
-    pas_name = ip_pas(name)
-
-    curs.execute(db_change("select code, id, date from topic where ip = ? order by date desc limit ?, 50"), [name, sql_num])
-    data_list = curs.fetchall()
-    for data in data_list:
-        title = html.escape(data[0])
-
-        curs.execute(db_change("select title, sub from rd where code = ?"), [data[0]])
-        other_data = curs.fetchall()
-        
-        div += '' + \
-            '<tr>' + \
-                '<td>' + \
-                    '<a href="/thread/' + data[0] + '#' + data[1] + '">' + other_data[0][1] + '#' + data[1] + '</a> (' + other_data[0][0] + ')' + \
-                '</td>' + \
-                '<td>' + pas_name + '</td>' + \
-                '<td>' + data[2] + '</td>' + \
-            '</tr>' + \
-        ''
-
-    div += '</table>'
-    div += next_fix('/record/topic/' + url_pas(name) + '?num=', num, data_list)
-    
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('discussion_record'), wiki_set(), wiki_custom(), wiki_css([sub, 0])],
-        data = div,
-        menu = [
-            ['other', load_lang('other')], 
-            ['user', load_lang('user')]
-        ]
-    ))
+def recent_record_topic(name = 'Test'):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        num = int(number_check(flask.request.args.get('num', '1')))
+        sql_num = (num * 50 - 50) if num * 50 > 0 else 0
+
+        div = '''
+            <table id="main_table_set">
+                <tr id="main_table_top_tr">
+                    <td id="main_table_width">''' + load_lang('discussion_name') + '''</td>
+                    <td id="main_table_width">''' + load_lang('writer') + '''</td>
+                    <td id="main_table_width">''' + load_lang('time') + '''</td>
+                </tr>
+        '''
+        sub = '(' + html.escape(name) + ')'
+        pas_name = ip_pas(name)
+
+        curs.execute(db_change("select code, id, date from topic where ip = ? order by date desc limit ?, 50"), [name, sql_num])
+        data_list = curs.fetchall()
+        for data in data_list:
+            title = html.escape(data[0])
+
+            curs.execute(db_change("select title, sub from rd where code = ?"), [data[0]])
+            other_data = curs.fetchall()
+
+            div += '' + \
+                '<tr>' + \
+                    '<td>' + \
+                        '<a href="/thread/' + data[0] + '#' + data[1] + '">' + other_data[0][1] + '#' + data[1] + '</a> (' + other_data[0][0] + ')' + \
+                    '</td>' + \
+                    '<td>' + pas_name + '</td>' + \
+                    '<td>' + data[2] + '</td>' + \
+                '</tr>' + \
+            ''
+
+        div += '</table>'
+        div += next_fix('/record/topic/' + url_pas(name) + '?num=', num, data_list)
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [load_lang('discussion_record'), wiki_set(), wiki_custom(), wiki_css([sub, 0])],
+            data = div,
+            menu = [
+                ['other', load_lang('other')], 
+                ['user', load_lang('user')]
+            ]
+        ))

+ 8 - 5
route/tool/func.py

@@ -2036,7 +2036,7 @@ def re_error(data):
         elif num == 4:
             data = load_lang('no_admin_block_error')
         elif num == 5:
-            data = load_lang('skin_error')
+            data = load_lang('error_skin_set')
         elif num == 6:
             data = load_lang('same_id_exist_error')
         elif num == 7:
@@ -2104,13 +2104,16 @@ def re_error(data):
             data = '???'
 
         if num == 5:
-            if flask.request.path != '/main_skin_set':
+            if not flask.request.path in ('/main_skin_set', '/change/skin_set/main'):
+                if flask.request.path != '/skin_set':
+                    data += '<br>' + load_lang('error_skin_set_old') + ' <a href="/skin_set">(' + load_lang('go') + ')</a>'
+
                 title = load_lang('skin_set')
-                tool = [['main_skin_set', load_lang('main_skin_set')]]
+                tool = [['change', load_lang('user_setting')]]
                 load_skin_set = ''
             else:
                 title = load_lang('main_skin_set')
-                tool = [['skin_set', load_lang('skin_set')]]
+                tool = [['change', load_lang('user_setting')]]
                 load_skin_set = '<script>main_css_skin_set();</script>'
         
             return easy_minify(flask.render_template(skin_check(),
@@ -2119,7 +2122,7 @@ def re_error(data):
                     '<div id="main_skin_set">' + \
                         '<h2>' + load_lang('error') + '</h2>' + \
                         '<ul class="inside_ul">' + \
-                            '<li>' + data + ' <a href="/main_skin_set">(' + load_lang('main_skin_set') + ')</a></li>' + \
+                            '<li>' + data + '</a></li>' + \
                         '</ul>' + \
                     '</div>' + \
                     load_skin_set,

+ 4 - 0
route/user_setting.py

@@ -113,6 +113,8 @@ def user_setting():
                             <hr class="main_hr">
                             <select name="skin">''' + div2 + '''</select>
                             <hr class="main_hr">
+                            <a href="/change/skin_set">(''' + load_lang('skin_set') + ''')</a> <a href="/change/skin_set/main">(''' + load_lang('main_skin_set') + ''')</a>
+                            <hr class="main_hr">
                             <span>''' + load_lang('language') + '''</span>
                             <hr class="main_hr">
                             <select name="lang">''' + div3 + '''</select>
@@ -171,6 +173,8 @@ def user_setting():
                             <hr class="main_hr">
                             <select name="skin">''' + div2 + '''</select>
                             <hr class="main_hr">
+                            <a href="/change/skin_set">(''' + load_lang('skin_set') + ''')</a> <a href="/change/skin_set/main">(''' + load_lang('main_skin_set') + ''')</a>
+                            <hr class="main_hr">
                             <span>''' + load_lang('language') + '''</span>
                             <hr class="main_hr">
                             <select name="lang">''' + div3 + '''</select>

+ 1 - 1
route/main_func_skin_set.py → route/user_setting_skin_set.py

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

+ 25 - 0
route/user_setting_skin_set_main.py

@@ -0,0 +1,25 @@
+from .tool.func import *
+
+def user_setting_skin_set_main():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if ban_check() == 1:
+            return re_error('/ban')
+            
+        if flask.request.method == 'POST':
+
+            conn.commit()
+
+            return redirect('/change')
+        else:
+
+            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">
+
+                    </form>
+                ''',
+                menu = [['user', load_lang('return')]]
+            ))

+ 2 - 2
views/main_css/js/load_skin_set.js

@@ -130,9 +130,9 @@ function main_css_skin_load() {
         var get_category = document.getElementById('cate_all');
         if(get_category) {
             var backup_category = get_category.innerHTML;
-            var in_data = document.getElementById('in_data_0').innerHTML;
+            var in_data = document.getElementById('render_content').innerHTML;
             get_category.innerHTML = '';
-            document.getElementById('in_data_0').innerHTML = backup_category + in_data;
+            document.getElementById('render_content').innerHTML = backup_category + in_data;
             head_data.innerHTML += '<style>#cate { margin-top: 0px; margin-bottom: 20px; }</style>';
         }
     }

+ 1 - 1
views/main_css/js/render_onmark.js

@@ -846,7 +846,7 @@ function do_onmark_last_render(data, name_include, data_category) {
     data = data.replace(/\n/g, '<br>');
     
     data += data_category;
-    
+
     return data;
 }
 

+ 0 - 5
views/main_css/js/route/edit.js

@@ -1,5 +0,0 @@
-"use strict";
-
-function opennamu_route_edit() {
-    
-}