from .tool.func import * def recent_discuss(tool): with get_db_connect() as conn: curs = conn.cursor() div = '' if tool == 'normal': div += '(' + load_lang('close_discussion') + ') ' div += '(' + load_lang('open_discussion_list') + ')' if admin_check() == 1: div += ' (' + load_lang('delete') + ')' m_sub = 0 elif tool == 'close': div += '(' + load_lang('normal') + ')' m_sub = ' (' + load_lang('closed') + ')' else: div += '(' + load_lang('normal') + ')' m_sub = ' (' + load_lang('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(last_editor) count = 0 for data in db_data: div += '' + \ '' + \ '' + \ '' + \ '' + \ '' + \ '' count += 1 div += '' + \ '' + \ '
''' + load_lang('discussion_name') + ''' ''' + load_lang('editor') + ''' ''' + load_lang('time') + '''
' + \ '' + html.escape(data[1]) + ' ' + \ '(' + html.escape(data[0]) + ')' + \ '' + last_editor_ip_pas[last_editor[count]] + '' + data[2] + '
' + \ '' return easy_minify(flask.render_template(skin_check(), imp = [load_lang('recent_discussion'), wiki_set(), wiki_custom(), wiki_css([m_sub, 0])], data = div, menu = 0 ))