Просмотр исходного кода

Merge branch 'master' into stable

Surplus_Up (2DU) 8 лет назад
Родитель
Сommit
98250d5671
9 измененных файлов с 559 добавлено и 283 удалено
  1. 392 170
      app.py
  2. 0 41
      back_reset.py
  3. 0 15
      delete_recaptcha.py
  4. 63 0
      emergency_tool.py
  5. 37 4
      func.py
  6. 27 9
      language/en-US.json
  7. 10 0
      language/ko-KR.json
  8. 22 20
      set_mark/start.py
  9. 8 24
      views/acme/css/style-responsive.css

Разница между файлами не показана из-за своего большого размера
+ 392 - 170
app.py


+ 0 - 41
back_reset.py

@@ -1,41 +0,0 @@
-# 주요 모듈 불러옴
-import json
-import sqlite3
-import threading
-
-# 기타 코드 불러옴
-from func import *
-from mark import namumark
-
-# JSON 불러옴
-json_data = open('set.json').read()
-set_data = json.loads(json_data)
-
-# 디비 연결
-conn = sqlite3.connect(set_data['db'] + '.db', check_same_thread = False)
-curs = conn.cursor()
-
-# 파싱 해주는 함수
-def parser(data):
-    namumark(conn, data[0], data[1], 1)
-
-# 역링크 전부 삭제
-curs.execute("delete from back")
-conn.commit()
-
-# 데이터에서 제목이랑 내용 불러옴
-curs.execute("select title, data from data")
-data = curs.fetchall()
-
-# for 돌려서 처리
-for test in data:
-    # 제목 프린트
-    print(test[0])
-
-    # 스레드 기반으로 처리
-    t = threading.Thread(target = parser, args = [test])
-    t.start()
-    t.join()
-
-# 커밋
-conn.commit()

+ 0 - 15
delete_recaptcha.py

@@ -1,15 +0,0 @@
-import json
-import sqlite3
-
-# JSON 연결
-json_data = open('set.json').read()
-set_data = json.loads(json_data)
-
-# 디비 연결
-conn = sqlite3.connect(set_data['db'] + '.db', check_same_thread = False)
-curs = conn.cursor()
-
-# 데이터 삭제
-curs.execute("delete from other where name = 'recaptcha'")
-curs.execute("delete from other where name = 'sec_re'")
-conn.commit()

+ 63 - 0
emergency_tool.py

@@ -0,0 +1,63 @@
+# 주요 모듈 불러옴
+import json
+import sqlite3
+import threading
+
+# 기타 코드 불러옴
+from func import *
+from mark import namumark
+
+# JSON 불러옴
+json_data = open('set.json').read()
+set_data = json.loads(json_data)
+
+# 디비 연결
+conn = sqlite3.connect(set_data['db'] + '.db', check_same_thread = False)
+curs = conn.cursor()
+
+print('1. BackLink ReSet')
+print('2. ReCaptcha Delete')
+print('3. Ban Delete')
+print('')
+
+print('select : ', end = '')
+what_i_do = input()
+
+if what_i_do == '1':
+    # 파싱 해주는 함수
+    def parser(data):
+        namumark(conn, data[0], data[1], 1)
+
+    # 역링크 전부 삭제
+    curs.execute("delete from back")
+    conn.commit()
+
+    # 데이터에서 제목이랑 내용 불러옴
+    curs.execute("select title, data from data")
+    data = curs.fetchall()
+
+    # for 돌려서 처리
+    for test in data:
+        # 스레드 기반으로 처리
+        t = threading.Thread(target = parser, args = [test])
+        t.start()
+        t.join()
+elif what_i_do == '2':
+    # 데이터 삭제
+    curs.execute("delete from other where name = 'recaptcha'")
+    curs.execute("delete from other where name = 'sec_re'")
+elif what_i_do == '3':
+    print('IP or User_Name : ', end = '')
+    user_data = input()
+
+    if re.search("^([0-9]{1,3}\.[0-9]{1,3})$", user_data):
+        band = 'O'
+    else:
+        band = ''
+
+    # 데이터 삭제
+    curs.execute("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)", [user_data, '해제', get_time(), 'localhost', '', band])
+    curs.execute("delete from ban where block = ?", [user_data])
+
+# 커밋
+conn.commit()

