from .tool.func import *
def filter_all(tool):
with get_db_connect() as conn:
curs = conn.cursor()
div = '
'
div += ''
div += '| A | '
div += 'B | '
div += 'C | '
div += '
'
admin = acl_check(tool = 'owner_auth')
admin = 1 if admin == 0 else 0
if tool == 'edit_filter':
if acl_check('', 'edit_filter_view', '', '') == 1:
return re_error(conn, 0)
if tool == 'inter_wiki':
title = get_lang(conn, 'interwiki_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'inter_wiki'"))
elif tool == 'email_filter':
title = get_lang(conn, 'email_filter_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'email'"))
elif tool == 'name_filter':
title = get_lang(conn, 'id_filter_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'name'"))
elif tool == 'edit_filter':
title = get_lang(conn, 'edit_filter_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'regex_filter'"))
elif tool == 'file_filter':
title = get_lang(conn, 'file_filter_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'file'"))
elif tool == 'image_license':
title = get_lang(conn, 'image_license_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'image_license'"))
elif tool == 'extension_filter':
title = get_lang(conn, 'extension_filter_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'extension'"))
elif tool == 'document':
title = get_lang(conn, 'document_filter_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'document'"))
elif tool == 'outer_link':
title = get_lang(conn, 'outer_link_filter_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'outer_link'"))
elif tool == 'template':
title = get_lang(conn, 'template_document_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'template'"))
else:
title = get_lang(conn, 'edit_tool_list')
curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'edit_top'"))
db_data = curs.fetchall()
for data in db_data:
div += ''
div += '| '
div += html.escape(data[0])
if admin == 1:
if tool in ('inter_wiki', 'outer_link', 'edit_filter', 'document', 'edit_top', 'template'):
div += ' (' + get_lang(conn, 'edit') + ')'
div += ' (' + get_lang(conn, 'delete') + ')'
div += ' | '
if tool in ('inter_wiki', 'outer_link'):
if tool == 'inter_wiki':
div += '' + html.escape(data[1]) + ' | '
else:
div += '' + html.escape(data[1]) + ' | '
div += '' + data[2] + ' | '
else:
div += '' + html.escape(data[1]) + ' | '
div += '' + html.escape(data[2]) + ' | '
div += '
'
div += '
'
if admin == 1:
div += '