from .tool.func import * def api_topic_sub_2(conn, topic_num): curs = conn.cursor() topic_num = str(topic_num) if flask.request.args.get('num', None): curs.execute(db_change("select id, data, date, ip, block, top from topic where code = ? and id + 0 = ? + 0 order by id + 0 asc"), [ topic_num, flask.request.args.get('num', '') ]) elif flask.request.args.get('top', None): curs.execute(db_change("select id, data, date, ip, block, top from topic where code = ? and top = 'O' order by id + 0 asc"), [topic_num]) else: curs.execute(db_change("select id, data, date, ip, block, top from topic where code = ? order by id + 0 asc"), [topic_num]) data = curs.fetchall() if data: json_data = {} admin = admin_check(3) for i in data: ip = ip_pas(i[3]) if i[4] != 'O': t_data_f = i[1] b_color = 'toron_color' else: if admin == 1: t_data_f = i[1] b_color = 'toron_color_grey' else: t_data_f = '' b_color = 'toron_color_not' ip += ' (B)' if flask.request.args.get('render', None): if i[0] == '1': s_user = i[3] else: if flask.request.args.get('num', None): curs.execute(db_change("select ip from topic where code = ? order by id + 0 asc limit 1"), [topic_num]) g_data = curs.fetchall() if g_data: s_user = g_data[0][0] else: s_user = '' if flask.request.args.get('top', None): t_color = 'toron_color_red' elif i[3] == s_user and i[5] != '1': t_color = 'toron_color_green' elif i[5] == '1': t_color = 'toron_color_blue' else: t_color = 'toron_color' if admin == 1 or b_color != 'toron_color_not': ip += ' (' + load_lang('discussion_tool') + ')' if t_data_f == '': t_data_f = '[br]' t_data_f = render_set(data = t_data_f, num = 2, include = 'topic_' + i[0]) t_plus_data = t_data_f[1] t_data_f = t_data_f[0] all_data = '' + \ '
| ' + \ '#' + i[0] + ' ' + ip + ' ' + i[2] + '' + \ ' | ' + \ '
| ' + \
' ' + t_data_f + ' ' + \
' | ' + \
'