+ 37 - 4
func.py

@@ -21,6 +21,10 @@ from set_mark.tool import sha224
 # 나무마크 불러옴
 from mark import *
 
+# 서브 언어팩 불러옴
+json_data = open(os.path.join('language', 'en-US.json'), 'rt', encoding='utf-8').read()
+else_lang = json.loads(json_data)
+
 def captcha_get(conn):
     curs = conn.cursor()
 
@@ -61,6 +65,35 @@ def captcha_post(test, conn, num = 1):
     else:
         pass
 
+def load_lang(lang, data):
+    if data in lang:
+        return lang[data]
+    else:
+        return else_lang[data]
+
+def edit_help_button():
+    # https://stackoverflow.com/questions/11076975/insert-text-into-textarea-at-cursor-position-javascript
+    '''<script>
+                function insertAtCursor(myField, myValue) {
+                    if (document.selection) { 
+                        document.getElementById(myField).focus();
+                        sel = document.selection.createRange(); 
+                        sel.text = myValue; 
+                    } else if (document.getElementById(myField).selectionStart || document.getElementById(myField).selectionStart == '0') { 
+                        var startPos = document.getElementById(myField).selectionStart; 
+                        var endPos = document.getElementById(myField).selectionEnd; 
+                        document.getElementById(myField).value = document.getElementById(myField).value.substring(0, startPos) + myValue + document.getElementById(myField).value.substring(endPos, document.getElementById(myField).value.length); 
+                    } else { 
+                        document.getElementById(myField).value += myValue;
+                    }
+                }
+            </script>
+        '''
+
+    '<a href="javascript:void(0);" onclick="insertAtCursor(\'content\', \'[[]]\');">(링크)</a> <a href="javascript:void(0);" onclick="insertAtCursor(\'content\', \'[macro()]\');">(매크로)</a> <a href="javascript:void(0);" onclick="insertAtCursor(\'content\', \'{{{#! }}}\');">(중괄호)</a><hr>'
+
+    return ['', '']
+
 def ip_warring(conn):
     curs = conn.cursor()
 
@@ -364,11 +397,11 @@ def ban_check(conn):
 
     band = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
     if band:
-        band_it = band.groups()
+        band_it = band.groups()[0]
     else:
-        band_it = ['Not']
+        band_it = 'Not'
         
-    curs.execute("select block from ban where block = ? and band = 'O'", [band_it[0]])
+    curs.execute("select block from ban where block = ?", [band_it])
     band_d = curs.fetchall()
     
     curs.execute("select block from ban where block = ?", [ip])
@@ -484,7 +517,7 @@ def re_error(conn, data):
             if not end_data:
                 match = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
                 if match:
-                    curs.execute("select end, why from ban where block = ? and band = 'O'", [m.groups()[0]])
+                    curs.execute("select end, why from ban where block = ?", [match.groups()[0]])
                     end_data = curs.fetchall()
             
             if end_data:

+ 27 - 9
language/en-US.json

@@ -2,8 +2,8 @@
     "edit" : "Edit",
     "history" : "History",
     "delete" : "Delete",
-    "bulk_delete" : "Bulk delete",
-    "edit_filter" : "Edit filtering",
+    "bulk_delete" : "Bulk Delete",
+    "edit_filter" : "Edit Filtering",
     "move" : "Move",
     "hide" : "Hide",
     "list" : "List",
@@ -17,21 +17,39 @@
     "other" : "Others",
     "tool" : "Tools",
     "plus" : "Add",
