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

숫자 버그 수정, 많은 기능 분리

Surplus_UP (2DU) пре 7 година
родитељ
комит
9e03faff12
9 измењених фајлова са 271 додато и 229 уклоњено
  1. 23 225
      app.py
  2. 47 0
      route/acl_list.py
  3. 23 0
      route/admin_list.py
  4. 85 0
      route/admin_plus.py
  5. 17 0
      route/history_hidden.py
  6. 9 0
      route/image_view.py
  7. 1 1
      route/read_view.py
  8. 9 3
      route/tool/func.py
  9. 57 0
      route/user_log.py

+ 23 - 225
app.py

@@ -354,233 +354,31 @@ def not_close_topic():
 
 @app.route('/image/<name>')
 def image_view(name = None):
-    if os.path.exists(os.path.join('image', name)):
-        return flask.send_from_directory('./image', name)
-    else:
-        return redirect()
+    return image_view_2(conn, name)
 
 @app.route('/acl_list')
 def acl_list():
-    div =   '''
-            <table id="main_table_set">
-                <tbody>
-                    <tr>
-                        <td id="main_table_width_quarter">''' + load_lang('document_name') + '''</td>
-                        <td id="main_table_width_quarter">''' + load_lang('document') + ''' acl</td>
-                        <td id="main_table_width_quarter">''' + load_lang('discussion') + ''' acl</td>
-                        <td id="main_table_width_quarter">''' + load_lang('acl_required') + '''</td>
-            '''
-    
-    curs.execute("select title, dec, dis, view, why from acl where dec = 'admin' or dec = 'user' or dis = 'admin' or dis = 'user' or view = 'admin' or view = 'user' order by title desc")
-    list_data = curs.fetchall()
-    for data in list_data:
-        if not re.search('^user:', data[0]) and not re.search('^file:', data[0]):
-            acl = []
-            for i in range(1, 4):
-                if data[i] == 'admin':
-                    acl += [load_lang('admin')]
-                else:
-                    acl += [load_lang('member')]
-
-            div +=  '''
-                    <tr>
-                        <td>
-                            <a href="/w/''' + url_pas(data[0]) + '">' + data[0] + '''</a>
-                        </td>
-                        <td>''' + acl[0] + '''</td>
-                        <td>''' + acl[1] + '''</td>
-                        <td>''' + acl[2] + '''</td>
-                    </tr>
-                    '''
-        
-    div +=  '''
-                </tbody>
-            </table>
-            '''
-    
-    return easy_minify(flask.render_template(skin_check(), 
-        imp = [load_lang('acl_document_list'), wiki_set(), custom(), other2([0, 0])],
-        data = div,
-        menu = [['other', load_lang('return')]]
-    ))
+    return acl_list_2(conn)
 
 @app.route('/admin_plus/<name>', methods=['POST', 'GET'])
 def admin_plus(name = None):
