Pārlūkot izejas kodu

Merge pull request #307 from 2DU/beta

Beta
ect (or 2du) 8 gadi atpakaļ
vecāks
revīzija
50e6bf6542
8 mainītis faili ar 138 papildinājumiem un 118 dzēšanām
  1. 67 76
      app.py
  2. 16 15
      func.py
  3. 9 5
      set_mark/indent.py
  4. 3 3
      set_mark/link.py
  5. 11 11
      set_mark/mid_pas.py
  6. 30 6
      set_mark/table.py
  7. 1 1
      version.md
  8. 1 1
      views/acme/css/bootstrap-reset.css

+ 67 - 76
app.py

@@ -7,20 +7,16 @@ import threading
 import logging
 logging.basicConfig(level = logging.ERROR)
 
-session_opts = {
-    'session.type': 'dbm',
-    'session.data_dir': './app_session/',
-    'session.auto': 1
-}
-
+session_opts = { 'session.type' : 'dbm', 'session.data_dir' : './app_session/', 'session.auto' : 1 }
 app = beaker.middleware.SessionMiddleware(app(), session_opts)
 BaseRequest.MEMFILE_MAX = 1000 ** 4
-r_ver = '2.5.1'
+r_ver = '2.5.2'
 
 from func import *
 from set_mark.mid_pas import mid_pas
 from set_mark.macro import savemark
 
+# set.json 설정 확인
 try:
     json_data = open('set.json').read()
     set_data = json.loads(json_data)
@@ -46,12 +42,14 @@ except:
             print('모든 값을 입력하세요.')
             pass
 
+# 디비 연결
 conn = sqlite3.connect(set_data['db'] + '.db')
 curs = conn.cursor()
 
 # 스킨 불러오기 부분
 TEMPLATE_PATH.insert(0, skin_check(conn))
 
+# 호환성 설정
 try:
     try:
         plus_all_data = ''
@@ -126,6 +124,7 @@ if(not os.path.exists('image')):
 if(not os.path.exists('views')):
     os.makedirs('views')
 
+# 백업 설정
 def back_up():
     try:
         shutil.copyfile(set_data['db'] + '.db', 'back_' + set_data['db'] + '.db')
@@ -142,6 +141,7 @@ try:
 except:
     back_time = 0
     
+# 백업 여부 확인
 if(back_time != 0):
     print(str(back_time) + '시간 간격으로 백업')
 
@@ -649,9 +649,9 @@ def user_log(num = 1):
         else:
             count = 0
 
