Преглед изворни кода

Merge pull request #975 from 2du/master

버그 수정
잉여개발기 (SPDV) пре 5 година
родитељ
комит
418dc19030
7 измењених фајлова са 26 додато и 24 уклоњено
  1. 1 0
      language/en-US.json
  2. 1 0
      language/ko-KR.json
  3. 2 1
      route/api_topic_sub.py
  4. 2 1
      route/give_acl.py
  5. 17 19
      route/tool/func.py
  6. 1 1
      route/tool/set_mark/namumark.py
  7. 2 2
      version.json

+ 1 - 0
language/en-US.json

@@ -326,6 +326,7 @@
             "owner_acl" : "Owner only",
             "before_acl" : "Only those who have edited this document before",
             "ban_acl" : "Include blocked users",
+            "ban_admin_acl" : "Blocked users and administrators",
             "30_day_acl" : "Only members 30 days after register",
             "_comment_2.6_1_" : "Set",
                 "document_acl" : "Document ACL",

+ 1 - 0
language/ko-KR.json

@@ -353,6 +353,7 @@
     "extension_filter_add": "확장자 필터 추가",
     "extension": "확장자",
     "ban_acl": "차단된 사용자 포함",
+    "ban_admin_acl": "차단된 사용자 및 관리자",
     "topic_name_change": "토론 제목 변경",
     "topic_acl_setting" : "토론 ACL 설정",
     "topic_acl" : "토론 ACL",

+ 2 - 1
route/api_topic_sub.py

@@ -4,6 +4,7 @@ def api_topic_sub_2(conn, topic_num):
     curs = conn.cursor()
 
     topic_num = str(topic_num)
+    get_acl = acl_check('', 'render')
 
     if flask.request.args.get('num', None):
         curs.execute(db_change("select id, data, date, ip, block, top from topic where code = ? and id + 0 = ? + 0 order by id + 0 asc"), [
@@ -63,7 +64,7 @@ def api_topic_sub_2(conn, topic_num):
                 if t_data_f == '':
                     t_data_f = '[br]'
 
-                t_data_f = render_set(data = t_data_f, num = 2, include = 'topic_' + i[0])
+                t_data_f = render_set(data = t_data_f, num = 2, include = 'topic_' + i[0], acl = get_acl)
                 t_plus_data = t_data_f[1]
                 t_data_f = t_data_f[0]
 

+ 2 - 1
route/give_acl.py

@@ -138,6 +138,7 @@ def give_acl_2(conn, name):
                     <li>ban : ''' + load_lang('ban_acl') + '''</li>
                     <li>before : ''' + load_lang('before_acl') + '''</li>
                     <li>30_day : ''' + load_lang('30_day_acl') + '''</li>
+                    <li>ban_admin : ''' + load_lang('ban_admin_acl') + '''</li>
                 </ul>
             '''
 
@@ -164,4 +165,4 @@ def give_acl_2(conn, name):
                 </form>
             ''',
             menu = [['w/' + url_pas(name), load_lang('document')], ['manager', load_lang('admin')], ['admin_log?search=' + url_pas('acl (' + name + ')'), load_lang('acl_record')]]
-        ))
+        ))

+ 17 - 19
route/tool/func.py

@@ -166,8 +166,11 @@ def last_change(data):
 def easy_minify(data, tool = None):
     return last_change(data)
 
-def render_set(title = '', data = '', num = 0, s_data = 0, include = None):
-    if acl_check(title, 'render') == 1:
+def render_set(title = '', data = '', num = 0, s_data = 0, include = None, acl = None):
+    if not acl:
+        acl = acl_check(title, 'render')
+
+    if acl == 1:
         return 'HTTP Request 401.3'
     elif s_data == 1:
         return data
@@ -871,18 +874,13 @@ def acl_check(name = 'test', tool = '', topic_num = '1'):
     if tool == '' and acl_check(name, 'render') == 1:
         return 1
     
-    if tool == '':
+    if tool == '' and tool == 'topic':
         end = 3
-    elif tool == 'topic':
-        if not name:
+
+        if tool == 'topic' and not name:
             curs.execute(db_change("select title from rd where code = ?"), [topic_num])
             topic_data = curs.fetchall()
-            if topic_data:
-                name = topic_data[0][0]
-            else:
-                name = 'test'
-
-        end = 3
+            name = topic_data[0][0] if topic_data else 'test'
     elif tool == 'render':
         end = 2
     else:
@@ -981,17 +979,17 @@ def acl_check(name = 'test', tool = '', topic_num = '1'):
             elif acl_data[0][0] == 'owner':
                 if admin_check() == 1:
                     return 0
+            elif acl_data[0][0] == 'ban_admin':
+                if admin_check(1) == 1 or ban_check() == 1:
+                    return 0
 
             return 1
         else:
             if i == (end - 1):
-                if tool == 'topic':
-                    if topic_num:
-                        curs.execute(db_change("select title from rd where code = ? and stop != ''"), [topic_num])
-                        if curs.fetchall():
-                            if admin_check(3, 'topic (code ' + topic_num + ')') == 1:
-                                return 0
-                        else:
+                if tool == 'topic' and topic_num:
+                    curs.execute(db_change("select title from rd where code = ? and stop != ''"), [topic_num])
+                    if curs.fetchall():
+                        if admin_check(3, 'topic (code ' + topic_num + ')') == 1:
                             return 0
                     else:
                         return 0
@@ -1175,7 +1173,7 @@ def get_acl_list(type_d = 'normal'):
     if type_d == 'user':
         return ['', 'user', 'all']
     else:
-        return ['', 'all', 'user', 'admin', 'owner', '50_edit', 'email', 'ban', 'before', '30_day']
+        return ['', 'all', 'user', 'admin', 'owner', '50_edit', 'email', 'ban', 'before', '30_day', 'ban_admin']
 
 def re_error(data):
     conn.commit()

+ 1 - 1
route/tool/set_mark/namumark.py

@@ -1200,7 +1200,7 @@ def namumark(conn, data, title, include_num):
                 else:
                     if re.search(r'^#', other_link):
                         data = link_re.sub(
-                            '<a title="' + other_link + '" href="' + other_link + '">' + other_link + '</a>',
+                            '<a title="' + other_link + '" href="' + other_link + '">' + (other_link if see_link == other_link else see_link) + '</a>',
                             data,
                             1
                         )

+ 2 - 2
version.json

@@ -1,10 +1,10 @@
 {
     "master" : {
-        "r_ver" : "v3.2.0-stable-09",
+        "r_ver" : "v3.2.0-stable-10",
         "c_ver" : "3200900",
         "s_ver" : "9"
     }, "stable" : {
-        "r_ver" : "v3.2.0-stable-09",
+        "r_ver" : "v3.2.0-stable-10",
         "c_ver" : "3200900",
         "s_ver" : "9"
     }