-    if flask.request.method == 'POST':
-        if admin_check(None, 'admin_plus (' + name + ')') != 1:
-            return re_error('/error/3')
-
-        curs.execute("delete from alist where name = ?", [name])
-        
-        if flask.request.form.get('ban', 0) != 0:
-            curs.execute("insert into alist (name, acl) values (?, 'ban')", [name])
-
-        if flask.request.form.get('toron', 0) != 0:
-            curs.execute("insert into alist (name, acl) values (?, 'toron')", [name])
-            
-        if flask.request.form.get('check', 0) != 0:
-            curs.execute("insert into alist (name, acl) values (?, 'check')", [name])
-
-        if flask.request.form.get('acl', 0) != 0:
-            curs.execute("insert into alist (name, acl) values (?, 'acl')", [name])
-
-        if flask.request.form.get('hidel', 0) != 0:
-            curs.execute("insert into alist (name, acl) values (?, 'hidel')", [name])
-
-        if flask.request.form.get('give', 0) != 0:
-            curs.execute("insert into alist (name, acl) values (?, 'give')", [name])
-
-        if flask.request.form.get('owner', 0) != 0:
-            curs.execute("insert into alist (name, acl) values (?, 'owner')", [name])
-            
-        conn.commit()
-        
-        return redirect('/admin_plus/' + url_pas(name))
-    else:        
-        data = '<ul>'
-        
-        exist_list = ['', '', '', '', '', '', '', '']
-
-        curs.execute('select acl from alist where name = ?', [name])
-        acl_list = curs.fetchall()    
-        for go in acl_list:
-            if go[0] == 'ban':
-                exist_list[0] = 'checked="checked"'
-            elif go[0] == 'toron':
-                exist_list[2] = 'checked="checked"'
-            elif go[0] == 'check':
-                exist_list[3] = 'checked="checked"'
-            elif go[0] == 'acl':
-                exist_list[4] = 'checked="checked"'
-            elif go[0] == 'hidel':
-                exist_list[5] = 'checked="checked"'
-            elif go[0] == 'give':
-                exist_list[6] = 'checked="checked"'
-            elif go[0] == 'owner':
-                exist_list[7] = 'checked="checked"'
-
-        if admin_check() != 1:
-            state = 'disabled'
-        else:
-            state = ''
-
-        data += '''
-                    <li><input type="checkbox" ''' + state +  ' name="ban" ' + exist_list[0] + '> ' + load_lang('ban_authority') + '''</li>
-                    <li><input type="checkbox" ''' + state +  ' name="toron" ' + exist_list[2] + '> ' + load_lang('discussion_authority') + '''</li>
-                    <li><input type="checkbox" ''' + state +  ' name="check" ' + exist_list[3] + '> ' + load_lang('user_check_authority') + '''</li>
-                    <li><input type="checkbox" ''' + state +  ' name="acl" ' + exist_list[4] + '> ' + load_lang('document_acl_authority') + '''</li>
-                    <li><input type="checkbox" ''' + state +  ' name="hidel" ' + exist_list[5] + '> ' + load_lang('history_hide_authority') + '''</li>
-                    <li><input type="checkbox" ''' + state +  ' name="give" ' + exist_list[6] + '> ' + load_lang('authorization_authority') + '''</li>
-                    <li><input type="checkbox" ''' + state +  ' name="owner" ' + exist_list[7] + '> ' + load_lang('owner_authority') + '''</li>
-                </ul>
-                '''
-
-        return easy_minify(flask.render_template(skin_check(), 
-            imp = [load_lang('admin_group_add'), wiki_set(), custom(), other2([0, 0])],
-            data =  '''
-                    <form method="post">
-                        ''' + data + '''
-                        <hr class=\"main_hr\">
-                        <button id="save" ''' + state +  ''' type="submit">''' + load_lang('save') + '''</button>
-                    </form>
-                    ''',
-            menu = [['manager', load_lang('return')]]
-        ))        
+    return admin_plus_2(conn)
         
 @app.route('/admin_list')
 def admin_list():
-    div = '<ul>'
-    
-    curs.execute("select id, acl, date from user where not acl = 'user' order by date desc")
-    for data in curs.fetchall():
-        name = ip_pas(data[0]) + ' <a href="/admin_plus/' + url_pas(data[1]) + '">(' + data[1] + ')</a>'
-        
-        if data[2] != '':
-            name += '(' + data[2] + ')'
-
-        div += '<li>' + name + '</li>'
-        
-    div += '</ul>'
-                
-    return easy_minify(flask.render_template(skin_check(), 
-        imp = [load_lang('admin_list'), wiki_set(), custom(), other2([0, 0])],
-        data = div,
-        menu = [['other', load_lang('return')]]
-    ))
+    return admin_list_2(conn)
         
 @app.route('/hidden/<everything:name>')
 def history_hidden(name = None):
