from .tool.func import * def setting_adsense_2(conn): curs = conn.cursor() if admin_check(None, 'adsense setting') != 1: return re_error('/error/3') if flask.request.method == 'POST': try: adsense_enabled = flask.request.form.get('adsense_enabled') adsense_code = flask.request.form['adsense_code'] except: return easy_minify(flask.render_template(skin_check(), imp = [load_lang('inter_error'), wiki_set(), custom(), other2([0, 0])], data = '

ie_no_data_required

' + load_lang('ie_no_data_required'), menu = [['other', load_lang('return')]] )) if adsense_enabled == 'on': curs.execute('update other set data = "True" where name = "adsense"') else: curs.execute('update other set data = "False" where name = "adsense"') curs.execute('update other set data = ? where name = "adsense_code"', [adsense_code]) conn.commit() return redirect('/adsense_setting') body_content = '' curs.execute('select data from other where name = "adsense"') adsense_enabled = curs.fetchall()[0][0] curs.execute('select data from other where name = "adsense_code"') adsense_code = curs.fetchall()[0][0] template = '''


''' body_content += template.format( 'checked' if adsense_enabled == 'True' else '', load_lang('adsense_enable'), adsense_code, load_lang('save') ) return easy_minify(flask.render_template(skin_check(), imp = [load_lang('adsense_setting'), wiki_set(), custom(), other2([0, 0])], data = body_content, menu = [['other', load_lang('return')]] ))