Explorar o código

dec에서 decu로 이동

Surplus_Up (2DU) %!s(int64=6) %!d(string=hai) anos
pai
achega
e4cc7fab43
Modificáronse 9 ficheiros con 88 adicións e 33 borrados
  1. 1 2
      app.py
  2. 1 1
      language/ko-KR.json
  3. 1 1
      route/func_upload.py
  4. 7 7
      route/give_acl.py
  5. 0 1
      route/give_user_ban.py
  6. 1 1
      route/list_acl.py
  7. 17 3
      route/tool/func.py
  8. 59 16
      route/view_read.py
  9. 1 1
      version.json

+ 1 - 2
app.py

@@ -118,7 +118,6 @@ if setup_tool == 0:
 
 if setup_tool != 0:
     create_data = {}
-
     create_data['all_data'] = [
         'data', 
         'cache_data', 
@@ -162,7 +161,7 @@ if setup_tool != 0:
     create_data['ua_d'] = ['name', 'ip', 'ua', 'today', 'sub']
     create_data['filter'] = ['name', 'regex', 'sub']
     create_data['scan'] = ['user', 'title']
-    create_data['acl'] = ['title', 'dec', 'dis', 'view', 'why']
+    create_data['acl'] = ['title', 'decu', 'dis', 'view', 'why']
     create_data['inter'] = ['title', 'link']
     create_data['html_filter'] = ['html', 'kind']
     create_data['oauth_conn'] = ['provider', 'wiki_id', 'sns_id', 'name', 'picture']

+ 1 - 1
language/ko-KR.json

@@ -104,7 +104,7 @@
     "owner_authority": "소유자 권한",
     "wiki_port": "위키 포트",
     "limitless": "무기한",
-    "normal": "보통",
+    "normal": "일반",
     "topic_open": "토론 열기",
     "reset_user_ok": "검사 성공",
     "in_progress": "진행중",

+ 1 - 1
route/func_upload.py

@@ -63,7 +63,7 @@ def func_upload_2(conn):
             data.save(os.path.join(app_var['path_data_image'], e_data))
         
         curs.execute("insert into data (title, data) values (?, ?)", ['file:' + name, '[[file:' + name + ']][br][br]{{{[[file:' + name + ']]}}}[br][br]' + lice])
-        curs.execute("insert into acl (title, dec, dis, why, view) values (?, 'admin', '', '', '')", ['file:' + name])
+        curs.execute("insert into acl (title, decu, dis, why, view) values (?, 'admin', '', '', '')", ['file:' + name])
 
         history_plus(
             'file:' + name, '[[file:' + name + ']][br][br]{{{[[file:' + name + ']]}}}[br][br]' + lice,

+ 7 - 7
route/give_acl.py

@@ -29,25 +29,25 @@ def give_acl_2(conn, name):
                 check_ok = 'disabled'
 
     if flask.request.method == 'POST':
-        dec = flask.request.form.get('dec', '')
+        decu = flask.request.form.get('decu', '')
         view = flask.request.form.get('view', '')
 
         curs.execute("select title from acl where title = ?", [name])
         if curs.fetchall():
-            curs.execute("update acl set dec = ? where title = ?", [dec, name])
+            curs.execute("update acl set decu = ? where title = ?", [decu, name])
             curs.execute("update acl set dis = ? where title = ?", [flask.request.form.get('dis', ''), name])
             curs.execute("update acl set why = ? where title = ?", [flask.request.form.get('why', ''), name])
             curs.execute("update acl set view = ? where title = ?", [view, name])
         else:
-            curs.execute("insert into acl (title, dec, dis, why, view) values (?, ?, ?, ?, ?)", [
+            curs.execute("insert into acl (title, decu, dis, why, view) values (?, ?, ?, ?, ?)", [
                 name, 
-                dec, 
+                decu, 
                 flask.request.form.get('dis', ''), 
                 flask.request.form.get('why', ''), 
                 view
             ])
         
-        curs.execute("select title from acl where title = ? and dec = '' and dis = '' and view = ''", [name])
+        curs.execute("select title from acl where title = ? and decu = '' and dis = '' and view = ''", [name])
         if curs.fetchall():
             curs.execute("delete from acl where title = ?", [name])
 
@@ -55,14 +55,14 @@ def give_acl_2(conn, name):
             
         return redirect('/acl/' + url_pas(name))            
     else:
-        data = '<h2>' + load_lang('document_acl') + '</h2><hr class=\"main_hr\"><select name="dec" ' + check_ok + '>'
+        data = '<h2>' + load_lang('document_acl') + '</h2><hr class=\"main_hr\"><select name="decu" ' + check_ok + '>'
     
         if re.search('^user:', name):
             acl_list = [['', 'normal'], ['user', 'member'], ['all', 'all']]
         else:
             acl_list = [['', 'normal'], ['user', 'member'], ['admin', 'admin'], ['50_edit', '50 edit'], ['email', 'email']]
         
-        curs.execute("select dec from acl where title = ?", [name])
+        curs.execute("select decu from acl where title = ?", [name])
         acl_data = curs.fetchall()
         for data_list in acl_list:
             if acl_data and acl_data[0][0] == data_list[0]:

+ 0 - 1
route/give_user_ban.py

@@ -106,7 +106,6 @@ def give_user_ban_2(conn, name):
             insert_data = ''
             for i in time_data:
                 insert_data += '<a href="javascript:insert_v(\'second\', \'' + i[0] + '\')">(' + i[1] + ')</a> '
-            # 언어 적용 필요
 
             data = name + '''
                 <script>function insert_v(name, data) { document.getElementById(name).value = data; }</script>''' + insert_data + '''                

+ 1 - 1
route/list_acl.py

@@ -13,7 +13,7 @@ def list_acl_2(conn):
                     <td id="main_table_width_quarter">''' + load_lang('view_acl') + '''</td>
     '''
     
-    curs.execute("select title, dec, dis, view, why from acl where dec != '' or dis != '' or view != '' order by title desc")
+    curs.execute("select title, decu, dis, view, why from acl where decu != '' or dis != '' or view != '' 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]):

+ 17 - 3
route/tool/func.py

@@ -41,6 +41,8 @@ for i in range(0, 2):
         from .mark import *
     except ImportError as e:
         if i == 0:
+            print(e)
+            print('----')
             if platform.system() == 'Linux':
                 ok = os.system('python3 -m pip install --user -r requirements.txt')
                 if ok == 0:
@@ -176,7 +178,19 @@ def captcha_get():
     return data
 
 def update():
-    pass
+    #v3.1.2
+    try:
+        curs.execute('select title, dec from acl where dec != ""')
+        db_data = curs.fetchall()
+        for i in db_data:
+            curs.execute("update acl set decu = ? where title = ?", [i[1], i[0]])
+
+        print('fix table acl column dec to decu')
+        print('----')
+    except:
+        pass
+
+    conn.commit()
 
 def pw_encode(data, data2 = '', type_d = ''):
     if type_d == '':
@@ -705,7 +719,7 @@ def acl_check(name, tool = ''):
             if admin_check(5) == 1:
                 return 0
 
-            curs.execute("select dec from acl where title = ?", ['user:' + acl_n[0]])
+            curs.execute("select decu from acl where title = ?", ['user:' + acl_n[0]])
             acl_data = curs.fetchall()
             if acl_data:
                 if acl_data[0][0] == 'all':
@@ -725,7 +739,7 @@ def acl_check(name, tool = ''):
         if re.search("^file:", name) and admin_check(None, 'file edit (' + name + ')') != 1:
             return 1
 
-        curs.execute("select dec from acl where title = ?", [name])
+        curs.execute("select decu from acl where title = ?", [name])
         acl_data = curs.fetchall()
         if acl_data:
             if acl_data[0][0] == 'user':

+ 59 - 16
route/view_read.py

@@ -6,6 +6,8 @@ def view_read_2(conn, name):
     sub = ''
     acl = ''
     div = ''
+    plus_d = ''
+    plus_t = []
 
     num = flask.request.args.get('num', None)
     if num:
@@ -79,21 +81,7 @@ def view_read_2(conn, name):
     else:
         else_data = None
 
-    m = re.search("^user:([^/]*)", name)
-    if m:
-        g = m.groups()
-        
-        curs.execute("select acl from user where id = ?", [g[0]])
-        test = curs.fetchall()
-        if test and test[0][0] != 'user':
-            acl = ' (' + load_lang('admin') + ')'
-        else:
-            if ban_check(g[0]) == 1:
-                sub += ' (' + load_lang('blocked') + ')'
-            else:
-                acl = ''
-
-    curs.execute("select dec from acl where title = ?", [name])
+    curs.execute("select decu from acl where title = ?", [name])
     data = curs.fetchall()
     if data:
         acl += ' (' + load_lang('acl') + ')'
@@ -198,8 +186,63 @@ def view_read_2(conn, name):
     
     div = adsense_code + '<div>' + div + '</div>'
 
+    # 이 부분 개선 필요
+    m = re.search("^user:([^/]*)", name)
+    if m:
+        g = m.groups()
+
+        plus_d = '''
+            <table>
+                <tbody>
+                    <tr>
+                        <td>''' + load_lang('authority') + '''</td>
+                        <td>{}</td>
+                    </tr>
+                    <tr>
+                        <td>''' + load_lang('state') + '''</td>
+                        <td>{}</td>
+                    </tr>
+                </tbody>
+            </table>
+        '''
+        
+        curs.execute("select acl from user where id = ?", [g[0]])
+        data = curs.fetchall()
+        if data:
+            if data[0][0] != 'user':
+                plus_t += [data[0][0]]
+            else:
+                plus_t += [load_lang('member')]
+        else:
+            plus_t += [load_lang('normal')]
+
+        if ban_check(g[0]) == 0:
+            plus_t += [load_lang('normal')]
+        else:
+            match = re.search("^([0-9]{1,3}\.[0-9]{1,3})", g[0])
+            if match:
+                match = match.groups()[0]
+            else:
+                match = '-'
+
+            curs.execute("select end, login, band from ban where block = ? or block = ?", [g[0], match])
+            block_data = curs.fetchall()
+            if block_data:
+                if block_data[0][0] != '':
+                    plus_t += [load_lang('period') + ' : ' + block_data[0][0]]
+                else:
+                    plus_t += [load_lang('limitless')]
+
+                if block_data[0][1] != '':
+                    plus_t += [load_lang('login_able')]
+
+                if block_data[0][2] == 'O':
+                    plus_t += [load_lang('band_blocked')]
+
+        plus_d = plus_d.format(plus_t[0], plus_t[1])
+
     return easy_minify(flask.render_template(skin_check(), 
         imp = [flask.request.args.get('show', name), wiki_set(), custom(), other2([sub + acl, r_date])],
-        data = div,
+        data = plus_d + div,
         menu = menu
     )), response_data

+ 1 - 1
version.json

@@ -1,7 +1,7 @@
 {
     "master" : {
         "r_ver" : "v3.1.2-master-14",
-        "c_ver" : "400001",
+        "c_ver" : "400002",
         "s_ver" : "2"
     }, "stable" : {
         "r_ver" : "v3.1.1-stable-04",