from .tool.func import * def user_custom_head_view_2(conn): curs = conn.cursor() ip = ip_check() if flask.request.method == 'POST': get_data = flask.request.form.get('content', '') if ip_or_user(ip) == 0: curs.execute(db_change("select id from user_set where id = ? and name = 'custom_css'"), [ip]) if curs.fetchall(): curs.execute(db_change("update user_set set data = ? where id = ? and name = 'custom_css'"), [get_data, ip]) else: curs.execute(db_change("insert into user_set (id, name, data) values (?, 'custom_css', ?)"), [ip, get_data]) conn.commit() flask.session['head'] = get_data return redirect('/custom_head') else: if ip_or_user(ip) == 0: start = '' curs.execute(db_change("select data from user_set where id = ? and name = 'custom_css'"), [ip]) head_data = curs.fetchall() data = head_data[0][0] if head_data else '' else: start = '' + \ '' + load_lang('user_head_warning') + '' + \ '
' + \ '' data = flask.session['head'] if 'head' in flask.session else '' start += '' + \ '' + \ '<style>CSS</style>' + \ '
' + \ '<script>JS</script>' + \ '
' + \ '
' + \ '' return easy_minify(flask.render_template(skin_check(), imp = [load_lang(data = 'user_head', safe = 1), wiki_set(), wiki_custom(), wiki_css([0, 0])], data = start + '''

''', menu = [['user', load_lang('return')]] ))