Просмотр исходного кода

토론을 넘버링 형태로 바꿈

Surplus_Up (2DU) 6 лет назад
Родитель
Сommit
82e9172e9c

+ 27 - 28
app.py

@@ -193,7 +193,7 @@ if setup_tool != 0:
     create_data['user'] = ['id', 'pw', 'acl', 'date', 'encode']
     create_data['user_set'] = ['name', 'id', 'data']
     create_data['ban'] = ['block', 'end', 'why', 'band', 'login']
-    create_data['topic'] = ['id', 'title', 'sub', 'data', 'date', 'ip', 'block', 'top']
+    create_data['topic'] = ['id', 'title', 'sub', 'data', 'date', 'ip', 'block', 'top', 'code']
     create_data['rb'] = ['block', 'end', 'today', 'blocker', 'why', 'band']
     create_data['back'] = ['title', 'link', 'type']
     create_data['custom'] = ['user', 'css']
@@ -445,9 +445,9 @@ def search_deep(name = 'test'):
     return search_deep_2(conn, name)
          
 @app.route('/raw/<everything:name>')
-@app.route('/topic/<everything:name>/sub/<sub_title>/raw/<int:num>')
-def view_raw(name = None, sub_title = None, num = None):
-    return view_raw_2(conn, name, sub_title, num)
+@app.route('/thread/<int:topic_num>/raw/<int:num>')
+def view_raw(name = None, topic_num = None, num = None):
+    return view_raw_2(conn, name, topic_num, num)
         
 @app.route('/revert/<everything:name>', methods=['POST', 'GET'])
 def edit_revert(name = None):
@@ -482,34 +482,33 @@ def main_manager(num = 1):
 def list_title_index():
     return list_title_index_2(conn)
                 
-@app.route('/topic/<everything:name>/sub/<sub>/b/<int:num>')
-def topic_block(name = None, sub = None, num = 1):
-    return topic_block_2(conn, name, sub, num)
+@app.route('/thread/<int:topic_num>/b/<int:num>')
+def topic_block(topic_num = 1, num = 1):
+    return topic_block_2(conn, topic_num, num)
         
-@app.route('/topic/<everything:name>/sub/<sub>/notice/<int:num>')
-def topic_top(name = None, sub = None, num = 1):
-    return topic_top_2(conn, name, sub, num)
+@app.route('/thread/<int:topic_num>/notice/<int:num>')
+def topic_top(topic_num = 1, num = 1):
+    return topic_top_2(conn, topic_num, num)
                 
-@app.route('/topic/<everything:name>/sub/<sub>/setting', methods=['POST', 'GET'])
-def topic_stop(name = None, sub = None):
-    return topic_stop_2(conn, name, sub)
+@app.route('/thread/<int:topic_num>/setting', methods=['POST', 'GET'])
+def topic_stop(topic_num = 1):
+    return topic_stop_2(conn, topic_num)
 
-@app.route('/topic/<everything:name>/sub/<sub>/tool')
-def topic_tool(name = None, sub = None):
-    return topic_tool_2(conn, name, sub)
+@app.route('/thread/<int:topic_num>/tool')
+def topic_tool(topic_num = 1):
+    return topic_tool_2(conn, topic_num)
 
-@app.route('/topic/<everything:name>/sub/<sub>/admin/<int:num>')
-def topic_admin(name = None, sub = None, num = 1):
-    return topic_admin_2(conn, name, sub, num)
+@app.route('/thread/<int:topic_num>/admin/<int:num>')
+def topic_admin(topic_num = 1, num = 1):
+    return topic_admin_2(conn, topic_num, num)
 
-@app.route('/topic/<everything:name>/sub/<sub>', methods=['POST', 'GET'])
-def topic(name = None, sub = None):
-    return topic_2(conn, name, sub)
+@app.route('/thread/<int:topic_num>', methods=['POST', 'GET'])
+def topic(topic_num = 1):
+    return topic_2(conn, topic_num)
         
 @app.route('/topic/<everything:name>', methods=['POST', 'GET'])
