from .tool.func import * def recent_changes_2(conn, name, tool): curs = conn.cursor() if flask.request.method == 'POST': return redirect( '/diff/' + url_pas(name) + '?first=' + flask.request.form.get('b', '1') + '&second=' + flask.request.form.get('a', '1') ) else: ban = '' select = '' sub = '' div = ''' ''' num = int(number_check(flask.request.args.get('num', '1'))) sql_num = (num * 50 - 50) if num * 50 > 0 else 0 if name: if tool == 'history': sub += ' (' + load_lang('history') + ')' div += ''' ''' tool_select = flask.request.args.get('tool', 'normal') if tool_select == 'move': plus_sql = 'where (send like ? or send like ?) and type = "" ' plus_list = ['%(' + name +'%', '%' + name + ' move)', sql_num] sub += ' (' + load_lang('move') + ')' elif tool_select == 'delete': plus_sql = 'where send like "%(delete)" and title = ? and type = "" ' plus_list = [name, sql_num] sub += ' (' + load_lang('delete') + ')' elif tool_select == 'revert': plus_sql = 'where send like ? and title = ? and type = "" ' plus_list = ['%(r%)', name, sql_num] sub += ' (' + load_lang('revert') + ')' else: plus_sql = 'where title = ? and type = "" ' plus_list = [name, sql_num] curs.execute(db_change('' + \ 'select id, title, date, ip, send, leng, hide from history ' + \ plus_sql + \ 'order by id + 0 desc ' + \ "limit ?, 50" + \ ''), plus_list) data_list = curs.fetchall() else: div += ''' ''' div = '(' + load_lang('discussion') + ')
' + div curs.execute(db_change('' + \ 'select id, title, date, ip, send, leng, hide from history ' + \ "where ip = ? and type = '' order by date desc limit ?, 50" + \ ''), [name, sql_num]) data_list = curs.fetchall() else: div += ''' ''' sub = '' set_type = flask.request.args.get('set', 'normal') if set_type != 'normal': if set_type == 'move': plus_sql = 'where send like "% move)" and ' sub += ' (' + load_lang('move') + ')' elif set_type == 'delete': plus_sql = 'where send like "%(delete)" and ' sub += ' (' + load_lang('delete') + ')' elif set_type == 'revert': plus_sql = 'where send like "%(r%)" and ' sub += ' (' + load_lang('revert') + ')' else: plus_sql = 'where ' plus_sql += 'type = "" ' if set_type == 'user': plus_sql = 'where title like "user:%" ' sub += ' (' + load_lang('user') + ')' else: plus_sql += 'and not title like "user:%" ' curs.execute(db_change('' + \ 'select id, title, date, ip, send, leng, hide from history ' + \ plus_sql + \ 'order by date desc ' + \ 'limit 50' + \ '')) data_list = curs.fetchall() else: data_list = [] curs.execute(db_change('select id, title from rc order by date desc')) for i in curs.fetchall(): curs.execute(db_change('select id, title, date, ip, send, leng, hide from history where id = ? and title = ?'), i) data_list += curs.fetchall() div += '' all_ip = ip_pas([i[3] for i in data_list]) for data in data_list: select += '' send = '
' if data[4]: if not re.search(r"^(?: *)$", data[4]): send = data[4] if re.search(r"\+", data[5]): leng = '(' + data[5] + ')' elif re.search(r"\-", data[5]): leng = '(' + data[5] + ')' else: leng = '(' + data[5] + ')' ip = all_ip[data[3]] if tool == 'history': m_tool = '(' + load_lang('tool') + ')' else: m_tool = '(' + load_lang('tool') + ')' style = ['', ''] date = data[2] if data[6] == 'O': if admin_check(6) == 1: style[0] = 'id="toron_color_grey"' style[1] = 'id="toron_color_grey"' send += ' (' + load_lang('hide') + ')' else: ip = '' ban = '' date = '' send = '(' + load_lang('hide') + ')' style[0] = 'style="display: none;"' style[1] = 'id="toron_color_grey"' if tool == 'history': title = 'r' + data[0] + ' ' else: title = '' + html.escape(data[1]) + ' ' title += '(r' + data[0] + ') ' div += ''' ''' div += '''
''' + load_lang('version') + ''' ''' + load_lang('editor') + ''' ''' + load_lang('time') + '''''' + load_lang('document_name') + ''' ''' + load_lang('editor') + ''' ''' + load_lang('time') + '''''' + load_lang('document_name') + ''' ''' + load_lang('editor') + ''' ''' + load_lang('time') + '''
''' + title + m_tool + ' ' + leng + ''' ''' + ip + ban + ''' ''' + date + '''
''' + send_parser(send) + '''
''' if name: if tool == 'history': if tool_select == 'normal': div = '' + \ '(' + load_lang('move') + ') ' + \ '(' + load_lang('delete') + ') ' + \ '(' + load_lang('revert') + ')' + \ '
' + div + \ '' div = '''

''' + div menu = [['w/' + url_pas(name), load_lang('return')]] if admin_check() == 1: menu += [['add_history/' + url_pas(name), load_lang('history_add')]] else: menu = [['history/' + url_pas(name), load_lang('return')]] title = name div += next_fix('/history/' + url_pas(name) + '?tool=' + tool_select + '&num=', num, data_list) else: title = load_lang('edit_record') menu = [['other', load_lang('other')], ['user', load_lang('user')], ['count/' + url_pas(name), load_lang('count')]] div += next_fix('/record/' + url_pas(name) + '?num=', num, data_list) else: div = '' + \ '(' + load_lang('normal') + ') ' + \ '(' + load_lang('user_document') + ') ' + \ '(' + load_lang('move') + ') ' + \ '(' + load_lang('delete') + ') ' + \ '(' + load_lang('revert') + ')' + \ '
' + div + \ '' menu = 0 title = load_lang('recent_change') if sub == '': sub = 0 return easy_minify(flask.render_template(skin_check(), imp = [title, wiki_set(), custom(), other2([sub, 0])], data = div, menu = menu ))