Bladeren bron

Merge pull request #1416 from openNAMU/dev

Dev
잉여개발기 (SPDV) 4 jaren geleden
bovenliggende
commit
d201d94f3a

+ 13 - 34
app.py

@@ -472,7 +472,6 @@ def view_xref_this(name = 'Test'):
 app.route('/raw/<everything:name>')(view_raw_2)
 app.route('/raw/<everything:name>/doc_acl', defaults = { 'doc_acl' : 1 })(view_raw_2)
 app.route('/raw/<everything:name>/doc_rev/<int:num>')(view_raw_2)
-app.route('/thread/<int:topic_num>/raw/<int:num>')(view_raw_2)
 
 @app.route('/diff/<int(signed = True):num_a>/<int(signed = True):num_b>/<everything:name>')
 def view_diff(name = 'Test', num_a = 1, num_b = 1):
@@ -531,40 +530,20 @@ def recent_discuss_close():
 def recent_discuss_open():
     return recent_discuss_2(load_db.db_get(), 'open')
 
-@app.route('/thread/<int:topic_num>/b/<int:num>')
-def topic_block(topic_num = 1, num = 1):
-    return topic_block_2(load_db.db_get(), topic_num, num)
-
-@app.route('/thread/<int:topic_num>/notice/<int:num>')
-def topic_top(topic_num = 1, num = 1):
-    return topic_top_2(load_db.db_get(), topic_num, num)
-
-@app.route('/thread/<int:topic_num>/setting', methods = ['POST', 'GET'])
-def topic_stop(topic_num = 1):
-    return topic_stop_2(load_db.db_get(), topic_num)
-
-@app.route('/thread/<int:topic_num>/acl', methods = ['POST', 'GET'])
-def topic_acl(topic_num = 1):
-    return topic_acl_2(load_db.db_get(), topic_num)
-
-@app.route('/thread/<int:topic_num>/delete', methods = ['POST', 'GET'])
-def topic_delete(topic_num = 1):
-    return topic_delete_2(load_db.db_get(), topic_num)
-
-@app.route('/thread/<int:topic_num>/tool')
-def topic_tool(topic_num = 1):
-    return topic_tool_2(load_db.db_get(), topic_num)
-
-@app.route('/thread/<int:topic_num>/change', methods = ['POST', 'GET'])
-def topic_change(topic_num = 1):
-    return topic_change_2(load_db.db_get(), topic_num)
-
-@app.route('/thread/<int:topic_num>/admin/<int:num>')
-def topic_admin(topic_num = 1, num = 1):
-    return topic_admin_2(load_db.db_get(), topic_num, num)
-
 app.route('/thread/<int:topic_num>', methods = ['POST', 'GET'])(topic)
-app.route('/topic/<everything:name>', methods = ['POST', 'GET'])(topic_close_list)
+app.route('/topic/<everything:name>', methods = ['POST', 'GET'])(topic_list)
+
+app.route('/thread/<int:topic_num>/tool')(topic_tool)
+app.route('/thread/<int:topic_num>/setting', methods = ['POST', 'GET'])(topic_tool_setting)
+app.route('/thread/<int:topic_num>/acl', methods = ['POST', 'GET'])(topic_tool_acl)
+app.route('/thread/<int:topic_num>/delete', methods = ['POST', 'GET'])(topic_tool_delete)
+app.route('/thread/<int:topic_num>/change', methods = ['POST', 'GET'])(topic_tool_change)
+
+app.route('/thread/<int:topic_num>/comment/<int:num>/tool')(topic_comment_tool)
+app.route('/thread/<int:topic_num>/comment/<int:num>/notice')(topic_comment_notice)
+app.route('/thread/<int:topic_num>/comment/<int:num>/blind')(topic_comment_blind)
+app.route('/thread/<int:topic_num>/comment/<int:num>/raw')(view_raw_2)
+app.route('/thread/<int:topic_num>/comment/<int:num>/delete', methods = ['POST', 'GET'])(topic_comment_delete)
 
 # Func-user
 @app.route('/change', methods = ['POST', 'GET'])

+ 1 - 1
route/tool/func.py

@@ -882,7 +882,7 @@ def wiki_css(data):
     data += ['' for _ in range(0, 3 - len(data))]
     
     data_css = ''
-    data_css_ver = '146'
+    data_css_ver = '147'
     
     # Func JS
     data_css += '<script src="/views/main_css/js/func/func.js?ver=' + data_css_ver + '"></script>'

+ 0 - 70
route/topic_acl.py

@@ -1,70 +0,0 @@
-from .tool.func import *
-
-def topic_acl_2(conn, topic_num):
-    curs = conn.cursor()
-
-    if admin_check(3) != 1:
-        return re_error('/error/3')
-
-    ip = ip_check()
-    time = get_time()
-    topic_num = str(topic_num)
-
-    curs.execute(db_change("select title, sub from rd where code = ?"), [topic_num])
-    rd_d = curs.fetchall()
-    if not rd_d:
-        return redirect('/')
-
-    if flask.request.method == 'POST':
-        admin_check(3, 'topic_acl_set (code ' + topic_num + ')')
-
-        curs.execute(db_change("select id from topic where code = ? order by id + 0 desc limit 1"), [topic_num])
-        topic_check = curs.fetchall()
-        if topic_check:
-            acl_data = flask.request.form.get('acl', '')
-
-            curs.execute(db_change("update rd set acl = ? where code = ?"), [
-                acl_data,
-                topic_num
-            ])
-
-            curs.execute(db_change("insert into topic (id, data, date, ip, top, code) values (?, ?, ?, ?, '1', ?)"), [
-                str(int(topic_check[0][0]) + 1),
-                'acl change ' + acl_data,
-                time,
-                ip,
-                topic_num
-            ])
-
-            rd_plus(topic_num, time)
-
-        return redirect('/thread/' + topic_num)
-    else:
-        acl_list = get_acl_list()
-        acl_html_list = ''
-
-        curs.execute(db_change("select acl from rd where code = ?"), [topic_num])
-        topic_acl_get = curs.fetchall()
-        for data_list in acl_list:
-            if topic_acl_get and topic_acl_get[0][0] == data_list:
-                check = 'selected="selected"'
-            else:
-                check = ''
-
-            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(), wiki_custom(), wiki_css([0, 0])],
-            data = '''
-                <form method="post">
-                    <a href="/acl/TEST#exp">(''' + load_lang('reference') + ''')</a>
-                    <hr>
-                    <select name="acl">
-                    ''' + acl_html_list + '''
-                    </select>
-                    <hr class=\"main_hr\">
-                    <button type="submit">''' + load_lang('save') + '''</button>
-                </form>
-            ''',
-            menu = [['thread/' + topic_num + '/tool', load_lang('return')]]
-        ))

+ 0 - 64
route/topic_admin.py

