2du %!s(int64=3) %!d(string=hai) anos
pai
achega
31b890efcb

+ 1 - 1
lang/en-US.json

@@ -194,7 +194,7 @@
         "accept_edit_request" : "Accept edit request",
         "history_add" : "Add history",
         "all_register_num" : "The number of application forms",
-        "replace_move" : "Swaping documents",
+        "replace_move" : "Interchange",
         "merge_move" : "Merging documents",
         "add_admin_group" : "Add administrator groups",
         "add_watchlist" : "Add watchlist",

+ 1 - 1
lang/ko-KR.json

@@ -329,7 +329,7 @@
     "application_not_found": "존재하지 않는 회원가입 신청입니다.",
     "approval_requirement_disabled": "현재 가입시 승인필요 설정이 비활성화되어있습니다. 필요시 설정에서 활성화할 수 있습니다.",
     "all_register_num": "모든 가입 신청자의 수",
-    "replace_move": "서 바꾸기",
+    "replace_move": "서 바꾸기",
     "merge_move": "문서 병합",
     "add_admin_group": "관리자 그룹 추가",
     "add_watchlist": "주시 문서 추가",

+ 43 - 13
route/tool/func.py

@@ -1890,6 +1890,49 @@ def do_title_length_check(name, check_type = 'document'):
     return 0
 
 # Func-insert
+def do_add_thread(thread_code, thread_data, thread_top = '', thread_id = ''):
+    curs = conn.cursor()
+    
+    if thread_id == '':
+        curs.execute(db_change("select id from topic where code = ? order by id + 0 desc limit 1"), [thread_code])
+        db_data = curs.fetchall()
+        if db_data:
+            thread_id = str(int(db_data[0][0]) + 1)
+        else:
+            thread_id = '1'
+        
+    curs.execute(db_change("insert into topic (id, data, date, ip, block, top, code) values (?, ?, ?, ?, ?, '', ?)"), [
+        thread_id,
+        thread_data,
+        get_time(),
+        ip_check(),
+        thread_top,
+        thread_code
+    ])
+    
+    conn.commit()
+    
+def do_reload_recent_thread(topic_num, date, name = None, sub = None):
+    curs = conn.cursor()
+
+    curs.execute(db_change("select code from rd where code = ?"), [topic_num])
+    if curs.fetchall():
+        curs.execute(db_change("update rd set date = ? where code = ?"), [
+            date, 
+            topic_num
+        ])
+    else:
+        curs.execute(db_change(
+            "insert into rd (title, sub, code, date, band, stop, agree, acl) values (?, ?, ?, ?, '', '', '', '')"
+        ), [
+            name, 
+            sub, 
+            topic_num, 
+            date
+        ])
+
+    conn.commit()
+
 def add_alarm(who, context):
     curs = conn.cursor()
 
@@ -2014,19 +2057,6 @@ def ban_insert(name, end, why, login, blocker, type_d = None):
 
     conn.commit()
 
-def rd_plus(topic_num, date, name = None, sub = None):
-    curs = conn.cursor()
-
-    curs.execute(db_change("select code from rd where code = ?"), [topic_num])
-    if curs.fetchall():
-        curs.execute(db_change("update rd set date = ? where code = ?"), [date, topic_num])
-    else:
-        curs.execute(db_change(
-            "insert into rd (title, sub, code, date, band, stop, agree, acl) values (?, ?, ?, ?, '', '', '', '')"
-        ), [name, sub, topic_num, date])
-
-    conn.commit()
-
 def history_plus(title, data, date, ip, send, leng, t_check = '', mode = ''):
     curs = conn.cursor()
     

+ 12 - 7
route/topic.py

@@ -101,14 +101,19 @@ def topic(topic_num = 0):
             data = re.sub(r"( |\n|^)(#(?:[0-9]+))( |\n|$)", '\g<1><topic_a>\g<2></topic_a>\g<3>', data)
             data = re.sub(r"( |\n|^)(@(?:[^ ]+))( |\n|$)", '\g<1><topic_call>\g<2></topic_call>\g<3>', data)
 
-            rd_plus(topic_num, today, name, sub)
-            curs.execute(db_change("insert into topic (id, data, date, ip, code) values (?, ?, ?, ?, ?)"), [
-                num,
+            do_add_thread(
+            	topic_num,
                 data,
-                today,
-                ip,
-                topic_num
-            ])
+                '',
+                num
+            )
+            do_reload_recent_thread(
+                topic_num, 
+                today, 
+                name, 
+                sub
+            )
+
             conn.commit()
 
             return redirect('/thread/' + topic_num + '#' + num)

+ 4 - 1
route/topic_comment_blind.py

@@ -18,7 +18,10 @@ def topic_comment_blind(topic_num = 1, num = 1):
             else:
                 curs.execute(db_change("update topic set block = 'O' where code = ? and id = ?"), [topic_num, num])
 
-            rd_plus(topic_num, get_time())
+            do_reload_recent_thread(
+                topic_num, 
+                get_time()
+            )
 
             conn.commit()
 

+ 5 - 1
route/topic_comment_notice.py

@@ -20,7 +20,11 @@ def topic_comment_notice(topic_num = 1, num = 1):
                 else:
                     curs.execute(db_change("update topic set top = 'O' where code = ? and id = ?"), [topic_num, num])
 
-            rd_plus(topic_num, get_time())
+            do_reload_recent_thread(
+                topic_num, 
+                get_time()
+            )
+            
             conn.commit()
 
         return redirect('/thread/' + topic_num + '#' + num)

+ 9 - 9
route/topic_tool_acl.py

@@ -43,15 +43,15 @@ def topic_tool_acl(topic_num = 1):
                         acl_data_view
                     ])
 
-                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)
+                do_add_thread(
+                    topic_num,
+                	'acl change ' + acl_data,
+                    '1'
+                )
+                do_reload_recent_thread(
+                    topic_num, 
+                    time
+                )
 
             return redirect('/thread/' + topic_num)
         else:

+ 9 - 9
route/topic_tool_change.py

@@ -31,15 +31,15 @@ def topic_tool_change(topic_num = 1):
                     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)
+                do_add_thread(
+                    topic_num,
+                    'change name to ' + sub_d + ' (' + title_d + ')',
+                    '1'
+                )
+                do_reload_recent_thread(
+                    topic_num, 
+                    time
+                )
 
             return redirect('/thread/' + topic_num)
         else:

+ 8 - 8
route/topic_tool_setting.py

@@ -39,15 +39,15 @@ def topic_tool_setting(topic_num = 1):
                 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),
+                do_add_thread(
+                    topic_num,
                     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)
+                    '1'
+                )
+                do_reload_recent_thread(
+                    topic_num, 
+                    time
+                )
 
             return redirect('/thread/' + topic_num)
         else: