func.py 23 KB

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