2
0

func.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. import flask
  2. import json
  3. import sqlite3
  4. import hashlib
  5. import requests
  6. import re
  7. import html
  8. import os
  9. from set_mark.tool import *
  10. from mark import *
  11. json_data = open(os.path.join('language', 'en-US.json'), 'rt', encoding='utf-8').read()
  12. else_lang = json.loads(json_data)
  13. def load_conn(data):
  14. global conn
  15. global curs
  16. conn = data
  17. curs = conn.cursor()
  18. load_conn2(data)
  19. def easy_minify(data):
  20. data = re.sub('\n +<', '\n<', data)
  21. return data
  22. def captcha_get():
  23. data = ''
  24. if custom()[2] == 0:
  25. curs.execute('select data from other where name = "recaptcha"')
  26. recaptcha = curs.fetchall()
  27. if recaptcha and recaptcha[0][0] != '':
  28. curs.execute('select data from other where name = "sec_re"')
  29. sec_re = curs.fetchall()
  30. if sec_re and sec_re[0][0] != '':
  31. data += recaptcha[0][0] + '<hr>'
  32. return data
  33. def update():
  34. # v3.0.5 사용자 문서, 파일 문서, 분류 문서 영어화
  35. try:
  36. all_rep = [['사용자:', 'user:'], ['파일:', 'file:'], ['분류:', 'category:']]
  37. all_rep2 = ['data', 'history', 'acl', 'topic', 'back']
  38. test = 0
  39. for i in range(3):
  40. for j in range(6):
  41. if not j == 5:
  42. curs.execute('select title from ' + all_rep2[j] + ' where title like ?', [all_rep[i][0] + '%'])
  43. else:
  44. curs.execute('select link from back where link like ?', [all_rep[i][0] + '%'])
  45. user_rep = curs.fetchall()
  46. for user_rep2 in user_rep:
  47. test = 1
  48. first = re.sub('^' + all_rep[i][0], all_rep[i][1], user_rep2[0])
  49. if j == 0:
  50. curs.execute("update data set title = ? where title = ?", [first, user_rep2[0]])
  51. elif j == 1:
  52. curs.execute("update history set title = ? where title = ?", [first, user_rep2[0]])
  53. elif j == 2:
  54. curs.execute("update acl set title = ? where title = ?", [first, user_rep2[0]])
  55. elif j == 3:
  56. curs.execute("update topic set title = ? where title = ?", [first, user_rep2[0]])
  57. elif j == 4:
  58. curs.execute("update back set title = ? where title = ?", [first, user_rep2[0]])
  59. elif j == 5:
  60. curs.execute("update back set link = ? where link = ?", [first, user_rep2[0]])
  61. if test == 1:
  62. print('사용자 to user, 파일 to file, 분류 to category')
  63. except:
  64. pass
  65. # v3.0.6 사용자 설정 분리
  66. try:
  67. curs.execute("alter table user drop email")
  68. curs.execute("alter table user drop skin")
  69. except:
  70. pass
  71. def captcha_post(re_data, num = 1):
  72. if num == 1:
  73. if custom()[2] == 0 and captcha_get() != '':
  74. curs.execute('select data from other where name = "sec_re"')
  75. sec_re = curs.fetchall()
  76. if sec_re and sec_re[0][0] != '':
  77. data = requests.get('https://www.google.com/recaptcha/api/siteverify', params = { 'secret' : sec_re, 'response' : re_data })
  78. if not data:
  79. return 0
  80. else:
  81. json_data = data.json()
  82. if data.status_code == 200 and json_data['success'] == True:
  83. return 0
  84. else:
  85. return 1
  86. else:
  87. return 0
  88. else:
  89. return 0
  90. else:
  91. pass
  92. def load_lang(data, num = 0):
  93. global lang
  94. if num == 1:
  95. try:
  96. if lang:
  97. pass
  98. except:
  99. curs.execute("select data from other where name = 'language'")
  100. rep_data = curs.fetchall()
  101. json_data = open(os.path.join('language', rep_data[0][0] + '.json'), 'rt', encoding='utf-8').read()
  102. lang = json.loads(json_data)
  103. if data == 'please_all':
  104. return lang
  105. else:
  106. if data in lang:
  107. return lang[data]
  108. else:
  109. if data in else_lang:
  110. return else_lang[data]
  111. else:
  112. return data + ' (Missing)'
  113. else:
  114. curs.execute('select data from user_set where name = "lang" and id = ?', [ip_check()])
  115. rep_data = curs.fetchall()
  116. try:
  117. json_data = open(os.path.join('language', rep_data[0][0] + '.json'), 'rt', encoding='utf-8').read()
  118. lang = json.loads(json_data)
  119. if lang:
  120. if data == 'please_all':
  121. return lang
  122. else:
  123. if data in lang:
  124. return lang[data]
  125. else:
  126. if data in else_lang:
  127. return else_lang[data]
  128. else:
  129. return data + ' (Missing)'
  130. except:
  131. return load_lang(data, 1)
  132. def ip_or_user(data):
  133. if re.search('(\.|:)', data):
  134. return 1
  135. else:
  136. return 0
  137. def edit_help_button():
  138. # https://stackoverflow.com/questions/11076975/insert-text-into-textarea-at-cursor-position-javascript
  139. js_data = '''
  140. <script>
  141. function insertAtCursor(myField, myValue) {
  142. if (document.selection) {
  143. document.getElementById(myField).focus();
  144. sel = document.selection.createRange();
  145. sel.text = myValue;
  146. } else if (document.getElementById(myField).selectionStart || document.getElementById(myField).selectionStart == '0') {
  147. var startPos = document.getElementById(myField).selectionStart;
  148. var endPos = document.getElementById(myField).selectionEnd;
  149. document.getElementById(myField).value = document.getElementById(myField).value.substring(0, startPos) + myValue + document.getElementById(myField).value.substring(endPos, document.getElementById(myField).value.length);
  150. } else {
  151. document.getElementById(myField).value += myValue;
  152. }
  153. }
  154. </script>
  155. '''
  156. insert_list = [['[[|]]', 'Link'], ['[()]', 'Macro'], ['{{{#!}}}', 'Middle'], ['||<>||', 'Table']]
  157. data = ''
  158. for insert_data in insert_list:
  159. data += '<a href="javascript:void(0);" onclick="insertAtCursor(\'content\', \'' + insert_data[0] + '\');">(' + insert_data[1] + ')</a>'
  160. return [js_data, data + '<hr>']
  161. def ip_warring():
  162. if custom()[2] == 0:
  163. curs.execute('select data from other where name = "no_login_warring"')
  164. data = curs.fetchall()
  165. if data and data[0][0] != '':
  166. text_data = '<span>' + data[0][0] + '</span><hr>'
  167. else:
  168. text_data = '<span>' + load_lang('no_login_warring') + '</span><hr>'
  169. else:
  170. text_data = ''
  171. return text_data
  172. def skin_check():
  173. skin = './views/acme/'
  174. try:
  175. curs.execute('select data from user_set where name = "skin" and id = ?', [ip_check()])
  176. skin_exist = curs.fetchall()
  177. if skin_exist and skin_exist[0][0] != '':
  178. if os.path.exists(os.path.abspath('./views/' + skin_exist[0][0] + '/index.html')) == 1:
  179. skin = './views/' + skin_exist[0][0] + '/'
  180. else:
  181. curs.execute('select data from other where name = "skin"')
  182. skin_exist = curs.fetchall()
  183. if skin_exist:
  184. if os.path.exists(os.path.abspath('./views/' + skin_exist[0][0] + '/index.html')) == 1:
  185. skin = './views/' + skin_exist[0][0] + '/'
  186. except:
  187. pass
  188. return skin + 'index.html'
  189. def next_fix(link, num, page, end = 50):
  190. list_data = ''
  191. if num == 1:
  192. if len(page) == end:
  193. list_data += '<hr><a href="' + link + str(num + 1) + '">(' + load_lang('next') + ')</a>'
  194. elif len(page) != end:
  195. list_data += '<hr><a href="' + link + str(num - 1) + '">(' + load_lang('previous') + ')</a>'
  196. else:
  197. list_data += '<hr><a href="' + link + str(num - 1) + '">(' + load_lang('previous') + ')</a> <a href="' + link + str(num + 1) + '">(' + load_lang('next') + ')</a>'
  198. return list_data
  199. def other2(data):
  200. return data + ['Deleted']
  201. def wiki_set(num = 1):
  202. if num == 1:
  203. data_list = []
  204. curs.execute('select data from other where name = ?', ['name'])
  205. db_data = curs.fetchall()
  206. if db_data and db_data[0][0] != '':
  207. data_list += [db_data[0][0]]
  208. else:
  209. data_list += ['Wiki']
  210. curs.execute('select data from other where name = "license"')
  211. db_data = curs.fetchall()
  212. if db_data and db_data[0][0] != '':
  213. data_list += [db_data[0][0]]
  214. else:
  215. data_list += ['CC 0']
  216. data_list += ['', '']
  217. curs.execute('select data from other where name = "logo"')
  218. db_data = curs.fetchall()
  219. if db_data and db_data[0][0] != '':
  220. data_list += [db_data[0][0]]
  221. else:
  222. data_list += [data_list[0]]
  223. curs.execute("select data from other where name = 'head'")
  224. db_data = curs.fetchall()
  225. if db_data and db_data[0][0] != '':
  226. data_list += [db_data[0][0]]
  227. else:
  228. data_list += ['']
  229. return data_list
  230. if num == 2:
  231. var_data = 'FrontPage'
  232. curs.execute('select data from other where name = "frontpage"')
  233. elif num == 3:
  234. var_data = '2'
  235. curs.execute('select data from other where name = "upload"')
  236. db_data = curs.fetchall()
  237. if db_data and db_data[0][0] != '':
  238. return db_data[0][0]
  239. else:
  240. return var_data
  241. def diff(seqm):
  242. output = []
  243. for opcode, a0, a1, b0, b1 in seqm.get_opcodes():
  244. if opcode == 'equal':
  245. output += [seqm.a[a0:a1]]
  246. elif opcode == 'insert':
  247. output += ["<span style='background:#CFC;'>" + seqm.b[b0:b1] + "</span>"]
  248. elif opcode == 'delete':
  249. output += ["<span style='background:#FDD;'>" + seqm.a[a0:a1] + "</span>"]
  250. elif opcode == 'replace':
  251. output += ["<span style='background:#FDD;'>" + seqm.a[a0:a1] + "</span>"]
  252. output += ["<span style='background:#CFC;'>" + seqm.b[b0:b1] + "</span>"]
  253. return ''.join(output)
  254. def admin_check(num, what):
  255. ip = ip_check()
  256. curs.execute("select acl from user where id = ?", [ip])
  257. user = curs.fetchall()
  258. if user:
  259. reset = 0
  260. while 1:
  261. if num == 1 and reset == 0:
  262. check = 'ban'
  263. elif num == 3 and reset == 0:
  264. check = 'toron'
  265. elif num == 4 and reset == 0:
  266. check = 'check'
  267. elif num == 5 and reset == 0:
  268. check = 'acl'
  269. elif num == 6 and reset == 0:
  270. check = 'hidel'
  271. elif num == 7 and reset == 0:
  272. check = 'give'
  273. else:
  274. check = 'owner'
  275. curs.execute('select name from alist where name = ? and acl = ?', [user[0][0], check])
  276. if curs.fetchall():
  277. if what:
  278. curs.execute("insert into re_admin (who, what, time) values (?, ?, ?)", [ip, what, get_time()])
  279. conn.commit()
  280. return 1
  281. else:
  282. if reset == 0:
  283. reset = 1
  284. else:
  285. break
  286. def ip_pas(raw_ip):
  287. hide = 0
  288. if re.search("(\.|:)", raw_ip):
  289. if not re.search("^" + load_lang('tool', 1) + ":", raw_ip):
  290. curs.execute("select data from other where name = 'ip_view'")
  291. data = curs.fetchall()
  292. if data and data[0][0] != '':
  293. ip = '<span style="font-size: 75%;">' + hashlib.md5(bytes(raw_ip, 'utf-8')).hexdigest() + '</span>'
  294. if not admin_check('ban', None):
  295. hide = 1
  296. else:
  297. ip = raw_ip
  298. else:
  299. ip = raw_ip
  300. hide = 1
  301. else:
  302. curs.execute("select title from data where title = ?", ['user:' + raw_ip])
  303. if curs.fetchall():
  304. ip = '<a href="/w/' + url_pas('user:' + raw_ip) + '">' + raw_ip + '</a>'
  305. else:
  306. ip = '<a id="not_thing" href="/w/' + url_pas('user:' + raw_ip) + '">' + raw_ip + '</a>'
  307. if hide == 0:
  308. ip += ' <a href="/record/' + url_pas(raw_ip) + '">(' + load_lang('record') + ')</a>'
  309. return ip
  310. def custom():
  311. if 'MyMaiToNight' in flask.session:
  312. user_head = flask.session['MyMaiToNight']
  313. else:
  314. user_head = ''
  315. if 'Now' in flask.session and flask.session['Now'] == 1:
  316. curs.execute('select name from alarm where name = ? limit 1', [ip_check()])
  317. if curs.fetchall():
  318. user_icon = 2
  319. else:
  320. user_icon = 1
  321. else:
  322. user_icon = 0
  323. if user_icon != 0:
  324. curs.execute('select data from user_set where name = "email" and id = ?', [ip_check()])
  325. data = curs.fetchall()
  326. if data:
  327. email = data[0][0]
  328. else:
  329. email = ''
  330. else:
  331. email = ''
  332. if user_icon != 0:
  333. user_name = ip_check()
  334. else:
  335. user_name = load_lang('user')
  336. return ['', '', user_icon, user_head, email, user_name]
  337. def load_skin(data = ''):
  338. div2 = ''
  339. if data == '':
  340. ip = ip_check()
  341. curs.execute('select data from user_set where name = "skin" and id = ?', [ip])
  342. data = curs.fetchall()
  343. for skin_data in os.listdir(os.path.abspath('views')):
  344. if not skin_data == 'main_css':
  345. if not data:
  346. curs.execute('select data from other where name = "skin"')
  347. sql_data = curs.fetchall()
  348. if sql_data and sql_data[0][0] == skin_data:
  349. div2 = '<option value="' + skin_data + '">' + skin_data + '</option>' + div2
  350. else:
  351. div2 += '<option value="' + skin_data + '">' + skin_data + '</option>'
  352. elif data[0][0] == skin_data:
  353. div2 = '<option value="' + skin_data + '">' + skin_data + '</option>' + div2
  354. else:
  355. div2 += '<option value="' + skin_data + '">' + skin_data + '</option>'
  356. else:
  357. for skin_data in os.listdir(os.path.abspath('views')):
  358. if not skin_data == 'main_css':
  359. if data == skin_data:
  360. div2 = '<option value="' + skin_data + '">' + skin_data + '</option>' + div2
  361. else:
  362. div2 += '<option value="' + skin_data + '">' + skin_data + '</option>'
  363. return div2
  364. def acl_check(name):
  365. ip = ip_check()
  366. if ban_check() == 1:
  367. return 1
  368. acl_c = re.search("^user:([^/]*)", name)
  369. if acl_c:
  370. acl_n = acl_c.groups()
  371. if admin_check(5, None) == 1:
  372. return 0
  373. curs.execute("select dec from acl where title = ?", ['user:' + acl_n[0]])
  374. acl_data = curs.fetchall()
  375. if acl_data:
  376. if acl_data[0][0] == 'all':
  377. return 0
  378. if acl_data[0][0] == 'user' and not re.search("(\.|:)", ip):
  379. return 0
  380. if ip != acl_n[0] or re.search("(\.|:)", ip):
  381. return 1
  382. if ip == acl_n[0] and not re.search("(\.|:)", ip) and not re.search("(\.|:)", acl_n[0]):
  383. return 0
  384. else:
  385. return 1
  386. file_c = re.search("^file:(.*)", name)
  387. if file_c and admin_check(5, 'edit (' + name + ')') != 1:
  388. return 1
  389. curs.execute("select acl from user where id = ?", [ip])
  390. user_data = curs.fetchall()
  391. curs.execute("select dec from acl where title = ?", [name])
  392. acl_data = curs.fetchall()
  393. if acl_data:
  394. if acl_data[0][0] == 'user':
  395. if not user_data:
  396. return 1
  397. if acl_data[0][0] == 'admin':
  398. if not user_data:
  399. return 1
  400. if not admin_check(5, 'edit (' + name + ')') == 1:
  401. return 1
  402. curs.execute('select data from other where name = "edit"')
  403. set_data = curs.fetchall()
  404. if set_data:
  405. if set_data[0][0] == 'user':
  406. if not user_data:
  407. return 1
  408. if set_data[0][0] == 'admin':
  409. if not user_data:
  410. return 1
  411. if not admin_check(5, None) == 1:
  412. return 1
  413. return 0
  414. def ban_check(ip = None, tool = None):
  415. if not ip:
  416. ip = ip_check()
  417. band = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
  418. if band:
  419. band_it = band.groups()[0]
  420. else:
  421. band_it = '-'
  422. curs.execute("select end, login from ban where block = ?", [band_it])
  423. band_d = curs.fetchall()
  424. curs.execute("select end, login from ban where block = ?", [ip])
  425. ban_d = curs.fetchall()
  426. data = band_d or ban_d
  427. if data and (data[0][0] == '' or data[0][0] > get_time()):
  428. if tool and tool == 'login':
  429. if data[0][1] == 'O':
  430. return 0
  431. return 1
  432. return 0
  433. def topic_check(name, sub):
  434. ip = ip_check()
  435. if ban_check() == 1:
  436. return 1
  437. curs.execute("select acl from user where id = ?", [ip])
  438. user_data = curs.fetchall()
  439. curs.execute("select dis from acl where title = ?", [name])
  440. acl_data = curs.fetchall()
  441. if acl_data:
  442. if acl_data[0][0] == 'user':
  443. if not user_data:
  444. return 1
  445. if acl_data[0][0] == 'admin':
  446. if not user_data:
  447. return 1
  448. if not admin_check(3, 'topic (' + name + ')') == 1:
  449. return 1
  450. curs.execute("select title from stop where title = ? and sub = ?", [name, sub])
  451. if curs.fetchall():
  452. if not admin_check(3, 'topic (' + name + ')') == 1:
  453. return 1
  454. return 0
  455. def ban_insert(name, end, why, login, blocker):
  456. now_time = get_time()
  457. if re.search("^([0-9]{1,3}\.[0-9]{1,3})$", name):
  458. band = 'O'
  459. else:
  460. band = ''
  461. curs.execute("select block from ban where block = ?", [name])
  462. if curs.fetchall():
  463. curs.execute("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)", [name, load_lang('release', 1), now_time, blocker, '', band])
  464. curs.execute("delete from ban where block = ?", [name])
  465. else:
  466. if login != '':
  467. login = 'O'
  468. else:
  469. login = ''
  470. if end != '0':
  471. time = datetime.datetime.now()
  472. plus = datetime.timedelta(seconds = int(end))
  473. r_time = (time + plus).strftime("%Y-%m-%d %H:%M:%S")
  474. else:
  475. r_time = ''
  476. curs.execute("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)", [name, r_time, now_time, blocker, why, band])
  477. curs.execute("insert into ban (block, end, why, band, login) values (?, ?, ?, ?, ?)", [name, r_time, why, band, login])
  478. conn.commit()
  479. def rd_plus(title, sub, date):
  480. curs.execute("select title from rd where title = ? and sub = ?", [title, sub])
  481. if curs.fetchall():
  482. curs.execute("update rd set date = ? where title = ? and sub = ?", [date, title, sub])
  483. else:
  484. curs.execute("insert into rd (title, sub, date) values (?, ?, ?)", [title, sub, date])
  485. def history_plus(title, data, date, ip, send, leng):
  486. curs.execute("select id from history where title = ? order by id + 0 desc limit 1", [title])
  487. id_data = curs.fetchall()
  488. if id_data:
  489. curs.execute("insert into history (id, title, data, date, ip, send, leng) values (?, ?, ?, ?, ?, ?, ?)", [str(int(id_data[0][0]) + 1), title, data, date, ip, send, leng])
  490. else:
  491. curs.execute("insert into history (id, title, data, date, ip, send, leng) values ('1', ?, ?, ?, ?, ?, ?)", [title, data, date, ip, send + ' (' + load_lang('new', 1) + ' ' + load_lang('document', 1) + ')', leng])
  492. def leng_check(first, second):
  493. if first < second:
  494. all_plus = '+' + str(second - first)
  495. elif second < first:
  496. all_plus = '-' + str(first - second)
  497. else:
  498. all_plus = '0'
  499. return all_plus
  500. def redirect(data):
  501. return flask.redirect(data)
  502. def re_error(data):
  503. if data == '/ban':
  504. ip = ip_check()
  505. end = '<li>' + load_lang('why') + ' : ' + load_lang('authority_error') + '</li>'
  506. if ban_check() == 1:
  507. curs.execute("select end, why from ban where block = ?", [ip])
  508. end_data = curs.fetchall()
  509. if not end_data:
  510. match = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
  511. if match:
  512. curs.execute("select end, why from ban where block = ?", [match.groups()[0]])
  513. end_data = curs.fetchall()
  514. if end_data:
  515. end = '<li>' + load_lang('state') + ' : ' + load_lang('ban') + '</li><li>'
  516. if end_data[0][0]:
  517. now = int(re.sub('(\-| |:)', '', get_time()))
  518. day = int(re.sub('(\-| |:)', '', end_data[0][0]))
  519. if now >= day:
  520. curs.execute("delete from ban where block = ?", [ip])
  521. conn.commit()
  522. end += '<script>location.reload();</script>'
  523. else:
  524. end += 'End : ' + end_data[0][0]
  525. else:
  526. end += load_lang('limitless')
  527. end += '</li>'
  528. if end_data[0][1] != '':
  529. end += '<li>' + load_lang('why') + ' : ' + end_data[0][1] + '</li>'
  530. return easy_minify(flask.render_template(skin_check(),
  531. imp = ['Error', wiki_set(1), custom(), other2([0, 0])],
  532. data = '<h2>Error</h2><ul>' + end + '</ul>',
  533. menu = 0
  534. ))
  535. else:
  536. error_data = re.search('\/error\/([0-9]+)', data)
  537. if error_data:
  538. num = int(error_data.groups()[0])
  539. if num == 1:
  540. data = load_lang('no_login_error')
  541. elif num == 2:
  542. data = load_lang('no_exist_user_error')
  543. elif num == 3:
  544. data = load_lang('authority_error')
  545. elif num == 4:
  546. data = load_lang('no_admin_block_error')
  547. elif num == 5:
  548. data = load_lang('skin_error')
  549. elif num == 6:
  550. data = load_lang('same_id_exist_error')
  551. elif num == 7:
  552. data = load_lang('long_id_error')
  553. elif num == 8:
  554. data = load_lang('id_char_error')
  555. elif num == 9:
  556. data = load_lang('file_exist_error')
  557. elif num == 10:
  558. data = load_lang('password_error')
  559. elif num == 13:
  560. data = load_lang('recaptcha_error')
  561. elif num == 14:
  562. data = load_lang('file_extension_error')
  563. elif num == 15:
  564. data = load_lang('edit_record_error')
  565. elif num == 16:
  566. data = load_lang('same_file_error')
  567. elif num == 17:
  568. data = load_lang('file_capacity_error') + ' ' + wiki_set(3)
  569. elif num == 19:
  570. data = load_lang('decument_exist_error')
  571. elif num == 20:
  572. data = load_lang('password_diffrent_error')
  573. elif num == 21:
  574. data = load_lang('edit_filter_error')
  575. elif num == 22:
  576. data = load_lang('file_name_error')
  577. else:
  578. data = '???'
  579. return easy_minify(flask.render_template(skin_check(),
  580. imp = ['Error', wiki_set(1), custom(), other2([0, 0])],
  581. data = '<h2>Error</h2><ul><li>' + data + '</li></ul>',
  582. menu = 0
  583. ))
  584. else:
  585. return redirect('/')