-@app.route('/topic/<everything:name>/<regex("close|agree"):tool>', methods=['GET'])
-def topic_close_list(name = None, tool = None):
-    return topic_close_list_2(conn, name, tool)
+def topic_close_list(name = 'test'):
+    return topic_close_list_2(conn, name)
 
 @app.route('/tool/<name>')
 def user_tool(name = None):
@@ -657,9 +656,9 @@ def api_markup():
 def api_user_info(name = ''):
     return api_user_info_2(conn, name)
 
-@app.route('/api/topic/<everything:name>/sub/<sub>')
-def api_topic_sub(name = '', sub = '', time = ''):
-    return api_topic_sub_2(conn, name, sub, time)
+@app.route('/api/thread/<topic_num>')
+def api_topic_sub(name = '', topic_num = 1):
+    return api_topic_sub_2(conn, topic_num)
 
 @app.route('/api/search/<name>')
 def api_search(name = ''):

+ 1 - 0
language/en-US.json

@@ -94,6 +94,7 @@
         "reference" : "Reference",
         "icon" : "Icon",
         "view" : "View",
+        "content" : "Content",
         "_comment_1.1_" : "Time",
             "second" : "Second(s)",
             "hour" : "Hour(s)",

+ 2 - 1
language/ko-KR.json

@@ -303,5 +303,6 @@
     "edit_help" : "편집창 문구",
     "defalut_edit_help" : "이곳에 내용을 써주세요",
     "many_delete" : "대량 삭제",
-    "many_delete_help" : "한 줄에 문서명 하나씩 적어주세요."
+    "many_delete_help" : "한 줄에 문서명 하나씩 적어주세요.",
+    "content" : "내용"
 }

+ 21 - 17
route/api_topic_sub.py

@@ -1,8 +1,12 @@
 from .tool.func import *
 
-def api_topic_sub_2(conn, name, sub, time):
+def api_topic_sub_2(conn, topic_num):
     curs = conn.cursor()
 
