from .tool.func import * def view_read_2(conn, name): curs = conn.cursor() sub = '' acl = '' div = '' num = flask.request.args.get('num', None) if num: num = int(number_check(num)) else: if not flask.request.args.get('from', None): curs.execute("select title from back where link = ? and type = 'redirect'", [name]) r_db = curs.fetchall() if r_db: r_data = link_fix(r_db[0][0]) return redirect('/w/' + r_data[0] + '?from=' + name + r_data[1]) curs.execute("select sub from rd where title = ? and not stop = 'O' order by date desc", [name]) if curs.fetchall(): sub += ' (' + load_lang('discussion') + ')' curs.execute("select link from back where title = ? and type = 'cat' order by link asc", [name]) curs.execute("select title from data where title like ?", ['%' + name + '/%']) if curs.fetchall(): down = 1 else: down = 0 m = re.search("^(.*)\/(.*)$", name) if m: uppage = m.groups()[0] else: uppage = 0 if re.search('^category:', name): curs.execute("select link from back where title = ? and type = 'cat' order by link asc", [name]) back = curs.fetchall() if back: div = '

' + load_lang('category') + '

' if div == '

' + load_lang('category') + '

': div = '' if u_div != '': div += '

' + load_lang('under_category') + '

' if num: curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [name, str(num)]) if curs.fetchall() and admin_check(6) != 1: return redirect('/history/' + url_pas(name)) curs.execute("select title, data from history where title = ? and id = ?", [name, str(num)]) else: curs.execute("select title, data from data where title = ?", [name]) data = curs.fetchall() if data: else_data = data[0][1] else: else_data = None curs.execute("select decu from acl where title = ?", [name]) data = curs.fetchall() if data: acl += ' (' + load_lang('acl') + ')' if flask.request.args.get('from', None) and else_data: else_data = re.sub('^\r\n', '', else_data) else_data = re.sub('\r\n$', '', else_data) end_data = render_set( title = name, data = else_data ) if end_data == 'HTTP Request 401.3': response_data = 401 curs.execute('select data from other where name = "error_401"') sql_d = curs.fetchall() if sql_d and sql_d[0][0] != '': end_data = '

' + load_lang('error') + '

' else: end_data = '

' + load_lang('error') + '

' elif end_data == 'HTTP Request 404': response_data = 404 curs.execute('select data from other where name = "error_404"') sql_d = curs.fetchall() if sql_d and sql_d[0][0] != '': end_data = '

' + load_lang('error') + '

' else: end_data = '

' + load_lang('error') + '

' curs.execute('select ip, date, leng, send from history where title = ? order by id desc limit 3', [name]) sql_d = curs.fetchall() if sql_d: end_data += '

' + load_lang('history') + '

' else: response_data = 200 if num: menu = [['history/' + url_pas(name), load_lang('history')]] sub = ' (r' + str(num) + ')' acl = '' r_date = 0 else: if response_data == 404: menu = [['edit/' + url_pas(name), load_lang('create')]] else: menu = [['edit/' + url_pas(name), load_lang('edit')]] menu += [['topic/' + url_pas(name), load_lang('discussion')], ['history/' + url_pas(name), load_lang('history')], ['xref/' + url_pas(name), load_lang('backlink')], ['acl/' + url_pas(name), load_lang('acl')]] if flask.request.args.get('from', None): menu += [['w/' + url_pas(name), load_lang('pass')]] end_data = '''
' + flask.request.args.get('from', None) + ' → ' + name + '''

''' + end_data if uppage != 0: menu += [['w/' + url_pas(uppage), load_lang('upper')]] if down: menu += [['down/' + url_pas(name), load_lang('sub')]] curs.execute("select date from history where title = ? order by date desc limit 1", [name]) date = curs.fetchall() if date: r_date = date[0][0] else: r_date = 0 div = end_data + div adsense_code = '
{}
' curs.execute("select data from other where name = 'adsense'") adsense_enabled = curs.fetchall()[0][0] if adsense_enabled == 'True': curs.execute("select data from other where name = 'adsense_code'") adsense_code = adsense_code.format(curs.fetchall()[0][0]) else: adsense_code = adsense_code.format('') curs.execute("select data from other where name = 'body'") body = curs.fetchall() if body: div = body[0][0] + '
' + div div = adsense_code + '
' + div + '
' # 이 부분 개선 필요 match = re.search("^user:([^/]*)", name) if match: user_name = match.groups()[0] div = '''
''' + div return easy_minify(flask.render_template(skin_check(), imp = [flask.request.args.get('show', name), wiki_set(), custom(), other2([sub + acl, r_date])], data = div, menu = menu )), response_data