瀏覽代碼

간편 검사 기능 추가

Surplus_Up (2DU) 5 年之前
父節點
當前提交
efa9f5d112
共有 4 個文件被更改,包括 152 次插入123 次删除
  1. 1 0
      language/en-US.json
  2. 2 1
      language/ko-KR.json
  3. 148 121
      route/give_user_check.py
  4. 1 1
      version.json

+ 1 - 0
language/en-US.json

@@ -207,6 +207,7 @@
         "star_doc" : "Document(s) of interest",
         "add_star_doc" : "Add document(s) of interest",
         "get_sitemap" : "Create or renewal sitemap.xml",
+        "simple_check" : "Simple check",
         "_comment_2.1_" : "Filter",
             "_comment_2.1.1_" : "List",
                 "interwiki_list" : "Interwiki(s) list",

+ 2 - 1
language/ko-KR.json

@@ -373,5 +373,6 @@
     "restart_fail_error" : "재시작이 실패했습니다. 수동 재시작을 이용해주세요.",
     "domain" : "도메인",
     "before_acl" : "이 문서를 이전에 편집한 적 있는 사람만",
-    "30_day_acl" : "가입 후 30일이 지난 가입자만"
+    "30_day_acl" : "가입 후 30일이 지난 가입자만",
+    "simple_check" : "간편 검사"
 }

+ 148 - 121
route/give_user_check.py

@@ -3,142 +3,169 @@ from .tool.func import *
 def give_user_check_2(conn, name):
     curs = conn.cursor()
 
-    curs.execute(db_change("select acl from user where id = ? or id = ?"), [name, flask.request.args.get('plus', '-')])
-    user = curs.fetchall()
-    if user and user[0][0] != 'user':
+    plus_id = flask.request.args.get('plus', None)
+
+    if admin_check('all', None, name) == 1 or (plus_id and admin_check('all', None, plus_id) == 1):
         if admin_check() != 1:
             return re_error('/error/4')
 
-    if admin_check(4, 'check (' + name + ')') != 1:
-        return re_error('/error/3')
-
     num = int(number_check(flask.request.args.get('num', '1')))
     sql_num = (num * 50 - 50) if num * 50 > 0 else 0
     
     div = ''
-    plus_id = flask.request.args.get('plus', None)
+    check_type = flask.request.args.get('type', '')
 
-    if ip_or_user(name) == 0:
-        curs.execute(db_change("select data from user_set where name = \"approval_question\" and id = ?"), [name])
-        approval_question = curs.fetchall()
-        if approval_question and approval_question[0][0]:
-            curs.execute(db_change("select data from user_set where name = \"approval_question_answer\" and id = ?"), [name])
-            approval_question_answer = curs.fetchall()
-            if approval_question_answer and approval_question_answer[0]:
-                div += '''
-                    <table id="main_table_set">
-                        <tbody>
-                            <tr>
-                                <td>Q</td>
-                                <td>''' + approval_question[0][0] + '''</td>
-                                <td>A</td>
-                                <td>''' + approval_question_answer[0][0] + '''</td>
-                            </tr>
-                        </tbody>
-                    </table>
-                    <hr class="main_hr">
-                '''
+    if admin_check(4, (check_type + ' ' if check_type != '' else '') + 'check (' + name + ')') != 1:
+        return re_error('/error/3')
 
