|
|
@@ -53,7 +53,7 @@ from func import *
|
|
|
|
|
|
BaseRequest.MEMFILE_MAX = 1000 ** 4
|
|
|
|
|
|
-r_ver = '2.4.5'
|
|
|
+r_ver = '2.4.6'
|
|
|
|
|
|
# 스킨 불러오기 부분
|
|
|
TEMPLATE_PATH.insert(0, skin_check())
|
|
|
@@ -1505,6 +1505,12 @@ def revert(name = None, num = None):
|
|
|
today = get_time()
|
|
|
|
|
|
if(request.method == 'POST'):
|
|
|
+ if(not request.forms.get('g-recaptcha-response')):
|
|
|
+ if(captcha_post() == 1):
|
|
|
+ return(re_error('/error/13'))
|
|
|
+ else:
|
|
|
+ captcha_post(0)
|
|
|
+
|
|
|
curs.execute("select title from hidhi where title = ? and re = ?", [name, str(num)])
|
|
|
if(curs.fetchall() and admin_check(6, None) != 1):
|
|
|
return(re_error('/error/3'))
|
|
|
@@ -1546,21 +1552,23 @@ def revert(name = None, num = None):
|
|
|
if(not curs.fetchall()):
|
|
|
return(redirect('/w/' + url_pas(name)))
|
|
|
|
|
|
- l = custom()
|
|
|
- if(l[2] == 0):
|
|
|
- plus = '<span>비 로그인 상태입니다. 비 로그인으로 진행 시 아이피가 역사에 기록됩니다.</span><br><br>'
|
|
|
+ custom_data = custom()
|
|
|
+ captcha = captcha_get()
|
|
|
+ if(custom_data[2] == 0):
|
|
|
+ ip_warring = '<span>비 로그인 상태입니다. 비 로그인으로 진행 시 아이피가 역사에 기록됩니다.</span><br><br>'
|
|
|
else:
|
|
|
- plus = ''
|
|
|
+ ip_warring = ''
|
|
|
|
|
|
return(
|
|
|
html_minify(
|
|
|
template('index',
|
|
|
- imp = [name, wiki_set(1), l, other2([' (되돌리기)', 0])],
|
|
|
- data = plus + ' \
|
|
|
+ imp = [name, wiki_set(1), custom_data, other2([' (되돌리기)', 0])],
|
|
|
+ data = ip_warring + ' \
|
|
|
<form method="post"> \
|
|
|
<input placeholder="사유" class="form-control input-sm" name="send" type="text"> \
|
|
|
<br> \
|
|
|
<br> \
|
|
|
+ ' + captcha + ' \
|
|
|
<button class="btn btn-primary" type="submit">되돌리기</button> \
|
|
|
</form>',
|
|
|
menu = [['history/' + url_pas(name), '역사'], ['recent_changes', '최근 변경']]
|
|
|
@@ -1636,6 +1644,12 @@ def edit(name = None, name2 = None, num = None):
|
|
|
return(re_error('/ban'))
|
|
|
|
|
|
if(request.method == 'POST'):
|
|
|
+ if(not request.forms.get('g-recaptcha-response')):
|
|
|
+ if(captcha_post() == 1):
|
|
|
+ return(re_error('/error/13'))
|
|
|
+ else:
|
|
|
+ captcha_post(0)
|
|
|
+
|
|
|
if(len(request.forms.send) > 500):
|
|
|
return(re_error('/error/15'))
|
|
|
|
|
|
@@ -1707,38 +1721,41 @@ def edit(name = None, name2 = None, num = None):
|
|
|
|
|
|
data2 = data
|
|
|
if(not num):
|
|
|
- p = '<form method="post" id="get_edit" action="/edit_get/' + url_pas(name) + '"> \
|
|
|
+ get_name = '<form method="post" id="get_edit" action="/edit_get/' + url_pas(name) + '"> \
|
|
|
<input placeholder="불러 올 문서" name="name" style="width: 50%;" type="text"> \
|
|
|
<button id="preview" class="btn" type="submit">불러오기</button> \
|
|
|
</form> \
|
|
|
<br>'
|
|
|
else:
|
|
|
- p = ''
|
|
|
+ get_name = ''
|
|
|
|
|
|
+ captcha = captcha_get()
|
|
|
if(name2):
|
|
|
curs.execute("select data from data where title = ?", [name2])
|
|
|
- d1 = curs.fetchall()
|
|
|
- if(d1):
|
|
|
- data = d1[0][0]
|
|
|
- p = ''
|
|
|
+ get_data = curs.fetchall()
|
|
|
+ if(get_data):
|
|
|
+ data = get_data[0][0]
|
|
|
+ get_name = ''
|
|
|
|
|
|
return(
|
|
|
html_minify(
|
|
|
template('index',
|
|
|
imp = [name, wiki_set(1), custom(), other2([' (수정)', 0])],
|
|
|
- data = p + '<form method="post" action="/edit/' + url_pas(name) + action + '"> \
|
|
|
- <textarea rows="25" name="content">' + html.escape(data) + '</textarea> \
|
|
|
- <textarea style="display: none;" name="otent">' + html.escape(data2) + '</textarea> \
|
|
|
- <br> \
|
|
|
- <br> \
|
|
|
- <input placeholder="사유" name="send" type="text"> \
|
|
|
- <br> \
|
|
|
- <br> \
|
|
|
- <div class="form-actions"> \
|
|
|
- <button id="preview" class="btn btn-primary" type="submit">저장</button> \
|
|
|
- <button id="preview" class="btn" type="submit" formaction="/preview/' + url_pas(name) + action + '">미리보기</button> \
|
|
|
- </div> \
|
|
|
- </form>',
|
|
|
+ data = get_name + ' \
|
|
|
+ <form method="post" action="/edit/' + url_pas(name) + action + '"> \
|
|
|
+ <textarea rows="25" name="content">' + html.escape(data) + '</textarea> \
|
|
|
+ <textarea style="display: none;" name="otent">' + html.escape(data2) + '</textarea> \
|
|
|
+ <br> \
|
|
|
+ <br> \
|
|
|
+ <input placeholder="사유" name="send" type="text"> \
|
|
|
+ <br> \
|
|
|
+ <br> \
|
|
|
+ <div class="form-actions"> \
|
|
|
+ ' + 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> \
|
|
|
+ </div> \
|
|
|
+ </form>',
|
|
|
menu = [['w/' + url_pas(name), '문서']]
|
|
|
)
|
|
|
)
|
|
|
@@ -1751,6 +1768,12 @@ def edit_get(name = None):
|
|
|
@route('/preview/<name:path>', method=['POST'])
|
|
|
@route('/preview/<name:path>/section/<num:int>', method=['POST'])
|
|
|
def preview(name = None, num = None):
|
|
|
+ if(not request.forms.get('g-recaptcha-response')):
|
|
|
+ if(captcha_post() == 1):
|
|
|
+ return(re_error('/error/13'))
|
|
|
+ else:
|
|
|
+ captcha_post(0)
|
|
|
+
|
|
|
ip = ip_check()
|
|
|
can = acl_check(name)
|
|
|
|
|
|
@@ -1779,7 +1802,7 @@ def preview(name = None, num = None):
|
|
|
<br> \
|
|
|
<br> \
|
|
|
<div class="form-actions"> \
|
|
|
- <button id="save" class="btn btn-primary" type="submit">저장</button> \
|
|
|
+ <button id="preview" class="btn btn-primary" type="submit">저장</button> \
|
|
|
<button id="preview" class="btn" type="submit" formaction="/preview/' + url_pas(name) + action + '">미리보기</button> \
|
|
|
</div> \
|
|
|
</form> \
|
|
|
@@ -1798,6 +1821,12 @@ def delete(name = None):
|
|
|
return(re_error('/ban'))
|
|
|
|
|
|
if(request.method == 'POST'):
|
|
|
+ if(not request.forms.get('g-recaptcha-response')):
|
|
|
+ if(captcha_post() == 1):
|
|
|
+ return(re_error('/error/13'))
|
|
|
+ else:
|
|
|
+ captcha_post(0)
|
|
|
+
|
|
|
curs.execute("select data from data where title = ?", [name])
|
|
|
data = curs.fetchall()
|
|
|
if(data):
|
|
|
@@ -1820,21 +1849,23 @@ def delete(name = None):
|
|
|
if(not curs.fetchall()):
|
|
|
return(redirect('/w/' + url_pas(name)))
|
|
|
|
|
|
- l = custom()
|
|
|
- if(l[2] == 0):
|
|
|
- plus = '<span>비 로그인 상태입니다. 비 로그인으로 진행 시 아이피가 역사에 기록됩니다.</span><br><br>'
|
|
|
+ custom_data = custom()
|
|
|
+ captcha = captcha_get()
|
|
|
+ if(custom_data[2] == 0):
|
|
|
+ ip_warring = '<span>비 로그인 상태입니다. 비 로그인으로 진행 시 아이피가 역사에 기록됩니다.</span><br><br>'
|
|
|
else:
|
|
|
- plus = ''
|
|
|
+ ip_warring = ''
|
|
|
|
|
|
return(
|
|
|
html_minify(
|
|
|
template('index',
|
|
|
- imp = [name, wiki_set(1), l, other2([' (삭제)', 0])],
|
|
|
+ imp = [name, wiki_set(1), custom_data, other2([' (삭제)', 0])],
|
|
|
data = '<form method="post"> \
|
|
|
- ' + plus + ' \
|
|
|
+ ' + ip_warring + ' \
|
|
|
<input placeholder="사유" class="form-control input-sm" name="send" type="text"> \
|
|
|
<br> \
|
|
|
<br> \
|
|
|
+ ' + captcha + ' \
|
|
|
<button class="btn btn-primary" type="submit">삭제</button> \
|
|
|
</form>',
|
|
|
menu = [['w/' + url_pas(name), '문서']]
|
|
|
@@ -1884,6 +1915,12 @@ def move(name = None):
|
|
|
return(re_error('/ban'))
|
|
|
|
|
|
if(request.method == 'POST'):
|
|
|
+ if(not request.forms.get('g-recaptcha-response')):
|
|
|
+ if(captcha_post() == 1):
|
|
|
+ return(re_error('/error/13'))
|
|
|
+ else:
|
|
|
+ captcha_post(0)
|
|
|
+
|
|
|
curs.execute("select title from history where title = ?", [request.forms.title])
|
|
|
if(curs.fetchall()):
|
|
|
return(re_error('/error/19'))
|
|
|
@@ -1912,24 +1949,26 @@ def move(name = None):
|
|
|
|
|
|
return(redirect('/w/' + url_pas(request.forms.title)))
|
|
|
else:
|
|
|
- c = custom()
|
|
|
- if(c[2] == 0):
|
|
|
- plus = '<span>비 로그인 상태입니다. 비 로그인으로 진행 시 아이피가 역사에 기록됩니다.</span><br><br>'
|
|
|
+ custom_data = custom()
|
|
|
+ captcha = captcha_get()
|
|
|
+ if(custom_data[2] == 0):
|
|
|
+ ip_warring = '<span>비 로그인 상태입니다. 비 로그인으로 진행 시 아이피가 역사에 기록됩니다.</span><br><br>'
|
|
|
else:
|
|
|
- plus = ''
|
|
|
+ ip_warring = ''
|
|
|
|
|
|
return(
|
|
|
html_minify(
|
|
|
template('index',
|
|
|
- imp = [name, wiki_set(1), c, other2([' (이동)', 0])],
|
|
|
+ imp = [name, wiki_set(1), custom_data, other2([' (이동)', 0])],
|
|
|
data = '<form method="post"> \
|
|
|
- ' + plus + ' \
|
|
|
+ ' + ip_warring + ' \
|
|
|
<input placeholder="문서명" class="form-control input-sm" value="' + name + '" name="title" type="text"> \
|
|
|
<br> \
|
|
|
<br> \
|
|
|
<input placeholder="사유" class="form-control input-sm" name="send" type="text"> \
|
|
|
<br> \
|
|
|
<br> \
|
|
|
+ ' + captcha + ' \
|
|
|
<button class="btn btn-primary" type="submit">이동</button> \
|
|
|
</form>',
|
|
|
menu = [['w/' + url_pas(name), '문서']]
|
|
|
@@ -2458,6 +2497,12 @@ def topic(name = None, sub = None):
|
|
|
admin = admin_check(3, None)
|
|
|
|
|
|
if(request.method == 'POST'):
|
|
|
+ if(not request.forms.get('g-recaptcha-response')):
|
|
|
+ if(captcha_post() == 1):
|
|
|
+ return(re_error('/error/13'))
|
|
|
+ else:
|
|
|
+ captcha_post(0)
|
|
|
+
|
|
|
ip = ip_check()
|
|
|
today = get_time()
|
|
|
|
|
|
@@ -2616,28 +2661,24 @@ def topic(name = None, sub = None):
|
|
|
|
|
|
i += 1
|
|
|
|
|
|
- l = custom()
|
|
|
+ custom_data = custom()
|
|
|
+ captcha = captcha_get()
|
|
|
if(ban != 1):
|
|
|
- data = '<a id="reload" href="javascript:void(0);" onclick="location.href.endsWith(\'#reload\') ? location.reload(true) : location.href = \'#reload\'"> \
|
|
|
- <i aria-hidden="true" class="fa fa-refresh"></i> \
|
|
|
- </a> \
|
|
|
- <form style="' + s + '" method="post"> \
|
|
|
- <br> \
|
|
|
- <textarea style="height: 100px;" name="content"></textarea> \
|
|
|
- <br> \
|
|
|
- <br> \
|
|
|
- <button class="btn btn-primary" type="submit">전송</button> \
|
|
|
- </form>'
|
|
|
+ data = '<a id="reload" href="javascript:void(0);" onclick="location.href.endsWith(\'#reload\') ? location.reload(true) : location.href = \'#reload\'"><i aria-hidden="true" class="fa fa-refresh"></i></a>'
|
|
|
+ data += '<form style="' + s + '" method="post"><br><textarea style="height: 100px;" name="content"></textarea><br><br>' + captcha
|
|
|
+
|
|
|
+ if(custom_data[2] == 0 and s == ''):
|
|
|
+ data += '<span>비 로그인 상태입니다. 비 로그인으로 진행 시 아이피가 토론에 기록됩니다.</span><br><br>'
|
|
|
+
|
|
|
+ data += '<button class="btn btn-primary" type="submit">전송</button></form>'
|
|
|
|
|
|
- if(l[2] == 0 and s == ''):
|
|
|
- data += '<span>비 로그인 상태입니다. 비 로그인으로 진행 시 아이피가 토론에 기록됩니다.</span>'
|
|
|
else:
|
|
|
data = ''
|
|
|
|
|
|
return(
|
|
|
html_minify(
|
|
|
template('index',
|
|
|
- imp = [name, wiki_set(1), l, other2([' (토론)', 0])],
|
|
|
+ imp = [name, wiki_set(1), custom_data, other2([' (토론)', 0])],
|
|
|
data = '<h2 style="margin-top: 0px;">' + sub + '</h2> \
|
|
|
<br> \
|
|
|
' + div + ' \
|
|
|
@@ -2651,7 +2692,6 @@ def topic(name = None, sub = None):
|
|
|
@route('/topic/<name:path>/<tool:path>', method=['GET'])
|
|
|
def close_topic_list(name = None, tool = None):
|
|
|
div = ''
|
|
|
- i = 0
|
|
|
list_d = 0
|
|
|
|
|
|
if(request.method == 'POST'):
|
|
|
@@ -2700,9 +2740,10 @@ def close_topic_list(name = None, tool = None):
|
|
|
it_p = 1
|
|
|
|
|
|
if(it_p != 1):
|
|
|
- div += '<h2><a href="/topic/' + url_pas(name) + '/sub/' + url_pas(data[0]) + '">' + str((i + 1)) + '. ' + data[0] + '</a></h2>'
|
|
|
-
|
|
|
- i += 1
|
|
|
+ div += '<h2><a href="/topic/' + url_pas(name) + '/sub/' + url_pas(data[0]) + '">' + data[0] + '</a></h2>'
|
|
|
+
|
|
|
+ if(div == ''):
|
|
|
+ plus = re.sub('^<br>', '', plus)
|
|
|
|
|
|
return(
|
|
|
html_minify(
|
|
|
@@ -2740,7 +2781,10 @@ def login():
|
|
|
|
|
|
if(request.method == 'POST'):
|
|
|
if(not request.forms.get('g-recaptcha-response')):
|
|
|
- return(re_error('/error/13'))
|
|
|
+ if(captcha_post() == 1):
|
|
|
+ return(re_error('/error/13'))
|
|
|
+ else:
|
|
|
+ captcha_post(0)
|
|
|
|
|
|
curs.execute("select pw from user where id = ?", [request.forms.id])
|
|
|
user = curs.fetchall()
|
|
|
@@ -2765,12 +2809,7 @@ def login():
|
|
|
|
|
|
return(redirect('/user'))
|
|
|
else:
|
|
|
- curs.execute('select data from other where name = "recaptcha"')
|
|
|
- recaptcha = curs.fetchall()
|
|
|
- if(recaptcha and recaptcha[0][0] != ''):
|
|
|
- plus = recaptcha[0][0] + '<br>'
|
|
|
- else:
|
|
|
- plus = ''
|
|
|
+ captcha = captcha_get()
|
|
|
|
|
|
return(
|
|
|
html_minify(
|
|
|
@@ -2783,7 +2822,7 @@ def login():
|
|
|
<input placeholder="비밀번호" name="pw" type="password"> \
|
|
|
<br> \
|
|
|
<br> \
|
|
|
- ' + plus + ' \
|
|
|
+ ' + captcha + ' \
|
|
|
<button class="btn btn-primary" type="submit">로그인</button> \
|
|
|
<br> \
|
|
|
<br> \
|
|
|
@@ -2935,7 +2974,10 @@ def register():
|
|
|
|
|
|
if(request.method == 'POST'):
|
|
|
if(not request.forms.get('g-recaptcha-response')):
|
|
|
- return(re_error('/error/13'))
|
|
|
+ if(captcha_post() == 1):
|
|
|
+ return(re_error('/error/13'))
|
|
|
+ else:
|
|
|
+ captcha_post(0)
|
|
|
|
|
|
if(request.forms.pw != request.forms.pw2):
|
|
|
return(re_error('/error/20'))
|
|
|
@@ -2962,35 +3004,30 @@ def register():
|
|
|
|
|
|
return(redirect('/login'))
|
|
|
else:
|
|
|
- p = ''
|
|
|
+ contract = ''
|
|
|
curs.execute('select data from other where name = "contract"')
|
|
|
- d = curs.fetchall()
|
|
|
- if(d and d[0][0] != ''):
|
|
|
- p = d[0][0] + '<br><br>'
|
|
|
+ data = curs.fetchall()
|
|
|
+ if(data and data[0][0] != ''):
|
|
|
+ contract = data[0][0] + '<br><br>'
|
|
|
|
|
|
- curs.execute('select data from other where name = "recaptcha"')
|
|
|
- recaptcha = curs.fetchall()
|
|
|
- if(recaptcha and recaptcha[0][0] != ''):
|
|
|
- plus = recaptcha[0][0] + '<br>'
|
|
|
- else:
|
|
|
- plus = ''
|
|
|
+ captcha = captcha_get()
|
|
|
|
|
|
return(
|
|
|
html_minify(
|
|
|
template('index',
|
|
|
imp = ['회원가입', wiki_set(1), custom(), other2([0, 0])],
|
|
|
data = '<form method="post"> \
|
|
|
- ' + p + ' \
|
|
|
+ ' + contract + ' \
|
|
|
<input placeholder="아이디" name="id" type="text"> \
|
|
|
<br> \
|
|
|
<br> \
|
|
|
<input placeholder="비밀번호" name="pw" type="password"> \
|
|
|
<br> \
|
|
|
<br> \
|
|
|
- <input placeholder="재 확인" name="pw2" type="password"> \
|
|
|
+ <input placeholder="다시" name="pw2" type="password"> \
|
|
|
<br> \
|
|
|
<br> \
|
|
|
- ' + plus + ' \
|
|
|
+ ' + captcha + ' \
|
|
|
<button class="btn btn-primary" type="submit">가입</button> \
|
|
|
<br> \
|
|
|
<br> \
|
|
|
@@ -3044,7 +3081,6 @@ def user_ban(name = None):
|
|
|
|
|
|
curs.execute("insert into ban (block, end, why, band) values (?, ?, ?, ?)", [name, end, request.forms.why, band_d])
|
|
|
|
|
|
- print(request.forms.login_ok)
|
|
|
if(request.forms.login_ok != ''):
|
|
|
curs.execute("insert into ok_login (ip, sub) values (?, '')", [name])
|
|
|
|
|
|
@@ -3216,12 +3252,13 @@ def acl(name = None):
|
|
|
curs.execute("select acl from data where title = ?", [name])
|
|
|
if(curs.fetchall()):
|
|
|
if(request.forms.select == 'admin'):
|
|
|
- curs.execute("update data set acl = 'admin' where title = ?", [name])
|
|
|
+ acl = 'admin'
|
|
|
elif(request.forms.select == 'user'):
|
|
|
- curs.execute("update data set acl = 'user' where title = ?", [name])
|
|
|
+ acl = 'user'
|
|
|
else:
|
|
|
- curs.execute("update data set acl = '' where title = ?", [name])
|
|
|
+ acl = ''
|
|
|
|
|
|
+ curs.execute("update data set acl = ? where title = ?", [acl, name])
|
|
|
conn.commit()
|
|
|
|
|
|
return(redirect('/w/' + url_pas(name)))
|
|
|
@@ -3243,17 +3280,16 @@ def acl(name = None):
|
|
|
html_minify(
|
|
|
template('index',
|
|
|
imp = [name, wiki_set(1), custom(), other2([' (ACL)', 0])],
|
|
|
- data = '<span>현재 ACL : ' + now + '</span> \
|
|
|
- <br> \
|
|
|
- <br> \
|
|
|
+ data = '<span>현재 ACL : ' + now + '</span><br><br> \
|
|
|
<form method="post"> \
|
|
|
<select name="select"> \
|
|
|
<option value="admin" selected="selected">관리자</option> \
|
|
|
<option value="user">가입자</option> \
|
|
|
<option value="normal">일반</option> \
|
|
|
</select> \
|
|
|
- <br> \
|
|
|
- <br> \
|
|
|
+ <br><br> \
|
|
|
+ <input placeholder="사유" name="why"> \
|
|
|
+ <br><br> \
|
|
|
<button class="btn btn-primary" type="submit">ACL 변경</button> \
|
|
|
</form>',
|
|
|
menu = [['w/' + url_pas(name), '문서'], ['manager', '관리자']]
|
|
|
@@ -3723,8 +3759,8 @@ def user_info():
|
|
|
|
|
|
ip = ip_pas(ip)
|
|
|
|
|
|
- l = custom()
|
|
|
- if(l[2] != 0):
|
|
|
+ custom_data = custom()
|
|
|
+ if(custom_data[2] != 0):
|
|
|
plus = ' * [[wiki:logout|로그아웃]]\r\n * [[wiki:change|비밀번호 변경]]'
|
|
|
else:
|
|
|
plus = ' * [[wiki:login|로그인]]'
|
|
|
@@ -3732,7 +3768,7 @@ def user_info():
|
|
|
return(
|
|
|
html_minify(
|
|
|
template('index',
|
|
|
- imp = ['사용자 메뉴', wiki_set(1), l, other2([0, 0])],
|
|
|
+ imp = ['사용자 메뉴', wiki_set(1), custom_data, other2([0, 0])],
|
|
|
data = ip + '<br><br>' + namumark(conn, '', '권한 상태 : ' + acl + '\r\n' + \
|
|
|
'[목차(없음)]\r\n' + \
|
|
|
'== 로그인 ==\r\n' + \
|