+    topic_change_data = topic_change(topic_num)
+    name = topic_change_data[0]
+    sub = topic_change_data[1]
+
     if flask.request.args.get('num', None):
         curs.execute(db_change("select id, data, date, ip, block, top from topic where title = ? and sub = ? and id + 0 = ? + 0 order by id + 0 asc"), [
             name, 
@@ -62,26 +66,26 @@ def api_topic_sub_2(conn, name, sub, time):
                     t_color = 'toron_color'
 
                 if admin == 1 or b_color != 'toron_color_not':
-                    ip += ' <a href="/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '/admin/' + i[0] + '">(' + load_lang('discussion_tool') + ')</a>'
+                    ip += ' <a href="/thread/' + str(topic_num) + '/admin/' + i[0] + '">(' + load_lang('discussion_tool') + ')</a>'
                     
                 if t_data_f == '':
                     t_data_f = '[br]'
             
-                all_data = '''
-                    <table id="toron">
-                        <tbody>
-                            <tr>
-                                <td id="''' + t_color + '''">
-                                    <a href="javascript:void(0);" id="''' + i[0] + '">#' + i[0] + '</a> ' + ip + ' <span style="float: right;">' + i[2] + '''</span>
-                                </td>
-                            </tr>
-                            <tr>
-                                <td id="''' + b_color + '">' + render_set(data = t_data_f, include = 'topic_' + i[0]) + '''</td>
-                            </tr>
-                        </tbody>
-                    </table>
-                    <hr class="main_hr">
-                '''
+                all_data = '' + \
+                    '<table id="toron">' + \
+                        '<tbody>' + \
+                            '<tr>' + \
+                               '<td id="' + t_color + '">' + \
+                                    '<a href="javascript:void(0);" id="' + i[0] + '">#' + i[0] + '</a> ' + ip + ' <span style="float: right;">' + i[2] + '</span>' + \
+                                '</td>' + \
+                            '</tr>' + \
+                            '<tr>' + \
+                                '<td id="' + b_color + '">' + render_set(data = t_data_f, include = 'topic_' + i[0]) + '</td>' + \
+                            '</tr>' + \
+                        '</tbody>' + \
+                    '</table>' + \
+                    '<hr class="main_hr">' + \
+                ''
                 
                 json_data[i[0]] = {
                     "data" : all_data

+ 8 - 1
route/recent_discuss.py

@@ -30,10 +30,17 @@ def recent_discuss_2(conn):
         curs.execute(db_change("select title, sub, date from rd where stop = 'O' order by date desc limit 50"))
         
     for data in curs.fetchall():
+        curs.execute(db_change("select code from topic where id = '1' and title = ? and sub = ?"), [data[0], data[1]])
+        get_code = curs.fetchall()
+        if get_code and get_code[0][0] != '':
+            get_code = get_code[0][0]
+        else:
+            get_code = '1'
+
         title = html.escape(data[0])
         sub = html.escape(data[1])
 
-        div += '<tr><td><a href="/topic/' + url_pas(data[0]) + '/sub/' + url_pas(data[1]) + '">' + title + '</a> (' + sub + ')</td><td>' + data[2] + '</td></tr>'
+        div += '<tr><td><a href="/thread/' + get_code + '">' + title + '</a> (' + sub + ')</td><td>' + data[2] + '</td></tr>'
     
     div += '</tbody></table>'
             

+ 20 - 7
route/tool/func.py

@@ -160,20 +160,31 @@ def captcha_get():
     return data
 
 def update():
-    #v3.1.2
+    #v3.1.5
     try:
-        curs.execute(db_change('select title, dec from acl where dec != ""'))
+        num = 1
+        curs.execute(db_change('select title, sub from topic where id = "1" order by date asc'))
         db_data = curs.fetchall()
         for i in db_data:
-            curs.execute(db_change("update acl set decu = ? where title = ?"), [i[1], i[0]])
+            curs.execute(db_change("update topic set code = ? where title = ? and sub = ? and id = '1'"), [str(num), i[0], i[1]])
+            num += 1
 
-        print('Fix table acl column dec to decu')
+        print('----')
+        print('Add topic code')
         print('----')
     except:
         pass
 
     conn.commit()
 
+def topic_change(num):
+    curs.execute(db_change('select title, sub from topic where id = "1" and code = ?'), [str(num)])
+    db_data = curs.fetchall()
+    if db_data:
+        return [db_data[0][0], db_data[0][1]]
+    else:
+        return ['Test', 'Test']
+
 def pw_encode(data, data2 = '', type_d = ''):
     if type_d == '':
         curs.execute(db_change('select data from other where name = "encode"'))
@@ -387,7 +398,7 @@ def other2(data):
     req_list = ''
     
     css_filter = {
-        'main.css' : '3'
+        'main.css' : '4'
     }
     for i_data in os.listdir(os.path.join("views", "main_css", "css")):
         if i_data in css_filter:
@@ -399,8 +410,10 @@ def other2(data):
         'load_include.js' : '2',
         'render_html.js' : '3',
         'do_open_foot.js' : '4',
-        'topic_main_load.js' : '2',
-        'topic_plus_load.js' : '3',
+        'topic_main_load.js' : '3',
+        'topic_plus_load.js' : '4',
+        'topic_top_load.js' : '2',
+        'topic_list_load.js' : '2',
         'do_stop_exit.js' : '2',
         'do_open_folding.js' : '3',
         'shotcuts_set.js' : '2'

+ 27 - 11
route/topic.py

@@ -1,8 +1,16 @@
 from .tool.func import *
 
-def topic_2(conn, name, sub):
+def topic_2(conn, topic_num):
     curs = conn.cursor()
-    
+
+    if flask.request.method == 'POST':
+        name = flask.request.form.get('topic', 'test')
+        sub = flask.request.form.get('title', 'test')
+    else:
+        topic_change_data = topic_change(topic_num)
+        name = topic_change_data[0]
+        sub = topic_change_data[1]
+
     ban = topic_check(name, sub)
     admin = admin_check(3)
 
@@ -52,7 +60,7 @@ def topic_2(conn, name, sub):
             if y_check == 1:
                 curs.execute(db_change('insert into alarm (name, data, date) values (?, ?, ?)'), [
                     match.groups()[0], 
-                    ip + ' | <a href="/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '">' + name + ' | ' + sub + ' | #' + str(num) + '</a>', 
+                    ip + ' | <a href="/thread/' + str(topic_num) + '#' + str(num) + '">' + name + ' | ' + sub + ' | #' + str(num) + '</a>', 
                     today
                 ])
         
@@ -65,20 +73,26 @@ def topic_2(conn, name, sub):
             if ip_data and ip_or_user(ip_data[0][0]) == 0:
                 curs.execute(db_change('insert into alarm (name, data, date) values (?, ?, ?)'), [
                     ip_data[0][0], 
-                    ip + ' | <a href="/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '#' + str(num) + '">' + name + ' | ' + sub + ' | #' + str(num) + '</a>', 
+                    ip + ' | <a href="/thread/' + str(topic_num) + '#' + str(num) + '">' + name + ' | ' + sub + ' | #' + str(num) + '</a>', 
                     today
                 ])
             
         data = re.sub("(?P<in>#(?:[0-9]+))", '[[\g<in>]]', data)
-
         data = savemark(data)
 
         rd_plus(name, sub, today)
-
-        curs.execute(db_change("insert into topic (id, title, sub, data, date, ip, block, top) values (?, ?, ?, ?, ?, ?, '', '')"), [str(num), name, sub, data, today, ip])
+        curs.execute(db_change("insert into topic (id, title, sub, data, date, ip, block, top, code) values (?, ?, ?, ?, ?, ?, '', '', ?)"), [
+            str(num), 
+            name, 
+            sub, 
+            data, 
+            today, 
+            ip,
+            str(topic_num) if num == 1 else ''
+        ])
         conn.commit()
         
-        return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '#reload')
+        return redirect('/thread/' + str(topic_num))
     else:
         data = ''
     
@@ -93,13 +107,15 @@ def topic_2(conn, name, sub):
             <div id="top_topic"></div>
             <div id="main_topic"></div>
             <div id="plus_topic"></div>
-            <script>topic_top_load("''' + name + '''", "''' + sub + '''");</script>
-            <a href="/topic/''' + url_pas(name) + '''/sub/''' + url_pas(sub) + '''/tool">(''' + load_lang('topic_tool') + ''')</a>
+            <script>topic_top_load("''' + str(topic_num) + '''");</script>
+            <a href="/thread/''' + str(topic_num) + '/tool">(' + load_lang('topic_tool') + ''')</a>
             <hr class=\"main_hr\">
             <form style="''' + display + '''" method="post">
-                <textarea id="content" style="height: 100px;" name="content"></textarea>
+                <textarea id="content" placeholder="''' + load_lang('content') + '''" name="content"></textarea>
                 <hr class=\"main_hr\">
                 ''' + captcha_get() + (ip_warring() if display == '' else '') + '''
+                <input style="display: none;" name="topic" value="''' + name + '''">
+                <input style="display: none;" name="title" value="''' + sub + '''">
                 <button type="submit">''' + load_lang('send') + '''</button>
                 <button id="preview" type="button" onclick="load_preview(\'''' + url_pas(name) + '\')">' + load_lang('preview') + '''</button>
             </form>

+ 10 - 6
route/topic_admin.py

@@ -1,12 +1,16 @@
 from .tool.func import *
 
-def topic_admin_2(conn, name, sub, num):
+def topic_admin_2(conn, topic_num, num):
     curs = conn.cursor()
 
+    topic_change_data = topic_change(topic_num)
+    name = topic_change_data[0]
+    sub = topic_change_data[1]
+
     curs.execute(db_change("select block, ip, date from topic where title = ? and sub = ? and id = ?"), [name, sub, str(num)])
     data = curs.fetchall()
     if not data:
-        return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub))
+        return redirect('/thread/' + str(topic_num))
 
     ban = '''
         <h2>''' + load_lang('state') + '''</h2>
@@ -18,7 +22,7 @@ def topic_admin_2(conn, name, sub, num):
         <h2>''' + load_lang('other_tool') + '''</h2>
         <ul>
             <li>
-                <a href="/topic/''' + url_pas(name) + '/sub/' + url_pas(sub) + '/raw/' + str(num) + '''">''' + load_lang('raw') + '''</a>
+                <a href="/thread/''' + str(topic_num) + '/raw/' + str(num) + '''">''' + load_lang('raw') + '''</a>
             </li>
         </ul>
     '''