-    if plus_id:
-        plus = "or " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ? "
-        set_list = [name, plus_id, sql_num]
-        
-        if num == 1:
-            curs.execute(db_change("" + \
-                "select distinct ip from ua_d " + \
-                "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? or " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ? "
-            ""), [name, plus_id])
-            all_ip_count = len(curs.fetchall())
-            
-            curs.execute(db_change("" + \
-                "select distinct ip from ua_d " + \
-                "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ?" + \
-            ""), [name])
-            a_ip_count = len(curs.fetchall())
-            
-            curs.execute(db_change("" + \
-                "select distinct ip from ua_d " + \
-                "where " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ? "
-            ""), [plus_id])
-            b_ip_count = len(curs.fetchall())
+    if check_type == '':
+        if ip_or_user(name) == 0:
+            curs.execute(db_change("select data from user_set where name = \"approval_question\" and id = ?"), [name])
+            approval_question = curs.fetchall()
+            if approval_question and approval_question[0][0]:
+                curs.execute(db_change("select data from user_set where name = \"approval_question_answer\" and id = ?"), [name])
+                approval_question_answer = curs.fetchall()
+                if approval_question_answer and approval_question_answer[0]:
+                    div += '''
+                        <table id="main_table_set">
+                            <tbody>
+                                <tr>
+                                    <td>Q</td>
+                                    <td>''' + approval_question[0][0] + '''</td>
+                                    <td>A</td>
+                                    <td>''' + approval_question_answer[0][0] + '''</td>
+                                </tr>
+                            </tbody>
+                        </table>
+                        <hr class="main_hr">
+                    '''
+
+        if plus_id:
+            plus = "or " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ? "
+            set_list = [name, plus_id, sql_num]
             
-            if a_ip_count + b_ip_count != all_ip_count:
-                div += load_lang('same_ip_exist') + '<hr class="main_hr">'    
-    else:
-        plus = ''
-        set_list = [name, sql_num]
-
-    curs.execute(db_change("" + \
-        "select name, ip, ua, today from ua_d " + \
-        "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? " + \
-        plus + \
-        "order by today desc limit ?, 50" + \
-    ""), set_list)
-
-    record = curs.fetchall()
-    if record:
-        if not plus_id:
-            div = '' + \
-                '<a href="/manager/14?plus=' + url_pas(name) + '">(' + load_lang('compare') + ')</a>' + \
-                '<hr class="main_hr">' + \
-            '' + div
+            if num == 1:
+                curs.execute(db_change("" + \
+                    "select distinct ip from ua_d " + \
+                    "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? or " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ? "
+                ""), [name, plus_id])
+                all_ip_count = len(curs.fetchall())
+                
+                curs.execute(db_change("" + \
+                    "select distinct ip from ua_d " + \
+                    "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ?" + \
+                ""), [name])
+                a_ip_count = len(curs.fetchall())
+                
+                curs.execute(db_change("" + \
+                    "select distinct ip from ua_d " + \
+                    "where " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ? "
+                ""), [plus_id])
+                b_ip_count = len(curs.fetchall())
+                
+                if a_ip_count + b_ip_count != all_ip_count:
+                    div += load_lang('same_ip_exist') + '<hr class="main_hr">'    
         else:
-            div = '' + \
-                '<a href="/check/' + url_pas(name) + '">(' + name + ')</a> ' + \
-                '<a href="/check/' + url_pas(plus_id) + '">(' + plus_id + ')</a>' + \
-                '<hr class="main_hr">' + \
-            '' + div
-
-        div += '''
-            <table id="main_table_set">
-                <tbody>
+            plus = ''
+            set_list = [name, sql_num]
+
+        curs.execute(db_change("" + \
+            "select name, ip, ua, today from ua_d " + \
+            "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? " + \
+            plus + \
+            "order by today desc limit ?, 50" + \
+        ""), set_list)
+
+        record = curs.fetchall()
+        if record:
+            if not plus_id:
+                div = '' + \
+                    '<a href="/manager/14?plus=' + url_pas(name) + '">(' + load_lang('compare') + ')</a> ' + \
+                    '<a href="/check/' + url_pas(name) + '?type=simple">(' + load_lang('simple_check') + ')</a>' + \
+                    '<hr class="main_hr">' + \
+                '' + div
+            else:
+                div = '' + \
+                    '<a href="/check/' + url_pas(name) + '">(' + name + ')</a> ' + \
+                    '<a href="/check/' + url_pas(plus_id) + '">(' + plus_id + ')</a>' + \
+                    '<hr class="main_hr">' + \
+                '' + div
+
+            div += '''
+                <table id="main_table_set">
+                    <tbody>
+                        <tr>
+                            <td id="main_table_width">''' + load_lang('name') + '''</td>
+                            <td id="main_table_width">''' + load_lang('ip') + '''</td>
+                            <td id="main_table_width">''' + load_lang('time') + '''</td>
+                        </tr>
+            '''
+
+            set_n = 0
+            for data in record:
+                if data[2]:
+                    if len(data[2]) > 300:
+                        ua = '' + \
+                            '<a href="javascript:void();" onclick="document.getElementById(\'check_' + str(set_n) + '\').style.display=\'block\';">(300+)</a>' + \
+                            '<div id="check_' + str(set_n) + '" style="display:none;">' + html.escape(data[2]) + '</div>' + \
+                        ''
+                        set_n += 1
+                    else:
+                        ua = html.escape(data[2])
+                else:
+                    ua = '<br>'
+
+                div += '''
                     <tr>