+    "open" : "Open",
+    "search" : "Search",
+    "need" : "Needful",
+    "upload" : "File Upload",
+    "record" : "Record",
+    "name" : "Name",
+    "license" : "License",
+    "interwiki" : "Inter Wiki",
+    "update" : "Update",
+    "setting" : "Setting",
+    "create" : "Create",
+    "editor" : "Editor",
+    "hour" : "Hour",
+    "time" : "Time",
+    "backlink" : "Back Link",
+    "why" : "Why",
+    "authority" : "Authority",
+    
     "user" : "User",
     "alarm" : "Alarm",
-    "watchlist" : "Watching list",
-    "my_info" : "About me",
+    "watchlist" : "Watching List",
+    "my_info" : "About Me",
+    
     "recent" : "Recently",
-    "recent_changes" : "Recently editted",
+    "recent_changes" : "Recent Changes",
+    
     "discussion" : "Discussions",
+
     "login" : "Login",
     "logout" : "Logout",
     "register" : "Register",
     "no_alarm" : "There is no alram available",
-    "able" : "Able to",
-    "year" : "Year",
-    "month" : "Month",
-    "day" : "Day",
+
     "normal" : "Normal",
     "subscriber" : "User",
     "admin" : "Admin",

+ 10 - 0
language/ko-KR.json

@@ -17,26 +17,36 @@
     "other" : "기타",
     "tool" : "도구",
     "plus" : "추가",
+    "open" : "열린",
+    "search" : "검색",
+
     "user" : "사용자",
     "alarm" : "알림",
     "watchlist" : "주시 문서",
     "my_info" : "내 정보",
+    
     "recent" : "최근",
     "recent_changes" : "최근 변경",
+    
     "discussion" : "토론",
+    
     "login" : "로그인",
     "logout" : "로그아웃",
     "register" : "회원가입",
     "no_alarm" : "알림이 없습니다.",
+    
     "able" : "가능",
+    
     "year" : "년",
     "month" : "월",
     "day" : "일",
+    
     "normal" : "일반",
     "subscriber" : "가입자",
     "admin" : "관리자",
     "owner" : "소유자",
     "admin_group" : "관리 그룹",
+
     "user_css_warring" : "비 로그인의 경우에는 사용자 CSS가 로그인하거나 브라우저 닫으면 날아갑니다.",
     "http_warring" : "주의 : 만약 HTTPS 연결이 아닌 경우 데이터가 유출될 가능성이 있습니다. 이에 대해 책임지지 않습니다."
 }

+ 22 - 20
set_mark/start.py

@@ -184,23 +184,25 @@ def start(conn, data, title):
     # 초기 설정
     data = '\n' + data + '\n'
     backlink = []