@@ -40,12 +44,12 @@ def topic_admin_2(conn, name, sub, num):
                     </a>
                 </li>
                 <li>
-                    <a href="/topic/''' + url_pas(name) + '/sub/' + url_pas(sub) + '/b/' + str(num) + '''">
+                    <a href="/thread/''' + str(topic_num) + '/b/' + str(num) + '''">
                         ''' + (load_lang('hide_release') if data[0][0] == 'O' else load_lang('hide')) + '''
                     </a>
                 </li>
                 <li>
-                    <a href="/topic/''' + url_pas(name) + '/sub/' + url_pas(sub) + '/notice/' + str(num) + '''">
+                    <a href="/thread/''' + str(topic_num) + '/notice/' + str(num) + '''">
                         ''' + (load_lang('pinned_release') if top_topic_d else load_lang('pinned')) + '''
                     </a>
                 </li>
@@ -55,5 +59,5 @@ def topic_admin_2(conn, name, sub, num):
     return easy_minify(flask.render_template(skin_check(), 
         imp = [load_lang('discussion_tool'), wiki_set(), custom(), other2([' (#' + str(num) + ')', 0])],
         data = ban,
-        menu = [['topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '#' + str(num), load_lang('return')]]
+        menu = [['thread/' + str(topic_num) + '#' + str(num), load_lang('return')]]
     ))

+ 6 - 2
route/topic_block.py

@@ -1,8 +1,12 @@
 from .tool.func import *
 
-def topic_block_2(conn, name, sub, num):
+def topic_block_2(conn, topic_num, num):
     curs = conn.cursor()
 
+    topic_change_data = topic_change(topic_num)
+    name = topic_change_data[0]
+    sub = topic_change_data[1]
+
     if admin_check(3, 'blind (' + name + ' - ' + sub + '#' + str(num) + ')') != 1:
         return re_error('/error/3')
 
@@ -18,4 +22,4 @@ def topic_block_2(conn, name, sub, num):
         
         conn.commit()
         
-    return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '#' + str(num))
+    return redirect('/thread/' + str(topic_num) + '#' + str(num))

+ 78 - 71
route/topic_close_list.py

@@ -1,85 +1,92 @@
 from .tool.func import *
 
-def topic_close_list_2(conn, name, tool):
+def topic_close_list_2(conn, name):
     curs = conn.cursor()
     
     div = ''
+    tool = flask.request.args.get('tool', '')
+
+    plus = ''
+    menu = [['topic/' + url_pas(name), load_lang('return')]]
     
-    if flask.request.method == 'POST':
-        t_num = ''
+    if tool == 'close':
+        curs.execute(db_change("select sub from rd where title = ? and stop = 'O' order by sub asc"), [name])
         
-        while 1:
-            curs.execute(db_change("select title from topic where title = ? and sub = ? limit 1"), [name, flask.request.form.get('topic', None) + t_num])
-            if curs.fetchall():
-                if t_num == '':
-                    t_num = ' 2'
-                else:
-                    t_num = ' ' + str(int(t_num.replace(' ', '')) + 1)
-            else:
-                break
-
-        return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(flask.request.form.get('topic', 'test') + t_num))
-    else:
-        plus = ''
-        menu = [['topic/' + url_pas(name), load_lang('return')]]
+        sub = load_lang('closed_discussion')
+    elif tool == 'agree':
+        curs.execute(db_change("select sub from rd where title = ? and agree = 'O' order by sub asc"), [name])
         
