2DU 9 лет назад
Родитель
Сommit
5b12275e81
7 измененных файлов с 632 добавлено и 623 удалено
  1. 207 205
      app.py
  2. BIN
      app_session/container_file/c/c8/c879ab587e6d47dbb9ffeefe8904d5c8.cache
  3. 12 13
      func.py
  4. 6 6
      mark.py
  5. 1 1
      readme.md
  6. 0 398
      templates/index.html
  7. 406 0
      views/index.tpl

Разница между файлами не показана из-за своего большого размера
+ 207 - 205
app.py


BIN
app_session/container_file/c/c8/c879ab587e6d47dbb9ffeefe8904d5c8.cache


+ 12 - 13
func.py

@@ -1,5 +1,4 @@
-from flask import Flask, session, request
-
+from bottle import request
 from urllib import parse
 import json
 import pymysql
@@ -46,18 +45,18 @@ def diff(seqm):
             
     return ''.join(output)
            
-def admin_check():
+def admin_check(session):
     if(session.get('Now') == True):
-        ip = ip_check()
+        ip = ip_check(session) 
         db_ex("select * from user where id = '" + db_pas(ip) + "'")
         user = db_get()
         if(user):
             if(user[0]['acl'] == 'owner' or user[0]['acl'] == 'admin'):
                 return 1
                 
-def owner_check():
+def owner_check(session):
     if(session.get('Now') == True):
-        ip = ip_check()
+        ip = ip_check(session) 
         db_ex("select * from user where id = '" + db_pas(ip) + "'")
         user = db_get()
         if(user):
@@ -79,7 +78,7 @@ def include_check(name, data):
                     
                 i += 1
     
-def login_check():
+def login_check(session):
     if(session.get('Now') == True):
         return 1
     else:
@@ -108,18 +107,18 @@ def ip_pas(raw_ip):
 
     return ip
 
-def ip_check():
+def ip_check(session):
     if(session.get('Now') == True):
         ip = format(session['DREAMER'])
     else:
-        if(request.headers.getlist("X-Forwarded-For")):
-            ip = request.headers.getlist("X-Forwarded-For")[0]
+        if(request.environ.get('HTTP_X_FORWARDED_FOR')):
+            ip = request.environ.get('HTTP_X_FORWARDED_FOR')
         else:
-            ip = request.remote_addr
-            
+            ip = request.environ.get('REMOTE_ADDR')
+
     return ip
 
-def custom_css_user():
+def custom_css_user(session):
     if(session.get('Now') == True):
         try:
             data = format(session['Daydream'])

+ 6 - 6
mark.py

@@ -17,13 +17,13 @@ db_pas = pymysql.escape_string
 
 db_ex("use " + set_data['db'])
 
-def savemark(data):
+def savemark(session, data):
     data = re.sub("\[date\(now\)\]", get_time(), data)
     
-    if(not re.search("\.", ip_check())):
-        name = '[[사용자:' + ip_check() + '|' + ip_check() + ']]'
+    if(not re.search("\.", ip_check(session))):
+        name = '[[사용자:' + ip_check(session) + '|' + ip_check(session) + ']]'
     else:
-        name = ip_check()
+        name = ip_check(session)
         
     data = re.sub("\[name\]", name, data)
 
@@ -211,7 +211,7 @@ def cat_plus(name, link):
         db_ex("insert into cat (title, cat) value ('" + db_pas(link) + "', '" + db_pas(name) + "')")
         db_com()
 
-def namumark(title, data):
+def namumark(session, title, data):
     data = html_pas(data, 1)
 
     b = 0
@@ -221,7 +221,7 @@ def namumark(title, data):
     b = a[1]
     
     data = re.sub("\[anchor\((?P<in>[^\[\]]*)\)\]", '<span id="\g<in>"></span>', data)
-    data = savemark(data)
+    data = savemark(session, data)
 
     i = 1
     while(True):

+ 1 - 1
readme.md

