|
@@ -15,7 +15,7 @@ import os
|
|
|
|
|
|
|
|
from set_mark.macro import get_time
|
|
from set_mark.macro import get_time
|
|
|
from set_mark.macro import ip_check
|
|
from set_mark.macro import ip_check
|
|
|
-from set_mark.mark import *
|
|
|
|
|
|
|
+from mark import *
|
|
|
from set_mark.link import url_pas
|
|
from set_mark.link import url_pas
|
|
|
from set_mark.link import sha224
|
|
from set_mark.link import sha224
|
|
|
|
|
|
|
@@ -23,40 +23,40 @@ def captcha_get(conn):
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
|
|
|
|
|
data = ''
|
|
data = ''
|
|
|
- if(custom(conn)[2] == 0):
|
|
|
|
|
|
|
+ if custom(conn)[2] == 0:
|
|
|
curs.execute('select data from other where name = "recaptcha"')
|
|
curs.execute('select data from other where name = "recaptcha"')
|
|
|
recaptcha = curs.fetchall()
|
|
recaptcha = curs.fetchall()
|
|
|
- if(recaptcha and recaptcha[0][0] != ''):
|
|
|
|
|
|
|
+ if recaptcha and recaptcha[0][0] != '':
|
|
|
curs.execute('select data from other where name = "sec_re"')
|
|
curs.execute('select data from other where name = "sec_re"')
|
|
|
sec_re = curs.fetchall()
|
|
sec_re = curs.fetchall()
|
|
|
- if(sec_re and sec_re[0][0] != ''):
|
|
|
|
|
|
|
+ if sec_re and sec_re[0][0] != '':
|
|
|
data += recaptcha[0][0] + '<hr>'
|
|
data += recaptcha[0][0] + '<hr>'
|
|
|
|
|
|
|
|
- return(data)
|
|
|
|
|
|
|
+ return data
|
|
|
|
|
|
|
|
def captcha_post(test, conn, num = 1):
|
|
def captcha_post(test, conn, num = 1):
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
|
|
|
|
|
- if(num == 1):
|
|
|
|
|
- if(custom(conn)[2] == 0 and captcha_get(conn) != ''):
|
|
|
|
|
|
|
+ if num == 1:
|
|
|
|
|
+ if custom(conn)[2] == 0 and captcha_get(conn) != '':
|
|
|
curs.execute('select data from other where name = "sec_re"')
|
|
curs.execute('select data from other where name = "sec_re"')
|
|
|
sec_re = curs.fetchall()
|
|
sec_re = curs.fetchall()
|
|
|
- if(sec_re and sec_re[0][0] != ''):
|
|
|
|
|
|
|
+ if sec_re and sec_re[0][0] != '':
|
|
|
data = requests.get('https://www.google.com/recaptcha/api/siteverify', params = { 'secret' : sec_re, 'response' : test })
|
|
data = requests.get('https://www.google.com/recaptcha/api/siteverify', params = { 'secret' : sec_re, 'response' : test })
|
|
|
|
|
|
|
|
- if(not data):
|
|
|
|
|
- return(0)
|
|
|
|
|
|
|
+ if not data:
|
|
|
|
|
+ return 0
|
|
|
else:
|
|
else:
|
|
|
json_data = data.json()
|
|
json_data = data.json()
|
|
|
|
|
|
|
|
- if(data.status_code == 200 and json_data['success'] == True):
|
|
|
|
|
- return(0)
|
|
|
|
|
|
|
+ if data.status_code == 200 and json_data['success'] == True:
|
|
|
|
|
+ return 0
|
|
|
else:
|
|
else:
|
|
|
- return(1)
|
|
|
|
|
|
|
+ return 1
|
|
|
else:
|
|
else:
|
|
|
- return(0)
|
|
|
|
|
|
|
+ return 0
|
|
|
else:
|
|
else:
|
|
|
- return(0)
|
|
|
|
|
|
|
+ return 0
|
|
|
else:
|
|
else:
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
@@ -66,14 +66,14 @@ def ip_warring(conn):
|
|
|
if(custom(conn)[2] == 0):
|
|
if(custom(conn)[2] == 0):
|
|
|
curs.execute('select data from other where name = "no_login_warring"')
|
|
curs.execute('select data from other where name = "no_login_warring"')
|
|
|
data = curs.fetchall()
|
|
data = curs.fetchall()
|
|
|
- if(data and data[0][0] != ''):
|
|
|
|
|
|
|
+ if data and data[0][0] != '':
|
|
|
text_data = '<span>' + data[0][0] + '</span><hr>'
|
|
text_data = '<span>' + data[0][0] + '</span><hr>'
|
|
|
else:
|
|
else:
|
|
|
text_data = '<span>비 로그인 상태입니다. 비 로그인으로 진행 시 아이피가 기록됩니다.</span><hr>'
|
|
text_data = '<span>비 로그인 상태입니다. 비 로그인으로 진행 시 아이피가 기록됩니다.</span><hr>'
|
|
|
else:
|
|
else:
|
|
|
text_data = ''
|
|
text_data = ''
|
|
|
|
|
|
|
|
- return(text_data)
|
|
|
|
|
|
|
+ return text_data
|
|
|
|
|
|
|
|
def skin_check(conn):
|
|
def skin_check(conn):
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
@@ -81,8 +81,8 @@ def skin_check(conn):
|
|
|
try:
|
|
try:
|
|
|
curs.execute('select data from other where name = "skin"')
|
|
curs.execute('select data from other where name = "skin"')
|
|
|
skin_exist = curs.fetchall()
|
|
skin_exist = curs.fetchall()
|
|
|
- if(skin_exist):
|
|
|
|
|
- if(os.path.exists(os.path.abspath('./views/' + skin_exist[0][0] + '/index.tpl')) == 1):
|
|
|
|
|
|
|
+ if skin_exist:
|
|
|
|
|
+ if os.path.exists(os.path.abspath('./views/' + skin_exist[0][0] + '/index.tpl')) == 1:
|
|
|
skin = './views/' + skin_exist[0][0] + '/'
|
|
skin = './views/' + skin_exist[0][0] + '/'
|
|
|
except:
|
|
except:
|
|
|
pass
|
|
pass
|
|
@@ -91,34 +91,34 @@ def skin_check(conn):
|
|
|
|
|
|
|
|
def next_fix(link, num, page, end = 50):
|
|
def next_fix(link, num, page, end = 50):
|
|
|
list_data = ''
|
|
list_data = ''
|
|
|
- if(num == 1):
|
|
|
|
|
- if(len(page) == end):
|
|
|
|
|
|
|
+ if num == 1:
|
|
|
|
|
+ if len(page) == end:
|
|
|
list_data += '<hr><a href="' + link + str(num + 1) + '">(이후)</a>'
|
|
list_data += '<hr><a href="' + link + str(num + 1) + '">(이후)</a>'
|
|
|
- elif(len(page) != end):
|
|
|
|
|
|
|
+ elif len(page) != end:
|
|
|
list_data += '<hr><a href="' + link + str(num - 1) + '">(이전)</a>'
|
|
list_data += '<hr><a href="' + link + str(num - 1) + '">(이전)</a>'
|
|
|
else:
|
|
else:
|
|
|
list_data += '<hr><a href="' + link + str(num - 1) + '">(이전)</a> <a href="' + link + str(num + 1) + '">(이후)</a>'
|
|
list_data += '<hr><a href="' + link + str(num - 1) + '">(이전)</a> <a href="' + link + str(num + 1) + '">(이후)</a>'
|
|
|
|
|
|
|
|
- return(list_data)
|
|
|
|
|
|
|
+ return list_data
|
|
|
|
|
|
|
|
def other2(origin):
|
|
def other2(origin):
|
|
|
- return(origin + ['제거 되었음. 스킨 업데이트 필요함.'])
|
|
|
|
|
|
|
+ return origin + ['제거 되었음. 스킨 업데이트 필요함.']
|
|
|
|
|
|
|
|
def wiki_set(conn, num):
|
|
def wiki_set(conn, num):
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
- if(num == 1):
|
|
|
|
|
|
|
+ if num == 1:
|
|
|
data_list = []
|
|
data_list = []
|
|
|
|
|
|
|
|
curs.execute('select data from other where name = ?', ['name'])
|
|
curs.execute('select data from other where name = ?', ['name'])
|
|
|
db_data = curs.fetchall()
|
|
db_data = curs.fetchall()
|
|
|
- if(db_data and db_data[0][0] != ''):
|
|
|
|
|
|
|
+ if db_data and db_data[0][0] != '':
|
|
|
data_list += [db_data[0][0]]
|
|
data_list += [db_data[0][0]]
|
|
|
else:
|
|
else:
|
|
|
data_list += ['무명위키']
|
|
data_list += ['무명위키']
|
|
|
|
|
|
|
|
curs.execute('select data from other where name = "license"')
|
|
curs.execute('select data from other where name = "license"')
|
|
|
db_data = curs.fetchall()
|
|
db_data = curs.fetchall()
|
|
|
- if(db_data and db_data[0][0] != ''):
|
|
|
|
|
|
|
+ if db_data and db_data[0][0] != '':
|
|
|
data_list += [db_data[0][0]]
|
|
data_list += [db_data[0][0]]
|
|
|
else:
|
|
else:
|
|
|
data_list += ['CC 0']
|
|
data_list += ['CC 0']
|
|
@@ -127,83 +127,83 @@ def wiki_set(conn, num):
|
|
|
|
|
|
|
|
curs.execute('select data from other where name = "logo"')
|
|
curs.execute('select data from other where name = "logo"')
|
|
|
db_data = curs.fetchall()
|
|
db_data = curs.fetchall()
|
|
|
- if(db_data and db_data[0][0] != ''):
|
|
|
|
|
|
|
+ if db_data and db_data[0][0] != '':
|
|
|
data_list += [db_data[0][0]]
|
|
data_list += [db_data[0][0]]
|
|
|
else:
|
|
else:
|
|
|
data_list += [data_list[0]]
|
|
data_list += [data_list[0]]
|
|
|
|
|
|
|
|
curs.execute("select data from other where name = 'head'")
|
|
curs.execute("select data from other where name = 'head'")
|
|
|
db_data = curs.fetchall()
|
|
db_data = curs.fetchall()
|
|
|
- if(db_data and db_data[0][0] != ''):
|
|
|
|
|
|
|
+ if db_data and db_data[0][0] != '':
|
|
|
data_list += [db_data[0][0]]
|
|
data_list += [db_data[0][0]]
|
|
|
else:
|
|
else:
|
|
|
data_list += ['']
|
|
data_list += ['']
|
|
|
|
|
|
|
|
- return(data_list)
|
|
|
|
|
|
|
+ return data_list
|
|
|
|
|
|
|
|
- if(num == 2):
|
|
|
|
|
|
|
+ if num == 2:
|
|
|
var_data = '위키:대문'
|
|
var_data = '위키:대문'
|
|
|
curs.execute('select data from other where name = "frontpage"')
|
|
curs.execute('select data from other where name = "frontpage"')
|
|
|
- elif(num == 3):
|
|
|
|
|
|
|
+ elif num == 3:
|
|
|
var_data = '2'
|
|
var_data = '2'
|
|
|
curs.execute('select data from other where name = "upload"')
|
|
curs.execute('select data from other where name = "upload"')
|
|
|
|
|
|
|
|
db_data = curs.fetchall()
|
|
db_data = curs.fetchall()
|
|
|
- if(db_data and db_data[0][0] != ''):
|
|
|
|
|
- return(db_data[0][0])
|
|
|
|
|
|
|
+ if db_data and db_data[0][0] != '':
|
|
|
|
|
+ return db_data[0][0]
|
|
|
else:
|
|
else:
|
|
|
- return(var_data)
|
|
|
|
|
|
|
+ return var_data
|
|
|
|
|
|
|
|
def diff(seqm):
|
|
def diff(seqm):
|
|
|
output = []
|
|
output = []
|
|
|
for opcode, a0, a1, b0, b1 in seqm.get_opcodes():
|
|
for opcode, a0, a1, b0, b1 in seqm.get_opcodes():
|
|
|
- if(opcode == 'equal'):
|
|
|
|
|
|
|
+ if opcode == 'equal':
|
|
|
output += [seqm.a[a0:a1]]
|
|
output += [seqm.a[a0:a1]]
|
|
|
- elif(opcode == 'insert'):
|
|
|
|
|
|
|
+ elif opcode == 'insert':
|
|
|
output += ["<span style='background:#CFC;'>" + seqm.b[b0:b1] + "</span>"]
|
|
output += ["<span style='background:#CFC;'>" + seqm.b[b0:b1] + "</span>"]
|
|
|
- elif(opcode == 'delete'):
|
|
|
|
|
|
|
+ elif opcode == 'delete':
|
|
|
output += ["<span style='background:#FDD;'>" + seqm.a[a0:a1] + "</span>"]
|
|
output += ["<span style='background:#FDD;'>" + seqm.a[a0:a1] + "</span>"]
|
|
|
- elif(opcode == 'replace'):
|
|
|
|
|
|
|
+ elif opcode == 'replace':
|
|
|
output += ["<span style='background:#FDD;'>" + seqm.a[a0:a1] + "</span>"]
|
|
output += ["<span style='background:#FDD;'>" + seqm.a[a0:a1] + "</span>"]
|
|
|
output += ["<span style='background:#CFC;'>" + seqm.b[b0:b1] + "</span>"]
|
|
output += ["<span style='background:#CFC;'>" + seqm.b[b0:b1] + "</span>"]
|
|
|
|
|
|
|
|
- return(''.join(output))
|
|
|
|
|
|
|
+ return ''.join(output)
|
|
|
|
|
|
|
|
def admin_check(conn, num, what):
|
|
def admin_check(conn, num, what):
|
|
|
ip = ip_check()
|
|
ip = ip_check()
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
curs.execute("select acl from user where id = ?", [ip])
|
|
curs.execute("select acl from user where id = ?", [ip])
|
|
|
user = curs.fetchall()
|
|
user = curs.fetchall()
|
|
|
- if(user):
|
|
|
|
|
|
|
+ if user:
|
|
|
reset = 0
|
|
reset = 0
|
|
|
- while(1):
|
|
|
|
|
- if(num == 1 and reset == 0):
|
|
|
|
|
|
|
+ while 1:
|
|
|
|
|
+ if num == 1 and reset == 0:
|
|
|
check = 'ban'
|
|
check = 'ban'
|
|
|
- elif(num == 2 and reset == 0):
|
|
|
|
|
|
|
+ elif num == 2 and reset == 0:
|
|
|
check = 'mdel'
|
|
check = 'mdel'
|
|
|
- elif(num == 3 and reset == 0):
|
|
|
|
|
|
|
+ elif num == 3 and reset == 0:
|
|
|
check = 'toron'
|
|
check = 'toron'
|
|
|
- elif(num == 4 and reset == 0):
|
|
|
|
|
|
|
+ elif num == 4 and reset == 0:
|
|
|
check = 'check'
|
|
check = 'check'
|
|
|
- elif(num == 5 and reset == 0):
|
|
|
|
|
|
|
+ elif num == 5 and reset == 0:
|
|
|
check = 'acl'
|
|
check = 'acl'
|
|
|
- elif(num == 6 and reset == 0):
|
|
|
|
|
|
|
+ elif num == 6 and reset == 0:
|
|
|
check = 'hidel'
|
|
check = 'hidel'
|
|
|
- elif(num == 7 and reset == 0):
|
|
|
|
|
|
|
+ elif num == 7 and reset == 0:
|
|
|
check = 'give'
|
|
check = 'give'
|
|
|
else:
|
|
else:
|
|
|
check = 'owner'
|
|
check = 'owner'
|
|
|
|
|
|
|
|
curs.execute('select name from alist where name = ? and acl = ?', [user[0][0], check])
|
|
curs.execute('select name from alist where name = ? and acl = ?', [user[0][0], check])
|
|
|
acl_data = curs.fetchall()
|
|
acl_data = curs.fetchall()
|
|
|
- if(acl_data):
|
|
|
|
|
- if(what):
|
|
|
|
|
|
|
+ if acl_data:
|
|
|
|
|
+ if what:
|
|
|
curs.execute("insert into re_admin (who, what, time) values (?, ?, ?)", [ip, what, get_time()])
|
|
curs.execute("insert into re_admin (who, what, time) values (?, ?, ?)", [ip, what, get_time()])
|
|
|
conn.commit()
|
|
conn.commit()
|
|
|
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ return 1
|
|
|
else:
|
|
else:
|
|
|
- if(reset == 0):
|
|
|
|
|
|
|
+ if reset == 0:
|
|
|
reset = 1
|
|
reset = 1
|
|
|
else:
|
|
else:
|
|
|
break
|
|
break
|
|
@@ -211,13 +211,13 @@ def admin_check(conn, num, what):
|
|
|
def ip_pas(conn, raw_ip):
|
|
def ip_pas(conn, raw_ip):
|
|
|
hide = 0
|
|
hide = 0
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
- if(re.search("(\.|:)", raw_ip)):
|
|
|
|
|
|
|
+ if re.search("(\.|:)", raw_ip):
|
|
|
if(not re.search("^도구:", raw_ip)):
|
|
if(not re.search("^도구:", raw_ip)):
|
|
|
curs.execute("select data from other where name = 'ip_view'")
|
|
curs.execute("select data from other where name = 'ip_view'")
|
|
|
d = curs.fetchall()
|
|
d = curs.fetchall()
|
|
|
- if(d and d[0][0] != ''):
|
|
|
|
|
|
|
+ if d and d[0][0] != '':
|
|
|
ip = '<span style="font-size: 75%;">' + hashlib.md5(bytes(raw_ip, 'utf-8')).hexdigest() + '</span>'
|
|
ip = '<span style="font-size: 75%;">' + hashlib.md5(bytes(raw_ip, 'utf-8')).hexdigest() + '</span>'
|
|
|
- if(not admin_check(conn, 'ban', None)):
|
|
|
|
|
|
|
+ if not admin_check(conn, 'ban', None):
|
|
|
hide = 1
|
|
hide = 1
|
|
|
else:
|
|
else:
|
|
|
ip = raw_ip
|
|
ip = raw_ip
|
|
@@ -226,106 +226,106 @@ def ip_pas(conn, raw_ip):
|
|
|
hide = 1
|
|
hide = 1
|
|
|
else:
|
|
else:
|
|
|
curs.execute("select title from data where title = ?", ['사용자:' + raw_ip])
|
|
curs.execute("select title from data where title = ?", ['사용자:' + raw_ip])
|
|
|
- if(curs.fetchall()):
|
|
|
|
|
|
|
+ if curs.fetchall():
|
|
|
ip = '<a href="/w/' + url_pas('사용자:' + raw_ip) + '">' + raw_ip + '</a>'
|
|
ip = '<a href="/w/' + url_pas('사용자:' + raw_ip) + '">' + raw_ip + '</a>'
|
|
|
else:
|
|
else:
|
|
|
ip = '<a class="not_thing" href="/w/' + url_pas('사용자:' + raw_ip) + '">' + raw_ip + '</a>'
|
|
ip = '<a class="not_thing" href="/w/' + url_pas('사용자:' + raw_ip) + '">' + raw_ip + '</a>'
|
|
|
|
|
|
|
|
- if(hide == 0):
|
|
|
|
|
|
|
+ if hide == 0:
|
|
|
ip += ' <a href="/record/' + url_pas(raw_ip) + '">(기록)</a>'
|
|
ip += ' <a href="/record/' + url_pas(raw_ip) + '">(기록)</a>'
|
|
|
|
|
|
|
|
- return(ip)
|
|
|
|
|
|
|
+ return ip
|
|
|
|
|
|
|
|
def custom(conn):
|
|
def custom(conn):
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
- if('MyMaiToNight' in session):
|
|
|
|
|
|
|
+ if 'MyMaiToNight' in session:
|
|
|
user_head = session['MyMaiToNight']
|
|
user_head = session['MyMaiToNight']
|
|
|
else:
|
|
else:
|
|
|
user_head = ''
|
|
user_head = ''
|
|
|
|
|
|
|
|
- if('Now' in session and session['Now'] == 1):
|
|
|
|
|
|
|
+ if 'Now' in session and session['Now'] == 1:
|
|
|
curs.execute('select name from alarm where name = ? limit 1', [ip_check()])
|
|
curs.execute('select name from alarm where name = ? limit 1', [ip_check()])
|
|
|
- if(curs.fetchall()):
|
|
|
|
|
|
|
+ if curs.fetchall():
|
|
|
user_icon = 2
|
|
user_icon = 2
|
|
|
else:
|
|
else:
|
|
|
user_icon = 1
|
|
user_icon = 1
|
|
|
else:
|
|
else:
|
|
|
user_icon = 0
|
|
user_icon = 0
|
|
|
|
|
|
|
|
- return(['', '', user_icon, user_head])
|
|
|
|
|
|
|
+ return ['', '', user_icon, user_head]
|
|
|
|
|
|
|
|
def acl_check(conn, name):
|
|
def acl_check(conn, name):
|
|
|
ip = ip_check()
|
|
ip = ip_check()
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
- if(ban_check(conn) == 1):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if ban_check(conn) == 1:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
acl_c = re.search("^사용자:([^/]*)", name)
|
|
acl_c = re.search("^사용자:([^/]*)", name)
|
|
|
- if(acl_c):
|
|
|
|
|
|
|
+ if acl_c:
|
|
|
acl_n = acl_c.groups()
|
|
acl_n = acl_c.groups()
|
|
|
|
|
|
|
|
- if(admin_check(conn, 5, None) == 1):
|
|
|
|
|
- return(0)
|
|
|
|
|
|
|
+ if admin_check(conn, 5, None) == 1:
|
|
|
|
|
+ return 0
|
|
|
|
|
|
|
|
curs.execute("select dec from acl where title = ?", ['사용자:' + acl_n[0]])
|
|
curs.execute("select dec from acl where title = ?", ['사용자:' + acl_n[0]])
|
|
|
acl_d = curs.fetchall()
|
|
acl_d = curs.fetchall()
|
|
|
- if(acl_d):
|
|
|
|
|
- if(acl_d[0][0] == 'all'):
|
|
|
|
|
- return(0)
|
|
|
|
|
|
|
+ if acl_d:
|
|
|
|
|
+ if acl_d[0][0] == 'all':
|
|
|
|
|
+ return 0
|
|
|
|
|
|
|
|
- if(acl_d[0][0] == 'user' and not re.search("(\.|:)", ip)):
|
|
|
|
|
- return(0)
|
|
|
|
|
|
|
+ if acl_d[0][0] == 'user' and not re.search("(\.|:)", ip):
|
|
|
|
|
+ return 0
|
|
|
|
|
|
|
|
- if(not ip == acl_n[0] or re.search("(\.|:)", ip)):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if not ip == acl_n[0] or re.search("(\.|:)", ip):
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
- if(ip == acl_n[0] and not re.search("(\.|:)", ip) and not re.search("(\.|:)", acl_n[0])):
|
|
|
|
|
- return(0)
|
|
|
|
|
|
|
+ if ip == acl_n[0] and not re.search("(\.|:)", ip) and not re.search("(\.|:)", acl_n[0]):
|
|
|
|
|
+ return 0
|
|
|
else:
|
|
else:
|
|
|
- return(1)
|
|
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
file_c = re.search("^파일:(.*)", name)
|
|
file_c = re.search("^파일:(.*)", name)
|
|
|
- if(file_c and admin_check(conn, 5, 'edit (' + name + ')') != 1):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if file_c and admin_check(conn, 5, 'edit (' + name + ')') != 1:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
curs.execute("select acl from user where id = ?", [ip])
|
|
curs.execute("select acl from user where id = ?", [ip])
|
|
|
user_d = curs.fetchall()
|
|
user_d = curs.fetchall()
|
|
|
|
|
|
|
|
curs.execute("select dec from acl where title = ?", [name])
|
|
curs.execute("select dec from acl where title = ?", [name])
|
|
|
acl_d = curs.fetchall()
|
|
acl_d = curs.fetchall()
|
|
|
- if(acl_d):
|
|
|
|
|
- if(acl_d[0][0] == 'user'):
|
|
|
|
|
- if(not user_d):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if acl_d:
|
|
|
|
|
+ if acl_d[0][0] == 'user':
|
|
|
|
|
+ if not user_d:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
- if(acl_d[0][0] == 'admin'):
|
|
|
|
|
- if(not user_d):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if acl_d[0][0] == 'admin':
|
|
|
|
|
+ if not user_d:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
- if(not admin_check(conn, 5, 'edit (' + name + ')') == 1):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if not admin_check(conn, 5, 'edit (' + name + ')') == 1:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
curs.execute('select data from other where name = "edit"')
|
|
curs.execute('select data from other where name = "edit"')
|
|
|
set_d = curs.fetchall()
|
|
set_d = curs.fetchall()
|
|
|
- if(set_d):
|
|
|
|
|
- if(set_d[0][0] == 'user'):
|
|
|
|
|
- if(not user_d):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if set_d:
|
|
|
|
|
+ if set_d[0][0] == 'user':
|
|
|
|
|
+ if not user_d:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
- if(set_d[0][0] == 'admin'):
|
|
|
|
|
- if(not user_d):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if set_d[0][0] == 'admin':
|
|
|
|
|
+ if not user_d:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
- if(not admin_check(conn, 5, None) == 1):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if not admin_check(conn, 5, None) == 1:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
- return(0)
|
|
|
|
|
|
|
+ return 0
|
|
|
|
|
|
|
|
def ban_check(conn):
|
|
def ban_check(conn):
|
|
|
ip = ip_check()
|
|
ip = ip_check()
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
band = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
|
|
band = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
|
|
|
- if(band):
|
|
|
|
|
|
|
+ if band:
|
|
|
band_it = band.groups()
|
|
band_it = band.groups()
|
|
|
else:
|
|
else:
|
|
|
band_it = ['Not']
|
|
band_it = ['Not']
|
|
@@ -335,28 +335,28 @@ def ban_check(conn):
|
|
|
|
|
|
|
|
curs.execute("select block from ban where block = ?", [ip])
|
|
curs.execute("select block from ban where block = ?", [ip])
|
|
|
ban_d = curs.fetchall()
|
|
ban_d = curs.fetchall()
|
|
|
- if(band_d or ban_d):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if band_d or ban_d:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
- return(0)
|
|
|
|
|
|
|
+ return 0
|
|
|
|
|
|
|
|
def topic_check(conn, name, sub):
|
|
def topic_check(conn, name, sub):
|
|
|
ip = ip_check()
|
|
ip = ip_check()
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
- if(ban_check(conn) == 1):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if ban_check(conn) == 1:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
curs.execute("select title from stop where title = ? and sub = ?", [name, sub])
|
|
curs.execute("select title from stop where title = ? and sub = ?", [name, sub])
|
|
|
topic_s = curs.fetchall()
|
|
topic_s = curs.fetchall()
|
|
|
- if(topic_s):
|
|
|
|
|
- return(1)
|
|
|
|
|
|
|
+ if topic_s:
|
|
|
|
|
+ return 1
|
|
|
|
|
|
|
|
- return(0)
|
|
|
|
|
|
|
+ return 0
|
|
|
|
|
|
|
|
def rd_plus(conn, title, sub, date):
|
|
def rd_plus(conn, title, sub, date):
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
curs.execute("select title from rd where title = ? and sub = ?", [title, sub])
|
|
curs.execute("select title from rd where title = ? and sub = ?", [title, sub])
|
|
|
- if(curs.fetchall()):
|
|
|
|
|
|
|
+ if curs.fetchall():
|
|
|
curs.execute("update rd set date = ? where title = ? and sub = ?", [date, title, sub])
|
|
curs.execute("update rd set date = ? where title = ? and sub = ?", [date, title, sub])
|
|
|
else:
|
|
else:
|
|
|
curs.execute("insert into rd (title, sub, date) values (?, ?, ?)", [title, sub, date])
|
|
curs.execute("insert into rd (title, sub, date) values (?, ?, ?)", [title, sub, date])
|
|
@@ -365,52 +365,52 @@ def history_plus(conn, title, data, date, ip, send, leng):
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
curs.execute("select id from history where title = ? order by id + 0 desc limit 1", [title])
|
|
curs.execute("select id from history where title = ? order by id + 0 desc limit 1", [title])
|
|
|
d = curs.fetchall()
|
|
d = curs.fetchall()
|
|
|
- if(d):
|
|
|
|
|
|
|
+ if d:
|
|
|
curs.execute("insert into history (id, title, data, date, ip, send, leng) values (?, ?, ?, ?, ?, ?, ?)", [str(int(d[0][0]) + 1), title, data, date, ip, send, leng])
|
|
curs.execute("insert into history (id, title, data, date, ip, send, leng) values (?, ?, ?, ?, ?, ?, ?)", [str(int(d[0][0]) + 1), title, data, date, ip, send, leng])
|
|
|
else:
|
|
else:
|
|
|
curs.execute("insert into history (id, title, data, date, ip, send, leng) values ('1', ?, ?, ?, ?, ?, ?)", [title, data, date, ip, send + ' (새 문서)', leng])
|
|
curs.execute("insert into history (id, title, data, date, ip, send, leng) values ('1', ?, ?, ?, ?, ?, ?)", [title, data, date, ip, send + ' (새 문서)', leng])
|
|
|
|
|
|
|
|
def leng_check(a, b):
|
|
def leng_check(a, b):
|
|
|
- if(a < b):
|
|
|
|
|
|
|
+ if a < b:
|
|
|
c = b - a
|
|
c = b - a
|
|
|
c = '+' + str(c)
|
|
c = '+' + str(c)
|
|
|
- elif(b < a):
|
|
|
|
|
|
|
+ elif b < a:
|
|
|
c = a - b
|
|
c = a - b
|
|
|
c = '-' + str(c)
|
|
c = '-' + str(c)
|
|
|
else:
|
|
else:
|
|
|
c = '0'
|
|
c = '0'
|
|
|
|
|
|
|
|
- return(c)
|
|
|
|
|
|
|
+ return c
|
|
|
|
|
|
|
|
def redirect(data):
|
|
def redirect(data):
|
|
|
- return('<meta http-equiv="refresh" content="0; url=' + data + '">')
|
|
|
|
|
|
|
+ return '<meta http-equiv="refresh" content="0; url=' + data + '">'
|
|
|
|
|
|
|
|
def re_error(conn, data):
|
|
def re_error(conn, data):
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
- if(data == '/ban'):
|
|
|
|
|
|
|
+ if data == '/ban':
|
|
|
ip = ip_check()
|
|
ip = ip_check()
|
|
|
end = '|| 사유 || 권한이 맞지 않는 상태 입니다. ||'
|
|
end = '|| 사유 || 권한이 맞지 않는 상태 입니다. ||'
|
|
|
- if(ban_check(conn) == 1):
|
|
|
|
|
|
|
+ if ban_check(conn) == 1:
|
|
|
curs.execute("select end, why from ban where block = ?", [ip])
|
|
curs.execute("select end, why from ban where block = ?", [ip])
|
|
|
d = curs.fetchall()
|
|
d = curs.fetchall()
|
|
|
- if(not d):
|
|
|
|
|
|
|
+ if not d:
|
|
|
m = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
|
|
m = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
|
|
|
- if(m):
|
|
|
|
|
|
|
+ if m:
|
|
|
curs.execute("select end, why from ban where block = ? and band = 'O'", [m.groups()[0]])
|
|
curs.execute("select end, why from ban where block = ? and band = 'O'", [m.groups()[0]])
|
|
|
d = curs.fetchall()
|
|
d = curs.fetchall()
|
|
|
|
|
|
|
|
- if(d):
|
|
|
|
|
|
|
+ if d:
|
|
|
end = '|| 상태 ||'
|
|
end = '|| 상태 ||'
|
|
|
- if(d[0][0]):
|
|
|
|
|
|
|
+ if d[0][0]:
|
|
|
now = int(re.sub('(:|-| )', '', get_time()))
|
|
now = int(re.sub('(:|-| )', '', get_time()))
|
|
|
day = re.sub('\-', '', d[0][0])
|
|
day = re.sub('\-', '', d[0][0])
|
|
|
|
|
|
|
|
- if(re.search(':', day)):
|
|
|
|
|
|
|
+ if re.search(':', day):
|
|
|
day = re.sub('( |:)', '', day)
|
|
day = re.sub('( |:)', '', day)
|
|
|
else:
|
|
else:
|
|
|
day += '000000'
|
|
day += '000000'
|
|
|
|
|
|
|
|
- if(now >= int(day)):
|
|
|
|
|
|
|
+ if now >= int(day):
|
|
|
curs.execute("delete from ban where block = ?", [ip])
|
|
curs.execute("delete from ban where block = ?", [ip])
|
|
|
conn.commit()
|
|
conn.commit()
|
|
|
|
|
|
|
@@ -422,7 +422,7 @@ def re_error(conn, data):
|
|
|
|
|
|
|
|
end += '||'
|
|
end += '||'
|
|
|
|
|
|
|
|
- if(d[0][1] != ''):
|
|
|
|
|
|
|
+ if d[0][1] != '':
|
|
|
end += '\r\n|| 사유 || ' + d[0][1] + ' ||'
|
|
end += '\r\n|| 사유 || ' + d[0][1] + ' ||'
|
|
|
|
|
|
|
|
return(html_minify(template('index',
|
|
return(html_minify(template('index',
|
|
@@ -432,85 +432,85 @@ def re_error(conn, data):
|
|
|
)))
|
|
)))
|
|
|
|
|
|
|
|
d = re.search('\/error\/([0-9]+)', data)
|
|
d = re.search('\/error\/([0-9]+)', data)
|
|
|
- if(d):
|
|
|
|
|
|
|
+ if d:
|
|
|
num = int(d.groups()[0])
|
|
num = int(d.groups()[0])
|
|
|
- if(num == 1):
|
|
|
|
|
|
|
+ if num == 1:
|
|
|
title = '권한 오류'
|
|
title = '권한 오류'
|
|
|
data = '비 로그인 상태 입니다.'
|
|
data = '비 로그인 상태 입니다.'
|
|
|
- elif(num == 2):
|
|
|
|
|
|
|
+ elif num == 2:
|
|
|
title = '권한 오류'
|
|
title = '권한 오류'
|
|
|
data = '이 계정이 없습니다.'
|
|
data = '이 계정이 없습니다.'
|
|
|
- elif(num == 3):
|
|
|
|
|
|
|
+ elif num == 3:
|
|
|
title = '권한 오류'
|
|
title = '권한 오류'
|
|
|
data = '권한이 모자랍니다.'
|
|
data = '권한이 모자랍니다.'
|
|
|
- elif(num == 4):
|
|
|
|
|
|
|
+ elif num == 4:
|
|
|
title = '권한 오류'
|
|
title = '권한 오류'
|
|
|
data = '관리자는 차단, 검사 할 수 없습니다.'
|
|
data = '관리자는 차단, 검사 할 수 없습니다.'
|
|
|
- elif(num == 5):
|
|
|
|
|
|
|
+ elif num == 5:
|
|
|
title = '사용자 오류'
|
|
title = '사용자 오류'
|
|
|
data = '그런 계정이 없습니다.'
|
|
data = '그런 계정이 없습니다.'
|
|
|
- elif(num == 6):
|
|
|
|
|
|
|
+ elif num == 6:
|
|
|
title = '가입 오류'
|
|
title = '가입 오류'
|
|
|
data = '동일한 아이디의 사용자가 있습니다.'
|
|
data = '동일한 아이디의 사용자가 있습니다.'
|
|
|
- elif(num == 7):
|
|
|
|
|
|
|
+ elif num == 7:
|
|
|
title = '가입 오류'
|
|
title = '가입 오류'
|
|
|
data = '아이디는 20글자보다 짧아야 합니다.'
|
|
data = '아이디는 20글자보다 짧아야 합니다.'
|
|
|
- elif(num == 8):
|
|
|
|
|
|
|
+ elif num == 8:
|
|
|
title = '가입 오류'
|
|
title = '가입 오류'
|
|
|
data = '아이디에는 한글과 알파벳과 공백만 허용 됩니다.'
|
|
data = '아이디에는 한글과 알파벳과 공백만 허용 됩니다.'
|
|
|
- elif(num == 9):
|
|
|
|
|
|
|
+ elif num == 9:
|
|
|
title = '파일 올리기 오류'
|
|
title = '파일 올리기 오류'
|
|
|
data = '파일이 없습니다.'
|
|
data = '파일이 없습니다.'
|
|
|
- elif(num == 10):
|
|
|
|
|
|
|
+ elif num == 10:
|
|
|
title = '변경 오류'
|
|
title = '변경 오류'
|
|
|
data = '비밀번호가 다릅니다.'
|
|
data = '비밀번호가 다릅니다.'
|
|
|
- elif(num == 11):
|
|
|
|
|
|
|
+ elif num == 11:
|
|
|
title = '로그인 오류'
|
|
title = '로그인 오류'
|
|
|
data = '이미 로그인 되어 있습니다.'
|
|
data = '이미 로그인 되어 있습니다.'
|
|
|
- elif(num == 12):
|
|
|
|
|
|
|
+ elif num == 12:
|
|
|
title = '편집 오류'
|
|
title = '편집 오류'
|
|
|
data = '누군가 먼저 편집 했습니다.'
|
|
data = '누군가 먼저 편집 했습니다.'
|
|
|
- elif(num == 13):
|
|
|
|
|
|
|
+ elif num == 13:
|
|
|
title = '리캡차 오류'
|
|
title = '리캡차 오류'
|
|
|
data = '리캡차를 통과하세요.'
|
|
data = '리캡차를 통과하세요.'
|
|
|
- elif(num == 14):
|
|
|
|
|
|
|
+ elif num == 14:
|
|
|
title = '파일 올리기 오류'
|
|
title = '파일 올리기 오류'
|
|
|
data = 'jpg, gif, jpeg, png, webp만 가능 합니다.'
|
|
data = 'jpg, gif, jpeg, png, webp만 가능 합니다.'
|
|
|
- elif(num == 15):
|
|
|
|
|
|
|
+ elif num == 15:
|
|
|
title = '편집 오류'
|
|
title = '편집 오류'
|
|
|
data = '편집 기록은 500자를 넘을 수 없습니다.'
|
|
data = '편집 기록은 500자를 넘을 수 없습니다.'
|
|
|
- elif(num == 16):
|
|
|
|
|
|
|
+ elif num == 16:
|
|
|
title = '파일 올리기 오류'
|
|
title = '파일 올리기 오류'
|
|
|
data = '동일한 이름의 파일이 있습니다.'
|
|
data = '동일한 이름의 파일이 있습니다.'
|
|
|
- elif(num == 17):
|
|
|
|
|
|
|
+ elif num == 17:
|
|
|
title = '파일 올리기 오류'
|
|
title = '파일 올리기 오류'
|
|
|
data = '파일 용량은 ' + wiki_set(conn, 3) + 'MB를 넘길 수 없습니다.'
|
|
data = '파일 용량은 ' + wiki_set(conn, 3) + 'MB를 넘길 수 없습니다.'
|
|
|
- elif(num == 18):
|
|
|
|
|
|
|
+ elif num == 18:
|
|
|
title = '편집 오류'
|
|
title = '편집 오류'
|
|
|
data = '내용이 원래 문서와 동일 합니다.'
|
|
data = '내용이 원래 문서와 동일 합니다.'
|
|
|
- elif(num == 19):
|
|
|
|
|
|
|
+ elif num == 19:
|
|
|
title = '이동 오류'
|
|
title = '이동 오류'
|
|
|
data = '이동 하려는 곳에 문서가 이미 있습니다.'
|
|
data = '이동 하려는 곳에 문서가 이미 있습니다.'
|
|
|
- elif(num == 20):
|
|
|
|
|
|
|
+ elif num == 20:
|
|
|
title = '비밀번호 오류'
|
|
title = '비밀번호 오류'
|
|
|
data = '재 확인이랑 비밀번호가 다릅니다.'
|
|
data = '재 확인이랑 비밀번호가 다릅니다.'
|
|
|
- elif(num == 21):
|
|
|
|
|
|
|
+ elif num == 21:
|
|
|
title = '편집 오류'
|
|
title = '편집 오류'
|
|
|
data = '편집 필터에 의해 검열 되었습니다.'
|
|
data = '편집 필터에 의해 검열 되었습니다.'
|
|
|
- elif(num == 22):
|
|
|
|
|
|
|
+ elif num == 22:
|
|
|
title = '파일 올리기 오류'
|
|
title = '파일 올리기 오류'
|
|
|
data = '파일 이름은 알파벳, 한글, 띄어쓰기, 언더바, 빼기표만 허용 됩니다.'
|
|
data = '파일 이름은 알파벳, 한글, 띄어쓰기, 언더바, 빼기표만 허용 됩니다.'
|
|
|
else:
|
|
else:
|
|
|
title = '정체 불명의 오류'
|
|
title = '정체 불명의 오류'
|
|
|
data = '???'
|
|
data = '???'
|
|
|
|
|
|
|
|
- if(title):
|
|
|
|
|
|
|
+ if title:
|
|
|
return(html_minify(template('index',
|
|
return(html_minify(template('index',
|
|
|
imp = [title, wiki_set(conn, 1), custom(conn), other2([0, 0])],
|
|
imp = [title, wiki_set(conn, 1), custom(conn), other2([0, 0])],
|
|
|
data = namumark(conn, "", "[목차(없음)]\r\n== 오류 발생 ==\r\n" + data, 0, 0, 0),
|
|
data = namumark(conn, "", "[목차(없음)]\r\n== 오류 발생 ==\r\n" + data, 0, 0, 0),
|
|
|
menu = 0
|
|
menu = 0
|
|
|
)))
|
|
)))
|
|
|
else:
|
|
else:
|
|
|
- return(redirect('/'))
|
|
|
|
|
|
|
+ return redirect('/')
|
|
|
else:
|
|
else:
|
|
|
- return(redirect('/'))
|
|
|
|
|
|
|
+ return redirect('/')
|