@@ -1,64 +0,0 @@
-from .tool.func import *
-
-def topic_admin_2(conn, topic_num, num):
-    curs = conn.cursor()
-
-    num = str(num)
-    topic_num = str(topic_num)
-
-    curs.execute(db_change("select block, ip, date from topic where code = ? and id = ?"), [topic_num, num])
-    data = curs.fetchall()
-    if not data:
-        return redirect('/thread/' + topic_num)
-
-    ban = '''
-        <h2>''' + load_lang('state') + '''</h2>
-        <ul class="inside_ul">
-            <li>''' + load_lang('writer') + ' : ''' + ip_pas(data[0][1]) + '''</li>
-            <li>''' + load_lang('time') + ' : ' + data[0][2] + '''</li>
-        </ul>
-        <h2>''' + load_lang('other_tool') + '''</h2>
-        <ul class="inside_ul">
-            <li>
-                <a href="/thread/''' + topic_num + '/raw/' + num + '''">''' + load_lang('raw') + '''</a>
-            </li>
-        </ul>
-    '''
-
-    if admin_check(3) == 1:
-        curs.execute(db_change(
-            "select id from topic where code = ? and id = ? and top = 'O'"
-        ), [topic_num, num])
-        top_topic_d = curs.fetchall()
-
-        curs.execute(db_change(
-            "select end from rb where block = ? and ongoing = '1'"
-        ), [data[0][1]])
-        user_ban_d = curs.fetchall()
-
-        ban += '''
-            <h2>''' + load_lang('admin_tool') + '''</h2>
-            <ul class="inside_ul">
-                <li>
-                    <a href="/ban/''' + url_pas(data[0][1]) + '''">
-                        ''' + (load_lang('release') if user_ban_d else load_lang('ban')) + '''
-                    </a>
-                </li>
-                <li>
-                    <a href="/thread/''' + topic_num + '/b/' + num + '''">
-                        ''' + (load_lang('hide_release') if data[0][0] == 'O' else load_lang('hide')) + '''
-                    </a>
-                </li>
-                <li>
-                    <a href="/thread/''' + topic_num + '/notice/' + num + '''">
-                        ''' + (load_lang('pinned_release') if top_topic_d else load_lang('pinned')) + '''
-                    </a>
-                </li>
-            </ul>
-        '''
-
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('discussion_tool'), wiki_set(), wiki_custom(), wiki_css(['(#' + num + ')', 0])],
-        data = ban,
-        menu = [['thread/' + topic_num + '#' + num, load_lang('return')]]
-    ))

+ 0 - 24
route/topic_block.py

@@ -1,24 +0,0 @@
-from .tool.func import *
-
-def topic_block_2(conn, topic_num, num):
-    curs = conn.cursor()
-
-    topic_num = str(topic_num)
-    num = str(num)
-
-    if admin_check(3, 'blind (code ' + topic_num + '#' + num + ')') != 1:
-        return re_error('/error/3')
-
-    curs.execute(db_change("select block from topic where code = ? and id = ?"), [topic_num, num])
-    block = curs.fetchall()
-    if block:
-        if block[0][0] == 'O':
-            curs.execute(db_change("update topic set block = '' where code = ? and id = ?"), [topic_num, num])
-        else:
-            curs.execute(db_change("update topic set block = 'O' where code = ? and id = ?"), [topic_num, num])
-
-        rd_plus(topic_num, get_time())
-
-        conn.commit()
-
-    return redirect('/thread/' + topic_num + '#' + num)

+ 0 - 61
route/topic_change.py

@@ -1,61 +0,0 @@
-from .tool.func import *
-
-def topic_change_2(conn, topic_num):
-    curs = conn.cursor()
-
-    if admin_check(None) != 1:
-        return re_error('/error/3')
-
-    ip = ip_check()
-    time = get_time()
-    topic_num = str(topic_num)
-
-    curs.execute(db_change("select title, sub from rd where code = ?"), [topic_num])
-    rd_d = curs.fetchall()
-    if not rd_d:
-        return redirect('/')
-
-    if flask.request.method == 'POST':
-        admin_check(None, 'move_topic (code ' + topic_num + ')')
-
-        curs.execute(db_change("select id from topic where code = ? order by id + 0 desc limit 1"), [topic_num])
-        topic_check = curs.fetchall()
-        if topic_check:
-            title_d = flask.request.form.get('title', 'test')
-            sub_d = flask.request.form.get('sub', 'test')
-
-            curs.execute(db_change("update rd set title = ?, sub = ? where code = ?"), [
-                title_d,
-                sub_d,
-                topic_num
-            ])
-
-            curs.execute(db_change("insert into topic (id, data, date, ip, top, code) values (?, ?, ?, ?, '1', ?)"), [
-                str(int(topic_check[0][0]) + 1),
-                'change name to ' + sub_d + '(' + title_d + ')',
-                time,
-                ip,
-                topic_num
-            ])
-
-            rd_plus(topic_num, time)
-
-        return redirect('/thread/' + topic_num)
-    else:
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('topic_name_change'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-            data = '''
-                <form method="post">
-                    ''' + load_lang('document_name') + '''
-                    <hr class=\"main_hr\">
-                    <input value="''' + rd_d[0][0] + '''" name="title" type="text">
-                    <hr class=\"main_hr\">
-                    ''' + load_lang('discussion_name') + '''
-                    <hr class=\"main_hr\">
-                    <input value="''' + rd_d[0][1] + '''" name="sub" type="text">
-                    <hr class=\"main_hr\">
-                    <button type="submit">''' + load_lang('save') + '''</button>
-                </form>
-            ''',
-            menu = [['thread/' + topic_num + '/tool', load_lang('return')]]
-        ))

+ 25 - 0
route/topic_comment_blind.py