-    num = int(flask.request.args.get('num', 0))
-
-    if admin_check(6, 'history_hidden (' + name + '#' + str(num) + ')') == 1:
-        curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [name, str(num)])
-        if curs.fetchall():
-            curs.execute("update history set hide = '' where title = ? and id = ?", [name, str(num)])
-        else:
-            curs.execute("update history set hide = 'O' where title = ? and id = ?", [name, str(num)])
-            
-        conn.commit()
-    
-    return redirect('/history/' + url_pas(name))
+    return history_hidden_2(name)
         
 @app.route('/user_log')
 def user_log():
-    num = int(flask.request.args.get('num', 1))
-    if num * 50 > 0:
-        sql_num = num * 50 - 50
-    else:
-        sql_num = 0
-        
-    list_data = '<ul>'
-
-    admin_one = admin_check(1)
-    
-    curs.execute("select id, date from user order by date desc limit ?, '50'", [str(sql_num)])
-    user_list = curs.fetchall()
-    for data in user_list:
-        if admin_one == 1:
-            curs.execute("select block from ban where block = ?", [data[0]])
-            if curs.fetchall():
-                ban_button = ' <a href="/ban/' + url_pas(data[0]) + '">(' + load_lang('ban_release') + ')</a>'
-            else:
-                ban_button = ' <a href="/ban/' + url_pas(data[0]) + '">(' + load_lang('ban') + ')</a>'
-        else:
-            ban_button = ''
-            
-        list_data += '<li>' + ip_pas(data[0]) + ban_button
-        
-        if data[1] != '':
-            list_data += ' (' + data[1] + ')'
-
-        list_data += '</li>'
-
-    if num == 1:
-        curs.execute("select count(id) from user")
-        user_count = curs.fetchall()
-        if user_count:
-            count = user_count[0][0]
-        else:
-            count = 0
-
-        list_data +=    '''
-                        </ul>
-                        <hr class=\"main_hr\">
-                        <ul>
-                            <li>all : ''' + str(count) + '''</li>
-                        </ul>
-                        '''
-
-    list_data += next_fix('/user_log?num=', num, user_list)
-
-    return easy_minify(flask.render_template(skin_check(), 
-        imp = [load_lang('member_list'), wiki_set(), custom(), other2([0, 0])],
-        data = list_data,
-        menu = [['other', load_lang('return')]]
-    ))
+    return user_log_2(conn)
 
 @app.route('/admin_log')
 def admin_log():
-    num = int(flask.request.args.get('num', 1))
+    num = int(number_check(flask.request.args.get('num', '1')))
     if num * 50 > 0:
         sql_num = num * 50 - 50
     else:
@@ -624,7 +422,7 @@ def give_log():
 
 @app.route('/indexing', methods=['POST', 'GET'])
 def indexing():
-    if admin_check(None, None) != 1:
+    if admin_check() != 1:
         return re_error('/error/3')
 
     if flask.request.method == 'POST':
@@ -906,7 +704,7 @@ def adsense_settings():
         
 @app.route('/xref/<everything:name>')
 def xref(name = None):
-    num = int(flask.request.args.get('num', 1))
+    num = int(number_check(flask.request.args.get('num', '1')))
     if num * 50 > 0:
         sql_num = num * 50 - 50
     else:
@@ -939,7 +737,7 @@ def xref(name = None):
 
 @app.route('/please')
 def please():
-    num = int(flask.request.args.get('num', 1))
+    num = int(number_check(flask.request.args.get('num', '1')))
     if num * 50 > 0:
         sql_num = num * 50 - 50
     else:
@@ -1009,7 +807,7 @@ def recent_discuss():
 @app.route('/block_log')
 @app.route('/<regex("block_user|block_admin"):tool>/<name>')
 def block_log(name = None, tool = None):
-    num = int(flask.request.args.get('num', 1))
+    num = int(number_check(flask.request.args.get('num', '1')))
     if num * 50 > 0:
         sql_num = num * 50 - 50
     else:
@@ -1118,7 +916,7 @@ def deep_search(name = None):
     if name == '':
         return redirect()
 
