From 181b206863d3765fe5343ceea8e1e00e52ffba9e Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 12 Jul 2018 21:14:44 +0800 Subject: update --- cgi-bin/config.ini | 4 ++-- cgi-bin/delete.py | 36 ++++++++++++++++++++++++++++++++++++ cgi-bin/html/ckeditor/config.js | 2 +- cgi-bin/template/edit.html | 1 + cgi-bin/template/page.html | 24 ++++++++++++------------ cgi-bin/template/whisper.html | 6 ++---- 6 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 cgi-bin/delete.py diff --git a/cgi-bin/config.ini b/cgi-bin/config.ini index b6d3959..7dfc0e1 100644 --- a/cgi-bin/config.ini +++ b/cgi-bin/config.ini @@ -2,7 +2,7 @@ url=/cgi-bin static=/html images=/html/imgs -templates=template +templates=./template [database] user=root passwd=root @@ -10,4 +10,4 @@ host=localhost port=3306 db=whisper [config] -whisper_count=20 +whisper_count=15 diff --git a/cgi-bin/delete.py b/cgi-bin/delete.py new file mode 100644 index 0000000..7c728a4 --- /dev/null +++ b/cgi-bin/delete.py @@ -0,0 +1,36 @@ +#!D:/Programs/Python3/python.exe +# -*- coding: utf-8 -*- +import cgi, cgitb +import pymysql +import sys, codecs +import configparser, codecs +import connect +from connect import Connect +import config +from config import Config +import path +from path import Path + +sys.stdout = codecs.getwriter('utf8')(sys.stdout.buffer) +print("Content-type:text/html\n") +form = cgi.FieldStorage() +w = form.getvalue('w') +if w == None: + print("Invalid whisper") +else: + db = Connect.produce() + cursor = db.cursor() + query = "delete from whisper where id={0}".format(int(w)) + cursor.execute(query) + db.commit() + cursor.close() + db.close() + _url = Config.get("route", "url") + redirect = """ + + + + + + """.format(_url) + print(redirect) \ No newline at end of file diff --git a/cgi-bin/html/ckeditor/config.js b/cgi-bin/html/ckeditor/config.js index 34baeed..048198a 100644 --- a/cgi-bin/html/ckeditor/config.js +++ b/cgi-bin/html/ckeditor/config.js @@ -35,6 +35,6 @@ CKEDITOR.editorConfig = function( config ) { // Simplify the dialog windows. config.removeDialogTabs = 'image:advanced;link:advanced'; - config.filebrowserImageUploadUrl = "/cgi-bin/html/image"; + config.filebrowserImageUploadUrl = "/cgi-bin/"; config.height = 100; }; diff --git a/cgi-bin/template/edit.html b/cgi-bin/template/edit.html index 27a3dd0..bc8cea0 100644 --- a/cgi-bin/template/edit.html +++ b/cgi-bin/template/edit.html @@ -13,6 +13,7 @@ {whisper_content} + 删除 diff --git a/cgi-bin/template/page.html b/cgi-bin/template/page.html index b87a6b0..672be2c 100644 --- a/cgi-bin/template/page.html +++ b/cgi-bin/template/page.html @@ -5,18 +5,18 @@
diff --git a/cgi-bin/template/whisper.html b/cgi-bin/template/whisper.html index ca09bb7..ae7ede4 100644 --- a/cgi-bin/template/whisper.html +++ b/cgi-bin/template/whisper.html @@ -2,11 +2,9 @@
{content}
-
- {date} -
+
-
\ No newline at end of file + -- cgit v1.1-26-g67d0