from .tool.func import * def recent_discuss(tool): with get_db_connect() as conn: curs = conn.cursor() div = '' admin_auth = admin_check(conn, 3) if tool == 'normal': div += '(' + get_lang(conn, 'close_discussion') + ') ' div += '(' + get_lang(conn, 'open_discussion_list') + ')' m_sub = 0 elif tool == 'close': div += '(' + get_lang(conn, 'normal') + ')' m_sub = ' (' + get_lang(conn, 'closed') + ')' else: div += '(' + get_lang(conn, 'normal') + ')' m_sub = ' (' + get_lang(conn, 'open_discussion_list') + ')' div += '''
''' if tool == 'normal': curs.execute(db_change("select title, sub, date, code from rd where not stop = 'O' order by date desc limit 50")) elif tool == 'close': curs.execute(db_change("select title, sub, date, code from rd where stop = 'O' order by date desc limit 50")) else: curs.execute(db_change('select title, sub, date, code from rd where stop != "O" order by date asc limit 50')) db_data = curs.fetchall() last_editor = [] for for_a in db_data: curs.execute(db_change("select ip from topic where code = ? order by id + 0 desc limit 1"), [for_a[3]]) db_data_2 = curs.fetchall() if db_data_2: last_editor += [db_data_2[0][0]] else: last_editor += [''] last_editor_ip_pas = ip_pas(conn, last_editor) count = 0 for data in db_data: div += '' + \ '' + \ '' + \ '' + \ '' + \ '' + \ '' count += 1 div += '' + \ '' + \ '
''' + get_lang(conn, 'discussion_name') + ''' ''' + get_lang(conn, 'editor') + ''' ''' + get_lang(conn, 'time') + '''
' + \ '' + html.escape(data[1]) + ' ' + \ '(' + html.escape(data[0]) + ')' + \ (' (' + get_lang(conn, 'tool') + ')' if admin_auth == 1 else '') + \ '' + last_editor_ip_pas[last_editor[count]] + '' + data[2] + '
' + \ '' return easy_minify(conn, flask.render_template(skin_check(conn), imp = [get_lang(conn, 'recent_discussion'), wiki_set(conn), wiki_custom(conn), wiki_css([m_sub, 0])], data = div, menu = [['other', get_lang(conn, 'return')]] ))