-    num = int(flask.request.args.get('num', 1))
+    num = int(number_check(flask.request.args.get('num', '1')))
     if num * 50 > 0:
         sql_num = num * 50 - 50
     else:
@@ -1176,7 +974,7 @@ def raw_view(name = None, sub_title = None, num = None):
     if not num:
         num = flask.request.args.get('num', None)
         if num:
-            num = int(num)
+            num = int(number_check(num))
     
     if not sub_title and num:
         curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [name, str(num)])
@@ -1215,7 +1013,7 @@ def raw_view(name = None, sub_title = None, num = None):
         
 @app.route('/revert/<everything:name>', methods=['POST', 'GET'])
 def revert(name = None):    
-    num = int(flask.request.args.get('num', 0))
+    num = int(number_check(flask.request.args.get('num', '1')))
 
     curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [name, str(num)])
     if curs.fetchall() and admin_check(6) != 1:
@@ -1672,8 +1470,8 @@ def manager(num = 1):
         
 @app.route('/title_index')
 def title_index():
-    page = int(flask.request.args.get('page', 1))
-    num = int(flask.request.args.get('num', 100))
+    page = int(number_check(flask.request.args.get('page', '1')))
+    num = int(number_check(flask.request.args.get('num', '100')))
     if page * num > 0:
         sql_num = page * num - num
     else:
@@ -1741,7 +1539,7 @@ def title_index():
     ))
         
 @app.route('/topic/<everything:name>/sub/<sub>/b/<int:num>')
-def topic_block(name = None, sub = None, num = None):
+def topic_block(name = None, sub = None, num = 1):
     if admin_check(3, 'blind (' + name + ' - ' + sub + '#' + str(num) + ')') != 1:
         return re_error('/error/3')
 
@@ -1760,7 +1558,7 @@ def topic_block(name = None, sub = None, num = None):
     return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '#' + str(num))
         
 @app.route('/topic/<everything:name>/sub/<sub>/notice/<int:num>')
-def topic_top(name = None, sub = None, num = None):
+def topic_top(name = None, sub = None, num = 1):
     if admin_check(3, 'notice (' + name + ' - ' + sub + '#' + str(num) + ')') != 1:
         return re_error('/error/3')
 
@@ -1834,7 +1632,7 @@ def topic_stop(name = None, sub = None, tool = None):
     return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub))    
 
 @app.route('/topic/<everything:name>/sub/<sub>/admin/<int:num>')
-def topic_admin(name = None, sub = None, num = None):
+def topic_admin(name = None, sub = None, num = 1):
     curs.execute("select block, ip, date from topic where title = ? and sub = ? and id = ?", [name, sub, str(num)])
     data = curs.fetchall()
     if not data:
@@ -2605,7 +2403,7 @@ def user_check(name = None):
     if admin_check(4, 'check (' + name + ')') != 1:
         return re_error('/error/3')
         
-    num = int(flask.request.args.get('num', 1))
+    num = int(number_check(flask.request.args.get('num', '1')))
     if num * 50 > 0:
         sql_num = num * 50 - 50
     else:
@@ -3253,7 +3051,7 @@ def read_view(name = None):
 
 @app.route('/topic_record/<name>')
 def user_topic_list(name = None):
-    num = int(flask.request.args.get('num', 1))
+    num = int(number_check(flask.request.args.get('num', '1')))
     if num * 50 > 0:
         sql_num = num * 50 - 50
     else:
@@ -3324,7 +3122,7 @@ def recent_changes(name = None, tool = 'record'):
                 '''
         
         if name:
-            num = int(flask.request.args.get('num', 1))
+            num = int(number_check(flask.request.args.get('num', '1')))
             if num * 50 > 0:
                 sql_num = num * 50 - 50
             else:
@@ -3350,7 +3148,7 @@ def recent_changes(name = None, tool = 'record'):
                 
                 curs.execute("select id, title, date, ip, send, leng from history where ip = ? order by date desc limit ?, '50'", [name, str(sql_num)])
         else:
-            num = int(flask.request.args.get('num', 1))
+            num = int(number_check(flask.request.args.get('num', '1')))
             if num * 50 > 0:
                 sql_num = num * 50 - 50
             else:

+ 47 - 0
route/acl_list.py

@@ -0,0 +1,47 @@
+from .tool.func import *
+
+def acl_list_2(conn):
+    curs = conn.cursor()
+    
+    div =   '''
+        <table id="main_table_set">
+            <tbody>
+                <tr>
+                    <td id="main_table_width_quarter">''' + load_lang('document_name') + '''</td>
+                    <td id="main_table_width_quarter">''' + load_lang('document') + ''' acl</td>
+                    <td id="main_table_width_quarter">''' + load_lang('discussion') + ''' acl</td>
+                    <td id="main_table_width_quarter">''' + load_lang('acl_required') + '''</td>
+    '''
+    
+    curs.execute("select title, dec, dis, view, why from acl where dec = 'admin' or dec = 'user' or dis = 'admin' or dis = 'user' or view = 'admin' or view = 'user' order by title desc")
+    list_data = curs.fetchall()
+    for data in list_data:
+        if not re.search('^user:', data[0]) and not re.search('^file:', data[0]):
+            acl = []
+            for i in range(1, 4):
+                if data[i] == 'admin':
+                    acl += [load_lang('admin')]
+                else:
+                    acl += [load_lang('member')]
+
+            div +=  '''
+                <tr>
+                    <td>
+                        <a href="/w/''' + url_pas(data[0]) + '">' + data[0] + '''</a>
+                    </td>
+                    <td>''' + acl[0] + '''</td>
+                    <td>''' + acl[1] + '''</td>
+                    <td>''' + acl[2] + '''</td>
+                </tr>
+            '''
+        
+    div +=  '''
+            </tbody>
+        </table>
+    '''
+    
+    return easy_minify(flask.render_template(skin_check(), 
+        imp = [load_lang('acl_document_list'), wiki_set(), custom(), other2([0, 0])],
+        data = div,
+        menu = [['other', load_lang('return')]]
+    ))

+ 23 - 0
route/admin_list.py

@@ -0,0 +1,23 @@
+from .tool.func import *
+
+def admin_list_2(conn):
+    curs = conn.cursor()
+
+    div = '<ul>'
+    
+    curs.execute("select id, acl, date from user where not acl = 'user' order by date desc")
+    for data in curs.fetchall():
+        name = ip_pas(data[0]) + ' <a href="/admin_plus/' + url_pas(data[1]) + '">(' + data[1] + ')</a>'
+        
+        if data[2] != '':
+            name += '(' + data[2] + ')'
+
+        div += '<li>' + name + '</li>'
+        
+    div += '</ul>'
+                
+    return easy_minify(flask.render_template(skin_check(), 
+        imp = [load_lang('admin_list'), wiki_set(), custom(), other2([0, 0])],
+        data = div,
+        menu = [['other', load_lang('return')]]
+    ))

+ 85 - 0
route/admin_plus.py

@@ -0,0 +1,85 @@
+from .tool.func import *
+
+def admin_plus_2(conn):
+    curs = conn.cursor()
+    
+    if flask.request.method == 'POST':
+        if admin_check(None, 'admin_plus (' + name + ')') != 1:
+            return re_error('/error/3')
+
+        curs.execute("delete from alist where name = ?", [name])
+        
+        if flask.request.form.get('ban', 0) != 0:
+            curs.execute("insert into alist (name, acl) values (?, 'ban')", [name])
+
+        if flask.request.form.get('toron', 0) != 0:
+            curs.execute("insert into alist (name, acl) values (?, 'toron')", [name])
+            
+        if flask.request.form.get('check', 0) != 0:
+            curs.execute("insert into alist (name, acl) values (?, 'check')", [name])
+
+        if flask.request.form.get('acl', 0) != 0:
+            curs.execute("insert into alist (name, acl) values (?, 'acl')", [name])
+
+        if flask.request.form.get('hidel', 0) != 0:
+            curs.execute("insert into alist (name, acl) values (?, 'hidel')", [name])
+
+        if flask.request.form.get('give', 0) != 0:
+            curs.execute("insert into alist (name, acl) values (?, 'give')", [name])
+
+        if flask.request.form.get('owner', 0) != 0:
+            curs.execute("insert into alist (name, acl) values (?, 'owner')", [name])
+            
+        conn.commit()
+        
+        return redirect('/admin_plus/' + url_pas(name))
+    else:        
+        data = '<ul>'
+        
+        exist_list = ['', '', '', '', '', '', '', '']
+
+        curs.execute('select acl from alist where name = ?', [name])
+        acl_list = curs.fetchall()    
+        for go in acl_list:
+            if go[0] == 'ban':
+                exist_list[0] = 'checked="checked"'
+            elif go[0] == 'toron':
+                exist_list[2] = 'checked="checked"'
+            elif go[0] == 'check':
+                exist_list[3] = 'checked="checked"'
+            elif go[0] == 'acl':
+                exist_list[4] = 'checked="checked"'
+            elif go[0] == 'hidel':
+                exist_list[5] = 'checked="checked"'
+            elif go[0] == 'give':
+                exist_list[6] = 'checked="checked"'
+            elif go[0] == 'owner':
+                exist_list[7] = 'checked="checked"'
+
+        if admin_check() != 1:
+            state = 'disabled'
+        else:
+            state = ''
+
+        data += '''
+                    <li><input type="checkbox" ''' + state +  ' name="ban" ' + exist_list[0] + '> ' + load_lang('ban_authority') + '''</li>
+                    <li><input type="checkbox" ''' + state +  ' name="toron" ' + exist_list[2] + '> ' + load_lang('discussion_authority') + '''</li>
+                    <li><input type="checkbox" ''' + state +  ' name="check" ' + exist_list[3] + '> ' + load_lang('user_check_authority') + '''</li>
+                    <li><input type="checkbox" ''' + state +  ' name="acl" ' + exist_list[4] + '> ' + load_lang('document_acl_authority') + '''</li>
+                    <li><input type="checkbox" ''' + state +  ' name="hidel" ' + exist_list[5] + '> ' + load_lang('history_hide_authority') + '''</li>
+                    <li><input type="checkbox" ''' + state +  ' name="give" ' + exist_list[6] + '> ' + load_lang('authorization_authority') + '''</li>
+                    <li><input type="checkbox" ''' + state +  ' name="owner" ' + exist_list[7] + '> ' + load_lang('owner_authority') + '''</li>
+                </ul>
+                '''
+
+        return easy_minify(flask.render_template(skin_check(), 
+            imp = [load_lang('admin_group_add'), wiki_set(), custom(), other2([0, 0])],
+            data =  '''
+                    <form method="post">
+                        ''' + data + '''
+                        <hr class=\"main_hr\">
+                        <button id="save" ''' + state +  ''' type="submit">''' + load_lang('save') + '''</button>
+                    </form>
+                    ''',
+            menu = [['manager', load_lang('return')]]
+        ))     

+ 17 - 0
route/history_hidden.py

@@ -0,0 +1,17 @@
+from .tool.func import *
+
+def history_hidden_2(conn, name):
+    curs = conn.cursor()
+
+    num = number_check(flask.request.args.get('num', '1'))
+
+    if admin_check(6, 'history_hidden (' + name + '#' + num + ')') == 1:
+        curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [name, num])
+        if curs.fetchall():
+            curs.execute("update history set hide = '' where title = ? and id = ?", [name, num])
+        else:
+            curs.execute("update history set hide = 'O' where title = ? and id = ?", [name, num])
+            
+        conn.commit()
+    
+    return redirect('/history/' + url_pas(name))

+ 9 - 0
route/image_view.py

@@ -0,0 +1,9 @@
+from .tool.func import *
+
+def image_view_2(conn, name):
+    curs = conn.cursor()
+    
+    if os.path.exists(os.path.join('image', name)):
+        return flask.send_from_directory('./image', name)
+    else:
+        return redirect()

+ 1 - 1
route/read_view.py

@@ -10,7 +10,7 @@ def read_view_2(conn, name):
 
     num = flask.request.args.get('num', None)
     if num:
-        num = int(num)
+        num = int(number_check(num))
     else:
         if not flask.request.args.get('from', None):
             curs.execute("select title from back where link = ? and type = 'redirect'", [name])

+ 9 - 3
route/tool/func.py

@@ -527,7 +527,7 @@ def ip_pas(raw_ip):
             if data and data[0][0] != '':
                 ip = '<span style="font-size: 75%;">' + hashlib.md5(bytes(raw_ip, 'utf-8')).hexdigest() + '</span>'
 
-                if not admin_check('ban', None):
+                if not admin_check(1):
                     hide = 1
             else:
                 ip = raw_ip
@@ -637,7 +637,7 @@ def acl_check(name, tool = ''):
         if acl_c:
             acl_n = acl_c.groups()
 
-            if admin_check(5, None) == 1:
+            if admin_check(5) == 1:
                 return 0
 
             curs.execute("select dec from acl where title = ?", ['user:' + acl_n[0]])
@@ -689,7 +689,7 @@ def acl_check(name, tool = ''):
                 if not user_data:
                     return 1
 
-                if not admin_check(5, None) == 1:
+                if not admin_check(5) == 1:
                     return 1
 
         return 0
@@ -817,6 +817,12 @@ def leng_check(first, second):
         
     return all_plus
 
+def number_check(data):
+    if re.search('[^0-9]', data):
+        return '1'
+    else:
+        return data
+
 def edit_filter_do(data):
     if admin_check(1, 'edit_filter pass') != 1:
         curs.execute("select regex, sub from filter")

+ 57 - 0
route/user_log.py

@@ -0,0 +1,57 @@
+from .tool.func import *
+
+def user_log_2(conn):
+    curs = conn.cursor()
+
+    num = int(number_check(flask.request.args.get('num', '1')))
+    if num * 50 > 0:
+        sql_num = num * 50 - 50
+    else:
+        sql_num = 0
+        
+    list_data = '<ul>'
+
+    admin_one = admin_check(1)
+    
+    curs.execute("select id, date from user order by date desc limit ?, '50'", [str(sql_num)])
+    user_list = curs.fetchall()
+    for data in user_list:
+        if admin_one == 1:
+            curs.execute("select block from ban where block = ?", [data[0]])
+            if curs.fetchall():
+                ban_button = ' <a href="/ban/' + url_pas(data[0]) + '">(' + load_lang('ban_release') + ')</a>'
+            else:
+                ban_button = ' <a href="/ban/' + url_pas(data[0]) + '">(' + load_lang('ban') + ')</a>'
+        else:
+            ban_button = ''
+            
+        list_data += '<li>' + ip_pas(data[0]) + ban_button
+        
+        if data[1] != '':
+            list_data += ' (' + data[1] + ')'
+
+        list_data += '</li>'
+
+    if num == 1:
+        curs.execute("select count(id) from user")
+        user_count = curs.fetchall()
+        if user_count:
+            count = user_count[0][0]
+        else:
+            count = 0
+
+        list_data +=    '''
+            </ul>
+            <hr class=\"main_hr\">
+            <ul>
+                <li>all : ''' + str(count) + '''</li>
+            </ul>
+        '''
+
+    list_data += next_fix('/user_log?num=', num, user_list)
+
+    return easy_minify(flask.render_template(skin_check(), 
+        imp = [load_lang('member_list'), wiki_set(), custom(), other2([0, 0])],
+        data = list_data,
+        menu = [['other', load_lang('return')]]
+    ))