소스 검색

역사 추가 기능 추가

Surplus_Up (2DU) 6 년 전
부모
커밋
dc6ac59be8
7개의 변경된 파일90개의 추가작업 그리고 18개의 파일을 삭제
  1. 4 0
      app.py
  2. 1 0
      language/en-US.json
  3. 2 1
      language/ko-KR.json
  4. 15 15
      route/edit.py
  5. 63 0
      route/give_history_add.py
  6. 4 1
      route/recent_changes.py
  7. 1 1
      version.json

+ 4 - 0
app.py

@@ -369,6 +369,10 @@ def list_admin():
 def give_history_hidden(name = None):
     return give_history_hidden_2(conn, name)
 
+@app.route('/add_history/<everything:name>', methods=['POST', 'GET'])
+def give_history_add(name = None):
+    return give_history_add_2(conn, name)
+
 @app.route('/user_log')
 def list_user():
     return list_user_2(conn)

+ 1 - 0
language/en-US.json

@@ -184,6 +184,7 @@
         "many_delete" : "Bulk delete",
         "edit_req" : "Edit request",
         "edit_req_check" : "Check edit request",
+        "history_add" : "Add history",
         "_comment_2.1_" : "Filter",
             "_comment_2.1.1_" : "List",
                 "interwiki_list" : "Interwiki(s) list",

+ 2 - 1
language/ko-KR.json

@@ -313,5 +313,6 @@
     "public_key": "공개키",
     "fast_edit_error": "편집 속도가 너무 빠릅니다. 제한 (초) : ",
     "main_acl_setting": "기본 ACL 설정",
-    "edit_req_acl": "편집 요청 ACL"
+    "edit_req_acl": "편집 요청 ACL",
+    "history_add" : "역사 추가"
 }

+ 15 - 15
route/edit.py

@@ -11,7 +11,7 @@ def edit_2(conn, name):
 
     if acl_check(name) == 1:
         return redirect('/edit_req/' + url_pas(name))
-
+    
     if flask.request.method == 'POST':
         if captcha_post(flask.request.form.get('g-recaptcha-response', '')) == 1:
             return re_error('/error/13')
@@ -26,15 +26,15 @@ def edit_2(conn, name):
 
         if flask.request.form.get('otent', '') == content:
             return redirect('/w/' + url_pas(name))
-
+        
         if edit_filter_do(content) == 1:
             return re_error('/error/21')
 
         content = savemark(content)
-
+        
         if old:
             leng = leng_check(len(flask.request.form.get('otent', '')), len(content))
-
+            
             if section:
                 content = old[0][0].replace(flask.request.form.get('otent', ''), content)
         else:
@@ -52,10 +52,10 @@ def edit_2(conn, name):
         for scan_user in curs.fetchall():
             curs.execute(db_change("insert into alarm (name, data, date) values (?, ?, ?)"), [
                 scan_user[0],
-                ip + ' | <a href="/w/' + url_pas(name) + '">' + name + '</a> | Edit',
+                ip + ' | <a href="/w/' + url_pas(name) + '">' + name + '</a> | Edit', 
                 today
             ])
-
+                
         history_plus(
             name,
             content,
@@ -64,20 +64,20 @@ def edit_2(conn, name):
             flask.request.form.get('send', ''),
             leng
         )
-
+        
         curs.execute(db_change("delete from back where link = ?"), [name])
         curs.execute(db_change("delete from back where title = ? and type = 'no'"), [name])
-
+        
         render_set(
             title = name,
             data = content,
             num = 1
         )
-
+        
         conn.commit()
-
+        
         return redirect('/w/' + url_pas(name))
-    else:
+    else:            
         if old:
             if section:
                 data = re.sub('\n(?P<in>={1,6})', '<br>\g<in>', html.escape('\n' + re.sub('\r\n', '\n', old[0][0]) + '\n'))
@@ -88,7 +88,7 @@ def edit_2(conn, name):
                     if g_data:
                         if int(section) - 1 == i:
                             data = html.unescape(re.sub('<br>(?P<in>={1,6})', '\n\g<in>', g_data.groups()[0]))
-
+                            
                             break
                         else:
                             data = re.sub('((?:<br>)(?:(?:(?!\n|<br>).)+)(?:\n*(?:(?:(?!<br>).)+\n*)+)?)', '\n', data, 1)
