소스 검색

필요 없어짐

ect (or 2du) 8 년 전
부모
커밋
d2231d9025
2개의 변경된 파일157개의 추가작업 그리고 157개의 파일을 삭제
  1. 141 141
      app.py
  2. 16 16
      func.py

+ 141 - 141
app.py

@@ -54,7 +54,7 @@ conn = sqlite3.connect(set_data['db'] + '.db', check_same_thread = False)
 curs = conn.cursor()
 
 # 보내주기
-load_conn(conn)
+load_conn()
 
 # 기타 설정 변경
 logging.basicConfig(level = logging.ERROR)
@@ -301,7 +301,7 @@ def del_alarm():
 
 @app.route('/alarm')
 def alarm():
-    if custom(conn)[2] == 0:
+    if custom()[2] == 0:
         return redirect('/login')    
 
     data = '<ul>'    
@@ -318,8 +318,8 @@ def alarm():
     
     data += '</ul>'
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('alarm'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('alarm'), wiki_set(1), custom(), other2([0, 0])],
         data = data,
         menu = [['user', load_lang('user')]]
     ))
@@ -367,8 +367,8 @@ def inter_wiki(tools = None):
         if admin == 1:
             div += '<a href="/' + plus_link + '">(' + load_lang('plus') + ')</a>'
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [title, wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [title, wiki_set(1), custom(), other2([0, 0])],
         data = div,
         menu = [['other', load_lang('other')]]
     ))
@@ -408,8 +408,8 @@ def plus_inter(tools = None):
             title = 'HTML Filter ' + load_lang('plus')
             form_data = '<input placeholder="HTML" type="text" name="title">'
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [title, wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [title, wiki_set(1), custom(), other2([0, 0])],
             data = '<form method="post">' + form_data + '<hr><button type="submit">' + load_lang('plus') + '</button></form>',
             menu = [['other', load_lang('other')]]
         ))
@@ -431,8 +431,8 @@ def edit_set(num = 0):
             x += 1
             li_data += '<li><a href="/edit_set/' + str(x) + '">' + li + '</a></li>'
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [load_lang('setting'), wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [load_lang('setting'), wiki_set(1), custom(), other2([0, 0])],
             data = '<h2>' + load_lang('list') + '</h2><ul>' + li_data + '</ul>',
             menu = [['manager', load_lang('admin')]]
         ))
@@ -501,8 +501,8 @@ def edit_set(num = 0):
                 else:
                     div2 += '<option value="' + skin_data + '">' + skin_data + '</option>'
 