-        if tool == 'close':
-            curs.execute(db_change("select sub from rd where title = ? and stop = 'O' order by sub asc"), [name])
-            
-            sub = load_lang('closed_discussion')
-        elif tool == 'agree':
-            curs.execute(db_change("select sub from rd where title = ? and agree = 'O' order by sub asc"), [name])
-            
-            sub = load_lang('agreed_discussion')
+        sub = load_lang('agreed_discussion')
+    else:        
+        sub = load_lang('discussion_list')
+        menu = [['w/' + url_pas(name), load_lang('document')]]
+
+        if topic_check(name, sub) == 1:
+            display = 'display: none;'
         else:
-            curs.execute(db_change("select sub from rd where title = ? order by date desc"), [name])
-            
-            sub = load_lang('discussion_list')
-            
-            menu = [['w/' + url_pas(name), load_lang('document')]]
-            
-            plus =  '''
-                <a href="/topic/''' + url_pas(name) + '''/close">(''' + load_lang('closed_discussion') + ''')</a> <a href="/topic/''' + url_pas(name) + '''/agree">(''' + load_lang('agreed_discussion') + ''')</a>
+            display = ''
+
+        curs.execute(db_change("select code from topic order by code + 0 desc limit 1"))
+        t_data = curs.fetchall()
+        if t_data:
+            topic_num = str(int(t_data[0][0]) + 1)
+        else:
+            topic_num = '1'
+        
+        plus = '''
+            <a href="/topic/''' + url_pas(name) + '?tool=close">(' + load_lang('closed_discussion') + ')</a> <a href="/topic/' + url_pas(name) + '?tool=agree">(' + load_lang('agreed_discussion') + ''')</a>
+            <hr class=\"main_hr\">
+            <form style="''' + display + '" method="post" action="/thread/' + topic_num + '''">
+                <input placeholder="''' + load_lang('discussion_name') + '''" name="title">
                 <hr class=\"main_hr\">