@@ -100,7 +100,7 @@ def edit_2(conn, name):
                 data = old[0][0]
         else:
             data = ''
-
+            
         data_old = data
         get_name = ''
 
@@ -109,7 +109,7 @@ def edit_2(conn, name):
                 <a href="/manager/15?plus=''' + url_pas(name) + '">(' + load_lang('load') + ')</a> <a href="/edit_filter">(' + load_lang('edit_filter_rule') + ''')</a>
                 <hr class=\"main_hr\">
             '''
-
+            
         if flask.request.args.get('plus', None):
             curs.execute(db_change("select data from data where title = ?"), [flask.request.args.get('plus', 'test')])
             get_data = curs.fetchall()
@@ -134,7 +134,7 @@ def edit_2(conn, name):
         else:
             p_text = load_lang('defalut_edit_help')
 
-        return easy_minify(flask.render_template(skin_check(),
+        return easy_minify(flask.render_template(skin_check(), 
             imp = [name, wiki_set(), custom(), other2([' (' + sub + ')', 0])],
             data =  get_name + '''
                 <form method="post">

+ 63 - 0
route/give_history_add.py

@@ -0,0 +1,63 @@
+from .tool.func import *
+
+def give_history_add_2(conn, name):
+    curs = conn.cursor()
+
+    ip = ip_check()
+    if admin_check() != 1:
+        return re_error('/ban')
+
+    if flask.request.method == 'POST':
+        today = get_time()
+        content = flask.request.form.get('content', '')
+        content = savemark(content)
+        leng = '+' + str(len(content))
+
+        history_plus(
+            name,
+            content,
+            today,
+            'Add:' + flask.request.form.get('get_ip', ''),
+            flask.request.form.get('send', ''),
+            leng
+        )
+
+        conn.commit()
+
+        return redirect('/history/' + url_pas(name))
+    else:
+        curs.execute(db_change('select data from other where name = "edit_bottom_text"'))
+        sql_d = curs.fetchall()
+        if sql_d and sql_d[0][0] != '':
+            b_text = '<hr class=\"main_hr\">' + sql_d[0][0]
+        else:
+            b_text = ''
+
+        curs.execute(db_change('select data from other where name = "edit_help"'))
+        sql_d = curs.fetchall()
+        if sql_d and sql_d[0][0] != '':
+            p_text = sql_d[0][0]
+        else:
+            p_text = load_lang('defalut_edit_help')
+
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [load_lang('history_add'), wiki_set(), custom(), other2([' (' + name + ')', 0])],
+            data = '''
+                <form method="post">
+                    <script>do_stop_exit();</script>
+                    ''' + edit_button() + '''
+                    <textarea rows="25" id="content" placeholder="''' + p_text + '''" name="content"></textarea>
+                    <hr class=\"main_hr\">
+                    <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
+                    <hr class=\"main_hr\">
+                    <input placeholder="''' + load_lang('name') + '''" name="get_ip" type="text">
+                    <hr class=\"main_hr\">
+                    <button id="save" type="submit" onclick="go_save_zone = 1;">''' + load_lang('save') + '''</button>
+                    <button id="preview" type="button" onclick="load_preview(\'''' + url_pas(name) + '\')">' + load_lang('preview') + '''</button>
+                </form>
+                ''' + b_text + '''
+                <hr class=\"main_hr\">
+                <div id="see_preview"></div>
+            ''',
+            menu = [['history/' + url_pas(name), load_lang('return')]]
+        ))

+ 4 - 1
route/recent_changes.py

@@ -195,7 +195,10 @@ def recent_changes_2(conn, name, tool):
                         <hr class=\"main_hr\">
                     ''' + div
 
-                    menu = [['w/' + url_pas(name), load_lang('document')], ['raw/' + url_pas(name), load_lang('raw')]]
+                    menu = [['w/' + url_pas(name), load_lang('return')]]
+
+                    if admin_check() == 1:
+                        menu += [['add_history/' + url_pas(name), load_lang('add_history')]]
                 else:
                     menu = [['history/' + url_pas(name), load_lang('return')]]
 

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "master" : {
-        "r_ver" : "v3.1.5-master-41",
+        "r_ver" : "v3.1.5-master-42",
         "c_ver" : "400007",
         "s_ver" : "7"
     }, "stable" : {