-        list_data += '<hr><li>이 위키에는 ' + str(count) + '명의 사람이 있습니다.</li>'
-        
-    list_data += '</ul><hr><a href="/user_log/' + str(num - 1) + '">(이전)</a> <a href="/user_log/' + str(num + 1) + '">(이후)</a>'
+        list_data += '</ul><hr><ul><li>이 위키에는 ' + str(count) + '명의 사람이 있습니다.</li></ul>'
+
+    list_data += next_fix('/user_log/', num, user_list)
 
     return(html_minify(template('index', 
         imp = ['사용자 가입 기록', wiki_set(conn, 1), custom(conn), other2([0, 0])],
@@ -675,27 +675,21 @@ def user_log(num = 1):
         ip = ip_pas(conn, data[0])
         list_data += '<li>' + ip + ' / ' + data[1] + ' / ' + data[2] + '</li>'
 
-    list_data += '</ul><hr><span>주의 : 권한 사용 안하고 열람만 해도 기록되는 경우도 있습니다.</span><hr>'
-    list_data += '<a href="/admin_log/' + str(num - 1) + '">(이전)</a> <a href="/admin_log/' + str(num + 1) + '">(이후)</a>'
+    list_data += '</ul><hr><ul><li>주의 : 권한 사용 안하고 열람만 해도 기록되는 경우도 있습니다.</li></ul>'
+    list_data += next_fix('/admin_log/', num, get_list)
 
     return(html_minify(template('index', 
-        imp = ['관리자 권한 기록', wiki_set(conn, 1), custom(conn), other2([0, 0])],
+        imp = ['권한 사용 기록', wiki_set(conn, 1), custom(conn), other2([0, 0])],
         data = list_data,
         menu = [['other', '기타']]
     )))
 
 @route('/give_log')
-@route('/give_log/<num:int>')
-def give_log(num = 1):
-    if(num * 50 > 0):
-        sql_num = num * 50 - 50
-    else:
-        sql_num = 0
-        
+def give_log():        
     list_data = '<ul>'
     back = ''
 
-    curs.execute("select distinct name from alist order by name asc limit ?, '50'", [str(sql_num)])
+    curs.execute("select distinct name from alist order by name asc")
     get_list = curs.fetchall()
     for data in get_list:                      
         if(back != data[0]):
@@ -704,7 +698,6 @@ def give_log(num = 1):
         list_data += '<li><a href="/admin_plus/' + url_pas(data[0]) + '">' + data[0] + '</a></li>'
     
     list_data += '</ul><hr><a href="/manager/8">(생성)</a>'
-    list_data += '<hr><a href="/give_log/' + str(num - 1) + '">(이전)</a> <a href="/give_log/' + str(num + 1) + '">(이후)</a>'
 
     return(html_minify(template('index', 
         imp = ['권한 목록', wiki_set(conn, 1), custom(conn), other2([0, 0])],
@@ -745,7 +738,8 @@ def xref(name = None, num = 1):
     div = '<ul>'
     
     curs.execute("select link, type from back where title = ? and not type = 'cat' and not type = 'no' order by link asc limit ?, '50'", [name, str(sql_num)])
-    for data in curs.fetchall():
+    data_list = curs.fetchall()
+    for data in data_list:
         div += '<li><a href="/w/' + url_pas(data[0]) + '">' + data[0] + '</a>'
         
         if(data[1]):
@@ -763,7 +757,7 @@ def xref(name = None, num = 1):
         if(re.search('^틀:', data[0])):
             div += '<li><a id="inside" href="/xref/' + url_pas(data[0]) + '">' + data[0] + '</a> (역링크)</li>'
       
-    div += '</ul><hr><a href="/xref/' + url_pas(name) + '/num/' + str(num - 1) + '">(이전)</a> <a href="/xref/' + url_pas(name) + '/num/' + str(num + 1) + '">(이후)</a>'
+    div += '</ul>' + next_fix('/xref/' + url_pas(name) + '/num/', num, data_list)
     
     return(html_minify(template('index', 
         imp = [name, wiki_set(conn, 1), custom(conn), other2([' (역링크)', 0])],
@@ -783,12 +777,13 @@ def please(num = 1):
     var = ''
     
     curs.execute("select distinct title from back where type = 'no' order by title asc limit ?, '50'", [str(sql_num)])
-    for data in curs.fetchall():
+    data_list = curs.fetchall()
+    for data in data_list:
         if(var != data[0]):
             div += '<li><a class="not_thing" href="/w/' + url_pas(data[0]) + '">' + data[0] + '</a></li>'        
             var = data[0]
         
-    div += '</ul><hr><a href="/please/' + str(num - 1) + '">(이전)</a> <a href="/please/' + str(num + 1) + '">(이후)</a>'
+    div += '</ul>' + next_fix('/please/', num, data_list)
     
     return(html_minify(template('index', 
         imp = ['필요한 문서', wiki_set(conn, 1), custom(conn), other2([0, 0])],
@@ -841,7 +836,8 @@ def recent_discuss(tools = 'normal'):
 
 @route('/block_log')
 @route('/block_log/<num:int>')
-@route('/block_log/<num:int>/<tool2:re:ip|user|never_end|can_end|end>')
+@route('/block_log/<tool2:re:ip|user|never_end|can_end|end>')
+@route('/block_log/<tool2:re:ip|user|never_end|can_end|end>/<num:int>')
 @route('/<tool:re:block_user|block_admin>/<name:path>')
 @route('/<tool:re:block_user|block_admin>/<name:path>/<num:int>')
 def block_log(num = 1, name = None, tool = None, tool2 = None):
@@ -854,7 +850,7 @@ def block_log(num = 1, name = None, tool = None, tool2 = None):
     
     if(not name):
         if(not tool2):
-            div = '<a href="/manager/11">(차단자 검색)</a> <a href="/manager/12">(관리자 검색)</a><hr><a href="/block_log/1/ip">(아이피)</a> <a href="/block_log/1/user">(가입자)</a> <a href="/block_log/1/never_end">(영구)</a> <a href="/block_log/1/can_end">(기간)</a> <a href="/block_log/1/end">(해제)</a><hr>' + div
+            div = '<a href="/manager/11">(차단자)</a> <a href="/manager/12">(관리자)</a><hr><a href="/block_log/ip">(아이피)</a> <a href="/block_log/user">(가입자)</a> <a href="/block_log/never_end">(영구)</a> <a href="/block_log/can_end">(기간)</a> <a href="/block_log/end">(해제)</a><hr>' + div
             sub = 0
             menu = [['other', '기타']]
 
@@ -881,7 +877,7 @@ def block_log(num = 1, name = None, tool = None, tool2 = None):
             else:
                 sub = '(기간)'
 
-                curs.execute("select why, block, blocker, end, today from rb where end like ? order by today desc limit ?, '50'", ['%:%', str(sql_num)])
+                curs.execute("select why, block, blocker, end, today from rb where end like ? order by today desc limit ?, '50'", ['%-%', str(sql_num)])
     else:
         menu = [['block_log', '일반']]
 
@@ -894,7 +890,9 @@ def block_log(num = 1, name = None, tool = None, tool2 = None):
 
             curs.execute("select why, block, blocker, end, today from rb where blocker = ? order by today desc limit ?, '50'", [name, str(sql_num)])
 
-    for data in curs.fetchall():
+    data_list = curs.fetchall()
+
+    for data in data_list:
         why = html.escape(data[0])
 
         if(why == ''):
@@ -914,8 +912,15 @@ def block_log(num = 1, name = None, tool = None, tool2 = None):
         div += '<tr><td>' + ip + '</td><td>' + ip_pas(conn, data[2]) + '</td><td>시작 : ' + data[4] + '<br>끝 : ' + end + '</td></tr>'
         div += '<tr><td colspan="3">' + why + '</td></tr>'
 
-    div += '</tbody></table><hr>'
-    div += '<a href="/block_log/' + str(num - 1) + '">(이전)</a> <a href="/block_log/' + str(num + 1) + '">(이후)</a>'
+    div += '</tbody></table>'
+
+    if(not name):
+        if(not tool2):
+            div += next_fix('/block_log/', num, data_list)
+        else:
+            div += next_fix('/block_log/' + url_pas(tool2) + '/', num, data_list)
+    else:
+        div += next_fix('/' + url_pas(tool) + '/' + url_pas(name) + '/', num, data_list)
                 
     return(html_minify(template('index', 
         imp = ['차단 기록', wiki_set(conn, 1), custom(conn), other2([sub, 0])],
@@ -947,18 +952,16 @@ def deep_search(name = None, num = 1):
     div = '<ul>'
     div_plus = ''
     no = 0
-
-    curs.execute("select distinct title from data where title like ? or data like ? order by case when title like ? then 1 else 2 end limit ?, '50'", ['%' + name + '%', '%' + name + '%', '%' + name + '%', str(sql_num)])
-    all_list = curs.fetchall()
+    start = 2
 
     curs.execute("select title from data where title = ?", [name])
-    exist = curs.fetchall()
-    if(exist):
+    if(curs.fetchall()):
         div = '<ul><li>문서로 <a href="/w/' + url_pas(name) + '">바로가기</a></li><hr>'
     else:
         div = '<ul><li>문서가 없습니다. <a class="not_thing" href="/w/' + url_pas(name) + '">바로가기</a></li><hr>'
-    
-    start = 2
+
+    curs.execute("select distinct title from data where title like ? or data like ? order by case when title like ? then 1 else 2 end limit ?, '50'", ['%' + name + '%', '%' + name + '%', '%' + name + '%', str(sql_num)])
+    all_list = curs.fetchall()
     if(all_list):
         for data in all_list:
             try:
@@ -984,8 +987,8 @@ def deep_search(name = None, num = 1):
     else:
         div += '<li>검색 결과 없음</li>'
 
-    div += div_plus
-    div += '</ul><hr><a href="/search/' + url_pas(name) + '/' + str(num - 1) + '">(이전)</a> <a href="/search/' + url_pas(name) + '/' + str(num + 1) + '">(이후)</a>'
+    div += div_plus + '</ul>'
+    div += next_fix('/search/' + url_pas(name) + '/', num, all_list)
     
     return(html_minify(template('index', 
         imp = [name, wiki_set(conn, 1), custom(conn), other2([' (검색)', 0])],
@@ -1268,7 +1271,6 @@ def edit(name = None, name2 = None, num = None):
             for data_list in data:
                 match = re.compile(data_list[0])
                 if(match.search(request.forms.content)):
-                    print(data_list[1])
                     if(data_list[1] == 'X'):
                         rb_plus(conn, ip, '', get_time(), '도구:편집 필터', '편집 필터에 의한 차단')
                         curs.execute("insert into ban (block, end, why, band) values (?, '', ?, '')", [ip, '편집 필터에 의한 차단'])
@@ -1442,7 +1444,6 @@ def preview(name = None, num = None):
 
     ip = ip_check()
     can = acl_check(conn, name)
-    captcha = captcha_get(conn)
     
     if(can == 1):
         return(re_error(conn, '/ban'))
@@ -1462,7 +1463,6 @@ def preview(name = None, num = None):
                     <textarea rows="25" name="content">' + html.escape(request.forms.content) + '</textarea> \
                     <textarea style="display: none;" name="otent">' + html.escape(request.forms.otent) + '</textarea><hr> \
                     <input placeholder="사유" name="send" type="text"><hr> \
-                    ' + captcha + ' \
                     <button id="preview" class="btn btn-primary" type="submit">저장</button> \
                     <button id="preview" class="btn" type="submit" formaction="/preview/' + url_pas(name) + action + '">미리보기</button> \
                 </form><hr>' + enddata,
@@ -1524,16 +1524,8 @@ def delete(name = None):
         )))            
             
 @route('/move_data/<name:path>')
-@route('/move_data/<name:path>/num/<num:int>')
-def move_data(name = None, num = 1):
-    if(num * 50 > 0):
-        sql_num = num * 50 - 50
-    else:
-        sql_num = 0
-
-    data = '<ul>'
-    
-    curs.execute("select send, date, ip from history where send like ? or send like ? order by date desc limit ?, '50'", ['%<a href="/w/' + url_pas(name) + '">' + name + '</a> 이동)%', '%(<a href="/w/' + url_pas(name) + '">' + name + '</a>%', str(sql_num)])
+def move_data(name = None):    
+    curs.execute("select send, date, ip from history where send like ? or send like ? order by date desc", ['%<a href="/w/' + url_pas(name) + '">' + name + '</a> 이동)%', '%(<a href="/w/' + url_pas(name) + '">' + name + '</a>%'])
     for for_data in curs.fetchall():
         match = re.findall('<a href="\/w\/(?:(?:(?!">).)+)">((?:(?!<\/a>).)+)<\/a>', for_data[0])
         send = re.sub('\([^\)]+\)$', '', for_data[0])
@@ -1543,7 +1535,7 @@ def move_data(name = None, num = 1):
         data += '<li><a href="/move_data/' + url_pas(match[0]) + '">' + match[0] + '</a> - <a href="/move_data/' + url_pas(match[1]) + '">' + match[1] + '</a>'
         data += ' / ' + for_data[2] + ' / ' + for_data[1] + ' / ' + send + '</li>'
     
-    data += '</ul><hr><a href="/move_data/' + url_pas(name) + '/num/' + str(num - 1) + '">(이전)</a> <a href="/move_data/' + url_pas(name) + '/num/' + str(num + 1) + '">(이후)</a>'
+    data = '<ul>' + data + '</ul>'
     
     return(html_minify(template('index', 
         imp = [name, wiki_set(conn, 1), custom(conn), other2([' (이동 기록)', 0])],
@@ -1620,7 +1612,7 @@ def other():
                             '== 기록 ==\r\n' + \
                             ' * [[wiki:block_log|차단 기록]]\r\n' + \
                             ' * [[wiki:user_log|가입 기록]]\r\n' + \
-                            ' * [[wiki:admin_log|권한 기록]]\r\n' + \
+                            ' * [[wiki:admin_log|권한 사용 기록]]\r\n' + \
                             ' * [[wiki:manager/6|편집 기록]]\r\n' + \
                             ' * [[wiki:manager/7|토론 기록]]\r\n' + \
                             '== 목록 ==\r\n' + \
@@ -1636,7 +1628,7 @@ def other():
                             '== 관리자 ==\r\n' + \
                             ' * [[wiki:manager/1|관리자 메뉴]]\r\n' + \
                             '== 버전 ==\r\n' + \
-                            ' * 이 오픈나무는 [[https://github.com/2DU/openNAMU/blob/SQLite/version.md|' + r_ver + ']]판 입니다.', 0, 0, 0),
+                            ' * 이 오픈나무는 [[https://github.com/2DU/openNAMU/blob/master/version.md|' + r_ver + ']]판 입니다.', 0, 0, 0),
         menu = 0
     )))
     
@@ -1751,7 +1743,7 @@ def title_index(num = 100, page = 1):
 
         count_end += [count_end[0] - count_end[1]  - count_end[2]  - count_end[3]  - count_end[4]]
 
-        data += '<hr><li>이 위키에는 총 ' + str(count_end[0]) + '개의 문서가 있습니다.</li><hr>'
+        data += '</ul><hr><ul><li>이 위키에는 총 ' + str(count_end[0]) + '개의 문서가 있습니다.</li></ul><hr><ul>'
         data += '<li>틀 문서는 총 ' + str(count_end[1]) + '개의 문서가 있습니다.</li>'
         data += '<li>분류 문서는 총 ' + str(count_end[2]) + '개의 문서가 있습니다.</li>'
         data += '<li>사용자 문서는 총 ' + str(count_end[3]) + '개의 문서가 있습니다.</li>'
@@ -1759,7 +1751,7 @@ def title_index(num = 100, page = 1):
         data += '<li>나머지 문서는 총 ' + str(count_end[5]) + '개의 문서가 있습니다.</li>'
 
     if(num != 0):
-        data += '</ul><hr><a href="/title_index/' + str(num) + '/' + str(page - 1) + '">(이전)</a> <a href="/title_index/' + str(num) + '/' + str(page + 1) + '">(이후)</a>'
+        data += '</ul>' + next_fix('/title_index/' + str(num) + '/', page, title_list, num)
     
     if(' (' + str(num) + '개)' == ' (0개)'):
         sub = 0
@@ -2886,7 +2878,8 @@ def user_topic_list(name = None, num = 1):
     div = '<a href="/record/' + url_pas(name) + '">(편집 기록)</a><hr>' + div
     
     curs.execute("select title, id, sub, ip, date from topic where ip = ? order by date desc limit ?, '50'", [name, str(sql_num)])
-    for data in curs.fetchall():
+    data_list = curs.fetchall()
+    for data in data_list:
         title = html.escape(data[0])
         sub = html.escape(data[2])
             
@@ -2905,7 +2898,7 @@ def user_topic_list(name = None, num = 1):
         div += '<td>' + ip + ban +  '</td><td>' + data[4] + '</td></tr>'
 
     div += '</tbody></table>'
-    div += '<hr><a href="/topic_record/' + url_pas(name) + '/' + str(num - 1) + '">(이전)</a> <a href="/topic_record/' + url_pas(name) + '/' + str(num + 1) + '">(이후)</a>'
+    div += next_fix('/topic_record/' + url_pas(name) + '/', num, data_list)
                 
     curs.execute("select end, why from ban where block = ?", [name])
     ban_it = curs.fetchall()
@@ -2921,8 +2914,9 @@ def user_topic_list(name = None, num = 1):
     )))
 
 @route('/<tool:re:history|record>/<name:path>', method=['POST', 'GET'])
-@route('/<tool:re:history|record>/<name:path>/num/<num:int>', method=['POST', 'GET'])
-@route('/record/<name:path>/<num:int>/<what:path>')
+@route('/<tool:re:history>/<name:path>/num/<num:int>', method=['POST', 'GET'])
+@route('/<tool:re:record>/<name:path>/<what:path>')
+@route('/<tool:re:record>/<name:path>/<what:path>/<num:int>')
 @route('/recent_changes')
 @route('/recent_changes/<what:path>')
 def recent_changes(name = None, num = 1, what = 'all', tool = 'record'):
@@ -2945,14 +2939,14 @@ def recent_changes(name = None, num = 1, what = 'all', tool = 'record'):
                 div += '<td style="width: 33.3%;">판</td><td style="width: 33.3%;">편집자</td><td style="width: 33.3%;">시간</td></tr>'
 
                 curs.execute("select id, title, date, ip, send, leng from history where title = ? order by id + 0 desc limit ?, '50'", [name, str(sql_num)])
-            elif(tool == 'record'):
+            else:
                 div += '<td style="width: 33.3%;">문서명</td><td style="width: 33.3%;">편집자</td><td style="width: 33.3%;">시간</td></tr>'
 
                 if(what == 'all'):
                     div = '<a href="/topic_record/' + url_pas(name) + '">(토론 기록)</a><hr>' + div
-                    div = '<a href="/record/' + url_pas(name) + '/' + str(num) + '/revert">(되돌리기)</a> ' + div
-                    div = '<a href="/record/' + url_pas(name) + '/' + str(num) + '/move">(이동)</a> ' + div
-                    div = '<a href="/record/' + url_pas(name) + '/' + str(num) + '/delete">(삭제)</a> ' + div
+                    div = '<a href="/record/' + url_pas(name) + '/revert">(되돌리기)</a> ' + div
+                    div = '<a href="/record/' + url_pas(name) + '/move">(이동)</a> ' + div
+                    div = '<a href="/record/' + url_pas(name) + '/delete">(삭제)</a> ' + div
                 
                     curs.execute("select id, title, date, ip, send, leng from history where ip = ? order by date desc limit ?, '50'", [name, str(sql_num)])
                 else:
@@ -2966,8 +2960,6 @@ def recent_changes(name = None, num = 1, what = 'all', tool = 'record'):
                         return(redirect('/'))
 
                     curs.execute("select id, title, date, ip, send, leng from history where ip = ? and send like ? order by date desc limit ?, '50'", [name, sql, str(sql_num)])
-            else:
-                return(redirect('/'))
         else:
             div += '<td style="width: 33.3%;">문서명</td><td style="width: 33.3%;">편집자</td><td style="width: 33.3%;">시간</td></tr>'
 
@@ -2989,7 +2981,8 @@ def recent_changes(name = None, num = 1, what = 'all', tool = 'record'):
 
                 curs.execute("select id, title, date, ip, send, leng from history where send like ? order by date desc limit 50", [sql])
 
-        for data in curs.fetchall():    
+        data_list = curs.fetchall()
+        for data in data_list:    
             select += '<option value="' + data[0] + '">' + data[0] + '</option>'     
             send = '<br>'
             if(data[4]):
@@ -3064,7 +3057,8 @@ def recent_changes(name = None, num = 1, what = 'all', tool = 'record'):
                 title = name
                 sub += ' (역사)'
                 menu = [['w/' + url_pas(name), '문서'], ['move_data/' + url_pas(name), '이동 기록']]
-                div += '<hr><a href="/history/' + url_pas(name) + '/num/' + str(num - 1) + '">(이전)</a> <a href="/history/' + url_pas(name) + '/num/' + str(num + 1) + '">(이후)</a>'
+                
+                div += next_fix('/history/' + url_pas(name) + '/num/', num, data_list)
             else:
                 curs.execute("select end, why from ban where block = ?", [name])
                 ban_it = curs.fetchall()
@@ -3073,10 +3067,7 @@ def recent_changes(name = None, num = 1, what = 'all', tool = 'record'):
 
                 title = '편집 기록'
                 menu = [['other', '기타'], ['user', '사용자'], ['count/' + url_pas(name), '횟수']]
-                if(what):
-                    div += '<hr><a href="/record/' + url_pas(name) + '/' + str(num - 1) + '/' + url_pas(what) + '">(이전)</a> <a href="/record/' + url_pas(name) + '/' + str(num + 1) + '/' + url_pas(what) + '">(이후)</a>'
-                else:
-                    div += '<hr><a href="/record/' + url_pas(name) + '/' + str(num - 1) + '">(이전)</a> <a href="/record/' + url_pas(name) + '/' + str(num + 1) + '">(이후)</a>'
+                div += next_fix('/record/' + url_pas(name) + '/' + url_pas(what) + '/', num, data_list)
 
                 if(what != 'all'):
                     menu += [['record/' + url_pas(name), '일반']]
@@ -3382,4 +3373,4 @@ def error_500(error):
     except:
         return('<!-- 아카이 타이요노 도레스데 오도루 와타시노 코토 미츠메테이루노 메오 소라시타이 데모 소라세나이 아아 죠네츠데 야카레타이 도키메키 이죠노 리즈무 코요이 시리타쿠테 이츠모요리 타이탄나 코토바오 츠부야이타 지분노 키모치나노니 젠젠 와카라나쿠 (낫챠이타이나) 리세이카라 시레이가 (토도카나이) 콘토로-루 후카노 손나 코이오 시타놋테 코에가 토도이테시맛타 하즈카시잇테 오모우케도 못토 시리타이노 못토 시리타이노 이케나이 유메다토 키즈키나가라 아카이 타이요노 도레스데 오도루 와타시노 코토 미츠메루 히토미 메오 소라시타이 데모 소라세나이 마나츠와 다레노 모노 아나타토 와타시노 모노니시타이 (닷테네) 코코로가 토마레나이 키세츠니 하지메테 무네노 토비라가 아이테 시마이소오요 You knock knock my heart!! -->' + redirect('/setup'))
 
-run(app = app, server = 'tornado', host = '0.0.0.0', port = int(set_data['port']), debug = True)
+run(app = app, server = 'tornado', host = '0.0.0.0', port = int(set_data['port']), debug = True)

+ 16 - 15
func.py

@@ -17,12 +17,7 @@ from set_mark.mark import *
 from set_mark.link import url_pas
 from set_mark.link import sha224
     
-session_opts = {
-    'session.type': 'dbm',
-    'session.data_dir': './app_session/',
-    'session.auto': 1
-}
-
+session_opts = { 'session.type' : 'dbm', 'session.data_dir' : './app_session/', 'session.auto' : 1 }
 app = beaker.middleware.SessionMiddleware(app(), session_opts)
 
 def captcha_get(conn):
@@ -30,7 +25,7 @@ def captcha_get(conn):
     curs = conn.cursor()
 
     data = ''
-    if(re.search('\.|:', ip_check()) and (not session.get('Awaken') or session.get('Awaken') != 1)):
+    if(re.search('\.|:', ip_check())):
         curs.execute('select data from other where name = "recaptcha"')
         recaptcha = curs.fetchall()
         if(recaptcha and recaptcha[0][0] != ''):
@@ -46,7 +41,7 @@ def captcha_post(response, conn, num = 1):
     curs = conn.cursor()
 
     if(num == 1):
-        if(re.search('\.|:', ip_check()) and (not session.get('Awaken') or session.get('Awaken') != 1) and captcha_get(conn) != ''):
+        if(re.search('\.|:', ip_check()) and captcha_get(conn) != ''):
             curs.execute('select data from other where name = "sec_re"')
             sec_re = curs.fetchall()
             if(sec_re and sec_re[0][0] != ''):
@@ -57,12 +52,6 @@ def captcha_post(response, conn, num = 1):
                 else:
                     json_data = data.json()
 
-                    try:
-                        json_data['error-codes']
-                        return(0)
-                    except:
-                        pass
-
                     if(data.status_code == 200 and json_data['success'] == True):
                         return(0)
                     else:
@@ -72,7 +61,7 @@ def captcha_post(response, conn, num = 1):
         else:
             return(0)
     else:
-        session['Awaken'] = 1
+        pass
 
 def skin_check(conn):
     curs = conn.cursor()
@@ -88,6 +77,18 @@ def skin_check(conn):
 
     return(skin)
 
+def next_fix(link, num, page, end = 50):
+    list_data = ''
+    if(num == 1):
+        if(len(page) == end):
+            list_data += '<hr><a href="' + link + str(num + 1) + '">(이후)</a>'
+    elif(len(page) != end):
+        list_data += '<hr><a href="' + link + str(num - 1) + '">(이전)</a>'
+    else:
+        list_data += '<hr><a href="' + link + str(num - 1) + '">(이전)</a> <a href="' + link + str(num + 1) + '">(이후)</a>'
+
+    return(list_data)
+
 def other2(origin):
     div = ''
     session = request.environ.get('beaker.session')

+ 9 - 5
set_mark/indent.py

@@ -2,22 +2,26 @@ import re
 
 def indent(data):
     while(1):
-        m = re.search("(\n(?:(?:( +)\*\s(?:[^\n]*))\n?)+)", data)
+        m = re.search("(\n(?:(?:( *)\* (?:[^\n]*))\n?)+)", data)
         if(m):
             result = m.groups()
             end = str(result[0])
 
             while(1):
-                isspace = re.search("( +)\*\s([^\n]*)", end)
+                isspace = re.search("( *)\*\s([^\n]*)", end)
                 if(isspace):
                     spacebar = isspace.groups()
-                    up = len(spacebar[0]) * 20
-                    end = re.sub("( +)\*\s([^\n]*)", "<li style='margin-left:" + str(up) + "px'>" + spacebar[1] + "</li>", end, 1)
+                    if(len(spacebar[0]) == 0):
+                        up = 20
+                    else:
+                        up = len(spacebar[0]) * 20
+
+                    end = re.sub("( *)\*\s([^\n]*)", "<li style='margin-left:" + str(up) + "px'>" + spacebar[1] + "</li>", end, 1)
                 else:
                     break
 
             end = re.sub("\n", '', end)
-            data = re.sub("(\n(?:(?:( +)\*\s(?:[^\n]*))\n?)+)", '<ul style="margin-top: 10px; margin-bottom: 10px;" id="list">' + end + '</ul>', data, 1)
+            data = re.sub("(\n(?:(?:( *)\* (?:[^\n]*))\n?)+)", '<ul style="margin-top: 10px; margin-bottom: 10px;" id="list">' + end + '</ul>', data, 1)
         else:
             break
 

+ 3 - 3
set_mark/link.py

@@ -107,7 +107,7 @@ def link(conn, title, data, num, category, backlink):
                     img = span[0] + '<img src="' + re.sub('^외부:', '', d[0]) + '" ' + width + height + '>' + span[1]
                     data = link.sub(img, data, 1)
                                     
-            elif(re.search('^https?:\/\/', d[0])):
+            elif(re.search('^https?:\/\/', re.sub('<([^>]*)>', '', d[0]))):
                 view = d[0]
                 try:
                     if(re.search('(.+)', d[1])):
@@ -115,7 +115,7 @@ def link(conn, title, data, num, category, backlink):
                 except:
                     pass
                 
-                data = link.sub('<a class="out_link" rel="nofollow" href="' + d[0] + '">' + view + '</a>', data, 1)
+                data = link.sub('<a class="out_link" rel="nofollow" href="' + re.sub('<([^>]*)>', '', d[0]) + '">' + view + '</a>', data, 1)
             else:
                 view = d[0].replace('\\\\', '<slash>').replace('\\', '').replace('<slash>', '\\')
                 try:
@@ -151,7 +151,7 @@ def link(conn, title, data, num, category, backlink):
                     else:
                         no = ''
                     
-                    data = link.sub('<a ' + no + ' title="' + href + sh + '" href="/w/' + url_pas(a) + sh + '">' + view.replace('\\', '\\\\') + '</a>', data, 1)
+                    data = link.sub('<a ' + no + ' title="' + re.sub('<([^>]*)>', '', href) + sh + '" href="/w/' + url_pas(re.sub('<([^>]*)>', '', a)) + sh + '">' + view.replace('\\', '\\\\') + '</a>', data, 1)
         else:
             break
             

+ 11 - 11
set_mark/mid_pas.py

@@ -38,37 +38,37 @@ def mid_pas(data, fol_num, include, in_c):
         if(is_it):
             it_d = is_it.groups()[0]
 
-            big_a = re.compile("^\+([1-5])\s(.*)$", re.DOTALL)
+            big_a = re.compile("^\+([1-5]) (.*)$", re.DOTALL)
             big = big_a.search(it_d)
 
-            small_a = re.compile("^\-([1-5])\s(.*)$", re.DOTALL)
+            small_a = re.compile("^\-([1-5]) (.*)$", re.DOTALL)
             small = small_a.search(it_d)
 
-            color_b = re.compile("^(#(?:[0-9a-f-A-F]{3}){1,2})\s(.*)$", re.DOTALL)
+            color_b = re.compile("^(#(?:[0-9a-f-A-F]{3}){1,2}) (.*)$", re.DOTALL)
             color_2 = color_b.search(it_d)
 
-            color_c = re.compile("^#(\w+)\s(.*)$", re.DOTALL)
+            color_c = re.compile("^#(\w+) (.*)$", re.DOTALL)
             color_3 = color_c.search(it_d)
 
-            back_a = re.compile("^@((?:[0-9a-f-A-F]{3}){1,2})\s(.*)$", re.DOTALL)
+            back_a = re.compile("^@((?:[0-9a-f-A-F]{3}){1,2}) (.*)$", re.DOTALL)
             back = back_a.search(it_d)
 
-            back_c = re.compile("^@(\w+)\s(.*)$", re.DOTALL)
+            back_c = re.compile("^@(\w+) (.*)$", re.DOTALL)
             back_3 = back_c.search(it_d)
 
-            include_out_a = re.compile("^#!noin\s(.*)$", re.DOTALL)
+            include_out_a = re.compile("^#!noin (.*)$", re.DOTALL)
             include_out = include_out_a.search(it_d)
 
-            div_a = re.compile("^#!wiki\sstyle=(?:&quot;|&#x27;)((?:(?!&quot;|&#x27;).)*)(?:&quot;|&#x27;)\r\n(.*)$", re.DOTALL)
+            div_a = re.compile("^#!wiki style=(?:&quot;|&#x27;)((?:(?!&quot;|&#x27;).)*)(?:&quot;|&#x27;)\r\n(.*)$", re.DOTALL)
             div = div_a.search(it_d)
 
-            html_a = re.compile("^#!html\s(.*)$", re.DOTALL)
+            html_a = re.compile("^#!html (.*)$", re.DOTALL)
             html_d = html_a.search(it_d)
 
-            fol_a = re.compile("^#!folding\s((?:(?!\n).)*)\n?\s\n(.*)$", re.DOTALL)
+            fol_a = re.compile("^#!folding ((?:(?!\n).)*)\n(.*)$", re.DOTALL)
             fol = fol_a.search(it_d)
 
-            syn_a = re.compile("^#!syntax\s([^\n]*)\r\n(.*)$", re.DOTALL)
+            syn_a = re.compile("^#!syntax ((?:(?!\n).)*)\n(.*)$", re.DOTALL)
             syn = syn_a.search(it_d)
 
             if(big):

+ 30 - 6
set_mark/table.py

@@ -136,7 +136,7 @@ def table(data):
             results = m.groups()
             table = results[0]
             while(1):
-                a = re.search("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)((?:(?!\|\|).)*)", table)
+                a = re.search("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)((?:(?!\|\||<\/td>).)*)", table)
                 if(a):
                     row = ''
                     cel = ''
@@ -160,14 +160,22 @@ def table(data):
                         table = re.sub("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "<table " + table_class + " " + alltable + "><tbody><tr " + rowstyle + "><td " + cel + " " + row + " " + celstyle + ">", table, 1)
                     else:
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
-                        table = re.sub("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "<table><tbody><tr><td " + cel + ">", table, 1)
+
+                        if(re.search('^ (.*) $', result[2])):
+                            celstyle += 'text-align: center;'
+                        elif(re.search('^ (.*)$', result[2])):
+                            celstyle += 'text-align: right;'
+                        elif(re.search('^(.*) $', result[2])):
+                            celstyle += 'text-align: left;'
+
+                        table = re.sub("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "<table><tbody><tr><td " + cel + " style='" + celstyle + "'>", table, 1)
                 else:
                     break
                     
             table = re.sub("\|\|$", "</td></tr></tbody></table>", table)
             
             while(1):
-                b = re.search("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)((?:(?!\|\|).)*)", table)
+                b = re.search("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)((?:(?!\|\||<\/td>).)*)", table)
                 if(b):
                     row = ''
                     cel = ''
@@ -186,12 +194,20 @@ def table(data):
                         table = re.sub("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td></tr><tr " + rowstyle + "><td " + cel + " " + row + " " + celstyle + ">", table, 1)
                     else:
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
-                        table = re.sub("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td></tr><tr><td " + cel + ">", table, 1)
+
+                        if(re.search('^ (.*) $', result[2])):
+                            celstyle += 'text-align: center;'
+                        elif(re.search('^ (.*)$', result[2])):
+                            celstyle += 'text-align: right;'
+                        elif(re.search('^(.*) $', result[2])):
+                            celstyle += 'text-align: left;'
+
+                        table = re.sub("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td></tr><tr><td " + cel + " style='" + celstyle + "'>", table, 1)
                 else:
                     break
 
             while(1):
-                c = re.search("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)((?:(?!\|\|).)*)", table)
+                c = re.search("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)((?:(?!\|\||<\/td>).)*)", table)
                 if(c):
                     row = ''
                     cel = ''
@@ -208,7 +224,15 @@ def table(data):
                         table = re.sub("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td><td " + cel + " " + row + " " + celstyle + ">", table, 1)
                     else:
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
-                        table = re.sub("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td><td " + cel + ">", table, 1)
+
+                        if(re.search('^ (.*) $', result[2])):
+                            celstyle += 'text-align: center;'
+                        elif(re.search('^ (.*)$', result[2])):
+                            celstyle += 'text-align: right;'
+                        elif(re.search('^(.*) $', result[2])):
+                            celstyle += 'text-align: left;'
+
+                        table = re.sub("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td><td " + cel + " style='" + celstyle + "'>", table, 1)
                 else:
                     break
             

+ 1 - 1
version.md

@@ -139,7 +139,7 @@
 
 ----
 ## 기타
- * 현재 버전 - v2.5.1
+ * 현재 버전 - v2.5.2
 
 ----
 ## 개발 이념

+ 1 - 1
views/acme/css/bootstrap-reset.css

@@ -388,7 +388,7 @@ input {
     border: 1px solid black;
     padding: 5px;
     margin-top: -30px;
-    margin-bottom: 10px;
+    margin-bottom: 20px;
     word-break: break-all;
 }