@@ -0,0 +1,25 @@
+from .tool.func import *
+
+def topic_comment_blind(topic_num = 1, num = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        topic_num = str(topic_num)
+        num = str(num)
+
+        if admin_check(3, 'blind (code ' + topic_num + '#' + num + ')') != 1:
+            return re_error('/error/3')
+
+        curs.execute(db_change("select block from topic where code = ? and id = ?"), [topic_num, num])
+        block = curs.fetchall()
+        if block:
+            if block[0][0] == 'O':
+                curs.execute(db_change("update topic set block = '' where code = ? and id = ?"), [topic_num, num])
+            else:
+                curs.execute(db_change("update topic set block = 'O' where code = ? and id = ?"), [topic_num, num])
+
+            rd_plus(topic_num, get_time())
+
+            conn.commit()
+
+        return redirect('/thread/' + topic_num + '#' + num)

+ 28 - 0
route/topic_comment_delete.py

@@ -0,0 +1,28 @@
+from .tool.func import *
+
+def topic_comment_delete(topic_num = 1, num = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if admin_check(None) != 1:
+            return re_error('/error/3')
+
+        topic_num = str(topic_num)
+        num = str(num)
+
+        if flask.request.method == 'POST':
+            curs.execute(db_change("delete from topic where code = ? and id = ?"), [topic_num, num])
+            conn.commit()
+
+            return redirect('/thread/' + topic_num)
+        else:
+            return easy_minify(flask.render_template(skin_check(),
+                imp = [load_lang('topic_delete'), wiki_set(), wiki_custom(), wiki_css(['(#' + num + ')', 0])],
+                data = '''
+                    <hr class="main_hr">
+                    <form method="post">
+                        <button type="submit">''' + load_lang('start') + '''</button>
+                    </form>
+                ''',
+                menu = [['thread/' + topic_num + '/comment/' + num + '/tool', load_lang('return')]]
+            ))

+ 26 - 0
route/topic_comment_notice.py

@@ -0,0 +1,26 @@
+from .tool.func import *
+
+def topic_comment_notice(topic_num = 1, num = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        topic_num = str(topic_num)
+        num = str(num)
+
+        if admin_check(3, 'notice (code ' + topic_num + '#' + num + ')') != 1:
+            return re_error('/error/3')
+
+        curs.execute(db_change("select code from topic where code = ? and id = ?"), [topic_num, num])
+        if curs.fetchall():
+            curs.execute(db_change("select top from topic where code = ? and id = ?"), [topic_num, num])
+            top_data = curs.fetchall()
+            if top_data:
+                if top_data[0][0] == 'O':
+                    curs.execute(db_change("update topic set top = '' where code = ? and id = ?"), [topic_num, num])
+                else:
+                    curs.execute(db_change("update topic set top = 'O' where code = ? and id = ?"), [topic_num, num])
+
+            rd_plus(topic_num, get_time())
+            conn.commit()
+
+        return redirect('/thread/' + topic_num + '#' + num)

+ 69 - 0
route/topic_comment_tool.py

@@ -0,0 +1,69 @@
+from .tool.func import *
+
+def topic_comment_tool(topic_num = 1, num = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        num = str(num)
+        topic_num = str(topic_num)
+
+        curs.execute(db_change("select block, ip, date from topic where code = ? and id = ?"), [topic_num, num])
+        data = curs.fetchall()
+        if not data:
+            return redirect('/thread/' + topic_num)
+
+        ban = '''
+            <h2>''' + load_lang('state') + '''</h2>
+            <ul class="inside_ul">
+                <li>''' + load_lang('writer') + ' : ''' + ip_pas(data[0][1]) + '''</li>
+                <li>''' + load_lang('time') + ' : ' + data[0][2] + '''</li>
+            </ul>
+            <h2>''' + load_lang('other_tool') + '''</h2>
+            <ul class="inside_ul">
+                <li>
+                    <a href="/thread/''' + topic_num + '/comment/' + num + '''/raw">''' + load_lang('raw') + '''</a>
+                </li>
+            </ul>
+        '''
+
+        if admin_check(3) == 1:
+            curs.execute(db_change(
+                "select id from topic where code = ? and id = ? and top = 'O'"
+            ), [topic_num, num])
+            top_topic_d = curs.fetchall()
+
+            curs.execute(db_change(
+                "select end from rb where block = ? and ongoing = '1'"
+            ), [data[0][1]])
+            user_ban_d = curs.fetchall()
+
+            ban += '''
+                <h2>''' + load_lang('admin_tool') + '''</h2>
+                <ul class="inside_ul">
+                    <li>
+                        <a href="/ban/''' + url_pas(data[0][1]) + '''">
+                            ''' + (load_lang('release') if user_ban_d else load_lang('ban')) + '''
+                        </a>
+                    </li>
+                    <li>
+                        <a href="/thread/''' + topic_num + '''/comment/''' + num + '''/blind">
+                            ''' + (load_lang('hide_release') if data[0][0] == 'O' else load_lang('hide')) + '''
+                        </a>
+                    </li>
+                    <li>
+                        <a href="/thread/''' + topic_num + '''/comment/''' + num + '''/notice">
+                            ''' + (load_lang('pinned_release') if top_topic_d else load_lang('pinned')) + '''
+                        </a>
+                    </li>
+                    <li>
+                        <a href="/thread/''' + topic_num + '''/comment/''' + num + '''/delete">
+                            ''' + load_lang('delete') + '''
+                        </a>
+                </ul>
+            '''
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [load_lang('discussion_tool'), wiki_set(), wiki_custom(), wiki_css(['(#' + num + ')', 0])],
+            data = ban,
+            menu = [['thread/' + topic_num + '#' + num, load_lang('return')]]
+        ))

+ 0 - 27
route/topic_delete.py

@@ -1,27 +0,0 @@
-from .tool.func import *
-
-def topic_delete_2(conn, topic_num):
-    curs = conn.cursor()
-
-    if admin_check(None) != 1:
-        return re_error('/error/3')
-
-    topic_num = str(topic_num)
-
-    if flask.request.method == 'POST':
-        curs.execute(db_change("delete from topic where code = ?"), [topic_num])
-        curs.execute(db_change("delete from rd where code = ?"), [topic_num])
-        conn.commit()
-
-        return redirect('/')
-    else:
-        return easy_minify(flask.render_template(skin_check(),
-            imp = [load_lang('topic_delete'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-            data = '''
-                <hr class=\"main_hr\">
-                <form method="post">
-                    <button type="submit">''' + load_lang('start') + '''</button>
-                </form>
-            ''',
-            menu = [['thread/' + topic_num + '/tool', load_lang('return')]]
-        ))

+ 1 - 1
route/topic_close_list.py → route/topic_list.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def topic_close_list(name = 'Test'):
+def topic_list(name = 'Test'):
     with get_db_connect() as conn:
         curs = conn.cursor()
 

+ 0 - 85
route/topic_stop.py

@@ -1,85 +0,0 @@
-from .tool.func import *
-
-def topic_stop_2(conn, topic_num):
-    curs = conn.cursor()
-
-    if admin_check(3) != 1:
-        return re_error('/error/3')
-
-    ip = ip_check()
-    time = get_time()
-    topic_num = str(topic_num)
-
-    curs.execute(db_change("select stop, agree from rd where code = ?"), [topic_num])
-    rd_d = curs.fetchall()
-    if not rd_d:
-        return redirect('/')
-
-    if flask.request.method == 'POST':
-        admin_check(3, 'change_topic_set (code ' + topic_num + ')')
-
-        curs.execute(db_change("select id from topic where code = ? order by id + 0 desc limit 1"), [topic_num])
-        topic_check = curs.fetchall()
-        if topic_check:
-            stop_d = flask.request.form.get('stop_d', '')
-            why_d = flask.request.form.get('why', '')
-            agree_d = flask.request.form.get('agree', '')
-
-            curs.execute(db_change("update rd set stop = ?, agree = ? where code = ?"), [
-                stop_d,
-                agree_d,
-                topic_num
-            ])
-
-            if stop_d == 'S':
-                t_state = 'Stop'
-            elif stop_d == 'O':
-                t_state = 'Close'
-            else:
-                t_state = 'Normal'
-
-            curs.execute(db_change("insert into topic (id, data, date, ip, top, code) values (?, ?, ?, ?, '1', ?)"), [
-                str(int(topic_check[0][0]) + 1),
-                t_state + (' (Agree)' if agree_d != '' else '') + (('[br][br]Why : ' + why_d) if why_d else ''),
-                time,
-                ip,
-                topic_num
-            ])
-
-            rd_plus(topic_num, time)
-
-        return redirect('/thread/' + topic_num)
-    else:
-        stop_d_list = ''
-        agree_check = ''
-        for_list = [
-            ['O', 'Close'],
-            ['S', 'Stop'],
-            ['', 'Normal']
-        ]
-
-        for i in for_list:
-            if rd_d and rd_d[0][0] == i[0]:
-                stop_d_list = '<option value="' + i[0] + '">' + i[1] + '</option>' + stop_d_list
-            else:
-                stop_d_list += '<option value="' + i[0] + '">' + i[1] + '</option>'
-
-        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(), wiki_custom(), wiki_css([0, 0])],
-            data = '''
-                <form method="post">
-                    <select name="stop_d">
-                        ''' + stop_d_list + '''
-                    </select>
-                    <hr class=\"main_hr\">
-                    <input type="checkbox" name="agree" value="O" ''' + agree_check + '''> Agree
-                    <hr class=\"main_hr\">
-                    <input placeholder="''' + load_lang('why') + ''' (''' + load_lang('markup_enabled') + ''')" name="why" type="text">
-                    <hr class=\"main_hr\">
-                    <button type="submit">''' + load_lang('save') + '''</button>
-                </form>
-            ''',
-            menu = [['thread/' + topic_num + '/tool', load_lang('return')]]
-        ))

+ 49 - 48
route/topic_tool.py

@@ -1,61 +1,62 @@
 from .tool.func import *
 
-def topic_tool_2(conn, topic_num):
-    curs = conn.cursor()
+def topic_tool(topic_num = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
 
-    data = ''
-    topic_num = str(topic_num)
+        data = ''
+        topic_num = str(topic_num)
 
-    curs.execute(db_change("select stop, agree from rd where code = ?"), [topic_num])
-    close_data = curs.fetchall()
-    if close_data:
-        if close_data[0][0] == 'S':
-            t_state = 'Stop'
-        elif close_data[0][0] == 'O':
-            t_state = 'Close'
+        curs.execute(db_change("select stop, agree from rd where code = ?"), [topic_num])
+        close_data = curs.fetchall()
+        if close_data:
+            if close_data[0][0] == 'S':
+                t_state = 'Stop'
+            elif close_data[0][0] == 'O':
+                t_state = 'Close'
+            else:
+                t_state = 'Normal'
         else:
             t_state = 'Normal'
-    else:
-        t_state = 'Normal'
 
-    curs.execute(db_change("select acl from rd where code = ?"), [topic_num])
-    topic_acl_get = curs.fetchall()
+        curs.execute(db_change("select acl from rd where code = ?"), [topic_num])
+        topic_acl_get = curs.fetchall()
 
-    if admin_check(3) == 1:
-        data = '''
-            <h2>''' + load_lang('admin_tool') + '''</h2>
-            <ul class="inside_ul">
-                <li><a href="/thread/''' + topic_num + '/setting">' + load_lang('topic_setting') + '''</a></li>
-                <li><a href="/thread/''' + topic_num + '/acl">' + load_lang('topic_acl_setting') + '''</a></li>
-            </ul>
-        '''
-    data += '''
-        <h2>''' + load_lang('tool') + '''</h2>
-        <ul class="inside_ul">
-            <li>''' + load_lang('topic_state') + ''' : ''' + t_state + '' + (' (Agree)' if close_data and (close_data[0][1] == 'O') else '') + '''</li>
-            <li>''' + load_lang('topic_acl') + ''' : <a href="/acl/TEST#exp">''' + ('Normal' if not topic_acl_get or (topic_acl_get[0][0] == '') else topic_acl_get[0][0]) + '''</a></li>
-        </ul>
-    '''
-
-    if admin_check(None) == 1:
+        if admin_check(3) == 1:
+            data = '''
+                <h2>''' + load_lang('admin_tool') + '''</h2>
+                <ul class="inside_ul">
+                    <li><a href="/thread/''' + topic_num + '/setting">' + load_lang('topic_setting') + '''</a></li>
+                    <li><a href="/thread/''' + topic_num + '/acl">' + load_lang('topic_acl_setting') + '''</a></li>
+                </ul>
+            '''
         data += '''
-            <h2>''' + load_lang('owner') + '''</h2>
+            <h2>''' + load_lang('tool') + '''</h2>
             <ul class="inside_ul">
-                <li>
-                    <a href="/thread/''' + topic_num + '''/delete">
-                        ''' + load_lang('topic_delete') + '''
-                    </a>
-                </li>
-                <li>
-                    <a href="/thread/''' + topic_num + '''/change">
-                        ''' + load_lang('topic_name_change') + '''
-                    </a>
-                </li>
+                <li>''' + load_lang('topic_state') + ''' : ''' + t_state + '' + (' (Agree)' if close_data and (close_data[0][1] == 'O') else '') + '''</li>
+                <li>''' + load_lang('topic_acl') + ''' : <a href="/acl/TEST#exp">''' + ('Normal' if not topic_acl_get or (topic_acl_get[0][0] == '') else topic_acl_get[0][0]) + '''</a></li>
             </ul>
         '''
 
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('topic_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-        data = data,
-        menu = [['thread/' + topic_num, load_lang('return')]]
-    ))
+        if admin_check(None) == 1:
+            data += '''
+                <h2>''' + load_lang('owner') + '''</h2>
+                <ul class="inside_ul">
+                    <li>
+                        <a href="/thread/''' + topic_num + '''/delete">
+                            ''' + load_lang('topic_delete') + '''
+                        </a>
+                    </li>
+                    <li>
+                        <a href="/thread/''' + topic_num + '''/change">
+                            ''' + load_lang('topic_name_change') + '''
+                        </a>
+                    </li>
+                </ul>
+            '''
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [load_lang('topic_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            data = data,
+            menu = [['thread/' + topic_num, load_lang('return')]]
+        ))

+ 71 - 0
route/topic_tool_acl.py

@@ -0,0 +1,71 @@
+from .tool.func import *
+
+def topic_tool_acl(topic_num = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if admin_check(3) != 1:
+            return re_error('/error/3')
+
+        ip = ip_check()
+        time = get_time()
+        topic_num = str(topic_num)
+
+        curs.execute(db_change("select title, sub from rd where code = ?"), [topic_num])
+        rd_d = curs.fetchall()
+        if not rd_d:
+            return redirect('/')
+
+        if flask.request.method == 'POST':
+            admin_check(3, 'topic_acl_set (code ' + topic_num + ')')
+
+            curs.execute(db_change("select id from topic where code = ? order by id + 0 desc limit 1"), [topic_num])
+            topic_check = curs.fetchall()
+            if topic_check:
+                acl_data = flask.request.form.get('acl', '')
+
+                curs.execute(db_change("update rd set acl = ? where code = ?"), [
+                    acl_data,
+                    topic_num
+                ])
+
+                curs.execute(db_change("insert into topic (id, data, date, ip, top, code) values (?, ?, ?, ?, '1', ?)"), [
+                    str(int(topic_check[0][0]) + 1),
+                    'acl change ' + acl_data,
+                    time,
+                    ip,
+                    topic_num
+                ])
+
+                rd_plus(topic_num, time)
+
+            return redirect('/thread/' + topic_num)
+        else:
+            acl_list = get_acl_list()
+            acl_html_list = ''
+
+            curs.execute(db_change("select acl from rd where code = ?"), [topic_num])
+            topic_acl_get = curs.fetchall()
+            for data_list in acl_list:
+                if topic_acl_get and topic_acl_get[0][0] == data_list:
+                    check = 'selected="selected"'
+                else:
+                    check = ''
+
+                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(), wiki_custom(), wiki_css([0, 0])],
+                data = '''
+                    <form method="post">
+                        <a href="/acl/TEST#exp">(''' + load_lang('reference') + ''')</a>
+                        <hr>
+                        <select name="acl">
+                        ''' + acl_html_list + '''
+                        </select>
+                        <hr class=\"main_hr\">
+                        <button type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                ''',
+                menu = [['thread/' + topic_num + '/tool', load_lang('return')]]
+            ))