-                        <td id="main_table_width">''' + load_lang('name') + '''</td>
-                        <td id="main_table_width">''' + load_lang('ip') + '''</td>
-                        <td id="main_table_width">''' + load_lang('time') + '''</td>
+                        <td><a href="/check/''' + url_pas(data[0]) + '''">''' + data[0] + '''</a></td>
+                        <td><a href="/check/''' + url_pas(data[1]) + '''">''' + data[1] + '''</a></td>
+                        <td>''' + data[3] + '''</td>
                     </tr>
-        '''
-
-        set_n = 0
-        for data in record:
-            if data[2]:
-                if len(data[2]) > 300:
-                    ua = '' + \
-                        '<a href="javascript:void();" onclick="document.getElementById(\'check_' + str(set_n) + '\').style.display=\'block\';">(300+)</a>' + \
-                        '<div id="check_' + str(set_n) + '" style="display:none;">' + html.escape(data[2]) + '</div>' + \
-                    ''
-                    set_n += 1
-                else:
-                    ua = html.escape(data[2])
-            else:
-                ua = '<br>'
+                    <tr>
+                        <td colspan="3">''' + ua + '''</td>
+                    </tr>
+                '''
 
             div += '''
-                <tr>
-                    <td>''' + ip_pas(data[0]) + '''</td>
-                    <td>''' + ip_pas(data[1]) + '''</td>
-                    <td>''' + data[3] + '''</td>
-                </tr>
-                <tr>
-                    <td colspan="3">''' + ua + '''</td>
-                </tr>
+                    </tbody>
+                </table>
             '''
+        else:
+            return re_error('/error/2')
 
-        div += '''
-                </tbody>
-            </table>
-        '''
+        div += next_fix(
+            '/check/' + url_pas(name) + ('?plus=' + plus_id + '&num=' if plus_id else '?num='), 
+            num, 
+            record
+        )
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [load_lang('check'), wiki_set(), custom(), other2([0, 0])],
+            data = div,
+            menu = [['manager', load_lang('return')]]
+        ))
     else:
-        return re_error('/error/2')
-
-    div += next_fix(
-        '/check/' + url_pas(name) + ('?plus=' + plus_id if plus_id else '') + '&num=', 
-        num, 
-        record
-    )
-
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('check'), wiki_set(), custom(), other2([0, 0])],
-        data = div,
-        menu = [['manager', load_lang('return')]]
-    ))
+        curs.execute(db_change("" + \
+            "select distinct " + ('name' if ip_or_user(name) == 1 else 'ip') + " from ua_d " + \
+            "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? "
+            "order by today desc limit ?, 50" + \
+        ""), [name, sql_num])
+        record = curs.fetchall()
+
+        div = ''
+        for i in record:
+            div += '<li><a href="/check/' + url_pas(i[0]) + '?type=simple">' + i[0] + '</a></li>'
+
+        if div != '':
+            div = '<ul>' + div + '</ul>'
+            div += next_fix(
+                '/check/' + url_pas(name) + '?type=' + check_type + '&num=', 
+                num, 
+                record
+            )
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('simple_check') + ')', 0])],
+            data = div,
+            menu = [['check/' + url_pas(name), load_lang('return')]]
+        ))

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "master" : {
-        "r_ver" : "v3.2.0-master-01",
+        "r_ver" : "v3.2.0-master-02",
         "c_ver" : "3193200",
         "s_ver" : "9"
     }, "stable" : {