-                <input placeholder="''' + load_lang('discussion_name') + '''" name="topic" type="text">
+                <textarea id="content" placeholder="''' + load_lang('content') + '''" name="content"></textarea>
                 <hr class=\"main_hr\">
-                <button type="submit">''' + load_lang('go') + '''</button>
-            '''
+                ''' + captcha_get() + (ip_warring() if display == '' else '') + '''
+                <input style="display: none;" name="topic" value="''' + name + '''">
+                <button type="submit">''' + load_lang('send') + '''</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>
+        '''
 
-        t_num = 0
-        for data in curs.fetchall():
-            t_num += 1
-            
-            curs.execute(db_change("select data, date, ip, block from topic where title = ? and sub = ? and id = '1'"), [name, data[0]])
-            if curs.fetchall():                
-                it_p = 0
-                
-                if sub == load_lang('discussion_list'):
-                    curs.execute(db_change("select title from rd where title = ? and sub = ? and stop = 'O' order by sub asc"), [name, data[0]])
-                    if curs.fetchall():
-                        it_p = 1
-                
-                if it_p != 1:
-                    curs.execute(db_change("select id from topic where title = ? and sub = ? order by date desc limit 1"), [name, data[0]])
-                    t_data = curs.fetchall()
-                
-                    div += '''
-                        <h2><a href="/topic/''' + url_pas(name) + '''/sub/''' + url_pas(data[0]) + '''">''' + str(t_num) + '''. ''' + data[0] + '''</a></h2>
-                        <div id="topic_pre_''' + str(t_num) + '''"></div>
-                        <div id="topic_back_pre_''' + str(t_num) + '''"></div>
-                        <script>
-                            topic_list_load("''' + name + '''", "''' + data[0] + '''", "1", "topic_pre_''' + str(t_num) + '''");
-                            if("''' + str(t_data[0][0]) + '''" !== "1") {
-                                topic_list_load("''' + name + '''", "''' + data[0] + '''", "''' + t_data[0][0] + '''", "topic_back_pre_''' + str(t_num) + '''");
-                            }
-                        </script>
-                    '''
+        curs.execute(db_change("select sub from rd where title = ? order by date desc"), [name])
 
-        if div == '':
-            plus = re.sub('^<br>', '', plus)
+    t_num = 0
+    for data in curs.fetchall():
+        t_num += 1
         