+ 62 - 0
route/topic_tool_change.py

@@ -0,0 +1,62 @@
+from .tool.func import *
+
+def topic_tool_change(topic_num = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if admin_check(None) != 1:
+            return re_error('/error/3')
+
+        ip = ip_check()
+        time = get_time()
+        topic_num = str(topic_num)
+
+        curs.execute(db_change("select title, sub from rd where code = ?"), [topic_num])
+        rd_d = curs.fetchall()
+        if not rd_d:
+            return redirect('/')
+
+        if flask.request.method == 'POST':
+            admin_check(None, 'move_topic (code ' + topic_num + ')')
+
+            curs.execute(db_change("select id from topic where code = ? order by id + 0 desc limit 1"), [topic_num])
+            topic_check = curs.fetchall()
+            if topic_check:
+                title_d = flask.request.form.get('title', 'test')
+                sub_d = flask.request.form.get('sub', 'test')
+
+                curs.execute(db_change("update rd set title = ?, sub = ? where code = ?"), [
+                    title_d,
+                    sub_d,
+                    topic_num
+                ])
+
+                curs.execute(db_change("insert into topic (id, data, date, ip, top, code) values (?, ?, ?, ?, '1', ?)"), [
+                    str(int(topic_check[0][0]) + 1),
+                    'change name to ' + sub_d + '(' + title_d + ')',
+                    time,
+                    ip,
+                    topic_num
+                ])
+
+                rd_plus(topic_num, time)
+
+            return redirect('/thread/' + topic_num)
+        else:
+            return easy_minify(flask.render_template(skin_check(),
+                imp = [load_lang('topic_name_change'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                data = '''
+                    <form method="post">
+                        ''' + load_lang('document_name') + '''
+                        <hr class="main_hr">
+                        <input value="''' + rd_d[0][0] + '''" name="title" type="text">
+                        <hr class="main_hr">
+                        ''' + load_lang('discussion_name') + '''
+                        <hr class="main_hr">
+                        <input value="''' + rd_d[0][1] + '''" name="sub" type="text">
+                        <hr class="main_hr">
+                        <button type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                ''',
+                menu = [['thread/' + topic_num + '/tool', load_lang('return')]]
+            ))

+ 28 - 0
route/topic_tool_delete.py

@@ -0,0 +1,28 @@
+from .tool.func import *
+
+def topic_tool_delete(topic_num = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if admin_check(None) != 1:
+            return re_error('/error/3')
+
+        topic_num = str(topic_num)
+
+        if flask.request.method == 'POST':
+            curs.execute(db_change("delete from topic where code = ?"), [topic_num])
+            curs.execute(db_change("delete from rd where code = ?"), [topic_num])
+            conn.commit()
+
+            return redirect('/')
+        else:
+            return easy_minify(flask.render_template(skin_check(),
+                imp = [load_lang('topic_delete'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+                data = '''
+                    <hr class="main_hr">
+                    <form method="post">
+                        <button type="submit">''' + load_lang('start') + '''</button>
+                    </form>
+                ''',
+                menu = [['thread/' + topic_num + '/tool', load_lang('return')]]
+            ))

+ 86 - 0
route/topic_tool_setting.py

@@ -0,0 +1,86 @@
+from .tool.func import *
+
+def topic_tool_setting(topic_num = 1):
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+
+        if admin_check(3) != 1:
+            return re_error('/error/3')
+
+        ip = ip_check()
+        time = get_time()
+        topic_num = str(topic_num)
+
+        curs.execute(db_change("select stop, agree from rd where code = ?"), [topic_num])
+        rd_d = curs.fetchall()
+        if not rd_d:
+            return redirect('/')
+
+        if flask.request.method == 'POST':
+            admin_check(3, 'change_topic_set (code ' + topic_num + ')')
+
+            curs.execute(db_change("select id from topic where code = ? order by id + 0 desc limit 1"), [topic_num])
+            topic_check = curs.fetchall()
+            if topic_check:
+                stop_d = flask.request.form.get('stop_d', '')
+                why_d = flask.request.form.get('why', '')
+                agree_d = flask.request.form.get('agree', '')
+
+                curs.execute(db_change("update rd set stop = ?, agree = ? where code = ?"), [
+                    stop_d,
+                    agree_d,
+                    topic_num
+                ])
+
+                if stop_d == 'S':
+                    t_state = 'Stop'
+                elif stop_d == 'O':
+                    t_state = 'Close'
+                else:
+                    t_state = 'Normal'
+
+                curs.execute(db_change("insert into topic (id, data, date, ip, top, code) values (?, ?, ?, ?, '1', ?)"), [
+                    str(int(topic_check[0][0]) + 1),
+                    t_state + (' (Agree)' if agree_d != '' else '') + (('[br][br]Why : ' + why_d) if why_d else ''),
+                    time,
+                    ip,
+                    topic_num
+                ])
+
+                rd_plus(topic_num, time)
+
+            return redirect('/thread/' + topic_num)
+        else:
+            stop_d_list = ''
+            agree_check = ''
+            for_list = [
+                ['O', 'Close'],
+                ['S', 'Stop'],
+                ['', 'Normal']
+            ]
+
+            for i in for_list:
+                if rd_d and rd_d[0][0] == i[0]:
+                    stop_d_list = '<option value="' + i[0] + '">' + i[1] + '</option>' + stop_d_list
+                else:
+                    stop_d_list += '<option value="' + i[0] + '">' + i[1] + '</option>'
+
+            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(), wiki_custom(), wiki_css([0, 0])],
+                data = '''
+                    <form method="post">
+                        <select name="stop_d">
+                            ''' + stop_d_list + '''
+                        </select>
+                        <hr class=\"main_hr\">
+                        <input type="checkbox" name="agree" value="O" ''' + agree_check + '''> Agree
+                        <hr class=\"main_hr\">
+                        <input placeholder="''' + load_lang('why') + ''' (''' + load_lang('markup_enabled') + ''')" name="why" type="text">
+                        <hr class=\"main_hr\">
+                        <button type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                ''',
+                menu = [['thread/' + topic_num + '/tool', load_lang('return')]]
+            ))

+ 0 - 25
route/topic_top.py

@@ -1,25 +0,0 @@
-from .tool.func import *
-
-def topic_top_2(conn, topic_num, num):
-    curs = conn.cursor()
-
-    topic_num = str(topic_num)
-    num = str(num)
-
-    if admin_check(3, 'notice (code ' + topic_num + '#' + num + ')') != 1:
-        return re_error('/error/3')
-
-    curs.execute(db_change("select code from topic where code = ? and id = ?"), [topic_num, num])
-    if curs.fetchall():
-        curs.execute(db_change("select top from topic where code = ? and id = ?"), [topic_num, num])
-        top_data = curs.fetchall()
-        if top_data:
-            if top_data[0][0] == 'O':
-                curs.execute(db_change("update topic set top = '' where code = ? and id = ?"), [topic_num, num])
-            else:
-                curs.execute(db_change("update topic set top = 'O' where code = ? and id = ?"), [topic_num, num])
-
-        rd_plus(topic_num, get_time())
-        conn.commit()
-
-    return redirect('/thread/' + topic_num + '#' + num)

+ 1 - 1
route/view_raw.py

@@ -38,7 +38,7 @@ def view_raw_2(name = None, topic_num = None, num = None, doc_acl = 0):
 
             menu = [
                 ['thread/' + topic_num + '#' + num, load_lang('discussion')], 
-                ['thread/' + topic_num + '/admin/' + num, load_lang('return')]
+                ['thread/' + topic_num + '/comment/' + num + '/tool', load_lang('return')]
             ]
         else:
             curs.execute(db_change("select data from data where title = ?"), [name])

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.4 (stable1) (beta3) (dev8)",
+        "r_ver" : "v3.4.4 (stable1) (beta3) (dev9)",
         "c_ver" : "3500105",
         "s_ver" : "3500110"
     }

+ 134 - 17
views/main_css/js/render/markdown.js

@@ -39,7 +39,7 @@ class opennamu_render_markdown {
     do_func_parser_to_text(data, parser_type = 'parser') {
         let parser_data_temp = this.parser_data_temp;
         let parser_match;
-        if(parser_type === 'nowiki') {
+        if(parser_type === 'nowiki' || parser_type === 'nowikiLink' || parser_type === 'nowikiEnd') {
             parser_match = /<(\/?nowiki[0-9]+Span)>/;
         } else {
             parser_match = /<(\/?render[0-9]+Span)>/;
@@ -47,7 +47,16 @@ class opennamu_render_markdown {
         
         while(data.match(parser_match)) {
             data = data.replace(parser_match, function(match, x1) {
-                return parser_data_temp[x1];
+                if(parser_type === 'nowikiEnd') {
+                    return parser_data_temp[x1 + 'End'];
+                } else if(parser_type === 'nowikiLink') {
+                    let nowiki_data = parser_data_temp[x1];
+                    nowiki_data = nowiki_data.replace(/\\(.)/g, '$1');
+                    
+                    return nowiki_data;
+                } else {
+                    return parser_data_temp[x1];
+                }
             });
         }
         
@@ -55,9 +64,11 @@ class opennamu_render_markdown {
     }
     
     do_func_xss_encode(data) {
+        data = data.replace(/'/g, '&#x27;');
         data = data.replace(/"/g, '&quot;');
         data = data.replace(/</g, '&lt;');
         data = data.replace(/</g, '&gt;');
+        data = data.replace(/&/g, '&amp;');
         
         return data;
     }
@@ -66,7 +77,8 @@ class opennamu_render_markdown {
         data = data.replace(/&#x27;/g, '\'');
         data = data.replace(/&quot;/g, '"');
         data = data.replace(/&lt;/g, '<');
-        data = data.replace(/&gt;/g, '<');
+        data = data.replace(/&gt;/g, '>');
+        data = data.replace(/&amp;/g, '&');
         
         return data;
     }
@@ -76,7 +88,7 @@ class opennamu_render_markdown {
         let parser_count = this.parser_count['parser'];
         let parser_data_temp = this.parser_data_temp;
         
-        this.doc_data = this.doc_data.replace(/~~((?:(?!~~).)+)~~/g, function(match, x1) {
+        this.doc_data = this.doc_data.replace(/~~((?:(?!~~|\n).)+)~~/g, function(match, x1) {
             parser_count += 1;
             let parser_count_str = String(parser_count);
             
@@ -86,7 +98,7 @@ class opennamu_render_markdown {
             return '<render' + parser_count_str + 'Span>' + x1 + '</render' + parser_count_str + 'Span>';
         });
         
-        this.doc_data = this.doc_data.replace(/\*\*((?:(?!\*\*).)+)\*\*/g, function(match, x1) {
+        this.doc_data = this.doc_data.replace(/\*\*((?:(?!\*\*|\n).)+)\*\*/g, function(match, x1) {
             parser_count += 1;
             let parser_count_str = String(parser_count);
             
@@ -96,7 +108,7 @@ class opennamu_render_markdown {
             return '<render' + parser_count_str + 'Span>' + x1 + '</render' + parser_count_str + 'Span>';
         });
         
-        this.doc_data = this.doc_data.replace(/__((?:(?!__).)+)__/g, function(match, x1) {
+        this.doc_data = this.doc_data.replace(/__((?:(?!__|\n).)+)__/g, function(match, x1) {
             parser_count += 1;
             let parser_count_str = String(parser_count);
             
@@ -106,7 +118,7 @@ class opennamu_render_markdown {
             return '<render' + parser_count_str + 'Span>' + x1 + '</render' + parser_count_str + 'Span>';
         });
         
-        this.doc_data = this.doc_data.replace(/\*([^*]+)\*/g, function(match, x1) {
+        this.doc_data = this.doc_data.replace(/\*([^*\n]+)\*/g, function(match, x1) {
             parser_count += 1;
             let parser_count_str = String(parser_count);
             
@@ -116,7 +128,7 @@ class opennamu_render_markdown {
             return '<render' + parser_count_str + 'Span>' + x1 + '</render' + parser_count_str + 'Span>';
         });
         
-        this.doc_data = this.doc_data.replace(/_([^_]+)_/g, function(match, x1) {
+        this.doc_data = this.doc_data.replace(/_([^_\n]+)_/g, function(match, x1) {
             parser_count += 1;
             let parser_count_str = String(parser_count);
             
@@ -126,7 +138,7 @@ class opennamu_render_markdown {
             return '<render' + parser_count_str + 'Span>' + x1 + '</render' + parser_count_str + 'Span>';
         });
         
-        this.doc_data = this.doc_data.replace(/&lt;ins&gt;((?:(?!&lt;ins&gt;|&lt;\/ins&gt;).)+)&lt;\/ins&gt;/g, function(match, x1) {
+        this.doc_data = this.doc_data.replace(/&lt;ins&gt;((?:(?!&lt;ins&gt;|&lt;\/ins&gt;|\n).)+)&lt;\/ins&gt;/g, function(match, x1) {
             parser_count += 1;
             let parser_count_str = String(parser_count);
             
@@ -136,7 +148,7 @@ class opennamu_render_markdown {
             return '<render' + parser_count_str + 'Span>' + x1 + '</render' + parser_count_str + 'Span>';
         });
         
-        this.doc_data = this.doc_data.replace(/&lt;sub&gt;((?:(?!&lt;sub&gt;|&lt;\/sub&gt;).)+)&lt;\/sub&gt;/g, function(match, x1) {
+        this.doc_data = this.doc_data.replace(/&lt;sub&gt;((?:(?!&lt;sub&gt;|&lt;\/sub&gt;|\n).)+)&lt;\/sub&gt;/g, function(match, x1) {
             parser_count += 1;
             let parser_count_str = String(parser_count);
             
@@ -146,7 +158,7 @@ class opennamu_render_markdown {
             return '<render' + parser_count_str + 'Span>' + x1 + '</render' + parser_count_str + 'Span>';
         });
         
-        this.doc_data = this.doc_data.replace(/&lt;sup&gt;((?:(?!&lt;sup&gt;|&lt;\/sup&gt;).)+)&lt;\/sup&gt;/g, function(match, x1) {
+        this.doc_data = this.doc_data.replace(/&lt;sup&gt;((?:(?!&lt;sup&gt;|&lt;\/sup&gt;|\n).)+)&lt;\/sup&gt;/g, function(match, x1) {
             parser_count += 1;
             let parser_count_str = String(parser_count);
             
@@ -168,7 +180,7 @@ class opennamu_render_markdown {
         
         let heading_n = 0;
         let heading_list = [0, 0, 0, 0, 0, 0];
-        let heading_regex = /\n(#{1,6})([^\n]+)\n/;
+        let heading_regex = /\n(#{1,6})([^#][^\n]*)\n/;
         while(this.doc_data.match(heading_regex)) {
             this.doc_data = this.doc_data.replace(heading_regex, function(match, x1, x2) {
                 let heading_level = x1.length - 1;
@@ -221,7 +233,7 @@ class opennamu_render_markdown {
         let parser_count = this.parser_count['parser'];
         let parser_data_temp = this.parser_data_temp;
         
-        this.doc_data = this.doc_data.replace(/!\[([^\[\]]*)\]\(([^\(\)]*)\)/g, function(match, x1, x2) {
+        this.doc_data = this.doc_data.replace(/!\[([^\[\]\n]*)\]\(([^\(\)\n]*)\)/g, function(match, x1, x2) {
             if(x1 === '' && x2 === '') {
                 return '<imageBlink>';
             } else {
@@ -266,7 +278,7 @@ class opennamu_render_markdown {
         let parser_count = this.parser_count['parser'];
         let parser_data_temp = this.parser_data_temp;
         
-        this.doc_data = this.doc_data.replace(/\[([^\[\]]*)\]\(([^\(\)]*)\)/g, function(match, x1, x2) {
+        this.doc_data = this.doc_data.replace(/\[([^\[\]\n]*)\]\(([^\(\)\n]*)\)/g, function(match, x1, x2) {
             if(x1 === '' && x2 === '') {
                 return '<linkBlink>';
             } else {
@@ -274,7 +286,9 @@ class opennamu_render_markdown {
                     parser_count += 1;
                     let parser_count_str = String(parser_count);
                     
-                    let link_main = render_main.do_func_xss_encode(x2);;
+                    let link_main = render_main.do_func_parser_to_text(x2, 'nowikiLink');
+                    link_main = render_main.do_func_xss_encode(link_main);
+                    
                     let link_sub;
                     if(x1 === '') {
                         link_sub = x2;
@@ -304,7 +318,10 @@ class opennamu_render_markdown {
                         link_sub = x1;
                     }
                     
-                    link_title = render_main.do_func_xss_encode(link_main);
+                    link_main = render_main.do_func_parser_to_text(link_main, 'nowikiLink');
+                    link_main = render_main.do_func_xss_encode(link_main);
+                    
+                    link_title = link_main;
 
                     link_main = render_main.do_func_xss_decode(link_main);
                     link_main = opennamu_do_url_encode(link_main);
@@ -422,7 +439,7 @@ class opennamu_render_markdown {
         let parser_data_temp = this.parser_data_temp;
         let parser_data_temp_other = this.parser_data_temp_other;
         
-        this.doc_data = this.doc_data.replace(/\[([^\[\(<>]+)\(((?:(?!\(|\)\]|<|>).)*)\)\]/g, function(match, x1, x2) {
+        this.doc_data = this.doc_data.replace(/\[([^\[\(<>\n]+)\(((?:(?!\(|\)\]|<|>|\n).)*)\)\]/g, function(match, x1, x2) {
             if(x1 === 'anchor') {
                 parser_count += 1;
                 let parser_count_str = String(parser_count);
@@ -477,6 +494,103 @@ class opennamu_render_markdown {
         this.parser_data_temp_other = parser_data_temp_other;
     }
     
+    do_part_nowiki() {
+        let render_main = this;
+        
+        let parser_count = this.parser_count['parser'];
+        let parser_data_temp = this.parser_data_temp;
+
+        this.doc_data = this.doc_data.replace(/\\(&#x27;|&quot;|&lt;|&gt;|&amp;|.)/g, function(match, x1) {
+            let nowiki_data = x1;
+            
+            parser_count += 1;
+            let parser_count_str = String(parser_count);
+
+            parser_data_temp['nowiki' + parser_count_str + 'Span'] = match;
+            parser_data_temp['/nowiki' + parser_count_str + 'Span'] = '';
+            
+            parser_data_temp['nowiki' + parser_count_str + 'SpanEnd'] = '<code>' + nowiki_data;
+            parser_data_temp['/nowiki' + parser_count_str + 'SpanEnd'] = '</code>';
+            
+            return '<nowiki' + parser_count_str + 'Span>' + '</nowiki' + parser_count_str + 'Span>';
+        });
+        
+        this.doc_data = this.doc_data.replace(/```((?:(?:(?!```).)|\n)+)```/g, function(match, x1) {
+            let nowiki_data = render_main.do_func_parser_to_text(x1, 'nowiki');
+            
+            parser_count += 1;
+            let parser_count_str = String(parser_count);
+            
+            if(nowiki_data.match(/\n/)) {
+                parser_data_temp['nowiki' + parser_count_str + 'Span'] = match;
+                parser_data_temp['/nowiki' + parser_count_str + 'Span'] = '';
+                
+                parser_data_temp['nowiki' + parser_count_str + 'SpanEnd'] = '<pre>' + nowiki_data;
+                parser_data_temp['/nowiki' + parser_count_str + 'SpanEnd'] = '</pre>';
+            } else {
+                parser_data_temp['nowiki' + parser_count_str + 'Span'] = match;
+                parser_data_temp['/nowiki' + parser_count_str + 'Span'] = '';
+                
+                parser_data_temp['nowiki' + parser_count_str + 'SpanEnd'] = '<code>' + nowiki_data;
+                parser_data_temp['/nowiki' + parser_count_str + 'SpanEnd'] = '</code>';
+            }
+            
+            return '<nowiki' + parser_count_str + 'Span>' + '</nowiki' + parser_count_str + 'Span>';
+        });
+        
+        this.doc_data = this.doc_data.replace(/`([^`\n]+)`/g, function(match, x1) {
+            let nowiki_data = render_main.do_func_parser_to_text(x1, 'nowiki');
+            
+            parser_count += 1;
+            let parser_count_str = String(parser_count);
+            
+            parser_data_temp['nowiki' + parser_count_str + 'Span'] = match;
+            parser_data_temp['/nowiki' + parser_count_str + 'Span'] = '';
+
+            parser_data_temp['nowiki' + parser_count_str + 'SpanEnd'] = '<code>' + nowiki_data;
+            parser_data_temp['/nowiki' + parser_count_str + 'SpanEnd'] = '</code>';
+            
+            return '<nowiki' + parser_count_str + 'Span>' + '</nowiki' + parser_count_str + 'Span>';
+        });
+        
+        this.doc_data = this.doc_data.replace(
+            /&lt;pre&gt;(?:\n| )*&lt;code&gt;((?:(?:(?!&lt;pre&gt;(?:\n| )*&lt;code&gt;|&lt;\/code&gt;(?:\n| )*&lt;\/pre&gt;).)|\n)+)&lt;\/code&gt;(?:\n| )*&lt;\/pre&gt;/g,
+            function(match, x1) {
+            let nowiki_data = render_main.do_func_parser_to_text(x1, 'nowiki');
+            
+            parser_count += 1;
+            let parser_count_str = String(parser_count);
+            
+            if(nowiki_data.match(/\n/)) {
+                parser_data_temp['nowiki' + parser_count_str + 'Span'] = match;
+                parser_data_temp['/nowiki' + parser_count_str + 'Span'] = '';
+                
+                parser_data_temp['nowiki' + parser_count_str + 'SpanEnd'] = '<pre>' + nowiki_data;
+                parser_data_temp['/nowiki' + parser_count_str + 'SpanEnd'] = '</pre>';
+            } else {
+                parser_data_temp['nowiki' + parser_count_str + 'Span'] = match;
+                parser_data_temp['/nowiki' + parser_count_str + 'Span'] = '';
+                
+                parser_data_temp['nowiki' + parser_count_str + 'SpanEnd'] = '<code>' + nowiki_data;
+                parser_data_temp['/nowiki' + parser_count_str + 'SpanEnd'] = '</code>';
+            }
+            
+            return '<nowiki' + parser_count_str + 'Span>' + '</nowiki' + parser_count_str + 'Span>';
+        });
+        
+        this.parser_count['parser'] = parser_count;
+        this.parser_data_temp = parser_data_temp;
+    }
+    
+    do_part_horizon() {
+        let horizone_regex = /\n((?:\*|\* |_|_ ){3,})\n/;
+        while(this.doc_data.match(horizone_regex)) {
+            this.doc_data = this.doc_data.replace(horizone_regex, function(match, x1, x2) {
+                return '\n<brEnd><hr><brStart>\n';
+            });
+        }
+    }
+    
     do_part_final() {
         this.doc_data = this.doc_data.replace(/<brStart>\n?/g, '');
         this.doc_data = this.doc_data.replace(/\n?<brEnd>/g, '');
@@ -500,7 +614,9 @@ class opennamu_render_markdown {
     
     // Main Part
     do_main() {
+        this.do_part_nowiki();
         this.do_part_heading();
+        this.do_part_horizon();
         this.do_part_footnote();
         this.do_part_macro();
         this.do_part_image();
@@ -509,6 +625,7 @@ class opennamu_render_markdown {
         this.do_part_final();
         
         this.doc_data = this.do_func_parser_to_text(this.doc_data);
+        this.doc_data = this.do_func_parser_to_text(this.doc_data, 'nowikiEnd');
         
         document.getElementById(this.render_part_id_add + this.render_part_id_after).innerHTML = this.doc_data;
         

+ 3 - 1
views/main_css/js/render/onmark.js

@@ -2,7 +2,9 @@
 
 class opennamu_render_onmark {
     constructor(
-        doc_data,
+        render_part_id,
+        render_part_id_after,
+        render_part_id_add,
         doc_name
     ) {
         this.doc_data = doc_data;

+ 24 - 22
views/main_css/js/render/wiki.js

@@ -53,29 +53,31 @@ class opennamu_render_wiki {
     }
     
     do_part_toc() {
-        for(
-            let for_a = 1;
-            document.getElementById('opennamuHeadingContent' + String(for_a));
-            for_a++
-        ) {
-            let heading_data = document.getElementById('opennamuHeadingContent' + String(for_a));
-            document.getElementById('opennamuTOCcontent' + String(for_a)).innerHTML = heading_data.innerText;
-            
-            document.getElementById('opennamuHeadingContent' + String(for_a)).id = heading_data.innerText;
-        }
-        
-        let toc_data_all = document.getElementsByClassName('opennamuTOC');
-        let toc_data = '';
-        for(
-            let for_a = 0;
-            for_a < toc_data_all.length;
-            for_a++
-        ) {
-            if(toc_data === '') {
-                toc_data = toc_data_all[0].innerHTML;
+        if(document.getElementById('opennamuTOCcontent1')) {
+            for(
+                let for_a = 1;
+                document.getElementById('opennamuHeadingContent' + String(for_a));
+                for_a++
+            ) {
+                let heading_data = document.getElementById('opennamuHeadingContent' + String(for_a));
+                document.getElementById('opennamuTOCcontent' + String(for_a)).innerHTML = heading_data.innerText;
+
+                document.getElementById('opennamuHeadingContent' + String(for_a)).id = heading_data.innerText;
+            }
+
+            let toc_data_all = document.getElementsByClassName('opennamuTOC');
+            let toc_data = '';
+            for(
+                let for_a = 0;
+                for_a < toc_data_all.length;
+                for_a++
+            ) {
+                if(toc_data === '') {
+                    toc_data = toc_data_all[0].innerHTML;
+                }
+
+                document.getElementsByClassName('opennamuTOC')[for_a].innerHTML = toc_data;
             }
-            
-            document.getElementsByClassName('opennamuTOC')[for_a].innerHTML = toc_data;
         }
     }
     

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

@@ -1086,7 +1086,7 @@ function do_onmark_table_render_main(data) {
 
             if(table_data === '') {
                 table_data += '' + 
-                    '<div style="' + table_data_option['div'] + '">' +
+                    '<div class="table_safe" style="' + table_data_option['div'] + '">' +
                         '<table style="' + table_data_option['table'] + '">' +
                             table_caption +
                 '';

+ 3 - 3
views/main_css/js/render_wiki.js

@@ -124,7 +124,7 @@ function get_file_state_intermal(data, data_inter) {
     var data_dict = {};
     var data_list = [];
     for(var key in data_inter) {
-        var data_class = document.getElementsByClassName(data + 'file_finder')[key];
+        var data_class = document.getElementsByClassName(data + 'file_finder')[data_inter[key]];
     
         var file_org = data_class.getAttribute('under_alt');
         var file_type = file_org.split('.');
@@ -141,9 +141,9 @@ function get_file_state_intermal(data, data_inter) {
         data_list.push(file_name);
         
         if(!data_dict[file_org]['list']) {
-            data_dict[file_org]['list'] = [key];
+            data_dict[file_org]['list'] = [data_inter[key]];
         } else {
-            data_dict[file_org]['list'].push(key);
+            data_dict[file_org]['list'].push(data_inter[key]);
         }
     }
     

+ 2 - 2
views/main_css/js/route/thread.js

@@ -74,12 +74,12 @@ function opennamu_do_thread_make(topic_num, type_do = 'top', some = '', where =
                     ip += ' <a href="/admin_log?search=blind%20(code%20' + topic_num + '#' + key + '">(B)</a>';
                     
                     if(admin === '1') {
-                        ip += ' <a href="/thread/' + topic_num + '/raw/' + key + '">(R)</a>';
+                        ip += ' <a href="/thread/' + topic_num + '/comment/' + key + '/raw">(R)</a>';
                     }
                 }
                 
                 if(admin === '1' || blind !== 'O') {
-                    ip += ' <a href="/thread/' + topic_num + '/admin/' + key + '">(T)</a>';
+                    ip += ' <a href="/thread/' + topic_num + '/comment/' + key + '/tool">(T)</a>';
                 }
                 
                 if(type_do === 'top') {