-            return html_minify(render_template(skin_check(conn), 
-                imp = ['Normal', wiki_set(1), custom(conn), other2([0, 0])],
+            return html_minify(render_template(skin_check(), 
+                imp = ['Normal', wiki_set(1), custom(), other2([0, 0])],
                 data = '''
                         <form method="post">
                             <span>''' + load_lang('name') + '''</span>
@@ -594,8 +594,8 @@ def edit_set(num = 0):
 
             conn.commit()
 
-            return html_minify(render_template(skin_check(conn), 
-                imp = ['Set Text', wiki_set(1), custom(conn), other2([0, 0])],
+            return html_minify(render_template(skin_check(), 
+                imp = ['Set Text', wiki_set(1), custom(), other2([0, 0])],
                 data = '''
                         <form method="post">
                             <span>Register Text</span>
@@ -634,8 +634,8 @@ def edit_set(num = 0):
             else:
                 data = ''
 
-            return html_minify(render_template(skin_check(conn), 
-                imp = ['Main HEAD', wiki_set(1), custom(conn), other2([0, 0])],
+            return html_minify(render_template(skin_check(), 
+                imp = ['Main HEAD', wiki_set(1), custom(), other2([0, 0])],
                 data = '''
                         <form method="post">
                             <textarea rows="25" name="content">''' + html.escape(data) + '''</textarea>
@@ -677,8 +677,8 @@ def edit_set(num = 0):
             if not data or data == '':
                 data = ''.join(lines)
 
-            return html_minify(render_template(skin_check(conn), 
-                imp = ['robots.txt', wiki_set(1), custom(conn), other2([0, 0])],
+            return html_minify(render_template(skin_check(), 
+                imp = ['robots.txt', wiki_set(1), custom(), other2([0, 0])],
                 data = '''
                         <a href="/robots.txt">(View)</a>
                         <hr>
@@ -720,8 +720,8 @@ def edit_set(num = 0):
 
             conn.commit()
 
-            return html_minify(render_template(skin_check(conn), 
-                imp = ['Google', wiki_set(1), custom(conn), other2([0, 0])],
+            return html_minify(render_template(skin_check(), 
+                imp = ['Google', wiki_set(1), custom(), other2([0, 0])],
                 data = '''
                         <form method="post">
                             <span>reCAPTCHA (HTML)</span>
@@ -755,8 +755,8 @@ def not_close_topic():
             
     div += '</ul>'
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('open') + ' ' + load_lang('discussion') + ' ' + load_lang('list'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('open') + ' ' + load_lang('discussion') + ' ' + load_lang('list'), wiki_set(1), custom(), other2([0, 0])],
         data = div,
         menu = [['manager', load_lang('admin')]]
     ))
@@ -785,8 +785,8 @@ def acl_list():
         
     div += '</ul>'
     
-    return html_minify(render_template(skin_check(conn), 
-        imp = ['ACL ' + load_lang('document') + ' ' + load_lang('list'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = ['ACL ' + load_lang('document') + ' ' + load_lang('list'), wiki_set(1), custom(), other2([0, 0])],
         data = div,
         menu = [['other', load_lang('other')]]
     ))
@@ -865,8 +865,8 @@ def admin_plus(name = None):
         data += '<li><input type="checkbox" ' + state +  ' name="give" ' + exist_list[6] + '> ' + load_lang('authority') + '</li>'
         data += '<li><input type="checkbox" ' + state +  ' name="owner" ' + exist_list[7] + '> ' + load_lang('owner') + '</li></ul>'
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [load_lang('admin_group') + ' ' + load_lang('plus'), wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [load_lang('admin_group') + ' ' + load_lang('plus'), wiki_set(1), custom(), other2([0, 0])],
             data = '<form method="post">' + data + '<hr><button id="save" ' + state +  ' type="submit">' + load_lang('save') + '</button></form>',
             menu = [['manager', load_lang('admin')]]
         ))        
@@ -886,8 +886,8 @@ def admin_list():
         
     div += '</ul>'
                 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('admin') + ' ' + load_lang('list'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('admin') + ' ' + load_lang('list'), wiki_set(1), custom(), other2([0, 0])],
         data = div,
         menu = [['other', load_lang('other')]]
     ))
@@ -950,8 +950,8 @@ def user_log():
 
     list_data += next_fix('/user_log?num=', num, user_list)
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = ['' + load_lang('recent') + ' ' + load_lang('register') + '', wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = ['' + load_lang('recent') + ' ' + load_lang('register') + '', wiki_set(1), custom(), other2([0, 0])],
         data = list_data,
         menu = 0
     ))
@@ -974,8 +974,8 @@ def admin_log():
     list_data += '</ul>'
     list_data += next_fix('/admin_log?num=', num, get_list)
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = ['' + load_lang('recent') + ' ' + load_lang('authority'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = ['' + load_lang('recent') + ' ' + load_lang('authority'), wiki_set(1), custom(), other2([0, 0])],
         data = list_data,
         menu = 0
     ))
@@ -994,8 +994,8 @@ def give_log():
     
     list_data += '</ul><hr><a href="/manager/8">(' + load_lang('create') + ')</a>'
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('admin_group') + ' ' + load_lang('list'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('admin_group') + ' ' + load_lang('list'), wiki_set(1), custom(), other2([0, 0])],
         data = list_data,
         menu = [['other', load_lang('other')]]
     ))
@@ -1084,8 +1084,8 @@ def update():
 
                 return redirect('/re_start')
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('update'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('update'), wiki_set(1), custom(), other2([0, 0])],
         data = 'Auto Update Is Not Support. <a href="https://github.com/2DU/openNAMU">(GitHub)</a>',
         menu = [['manager/1', load_lang('admin')]]
     ))
@@ -1122,8 +1122,8 @@ def xref(name = None):
       
     div += '</ul>' + next_fix('/xref/' + url_pas(name) + '?num=', num, data_list)
     
-    return html_minify(render_template(skin_check(conn), 
-        imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('backlink') + ')', 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('backlink') + ')', 0])],
         data = div,
         menu = [['w/' + url_pas(name), load_lang('document')]]
     ))
@@ -1149,8 +1149,8 @@ def please():
         
     div += '</ul>' + next_fix('/please?num=', num, data_list)
     
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('need') + ' ' + load_lang('document'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('need') + ' ' + load_lang('document'), wiki_set(1), custom(), other2([0, 0])],
         data = div,
         menu = [['other', load_lang('other')]]
     ))
@@ -1195,8 +1195,8 @@ def recent_discuss(tools = 'normal'):
     else:
         div += '</tbody></table>'
             
-    return html_minify(render_template(skin_check(conn), 
-        imp = ['' + load_lang('recent') + ' ' + load_lang('discussion'), wiki_set(1), custom(conn), other2([m_sub, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = ['' + load_lang('recent') + ' ' + load_lang('discussion'), wiki_set(1), custom(), other2([m_sub, 0])],
         data = div,
         menu = 0
     ))
@@ -1309,8 +1309,8 @@ def block_log(name = None, tool = None, tool2 = None):
     else:
         div += next_fix('/' + url_pas(tool) + '/' + url_pas(name) + '?num=', num, data_list)
                 
-    return html_minify(render_template(skin_check(conn), 
-        imp = ['' + load_lang('recent') + ' ' + load_lang('ban'), wiki_set(1), custom(conn), other2([sub, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = ['' + load_lang('recent') + ' ' + load_lang('ban'), wiki_set(1), custom(), other2([sub, 0])],
         data = div,
         menu = menu
     ))
@@ -1367,8 +1367,8 @@ def deep_search(name = None):
     div += div_plus + '</ul>'
     div += next_fix('/search/' + url_pas(name) + '?num=', num, all_list)
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('search') + ')', 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('search') + ')', 0])],
         data = div,
         menu = 0
     ))
@@ -1411,8 +1411,8 @@ def raw_view(name = None, sub_title = None, num = None):
         p_data = html.escape(data[0][0])
         p_data = '<textarea readonly rows="25">' + p_data + '</textarea>'
         
-        return html_minify(render_template(skin_check(conn), 
-            imp = [v_name, wiki_set(1), custom(conn), other2([sub, 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [v_name, wiki_set(1), custom(), other2([sub, 0])],
             data = p_data,
             menu = menu
         ))
@@ -1462,9 +1462,9 @@ def revert(name = None):
         if not curs.fetchall():
             return redirect('/w/' + url_pas(name))
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('revert') + ')', 0])],
-            data =  '<form method="post"><span>' + request.args.get('num', '0') + load_lang('version') + '</span><hr>' + ip_warring(conn) + '<input placeholder="' + load_lang('why') + '" name="send" type="text"><hr>' + captcha_get(conn) + '<button type="submit">' + load_lang('revert') + '</button></form>',
+        return html_minify(render_template(skin_check(), 
+            imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('revert') + ')', 0])],
+            data =  '<form method="post"><span>' + request.args.get('num', '0') + load_lang('version') + '</span><hr>' + ip_warring() + '<input placeholder="' + load_lang('why') + '" name="send" type="text"><hr>' + captcha_get() + '<button type="submit">' + load_lang('revert') + '</button></form>',
             menu = [['history/' + url_pas(name), load_lang('history')], ['recent_changes', '' + load_lang('recent') + ' ' + load_lang('change') + '']]
         ))            
                     
@@ -1496,8 +1496,8 @@ def big_delete():
 
         return redirect('/')
     else:
-        return html_minify(render_template(skin_check(conn), 
-            imp = [load_lang('bulk_delete'), wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [load_lang('bulk_delete'), wiki_set(1), custom(), other2([0, 0])],
             data = '''
                     <span>
                         Title A
@@ -1534,8 +1534,8 @@ def edit_filter():
     else:
         div = '<a href="/manager/9">(' + load_lang('plus') + ')</a>'
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('edit_filter') + ' ' + load_lang('list'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('edit_filter') + ' ' + load_lang('list'), wiki_set(1), custom(), other2([0, 0])],
         data = div,
         menu = [['manager', load_lang('admin')]]
     ))
@@ -1589,8 +1589,8 @@ def set_edit_filter(name = None):
         else:
             stat = ''
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('edit_filter') + ')', 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('edit_filter') + ')', 0])],
             data = '''
                     <form method="post">
                         <input ''' + stat + ''' type="checkbox" ''' + time_data + ''' name="ban">
@@ -1739,8 +1739,8 @@ def edit(name = None):
 
         js_data = edit_help_button()
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('edit') + ')', 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('edit') + ')', 0])],
             data = get_name + js_data[0] + '''
                     <form method="post" action="/edit/''' + url_pas(name) + action + '''">
                         ''' + js_data[1] + '''
@@ -1749,7 +1749,7 @@ def edit(name = None):
                         <hr>
                         <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
                         <hr>
-                        ''' + captcha_get(conn) + ip_warring(conn) + '''
+                        ''' + captcha_get() + ip_warring() + '''
                         <button id="save" type="submit">''' + load_lang('save') + '''</button>
                         <button id="preview" type="submit" formaction="/preview/''' + url_pas(name) + action + '">' + load_lang('preview') + '''</button>
                     </form>
@@ -1780,8 +1780,8 @@ def preview(name = None):
 
     js_data = edit_help_button()
     
-    return html_minify(render_template(skin_check(conn), 
-        imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('preview') + ')', 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('preview') + ')', 0])],
         data = js_data[0] + '''
                 <form method="post" action="/edit/''' + url_pas(name) + action + '''">
                     ''' + js_data[1] + '''
@@ -1790,7 +1790,7 @@ def preview(name = None):
                     <hr>
                     <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
                     <hr>
-                    ''' + captcha_get(conn) + '''
+                    ''' + captcha_get() + '''
                     <button id="save" type="submit">''' + load_lang('save') + '''</button>
                     <button id="preview" type="submit" formaction="/preview/''' + url_pas(name) + action + '">' + load_lang('preview') + '''</button>
                 </form>
@@ -1833,14 +1833,14 @@ def delete(name = None):
         if not curs.fetchall():
             return redirect('/w/' + url_pas(name))
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('delete') + ')', 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('delete') + ')', 0])],
             data = '''
                     <form method="post">
-                        ''' + ip_warring(conn) + '''
+                        ''' + ip_warring() + '''
                         <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
                         <hr>
-                        ''' + captcha_get(conn) + '''
+                        ''' + captcha_get() + '''
                         <button type="submit">''' + load_lang('delete') + '''</button>
                     </form>
                     ''',
@@ -1864,8 +1864,8 @@ def move_data(name = None):
     
     data += '</ul>'
     
-    return html_minify(render_template(skin_check(conn), 
-        imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('move') + ' ' + load_lang('history') + ')', 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('move') + ' ' + load_lang('history') + ')', 0])],
         data = data,
         menu = [['history/' + url_pas(name), load_lang('history')]]
     ))        
@@ -1906,16 +1906,16 @@ def move(name = None):
 
         return redirect('/w/' + url_pas(request.form.get('title', None)))
     else:            
-        return html_minify(render_template(skin_check(conn), 
-            imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('move') + ')', 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('move') + ')', 0])],
             data = '''
                     <form method="post">
-                        ''' + ip_warring(conn) + '''
+                        ''' + ip_warring() + '''
                         <input placeholder="''' + load_lang('document') + ' ' + load_lang('name') + '" value="' + name + '''" name="title" type="text">
                         <hr>
                         <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
                         <hr>
-                        ''' + captcha_get(conn) + '''
+                        ''' + captcha_get() + '''
                         <button type="submit">''' + load_lang('move') + '''</button>
                     </form>
                     ''',
@@ -1924,8 +1924,8 @@ def move(name = None):
             
 @app.route('/other')
 def other():
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('other') + ' ' + load_lang('tool'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('other') + ' ' + load_lang('tool'), wiki_set(1), custom(), other2([0, 0])],
         data = '''
                 <h2>''' + load_lang('record') + '''</h2>
                 <ul>
@@ -1967,8 +1967,8 @@ def manager(num = 1):
     title_list = [[load_lang('document') + ' ' + load_lang('name'), 'acl'], [0, 'check'], [0, 'ban'], [0, 'admin'], [0, 'record'], [0, 'topic_record'], [load_lang('name'), 'admin_plus'], [load_lang('name'), 'edit_filter'], [load_lang('document') + ' ' + load_lang('name'), 'search'], [0, 'block_user'], [0, 'block_admin'], [load_lang('document') + ' ' + load_lang('name'), 'watch_list']]
     
     if num == 1:
-        return html_minify(render_template(skin_check(conn), 
-            imp = [load_lang('admin') + ' ' + load_lang('tool'), wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [load_lang('admin') + ' ' + load_lang('tool'), wiki_set(1), custom(), other2([0, 0])],
             data = '''
                     <h2>''' + load_lang('admin') + '''</h2>
                     <ul>
@@ -2001,8 +2001,8 @@ def manager(num = 1):
             else:
                 placeholder = title_list[(num - 2)][0]
 
-            return html_minify(render_template(skin_check(conn), 
-                imp = ['Redirect', wiki_set(1), custom(conn), other2([0, 0])],
+            return html_minify(render_template(skin_check(), 
+                imp = ['Redirect', wiki_set(1), custom(), other2([0, 0])],
                 data = '<form method="post"><input placeholder="' + placeholder + '" name="name" type="text"><hr><button type="submit">' + load_lang('move') + '</button></form>',
                 menu = [['manager', load_lang('admin')]]
             ))
@@ -2065,8 +2065,8 @@ def title_index():
     data += '</ul>' + next_fix('/title_index?num=' + str(num) + '&page=', page, title_list, num)
     sub = ' (' + str(num) + '개)'
     
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('all') + ' ' + load_lang('document'), wiki_set(1), custom(conn), other2([sub, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('all') + ' ' + load_lang('document'), wiki_set(1), custom(), other2([sub, 0])],
         data = data,
         menu = [['other', load_lang('other')]]
     ))
@@ -2204,8 +2204,8 @@ def topic_admin(name = None, sub = None, num = None):
 
     ban = '<h2>정보</h2><ul>' + ban
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('discussion') + ' ' + load_lang('tool'), wiki_set(1), custom(conn), other2([' (' + str(num) + '번)', 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('discussion') + ' ' + load_lang('tool'), wiki_set(1), custom(), other2([' (' + str(num) + '번)', 0])],
         data = ban,
         menu = [['topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '#' + str(num), load_lang('discussion')]]
     ))
@@ -2363,15 +2363,15 @@ def topic(name = None, sub = None):
                     <br>
                     <textarea style="height: 100px;" name="content"></textarea>
                     <hr>
-                    ''' + captcha_get(conn)
+                    ''' + captcha_get()
             
             if display == '':
-                data += ip_warring(conn)
+                data += ip_warring()
 
             data += '<button type="submit">Send</button></form>'
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('discussion') + ')', 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('discussion') + ')', 0])],
             data = '<h2 id="topic_top_title">' + sub + '</h2>' + all_data + data,
             menu = [['topic/' + url_pas(name), load_lang('list')]]
         ))
@@ -2433,8 +2433,8 @@ def close_topic_list(name = None, tool = None):
         if div == '':
             plus = re.sub('^<br>', '', plus)
         
-        return html_minify(render_template(skin_check(conn), 
-            imp = [name, wiki_set(1), custom(conn), other2([' (' + sub + ')', 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [name, wiki_set(1), custom(), other2([' (' + sub + ')', 0])],
             data =  '<form method="post">' + div + plus + '</form>',
             menu = menu
         ))
@@ -2457,7 +2457,7 @@ def login():
 
         curs.execute("select block from ban where block = ? and login = 'O'", [match])
         if not curs.fetchall():
-            ban = ban_check(conn)
+            ban = ban_check()
         else:
             ban = 0
     else:
@@ -2495,18 +2495,18 @@ def login():
         
         return redirect('/user')  
     else:        
-        return html_minify(render_template(skin_check(conn),    
-            imp = [load_lang('login'), wiki_set(1), custom(conn), other2([0, 0])],
-            data = '<form method="post"><input placeholder="아이디" name="id" type="text"><hr><input placeholder="비밀번호" name="pw" type="password"><hr>' + captcha_get(conn) + '<button type="submit">' + load_lang('login') + '</button><hr><span>' + load_lang('http_warring') + '</span></form>',
+        return html_minify(render_template(skin_check(),    
+            imp = [load_lang('login'), wiki_set(1), custom(), other2([0, 0])],
+            data = '<form method="post"><input placeholder="아이디" name="id" type="text"><hr><input placeholder="비밀번호" name="pw" type="password"><hr>' + captcha_get() + '<button type="submit">' + load_lang('login') + '</button><hr><span>' + load_lang('http_warring') + '</span></form>',
             menu = [['user', load_lang('user')]]
         ))
                 
 @app.route('/change', methods=['POST', 'GET'])
 def change_password():
-    if ban_check(conn) == 1:
+    if ban_check() == 1:
         return re_error('/ban')
 
-    if custom(conn)[2] == 0:
+    if custom()[2] == 0:
         return redirect('/login')
     
     if request.method == 'POST':    
@@ -2559,8 +2559,8 @@ def change_password():
             else:
                 div2 += '<option value="' + skin_data + '">' + skin_data + '</option>'
 
-        return html_minify(render_template(skin_check(conn),    
-            imp = [load_lang('my_info') + ' ' + load_lang('edit'), wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(),    
+            imp = [load_lang('my_info') + ' ' + load_lang('edit'), wiki_set(1), custom(), other2([0, 0])],
             data = '''
                     <form method="post">
                         <span>ID : ''' + ip + '''</span>
@@ -2638,8 +2638,8 @@ def user_check(name = None):
     else:
         return re_error('/error/5')
             
-    return html_minify(render_template(skin_check(conn),    
-        imp = ['' + load_lang('check') + '', wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(),    
+        imp = ['' + load_lang('check') + '', wiki_set(1), custom(), other2([0, 0])],
         data = div,
         menu = [['manager', load_lang('admin')]]
     ))
@@ -2649,8 +2649,8 @@ def plus_check(name):
     if request.method == 'POST':
         return redirect('/check/' + url_pas(name) + '?plus=' + url_pas(request.form.get('name2', None)))
     else:
-        return html_minify(render_template(skin_check(conn),
-            imp = ['' + load_lang('plus'), wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(),
+            imp = ['' + load_lang('plus'), wiki_set(1), custom(), other2([0, 0])],
             data = '''
                     <form method="post">
                         <input placeholder="' + load_lang('compare') + '" name="name2" type="text">
@@ -2663,7 +2663,7 @@ def plus_check(name):
                 
 @app.route('/register', methods=['POST', 'GET'])
 def register():
-    if ban_check(conn) == 1:
+    if ban_check() == 1:
         return re_error('/ban')
 
     if not admin_check(None, None) == 1:
@@ -2710,8 +2710,8 @@ def register():
         if data and data[0][0] != '':
             contract = data[0][0] + '<hr>'
 
-        return html_minify(render_template(skin_check(conn),    
-            imp = ['' + load_lang('register') + '', wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(),    
+            imp = ['' + load_lang('register') + '', wiki_set(1), custom(), other2([0, 0])],
             data = '''
                     <form method="post">
                         ''' + contract + '''
@@ -2723,7 +2723,7 @@ def register():
                         <hr>
                         <input placeholder="Email (Option)" name="email" type="text">
                         <hr>
-                        ''' + captcha_get(conn) + '''
+                        ''' + captcha_get() + '''
                         <button type="submit">' + load_lang('register') + '</button>
                         <hr>
                         <span>''' + load_lang('http_warring') + '''</span>
@@ -2833,8 +2833,8 @@ def user_ban(name = None):
 
             data += '<input placeholder="' + load_lang('why') + '" name="why" type="text"><hr>' + plus
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [name, wiki_set(1), custom(conn), other2([' (' + now + ')', 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [name, wiki_set(1), custom(), other2([' (' + now + ')', 0])],
             data = '<form method="post">' + data + '<button type="submit">' + now + '</button></form>',
             menu = [['manager', load_lang('admin')]]
         ))            
@@ -2850,7 +2850,7 @@ def acl(name = None):
     
     user_data = re.search('^' + load_lang('user') + ':(.+)$', name)
     if user_data:
-        if check_data and custom(conn)[2] == 0:
+        if check_data and custom()[2] == 0:
             return redirect('/login')
         
         if user_data.groups()[0] != ip_check():
@@ -2920,8 +2920,8 @@ def acl(name = None):
             if acl_data:
                 data += '<hr><input value="' + html.escape(acl_data[0][1]) + '" placeholder="' + load_lang('why') + '" name="why" type="text" ' + check_ok + '>'
             
-        return html_minify(render_template(skin_check(conn), 
-            imp = [name, wiki_set(1), custom(conn), other2([' (ACL)', 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [name, wiki_set(1), custom(), other2([' (ACL)', 0])],
             data = '<form method="post">' + data + '<hr><button type="submit">ACL ' + load_lang('edit') + '</button></form>',
             menu = [['w/' + url_pas(name), load_lang('document')], ['manager', load_lang('admin')]]
         ))
@@ -2980,8 +2980,8 @@ def user_admin(name = None):
                 else:
                     div += '<option value="' + data[0] + '">' + data[0] + '</option>'
         
-        return html_minify(render_template(skin_check(conn), 
-            imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('authority') + ')', 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('authority') + ')', 0])],
             data =  '<form method="post"><select name="select">' + div + '</select><hr><button type="submit">' + load_lang('edit') + '</button></form>',
             menu = [['manager', load_lang('admin')]]
         ))
@@ -3006,8 +3006,8 @@ def diff_data(name = None):
                 diff_data = difflib.SequenceMatcher(None, first_data, second_data)
                 result = re.sub('\r', '', diff(diff_data))
             
-            return html_minify(render_template(skin_check(conn), 
-                imp = [name, wiki_set(1), custom(conn), other2([' (' + load_lang('compare') + ')', 0])],
+            return html_minify(render_template(skin_check(), 
+                imp = [name, wiki_set(1), custom(), other2([' (' + load_lang('compare') + ')', 0])],
                 data = '<pre>' + result + '</pre>',
                 menu = [['history/' + url_pas(name), load_lang('history')]]
             ))
@@ -3024,8 +3024,8 @@ def down(name = None):
         
     div += '</ul>'
     
-    return html_minify(render_template(skin_check(conn), 
-        imp = [name, wiki_set(1), custom(conn), other2([' (하위)', 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [name, wiki_set(1), custom(), other2([' (하위)', 0])],
         data = div,
         menu = [['w/' + url_pas(name), load_lang('document')]]
     ))
@@ -3176,8 +3176,8 @@ def read_view(name = None):
 
     div = end_data + div
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [name, wiki_set(1), custom(conn), other2([sub + acl, r_date])],
+    return html_minify(render_template(skin_check(), 
+        imp = [name, wiki_set(1), custom(), other2([sub + acl, r_date])],
         data = div,
         menu = menu
     )), response_data
@@ -3222,8 +3222,8 @@ def user_topic_list(name = None):
     else:
         sub = 0 
     
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('discussion') + ' ' + load_lang('record'), wiki_set(1), custom(conn), other2([sub, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('discussion') + ' ' + load_lang('record'), wiki_set(1), custom(), other2([sub, 0])],
         data = div,
         menu = [['other', load_lang('other')], ['user', load_lang('user')], ['count/' + url_pas(name), '' + load_lang('count') + ''], ['record/' + url_pas(name), load_lang('record')]]
     ))
@@ -3411,15 +3411,15 @@ def recent_changes(name = None, tool = 'record'):
         if sub == '':
             sub = 0
                 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [title, wiki_set(1), custom(conn), other2([sub, 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [title, wiki_set(1), custom(), other2([sub, 0])],
             data = div,
             menu = menu
         ))
     
 @app.route('/upload', methods=['GET', 'POST'])
 def upload():
-    if ban_check(conn) == 1:
+    if ban_check() == 1:
         return re_error('/ban')
     
     if request.method == 'POST':
@@ -3459,7 +3459,7 @@ def upload():
         if request.form.get('f_lice', None):
             lice = request.form.get('f_lice', None)
         else:
-            if custom(conn)[2] == 0:
+            if custom()[2] == 0:
                 lice = ip + ' Upload'
             else:
                 lice = '[[' + load_lang('user') + ':' + ip + ']] Upload'
@@ -3484,8 +3484,8 @@ def upload():
         
         return redirect('/w/' + load_lang('file') + ':' + name)      
     else:
-        return html_minify(render_template(skin_check(conn), 
-            imp = [load_lang('upload'), wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [load_lang('upload'), wiki_set(1), custom(), other2([0, 0])],
             data =  '''
                     <form method="post" enctype="multipart/form-data" accept-charset="utf8">
                         <input type="file" name="f_data">
@@ -3494,7 +3494,7 @@ def upload():
                         <hr>
                         <input placeholder="''' + load_lang('license') + '''" name="f_lice" type="text">
                         <hr>
-                        ''' + captcha_get(conn) + '''
+                        ''' + captcha_get() + '''
                         <button id="save" type="submit">''' + load_lang('save') + '''</button>
                     </form>
                     ''',
@@ -3507,7 +3507,7 @@ def user_info():
     
     curs.execute("select acl from user where id = ?", [ip])
     data = curs.fetchall()
-    if ban_check(conn) == 0:
+    if ban_check() == 0:
         if data:
             if data[0][0] != 'user':
                 acl = data[0][0]
@@ -3538,7 +3538,7 @@ def user_info():
             if block_data[0][2] == 'O':
                 acl += ' (대역)'
             
-    if custom(conn)[2] != 0:
+    if custom()[2] != 0:
         ip_user = '<a href="/w/' + load_lang('user') + ':' + ip + '">' + ip + '</a>'
         
         plus = '<li><a href="/logout">로그아웃</a></li><li><a href="/change">' + load_lang('my_info') + ' ' + load_lang('edit') + '</a></li>'
@@ -3556,8 +3556,8 @@ def user_info():
         plus = '<li><a href="/login">' + load_lang('login') + '</a></li>'
         plus2 = ''
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = [load_lang('user') + ' ' + load_lang('tool'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = [load_lang('user') + ' ' + load_lang('tool'), wiki_set(1), custom(), other2([0, 0])],
         data =  '''
                 <h2>상태</h2>
                 <ul>
@@ -3583,7 +3583,7 @@ def user_info():
 def watch_list():
     div = 'Limit : 10<hr>'
     
-    if custom(conn)[2] == 0:
+    if custom()[2] == 0:
         return redirect('/login')
 
     curs.execute("select title from scan where user = ?", [ip_check()])
@@ -3596,15 +3596,15 @@ def watch_list():
 
     div += '<a href="/manager/13">(' + load_lang('plus') + ')</a>'
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = ['' + load_lang('watchlist') + ' ' + load_lang('list'), wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = ['' + load_lang('watchlist') + ' ' + load_lang('list'), wiki_set(1), custom(), other2([0, 0])],
         data = div,
         menu = [['manager', load_lang('admin')]]
     ))
 
 @app.route('/watch_list/<path:name>')
 def watch_list_name(name = None):
-    if custom(conn)[2] == 0:
+    if custom()[2] == 0:
         return redirect('/login')
 
     ip = ip_check()
@@ -3629,7 +3629,7 @@ def custom_head_view():
     ip = ip_check()
 
     if request.method == 'POST':
-        if custom(conn)[2] != 0:
+        if custom()[2] != 0:
             curs.execute("select user from custom where user = ?", [ip + ' (head)'])
             if curs.fetchall():
                 curs.execute("update custom set css = ? where user = ?", [request.form.get('content', None), ip + ' (head)'])
@@ -3642,7 +3642,7 @@ def custom_head_view():
 
         return redirect('/user')
     else:
-        if custom(conn)[2] != 0:
+        if custom()[2] != 0:
             start = ''
 
             curs.execute("select css from custom where user = ?", [ip + ' (head)'])
@@ -3661,8 +3661,8 @@ def custom_head_view():
 
         start += '<span>&lt;style&gt;CSS&lt;/style&gt;<br>&lt;script&gt;JS&lt;/script&gt;</span><hr>'
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = [load_lang('user') + ' HEAD', wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = [load_lang('user') + ' HEAD', wiki_set(1), custom(), other2([0, 0])],
             data =  start + '''
                     <form method="post">
                         <textarea rows="25" cols="100" name="content">''' + data + '''</textarea>
@@ -3695,8 +3695,8 @@ def count_edit(name = None):
     else:
         t_data = 0
 
-    return html_minify(render_template(skin_check(conn), 
-        imp = ['' + load_lang('count') + '', wiki_set(1), custom(conn), other2([0, 0])],
+    return html_minify(render_template(skin_check(), 
+        imp = ['' + load_lang('count') + '', wiki_set(1), custom(), other2([0, 0])],
         data = '''
                 <ul>
                     <li><a href="/record/''' + url_pas(that) + '''">''' + load_lang('edit') + '''</a> : ''' + str(data) + '''</li>

+ 16 - 16
func.py

@@ -32,12 +32,12 @@ def load_conn(data):
     conn = data
     curs = conn.cursor()
 
-    load_conn2(conn)
+    load_conn2()
 
-def captcha_get(conn):
+def captcha_get():
     data = ''
 
-    if custom(conn)[2] == 0:
+    if custom()[2] == 0:
         curs.execute('select data from other where name = "recaptcha"')
         recaptcha = curs.fetchall()
         if recaptcha and recaptcha[0][0] != '':
@@ -50,7 +50,7 @@ def captcha_get(conn):
 
 def captcha_post(test, num = 1):
     if num == 1:
-        if custom(conn)[2] == 0 and captcha_get(conn) != '':
+        if custom()[2] == 0 and captcha_get() != '':
             curs.execute('select data from other where name = "sec_re"')
             sec_re = curs.fetchall()
             if sec_re and sec_re[0][0] != '':
@@ -114,8 +114,8 @@ def edit_help_button():
 
     return ['', '']
 
-def ip_warring(conn):
-    if custom(conn)[2] == 0:    
+def ip_warring():
+    if custom()[2] == 0:    
         curs.execute('select data from other where name = "no_login_warring"')
         data = curs.fetchall()
         if data and data[0][0] != '':
@@ -127,7 +127,7 @@ def ip_warring(conn):
 
     return text_data
 
-def skin_check(conn):
+def skin_check():
     skin = './views/acme/'
     
     try:
@@ -298,7 +298,7 @@ def ip_pas(raw_ip):
 
     return ip
 
-def custom(conn):
+def custom():
     if 'MyMaiToNight' in session:
         user_head = session['MyMaiToNight']
     else:
@@ -333,7 +333,7 @@ def custom(conn):
 def acl_check(name):
     ip = ip_check()
 
-    if ban_check(conn) == 1:
+    if ban_check() == 1:
         return 1
 
     acl_c = re.search("^" + load_lang('user') + ":([^/]*)", name)
@@ -397,7 +397,7 @@ def acl_check(name):
 
     return 0
 
-def ban_check(conn):
+def ban_check():
     ip = ip_check()
 
     band = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
@@ -419,7 +419,7 @@ def ban_check(conn):
 def topic_check(name, sub):
     ip = ip_check()
 
-    if ban_check(conn) == 1:
+    if ban_check() == 1:
         return 1
         
     curs.execute("select acl from user where id = ?", [ip])
@@ -506,7 +506,7 @@ def re_error(data):
 
         end = '<li>Why : 권한이 맞지 않는 상태 입니다.</li>'
 
-        if ban_check(conn) == 1:
+        if ban_check() == 1:
             curs.execute("select end, why from ban where block = ?", [ip])
             end_data = curs.fetchall()
             if not end_data:
@@ -537,8 +537,8 @@ def re_error(data):
                 if end_data[0][1] != '':
                     end += '<li>Why : ' + end_data[0][1] + '</li>'
 
-        return html_minify(render_template(skin_check(conn), 
-            imp = ['Authority Error', wiki_set(1), custom(conn), other2([0, 0])],
+        return html_minify(render_template(skin_check(), 
+            imp = ['Authority Error', wiki_set(1), custom(), other2([0, 0])],
             data = '<h2>Info</h2><ul>' + end + '</ul>',
             menu = 0
         ))
@@ -614,8 +614,8 @@ def re_error(data):
             data = '???'
 
         if title:
-            return html_minify(render_template(skin_check(conn), 
-                imp = [title, wiki_set(1), custom(conn), other2([0, 0])],
+            return html_minify(render_template(skin_check(), 
+                imp = [title, wiki_set(1), custom(), other2([0, 0])],
                 data = '<h2>Error</h2><ul><li>' + data + '</li></ul>',
                 menu = 0
             ))