-        return easy_minify(flask.render_template(skin_check(), 
-            imp = [name, wiki_set(), custom(), other2([' (' + sub + ')', 0])],
-            data = '<form method="post">' + div + plus + '</form>',
-            menu = menu
-        ))
+        curs.execute(db_change("select code from topic where title = ? and sub = ? and id = '1'"), [name, data[0]])
+        first_topic = curs.fetchall()
+        if first_topic:                
+            it_p = 0
+            
+            if tool == '':
+                curs.execute(db_change("select title from rd where title = ? and sub = ? and stop = 'O' order by sub asc"), [name, data[0]])
+                if curs.fetchall():
+                    it_p = 1
+            
+            if it_p != 1:
+                curs.execute(db_change("select id from topic where title = ? and sub = ? order by date desc limit 1"), [name, data[0]])
+                t_data = curs.fetchall()
+            
+                div += '''
+                    <h2><a href="/thread/''' + first_topic[0][0] + '">' + str(t_num) + '. ' + data[0] + '''</a></h2>
+                    <div id="topic_pre_''' + str(t_num) + '''"></div>
+                    <div id="topic_back_pre_''' + str(t_num) + '''"></div>
+                    <script>
+                        topic_list_load(''' + first_topic[0][0] + ', 1, "topic_pre_' + str(t_num) + '''");
+                        if(''' + str(t_data[0][0]) + ''' !== 1) {
+                            topic_list_load(''' + first_topic[0][0] + ', ' + t_data[0][0] + ', "topic_back_pre_' + str(t_num) + '''");
+                        }
+                    </script>
+                '''
+                
+    if div == '':
+        plus = re.sub('^<br>', '', plus)
+    
+    return easy_minify(flask.render_template(skin_check(), 
+        imp = [name, wiki_set(), custom(), other2([' (' + sub + ')', 0])],
+        data = div + plus,
+        menu = menu
+    ))

+ 6 - 2
route/topic_stop.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def topic_stop_2(conn, name, sub):
+def topic_stop_2(conn, topic_num):
     curs = conn.cursor()
 
     if admin_check(3) != 1:
@@ -9,6 +9,10 @@ def topic_stop_2(conn, name, sub):
     ip = ip_check()
     time = get_time()
 
+    topic_change_data = topic_change(topic_num)
+    name = topic_change_data[0]
+    sub = topic_change_data[1]
+
     if flask.request.method == 'POST':
         curs.execute(db_change("select id from topic where title = ? and sub = ? order by id + 0 desc limit 1"), [name, sub])
         topic_check = curs.fetchall()
@@ -42,7 +46,7 @@ def topic_stop_2(conn, name, sub):
 
             rd_plus(name, sub, time)
 
-        return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub))    
+        return redirect('/thread/' + str(topic_num))    
     else:
         stop_d_list = ''
         agree_check = ''

+ 6 - 2
route/topic_tool.py

@@ -1,10 +1,14 @@
 from .tool.func import *
 
-def topic_tool_2(conn, name, sub):
+def topic_tool_2(conn, topic_num):
     curs = conn.cursor()
 
     data = ''
 
+    topic_change_data = topic_change(topic_num)
+    name = topic_change_data[0]
+    sub = topic_change_data[1]
+
     curs.execute(db_change("select stop, agree from rd where title = ? and sub = ?"), [name, sub])
     close_data = curs.fetchall()
     if close_data:
@@ -21,7 +25,7 @@ def topic_tool_2(conn, name, sub):
         data = '''
             <h2>''' + load_lang('admin_tool') + '''</h2>
             <ul>
-                <li><a href="/topic/''' + url_pas(name) + '/sub/' + url_pas(sub) + '''/setting">''' + load_lang('topic_setting') + '''</a></li>
+                <li><a href="/thread/''' + str(topic_num) + '/setting">' + load_lang('topic_setting') + '''</a></li>
             </ul>
         '''
     data += '''

+ 6 - 2
route/topic_top.py

@@ -1,7 +1,11 @@
 from .tool.func import *
 
-def topic_top_2(conn, name, sub, num):
+def topic_top_2(conn, topic_num, num):
     curs = conn.cursor()
+
+    topic_change_data = topic_change(topic_num)
+    name = topic_change_data[0]
+    sub = topic_change_data[1]
     
     if admin_check(3, 'notice (' + name + ' - ' + sub + '#' + str(num) + ')') != 1:
         return re_error('/error/3')
@@ -20,4 +24,4 @@ def topic_top_2(conn, name, sub, num):
 
         conn.commit()
 
-    return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '#' + str(num))        
+    return redirect('/thread/' + str(topic_num) + '#' + str(num))        

+ 6 - 1
route/view_raw.py

@@ -1,10 +1,15 @@
 from .tool.func import *
 
-def view_raw_2(conn, name, sub_title, num):
+def view_raw_2(conn, name, topic_num, num):
     curs = conn.cursor()
 
     if acl_check(name, 'render') == 1:
         return re_error('/ban')
+
+    if topic_num:
+        topic_change_data = topic_change(topic_num)
+        name = topic_change_data[0]
+        sub_title = topic_change_data[1]
     
     v_name = name
     sub = ' (' + load_lang('raw') + ')'

+ 2 - 2
version.json

@@ -1,7 +1,7 @@
 {
     "master" : {
-        "r_ver" : "v3.1.5-master-12",
-        "c_ver" : "400004",
+        "r_ver" : "v3.1.5-master-13",
+        "c_ver" : "400005",
         "s_ver" : "5"
     }, "stable" : {
         "r_ver" : "v3.1.4-stable-03",

+ 2 - 1
views/main_css/css/main.css

@@ -43,4 +43,5 @@ blockquote { background-image: url(/views/acme/img/quote.png); background-positi
 @media (max-height: 400px) { .foot_plus { height: 80%; top: calc(100% - 92%); }}
 .foot_in { overflow-y: scroll; height: calc(100% - 20px); }
 #origin { display: none; }
-.all_in_data { display: block; width: 100%; }
+.all_in_data { display: block; width: 100%; }
+#content { height: 100px; }

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

@@ -1,6 +1,6 @@
-function topic_list_load(name, sub, s_num, where) {
+function topic_list_load(topic_num, s_num, where) {
     var o_data = document.getElementById(where);
-    var url = "/api/topic/" + encodeURI(name) + "/sub/" + encodeURI(sub) + "?render=1&num=" + s_num;
+    var url = "/api/thread/" + String(topic_num) + "?render=1&num=" + String(s_num);
     var n_data = "";
     var num = 1;
     

+ 4 - 4
views/main_css/js/topic_main_load.js

@@ -1,9 +1,9 @@
-function topic_main_load(name, sub, s_num) {
+function topic_main_load(topic_num, s_num) {
     var o_data = document.getElementById('main_topic');
     if(s_num) {
-        var url = "/api/topic/" + name + "/sub/" + sub + "?render=1&num=" + s_num;
+        var url = "/api/thread/" + String(topic_num) + "?render=1&num=" + s_num;
     } else {
-        var url = "/api/topic/" + name + "/sub/" + sub + "?render=1";
+        var url = "/api/thread/" + String(topic_num) + "?render=1";
     }
     var url_2 = "/api/markup";
     var n_data = "";
@@ -27,7 +27,7 @@ function topic_main_load(name, sub, s_num) {
             
             o_data.innerHTML = n_data;
             if(!s_num) {
-                topic_plus_load(name, sub, String(Number(num) + 1));
+                topic_plus_load(topic_num, String(Number(num) + 1));
             }
 
             xhr_2.onreadystatechange = function() {

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

@@ -1,6 +1,6 @@
-function topic_plus_load(name, sub, num) {
+function topic_plus_load(topic_num, num) {
     var test = setInterval(function() {
-        var url = "/api/topic/" + encodeURI(name) + "/sub/" + encodeURI(sub) + "?num=" + num + "&render=1";
+        var url = "/api/thread/" + String(topic_num) + "?num=" + num + "&render=1";
         var p_data = document.getElementById("plus_topic");
         var n_data = '';
         var n_num = 1;
@@ -49,7 +49,7 @@ function topic_plus_load(name, sub, num) {
                     }
                 }
 
-                topic_plus_load(name, sub, String(Number(num) + 1));
+                topic_plus_load(topic_num, String(Number(num) + 1));
                 clearInterval(test);
             }
         }

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

@@ -1,6 +1,6 @@
-function topic_top_load(name, sub) {
+function topic_top_load(topic_num) {
     var o_data = document.getElementById('top_topic');
-    var url = "/api/topic/" + encodeURI(name) + "/sub/" + encodeURI(sub) + "?top=1&render=1";
+    var url = "/api/thread/" + String(topic_num) + "?top=1&render=1";
     var n_data = "";
     var num = 1;
     
@@ -17,7 +17,7 @@ function topic_top_load(name, sub) {
             }
             
             o_data.innerHTML = n_data;
-            topic_main_load(name, sub, null);
+            topic_main_load(topic_num, null);
         }
     }