-    plus_data = '''<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
-                    <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
-                    <script>
-                        hljs.initHighlightingOnLoad(); 
-                        function folding(num) { 
-                            var fol = document.getElementById('folding_' + num); 
-                            if(fol.style.display == 'inline-block' || fol.style.display == 'block') { 
-                                fol.style.display = 'none';
-                            } else {
-                                if(num % 2 == 0) { 
-                                    fol.style.display = 'block'; 
-                                } else { 
-                                    fol.style.display = 'inline-block'; 
-                                } 
+    plus_data = '''
+                <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
+                <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
+                <script>
+                    hljs.initHighlightingOnLoad(); 
+                    function folding(num) { 
+                        var fol = document.getElementById('folding_' + num); 
+                        if(fol.style.display == 'inline-block' || fol.style.display == 'block') { 
+                            fol.style.display = 'none';
+                        } else {
+                            if(num % 2 == 0) { 
+                                fol.style.display = 'block'; 
+                            } else { 
+                                fol.style.display = 'inline-block'; 
                             } 
-                        }
-                    </script>'''
+                        } 
+                    }
+                </script>
+                '''
     end_data= []
     
     # XSS 이스케이프
@@ -400,7 +402,7 @@ def start(conn, data, title):
                                                             else:
                                                                 folding_data = ['Test']
                                                             
-                                                            data = re.sub('{{{#!folding ?((?:(?!\n).)*)\n?', '<div>' + str(folding_data[0]) + ' <div style="display: inline-block;"><a href="javascript:void(0);" onclick="folding(' + str(fol_num) + ');">[작동]</a></div_end><div id="folding_' + str(fol_num) + '" style="display: none;">', data, 1)
+                                                            data = re.sub('{{{#!folding ?((?:(?!\n).)*)\n?', '<div>' + str(folding_data[0]) + ' <div style="display: inline-block;"><a href="javascript:void(0);" onclick="folding(' + str(fol_num) + ');">[작동]</a></div_end><div id="folding_' + str(fol_num) + '" style="display: none;"><div id="wiki_div" style="">', data, 1)
                                                             
                                                             fol_num += 1
                                                         else:
@@ -429,7 +431,7 @@ def start(conn, data, title):
                             middle_number -= 1
                             
                         if middle_list[middle_number] == '2div':
-                            data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</div_end></div_end>', data, 1)
+                            data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</div_end></div_end></div_end>', data, 1)
                         elif middle_list[middle_number] == 'pre':
                             data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</code></pre>', data, 1)
                         else:
@@ -471,7 +473,7 @@ def start(conn, data, title):
            
     # 이중 표 처리
     while 1:
-        wiki_table_data = re.search('<div id="wiki_div" ((?:(?!>).)+)>((?:(?!<div id="wiki_div"|<\/div>).\n*)+)<\/div>', data)
+        wiki_table_data = re.search('<div id="wiki_div" ((?:(?!>).)+)>((?:(?!<div id="wiki_div"|<\/div_end>).\n*)+)<\/div_end>', data)
         if wiki_table_data:
             wiki_table_data = wiki_table_data.groups()
             if re.search('\|\|', wiki_table_data[1]):
@@ -479,7 +481,7 @@ def start(conn, data, title):
             else:
                 end_parser = wiki_table_data[1]
 
-            data = re.sub('<div id="wiki_div" ((?:(?!>).)+)>((?:(?!<div id="wiki_div"|<\/div>).\n*)+)<\/div>', '<div ' + wiki_table_data[0] + '>' + end_parser + '</div_end>', data, 1)
+            data = re.sub('<div id="wiki_div" ((?:(?!>).)+)>((?:(?!<div id="wiki_div"|<\/div_end>).\n*)+)<\/div_end>', '<div ' + wiki_table_data[0] + '>' + end_parser + '</div_end>', data, 1)
         else:
             break
             

+ 8 - 24
views/acme/css/style-responsive.css

@@ -373,11 +373,13 @@ td {
 }
 
 s, strike, del {
-    color:gray;
+    color: gray;
 }
 
 s:hover, strike:hover, del:hover {
-    color:#666;background-color:#eee;text-decoration:none;
+    color: #666;
+    background-color: #eee;
+    text-decoration: none;
 }
 
 .scroll-buttons a:link, .scroll-buttons a:visited {
@@ -459,22 +461,12 @@ div.scroll-buttons a {
     background-color: #f3c2c2;
 }
 
-#toron_color {
-    background-color: #d5d5d5;
+#toron_color_blue {
+    background: #c1ebff;
 }
 
-.popup {
-    position: fixed;
-    padding: 10px;
-    background: #f5f5f5;
-    width: 100%;
-    bottom: 0px;
-    left: 0px;
-    text-align: center;
-    box-shadow: 0 -1px 8px 0 rgba(0,0,0,0.35);
-    z-index: 100000;
-    max-height: 30%;
-    overflow-y: scroll;
+#toron_color {
+    background-color: #d5d5d5;
 }
 
 @media (max-width: 768px) {
@@ -503,10 +495,6 @@ textarea {
     font-family: FontAwesome;
 }
 
-#open {
-    color: yellow;
-}
-
 h1, h2, h3, h4, h5, h6 {
     margin-bottom: 10px;
     margin-top: 10px;
@@ -519,10 +507,6 @@ h1, h2, h3, h4, h5, h6 {
     font-size: 28px;
 }
 
-#toron_color_blue {
-    background: #c1ebff;
-}
-
 footer#footer {
     bottom: 0;
     position: relative;

Некоторые файлы не были показаны из-за большого количества измененных файлов