@@ -13,7 +13,7 @@ set 폴더에 있는 set.json을 폴더 밖으로 꺼내고 json 내용을 수
 ### 기본
  * [MariaDB](https://mariadb.org/)나 [MySQL](https://www.mysql.com/)
  * pip install bottle
- * pip install bottle-session
+ * pip install beaker
  * pip install tornado
  * pip install [bcrypt](https://pypi.python.org/pypi/bcrypt/3.1.0)
  * pip install [pymysql](https://pypi.python.org/pypi/PyMySQL)

+ 0 - 398
templates/index.html

@@ -1,398 +0,0 @@
-<html>
-    <head>
-        <title>{{title}} - {{logo}}</title>
-        <link rel="stylesheet" href="{{url_for('static', filename='primer.css')}}">
-        <link rel="stylesheet" href="{{url_for('static', filename='style.css')}}">
-        <link rel="stylesheet" href="{{url_for('static', filename='font-awesome/css/font-awesome.min.css')}}">
-        <script type="text/x-mathjax-config">
-          MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
-        </script>
-        <script type="text/javascript" async
-            src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_CHTML">
-        </script>
-        <meta name="twitter:creator" content="@{{logo}}">
-        <meta name="twitter:title" content="{{title}}">
-        <meta name="twitter:site" content="@{{logo}}">
-        <meta name="twitter:card" content="summary">
-        <meta name="twitter:description" content="{{data}}" />
-        <link rel="shortcut icon" href="{{url_for('static', filename='images/on.ico')}}">
-        <meta name="viewport" content="width=device-width, initial-scale=1">
-    <style>
-        {{custom}}
-    </style>
-    </head>
-    <body>
-        <br>
-        <div class="one-fifth column">
-            <div id="top">
-                <a href="/" id="logo">{{logo}}</a>
-                <div>
-                    <a href="/recentchanges" id="RecentChanges">
-                        <i class="fa fa-refresh" aria-hidden="true"></i>
-                        <span id="is_mobile">최근 변경</span>
-                    </a>
-                    <a href="/recentdiscuss" id="RecentChanges">
-                        <i class="fa fa-comment" aria-hidden="true"></i>
-                        <span id="is_mobile">최근 토론</span>
-                    </a>
-                    <a href="/random" id="log">
-                        <i class="fa fa-random" aria-hidden="true"></i>
-                    </a>
-                    <a href="/user" id="log">
-                        {% if login == 1 %}
-                        <i class="fa fa-user" aria-hidden="true"></i>
-                        {% elif login == 0 %}
-                        <i class="fa fa-user-times" aria-hidden="true"></i>
-                        {% else %}
-                        <i class="fa fa-user-secret" aria-hidden="true"></i>
-                        {% endif %}
-                    </a>
-                    <a href="/other" id="log">
-                        <i class="fa fa-cogs" aria-hidden="true"></i>
-                    </a>
-                </div>
-                <form method="POST" action="/search" id="search">
-                    <div class="input-group">
-                        <input class="form-control" name="search" type="text">
-                        <span class="input-group-button">
-                            <button id="goto" class="btn" formaction="/goto"><i class="fa fa-share" aria-hidden="true"></i></button>
-                        </span>
-                        <span class="input-group-button">
-                            <button class="btn"><i class="fa fa-search" aria-hidden="true"></i></button>
-                        </span>
-                    </div>
-                </form>
-            </div>
-        </div>
-        <div class="scroll-buttons">
-            <a class="scroll-toc" href="#toc"><i class="fa fa-list-alt" aria-hidden="true"></i></a>
-            <a class="scroll-button" href="#" id="left"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
-            <a class="scroll-bottom" href="#powered" id="right"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
-        </div>
-        <div id="all_contect">
-            <div id="left_bar">
-                <a href="#">맨 위로</a>
-                <br>
-                <br>
-                {% autoescape false %}
-                {{left}}
-                {% endautoescape %}
-            </div>
-            <div class="four-fifths column">
-                <div id="tool">
-                    <nav class="menu">
-                        <a class="menu-item selected" href="#" onclick="return false">{% if sub %}{{sub}}{% elif tn == 1 %}문서{% else %}기타{% endif %}</a>
-                        {% if tn == 1 %}
-                        {% if data_none == True %}
-                        <a class="menu-item" href="/edit/{{page}}">생성</a>
-                        {% else %}
-                        <a class="menu-item" href="/edit/{{page}}">수정</a>
-                        {% endif %}
-                        <a class="menu-item" id="{{topic}}" href="/topic/{{page}}">토론</a>
-                        {% if not data_none == True %}
-                        <a class="menu-item" href="/delete/{{page}}">삭제</a>
-                        {% endif %}
-                        <a class="menu-item" href="/move/{{page}}">이동</a>
-                        {% if not data_none == True %}
-                        <a class="menu-item" href="/raw/{{page}}">Raw</a>
-                        {% endif %}
-                        <a class="menu-item" href="/history/{{page}}/n/1">역사</a>
-                        <a class="menu-item" href="/backlink/{{page}}/n/1">역링크</a>
-                        {% if redirect %}
-                        <a class="menu-item" href="/w/{{page}}">넘기기</a>
-                        {% endif %}
-                        {% if admin == "ACL" %}
-                        <a class="menu-item" href="/acl/{{page}}">ACL</a>
-                        {% endif %}
-                        {% if uppage %}
-                        <a class="menu-item" style="{{style}}" href="/w/{{uppage}}">상위</a>
-                        {% endif %}
-                        {% elif tn == 6 or tn == 13 or not tn and not sub == '역링크' or tn == 12 or tn == 3 or tn == 4 or tn == 20 or tn == 21 %}
-                        <a class="menu-item" href="javascript:history.back(-1);">뒤로</a>
-                        {% elif tn == 10 and not list or tn == 11 %}
-                        <a class="menu-item" href="/topic/{{page}}">토론 목록</a>
-                        {% else %}
-                        <a class="menu-item" href="/w/{{page}}">문서</a>
-                        {% endif %}
-                    </nav>
-                </div>
-                <h1 class="title">{{title}}{% if acl %} <sub>{{acl}}</sub>{% endif %}{% if sub %} <sub>({{sub}})</sub>{% endif %}</h1>
-                {% if tn == 1 %}
-                {% if redirect %}
-                {% autoescape false %}
-                <li style="margin-top: -20px;"><a href="/w/{{redirect}}/from/{{page}}">{{redirect}}</a>에서 넘어 왔습니다.</li>
-                <br>
-                {% endautoescape %}
-                {% endif %}
-                <div>
-                    {% autoescape false %}
-                    {{data}}
-                    {% endautoescape %}
-                </div>
-                {% elif tn == 2 %}
-                {% if login == 0 %}
-                <br>
-                <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 역사에 기록됩니다.</span>
-                <br>
-                <br>
-                {% endif %}
-                {% if section == 1 %}
-                <form id="usrform" name="f1" method="POST" action="/edit/{{page}}/section/{{number}}">
-                    <textarea rows="30" cols="100" name="content" form="usrform">{{data}}</textarea>
-                    {% if preview == 1 %}
-                    <textarea style="display:none;" rows="30" cols="100" name="otent" form="usrform">{{odata}}</textarea>
-                    {% else %}
-                    <textarea style="display:none;" rows="30" cols="100" name="otent" form="usrform">{{data}}</textarea>
-                    {% endif %}
-                    <input name="send" style="margin-top:10px;width:100%" type="text">
-                    <br>
-                    <br>
-                    <div class="form-actions">
-                        <button class="btn btn-primary" type="submit" onclick="f1.action='/edit/{{page}}/section/{{number}}';">저장</button>
-                        <button class="btn" type="submit" onclick="f1.action='/preview/{{page}}/section/{{number}}';">미리보기</button>
-                    </div>
-                </form>
-                {% else %}
-                <form id="usrform" name="f1" method="POST" action="/edit/{{page}}">
-                    <textarea rows="30" cols="100" name="content" form="usrform">{{data}}</textarea>
-                    <input name="send" style="margin-top:10px;width:100%" type="text">
-                    <br>
-                    <br>
-                    <div class="form-actions">
-                        <button class="btn btn-primary" type="submit" onclick="f1.action='/edit/{{page}}';">저장</button>
-                        <button class="btn" type="submit" onclick="f1.action='/preview/{{page}}';">미리보기</button>
-                    </div>
-                </form>      
-                {% endif %}
-                {% if preview == 1 %}
-                {% autoescape false %}
-                {{enddata}}
-                {% endautoescape %}
-                {% endif %}
-                {% elif tn == 3 %}
-                {% autoescape false %}
-                {{rows}}
-                {% endautoescape %}
-                {% elif tn == 4 %}
-                {% autoescape false %}
-                {{rows}}
-                {% endautoescape %}
-                {% elif tn == 5 %}
-                <form class="usrform" method='POST' action='/history/{{page}}/n/1'>
-                <select name="a">
-                    {% autoescape false %}
-                    {{select}}
-                    {% endautoescape %}
-                </select>
-                <select name="b">
-                    {% autoescape false %}
-                    {{select}}
-                    {% endautoescape %}
-                </select>
-                <button class="btn btn-primary" type='submit'>리비전 비교</button>
-                <br>
-                <br>
-                {% autoescape false %}
-                {{rows}}
-                {% endautoescape %}
-                {% elif tn == 6 %}
-                <div>
-                    {% autoescape false %}
-                    {{data}}
-                    {% endautoescape %}
-                </div>
-                {% elif tn == 7 %}
-                <div>
-                    {% autoescape false %}
-                    {{data}}
-                    {% endautoescape %}
-                </div>
-                {% elif tn == 8 %}
-                <form id="usrform" method="POST" action="/delete/{{page}}">
-                    {{plus}}
-                    <br>
-                    <br>
-                    <button class="btn btn-primary" type="submit">삭제</button>
-                </form>
-                {% if login == 0 %}
-                <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 역사에 기록됩니다.</span>
-                {% endif %}
-                {% elif tn == 9 %}
-                <form id="usrform" method="POST" action="/move/{{page}}">
-                    {{plus}}
-                    <br>
-                    <br>
-                    <input class="form-control input-sm" value="{{title}}" name="title" type="text">
-                    <br>
-                    <br>
-                    <button class="btn btn-primary" type="submit">이동</button>
-                </form>
-                {% if login == 0 %}
-                <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 역사에 기록됩니다.</span>
-                {% endif %}
-                {% elif tn == 10 %}
-                <form id="usrform" style="margin-top: -30px;" method="POST" action="/topic/{{page}}">
-                    {% autoescape false %}
-                    {{plus}}
-                    {% endautoescape %}
-                    {% if list == 1 %}
-                    <br>
-                    <a href="/topic/{{page}}/close">(닫힌 토론)</a> <a href="/topic/{{page}}/agree">(합의된 토론)</a>
-                    <br>
-                    <br>
-                    <input class="form-control" name="topic" style="width: 100%">
-                    <br>
-                    <br>
-                    <button class="btn btn-primary" type="submit">새토론</button>
-                    {% endif %}
-                </form>
-                {% elif tn == 11 %}
-                <h2 style="margin-top: -15px;">{{toron}}</h2>
-                <br>
-                {% autoescape false %}
-                {{rows}}
-                {% endautoescape %}
-                {% if ban == 1 %}
-                {% else %}
-                <a id="reload" href="javascript:window.location.reload(true);">(갱신)</a> <a href="#reload">(갱신 전에 누르시오)</a>
-                <form id="usrform" style="{{style}}" method="POST" action="/topic/{{page}}/sub/{{suburl}}">
-                    <br>
-                    <textarea rows="10" cols="100" name="content" form="usrform"></textarea>
-                    <br>
-                    <br>
-                    <button class="btn btn-primary" type="submit">전송</button>
-                </form>
-                {% if login == 0 and style == '' %}
-                <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 역사에 기록됩니다.</span>
-                {% endif %}
-                {% endif %}
-                {% elif tn == 13 %}
-                <form id="usrform" method="POST" action="/revert/{{page}}/r/{{r}}">
-                    {{plus}}
-                    <br>
-                    <br>
-                    <button class="btn btn-primary" type="submit">되돌리기</button>
-                </form>
-                {% if login == 0 %}
-                <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 역사에 기록됩니다.</span>
-                {% endif %}
-                {% elif tn == 15 %}
-                {% if title == '회원가입' %}
-                <form id="usrform" method="POST" action="/register">
-                {% elif title == '비밀번호 변경' %}
-                <form id="usrform" method="POST" action="/change">
-                {% else %}
-                <form id="usrform" method="POST" action="/login">
-                {% endif %}
-                    <span>아이디</span>
-                    <br>
-                    <br>
-                    <input name="id" type="text">
-                    <br>
-                    <br>
-                    <span>{% if title == '비밀번호 변경' %}현재 {% endif %}비밀번호</span>
-                    <br>
-                    <br>
-                    <input name="pw" type="password">
-                    <br>
-                    <br>
-                    {% if not title == '로그인' %}
-                    <span>{% if title == '비밀번호 변경' %}변경할 비밀번호{% else %}재 확인{% endif %}</span>
-                    <br>
-                    <br>
-                    <input name="pw2" type="password">
-                    <br>
-                    <br>
-                    {% if title == '비밀번호 변경' %}
-                    <span>재 확인</span>
-                    <br>
-                    <br>
-                    <input name="pw3" type="password">
-                    <br>
-                    <br>
-                    {% endif %}
-                    {% endif %}
-                    <button class="btn btn-primary" type="submit">{{enter}}</button>
-                </form>
-                {% elif tn == 16 %}
-                <form id="usrform" method="POST" action="/ban/{{page}}">
-                    {% if now == '차단' or now == '대역 차단' %}
-                    <input class="form-control" name="end" style="width: 100%">
-                    <br>
-                    <br>
-                    <span>아무것도 안 적으면 무기한 차단입니다.</span>
-                    <br>
-                    <br>
-                    <span>차단 일 지정시 형식은 YYYY-MM-DD로 기록해야 합니다. (예시: 2017-01-20, 2017-10-15)</span>
-                    <br>
-                    <br>
-                    <span>지금 시각은 {{today}} 입니다.</span>
-                    <br>
-                    <br>
-                    <input class="form-control" name="why" style="width: 100%">
-                    <br>
-                    <br>
-                    <span>사유를 쓰는 곳입니다.</span>
-                    {% if allif == 1 %}
-                    <br>
-                    <br>
-                    <input type="checkbox" name="band">
-                        <span>대역 차단</span>
-                    </input>
-                    {% endif %}
-                    <br>
-                    <br>
-                    {% endif %}
-                    <button class="btn btn-primary" type="submit">{{now}}</button>
-                </form>
-                {% elif tn == 18 %}
-                <form id="usrform" method="POST" action="/admin/{{page}}">
-                    {% if now == '권한 부여' %}
-                    <select name="select">
-                        <option value="admin" selected="selected">관리자</option>
-                        <option value="owner">소유자</option>
-                    </select>
-                    <br>
-                    <br>
-                    {% endif %}
-                    <button class="btn btn-primary" type="submit">{{now}}</button>
-                </form>
-                {% elif tn == 19 %}
-                <br>
-                <span>{{now}}</span>
-                <br>
-                <br>
-                <form id="usrform" method="POST" action="/acl/{{page}}">
-                    <select name="select">
-                        <option value="admin" selected="selected">관리자만</option>
-                        <option value="user">유저 이상</option>
-                        <option value="normal">일반</option>
-                    </select>
-                    <br>
-                    <br>
-                    <button class="btn btn-primary" type="submit">ACL 변경</button>
-                </form>
-                {% elif tn == 21 %}
-                <div>
-                    <form action="" method=post enctype=multipart/form-data>
-                        <input type=file name=file>
-                        <input type=submit value=Upload>
-                    </form>
-                </div>
-                <span>{{number}}MB 이하 파일만 업로드 가능하고 확장자는 jpg, png, gif, jpeg만 가능합니다.</span>
-                {% else %}
-                <div>
-                    {% autoescape false %}
-                    {{data}}
-                    {% endautoescape %}
-                </div>
-                {% endif %}
-                <hr id="last">
-                <p>{% autoescape false %}{{license}}{% endautoescape %}</p>
-                <div id="powered">
-                    <a href="https://github.com/2DU/openNAMU"><img src="{{url_for('static', filename='images/on2.png')}}" width="100px"></a>
-                </div>
-            </div>
-        </div>
-    </body>
-</html>

+ 406 - 0
views/index.tpl

@@ -0,0 +1,406 @@
+<html>
+    <head>
+        <title>{{title}} - {{logo}}</title>
+        <link rel="stylesheet" href="/static/primer.css">
+        <link rel="stylesheet" href="/static/style.css">
+        <link rel="stylesheet" href="/static/font-awesome/css/font-awesome.min.css">
+        <script type="text/x-mathjax-config">
+          MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
+        </script>
+        <script type="text/javascript" async
+            src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_CHTML">
+        </script>
+        <meta name="twitter:creator" content="@{{logo}}">
+        <meta name="twitter:title" content="{{title}}">
+        <meta name="twitter:site" content="@{{logo}}">
+        <meta name="twitter:card" content="summary">
+        <meta name="twitter:description" content="{{get('data', 'Nope')}}" />
+        <link rel="shortcut icon" href="/static/images/on.ico">
+        <meta name="viewport" content="width=device-width, initial-scale=1">
+    <style>
+        {{get('custom', '')}}
+    </style>
+    </head>
+    <body>
+        <br>
+        <div class="one-fifth column">
+            <div id="top">
+                <a href="/" id="logo">{{logo}}</a>
+                <div>
+                    <a href="/recentchanges" id="RecentChanges">
+                        <i class="fa fa-refresh" aria-hidden="true"></i>
+                        <span id="is_mobile">최근 변경</span>
+                    </a>
+                    <a href="/recentdiscuss" id="RecentChanges">
+                        <i class="fa fa-comment" aria-hidden="true"></i>
+                        <span id="is_mobile">최근 토론</span>
+                    </a>
+                    <a href="/random" id="log">
+                        <i class="fa fa-random" aria-hidden="true"></i>
+                    </a>
+                    <a href="/user" id="log">
+                        % if login == 1:
+                            <i class="fa fa-user" aria-hidden="true"></i>
+                        % elif login == 0:
+                            <i class="fa fa-user-times" aria-hidden="true"></i>
+                        % else:
+                            <i class="fa fa-user-secret" aria-hidden="true"></i>
+                        % end
+                    </a>
+                    <a href="/other" id="log">
+                        <i class="fa fa-cogs" aria-hidden="true"></i>
+                    </a>
+                </div>
+                <form method="POST" action="/search" id="search">
+                    <div class="input-group">
+                        <input class="form-control" name="search" type="text">
+                        <span class="input-group-button">
+                            <button id="goto" class="btn" formaction="/goto"><i class="fa fa-share" aria-hidden="true"></i></button>
+                        </span>
+                        <span class="input-group-button">
+                            <button class="btn"><i class="fa fa-search" aria-hidden="true"></i></button>
+                        </span>
+                    </div>
+                </form>
+            </div>
+        </div>
+        <div class="scroll-buttons">
+            <a class="scroll-toc" href="#toc"><i class="fa fa-list-alt" aria-hidden="true"></i></a>
+            <a class="scroll-button" href="#" id="left"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
+            <a class="scroll-bottom" href="#powered" id="right"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
+        </div>
+        <div id="all_contect">
+            <div id="left_bar">
+                <a href="#">맨 위로</a>
+                <br>
+                <br>
+                {{!get('left', '')}}
+            </div>
+            <div class="four-fifths column">
+                <div id="tool">
+                    <nav class="menu">
+                        <a class="menu-item selected" href="#" onclick="return false">
+                            % if defined('sub'):
+                                {{sub}}
+                            % elif defined('tn'):
+                                % if tn == 1:
+                                    문서
+                                % else:
+                                    기타
+                                % end
+                            % else:
+                                기타
+                            % end
+                        </a>
+                        % if defined('tn'):
+                            % if tn == 1:
+                                % if defined('data_none'):
+                                    <a class="menu-item" href="/edit/{{page}}">생성</a>
+                                % else:
+                                    <a class="menu-item" href="/edit/{{page}}">수정</a>
+                                % end
+                                <a class="menu-item" id="{{topic}}" href="/topic/{{page}}">토론</a>
+                                % if not defined('data_none'):
+                                    <a class="menu-item" href="/delete/{{page}}">삭제</a>
+                                % end
+                                <a class="menu-item" href="/move/{{page}}">이동</a>
+                                % if not defined('data_none'):
+                                    <a class="menu-item" href="/raw/{{page}}">Raw</a>
+                                % end
+                                <a class="menu-item" href="/history/{{page}}/n/1">역사</a>
+                                <a class="menu-item" href="/backlink/{{page}}/n/1">역링크</a>
+                                % if redirect:
+                                    <a class="menu-item" href="/w/{{page}}">넘기기</a>
+                                % end
+                                % if admin == "ACL":
+                                    <a class="menu-item" href="/acl/{{page}}">ACL</a>
+                                % end
+                                % if uppage:
+                                    <a class="menu-item" style="{{style}}" href="/w/{{uppage}}">상위</a>
+                                % end
+                            % elif tn == 6 or tn == 13 or not tn and not sub == '역링크' or tn == 3:
+                                <a class="menu-item" href="javascript:history.back(-1);">뒤로</a>
+                            % elif tn == 10 and not list or tn == 11:
+                                <a class="menu-item" href="/topic/{{page}}">토론 목록</a>
+                            % else:
+                                <a class="menu-item" href="/w/{{get('page', '')}}">문서</a>
+                            % end
+                        % else:
+                            <a class="menu-item" href="/w/{{get('page', '')}}">문서</a>
+                        % end
+                    </nav>
+                </div>
+                <h1 class="title">
+                    {{title}}
+                    % if defined('acl'):
+                        <sub> {{acl}}</sub>
+                    % end
+                    % if defined('sub'):
+                        <sub> ({{sub}})</sub>
+                    % end
+                </h1>
+                % if defined('tn'):
+                    % if tn == 1:
+                        % if redirect:
+                            <li style="margin-top: -20px;"><a href="/w/{{redirect}}/from/{{page}}">{{!redirect or 'Nope'}}</a>에서 넘어 왔습니다.</li>
+                            <br>
+                        % end
+                        <div>
+                            {{!data}}
+                        </div>
+                    % elif tn == 2:
+                        % if login == 0:
+                            <br>
+                            <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 역사에 기록됩니다.</span>
+                            <br>
+                            <br>
+                        % end
+                        % if defined('section'):
+                            <form id="usrform" name="f1" method="POST" action="/edit/{{page}}/section/{{number}}">
+                                <textarea rows="30" cols="100" name="content" form="usrform">{{data}}</textarea>
+                                % if preview == 1:
+                                    <textarea style="display:none;" rows="30" cols="100" name="otent" form="usrform">{{odata}}</textarea>
+                                % else:
+                                    <textarea style="display:none;" rows="30" cols="100" name="otent" form="usrform">{{data}}</textarea>
+                                % end
+                                <input name="send" style="margin-top:10px;width:100%" type="text">
+                                <br>
+                                <br>
+                                <div class="form-actions">
+                                    <button class="btn btn-primary" type="submit" onclick="f1.action='/edit/{{page}}/section/{{number}}';">저장</button>
+                                    <button class="btn" type="submit" onclick="f1.action='/preview/{{page}}/section/{{number}}';">미리보기</button>
+                                </div>
+                            </form>
+                        % else:
+                            <form id="usrform" name="f1" method="POST" action="/edit/{{page}}">
+                                <textarea rows="30" cols="100" name="content" form="usrform">{{data}}</textarea>
+                                <input name="send" style="margin-top:10px;width:100%" type="text">
+                                <br>
+                                <br>
+                                <div class="form-actions">
+                                    <button class="btn btn-primary" type="submit" onclick="f1.action='/edit/{{page}}';">저장</button>
+                                    <button class="btn" type="submit" onclick="f1.action='/preview/{{page}}';">미리보기</button>
+                                </div>
+                            </form>      
+                        % end
+                        % if defined('preview'):
+                            {{!enddata}}
+                        % end
+                    % elif tn == 3:
+                        {{!rows}}
+                    % elif tn == 5:
+                        <form class="usrform" method='POST' action='/history/{{page}}/n/1'>
+                        <select name="a">
+                            {{!select}}
+                        </select>
+                        <select name="b">
+                            {{!select}}
+                        </select>
+                        <button class="btn btn-primary" type='submit'>리비전 비교</button>
+                        <br>
+                        <br>
+                        {{!rows}}
+                    % elif tn == 6:
+                        <div>
+                            {{!data}}
+                        </div>
+                    % elif tn == 8:
+                        <form id="usrform" method="POST" action="/delete/{{page}}">
+                            {{plus}}
+                            <br>
+                            <br>
+                            <button class="btn btn-primary" type="submit">삭제</button>
+                        </form>
+                        % if login == 0:
+                            <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 역사에 기록됩니다.</span>
+                        % end
+                    % elif tn == 9:
+                        <form id="usrform" method="POST" action="/move/{{page}}">
+                            {{plus}}
+                            <br>
+                            <br>
+                            <input class="form-control input-sm" value="{{title}}" name="title" type="text">
+                            <br>
+                            <br>
+                            <button class="btn btn-primary" type="submit">이동</button>
+                        </form>
+                        % if login == 0:
+                            <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 역사에 기록됩니다.</span>
+                        % end
+                    % elif tn == 10:
+                        <form id="usrform" style="margin-top: -30px;" method="POST" action="/topic/{{page}}">
+                            {{!plus}}
+                            % if list == 1:
+                                <br>
+                                <a href="/topic/{{page}}/close">(닫힌 토론)</a> <a href="/topic/{{page}}/agree">(합의된 토론)</a>
+                                <br>
+                                <br>
+                                <input class="form-control" name="topic" style="width: 100%">
+                                <br>
+                                <br>
+                                <button class="btn btn-primary" type="submit">새토론</button>
+                            % end
+                        </form>
+                    % elif tn == 11:
+                        <h2 style="margin-top: -15px;">{{toron}}</h2>
+                        <br>
+                        {{!rows}}
+                        % if not ban == 1:
+                            <a id="reload" href="javascript:window.location.reload(true);">(갱신)</a> <a href="#reload">(갱신 전에 누르시오)</a>
+                            <form id="usrform" style="{{style}}" method="POST" action="/topic/{{page}}/sub/{{suburl}}">
+                                <br>
+                                <textarea rows="10" cols="100" name="content" form="usrform"></textarea>
+                                <br>
+                                <br>
+                                <button class="btn btn-primary" type="submit">전송</button>
+                            </form>
+                            % if login == 0 and style == '':
+                                <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 역사에 기록됩니다.</span>
+                            % end
+                        % end
+                    % elif tn == 13:
+                        <form id="usrform" method="POST" action="/revert/{{page}}/r/{{r}}">
+                            {{plus}}
+                            <br>
+                            <br>
+                            <button class="btn btn-primary" type="submit">되돌리기</button>
+                        </form>
+                        % if login == 0:
+                            <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 역사에 기록됩니다.</span>
+                        % end
+                    % elif tn == 15:
+                        % if title == '회원가입':
+                            <form id="usrform" method="POST" action="/register">
+                        % elif title == '비밀번호 변경':
+                            <form id="usrform" method="POST" action="/change">
+                        % else:
+                            <form id="usrform" method="POST" action="/login">
+                        % end
+                            <span>아이디</span>
+                            <br>
+                            <br>
+                            <input name="id" type="text">
+                            <br>
+                            <br>
+                            <span>
+                                % if title == '비밀번호 변경':
+                                    현재 
+                                % end
+                                비밀번호
+                            </span>
+                            <br>
+                            <br>
+                            <input name="pw" type="password">
+                            <br>
+                            <br>
+                            % if not title == '로그인':
+                                <span>
+                                    % if title == '비밀번호 변경':
+                                        변경할 비밀번호
+                                    % else:
+                                        재 확인
+                                    % end
+                                </span>
+                                <br>
+                                <br>
+                                <input name="pw2" type="password">
+                                <br>
+                                <br>
+                                % if title == '비밀번호 변경':
+                                    <span>재 확인</span>
+                                    <br>
+                                    <br>
+                                    <input name="pw3" type="password">
+                                    <br>
+                                    <br>
+                                % end
+                            % end
+                            <button class="btn btn-primary" type="submit">{{enter}}</button>
+                        </form>
+                    % elif tn == 16:
+                        <form id="usrform" method="POST" action="/ban/{{page}}">
+                            % if now == '차단' or now == '대역 차단':
+                                <input class="form-control" name="end" style="width: 100%">
+                                <br>
+                                <br>
+                                <span>아무것도 안 적으면 무기한 차단입니다.</span>
+                                <br>
+                                <br>
+                                <span>차단 일 지정시 형식은 YYYY-MM-DD로 기록해야 합니다. (예시: 2017-01-20, 2017-10-15)</span>
+                                <br>
+                                <br>
+                                <span>지금 시각은 {{today}} 입니다.</span>
+                                <br>
+                                <br>
+                                <input class="form-control" name="why" style="width: 100%">
+                                <br>
+                                <br>
+                                <span>사유를 쓰는 곳입니다.</span>
+                                % if defined('allif'):
+                                    <br>
+                                    <br>
+                                    <input type="checkbox" name="band">
+                                        <span>대역 차단</span>
+                                    </input>
+                                % end
+                                <br>
+                                <br>
+                            % end
+                            <button class="btn btn-primary" type="submit">{{now}}</button>
+                        </form>
+                    % elif tn == 18:
+                        <form id="usrform" method="POST" action="/admin/{{page}}">
+                            % if now == '권한 부여':
+                                <select name="select">
+                                    <option value="admin" selected="selected">관리자</option>
+                                    <option value="owner">소유자</option>
+                                </select>
+                                <br>
+                                <br>
+                            % end
+                            <button class="btn btn-primary" type="submit">{{now}}</button>
+                        </form>
+                    % elif tn == 19:
+                        <br>
+                        <span>{{now}}</span>
+                        <br>
+                        <br>
+                        <form id="usrform" method="POST" action="/acl/{{page}}">
+                            <select name="select">
+                                <option value="admin" selected="selected">관리자만</option>
+                                <option value="user">유저 이상</option>
+                                <option value="normal">일반</option>
+                            </select>
+                            <br>
+                            <br>
+                            <button class="btn btn-primary" type="submit">ACL 변경</button>
+                        </form>
+                    % elif tn == 21:
+                        <div>
+                            <form action="" method=post enctype=multipart/form-data>
+                                <input type=file name=file>
+                                <input type=submit value=Upload>
+                            </form>
+                        </div>
+                        <span>{{number}}MB 이하 파일만 업로드 가능하고 확장자는 jpg, png, gif, jpeg만 가능합니다.</span>
+                     % else:
+                        <div>
+                            {{!data}}
+                        </div>
+                    % end
+                % else:
+                    <div>
+                        {{!data}}
+                    </div>
+                % end
+                <hr id="last">
+                <p>
+                    {{!license}}
+                </p>
+                <div id="powered">
+                    <a href="https://github.com/2DU/openNAMU"><img src="/static/images/on2.png" width="100px"></a>
+                </div>
+            </div>
+        </div>
+    </body>
+</html>

Некоторые файлы не были показаны из-за большого количества измененных файлов