summaryrefslogtreecommitdiff
path: root/src/editor/simple/upload.cgi
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2011-02-17 17:35:22 +0000
committerhallgren <hallgren@chalmers.se>2011-02-17 17:35:22 +0000
commit8dd2a1ddc05043f98b092b67364d7051e947e82d (patch)
tree809e63acb4bd891524f76be2ad1c487ed53daf8f /src/editor/simple/upload.cgi
parentc1f0d57210c00e3cb35c95f5fc11462f08f5bed2 (diff)
gfse: some small fixes
+ 'make install' to copy all required files to the server + configuration options and error checks in upload.cgi
Diffstat (limited to 'src/editor/simple/upload.cgi')
-rw-r--r--src/editor/simple/upload.cgi16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/editor/simple/upload.cgi b/src/editor/simple/upload.cgi
index fbc5a0be1..439ead53e 100644
--- a/src/editor/simple/upload.cgi
+++ b/src/editor/simple/upload.cgi
@@ -11,10 +11,10 @@ export LC_CTYPE="UTF-8"
style_url="editor.css"
make_dir() {
- dir="$(mktemp -d ../tmp/gfse.XXXXXXXX)"
+ dir="$(mktemp -d "$tmp/gfse.XXXXXXXX")"
# chmod a+rxw "$dir"
chmod a+rx "$dir"
- ln "$dir/../../grammars/grammars.cgi" "$dir"
+ ln "$grammars/grammars.cgi" "$dir"
}
@@ -49,12 +49,21 @@ check_grammar() {
endall
}
+if [ -z "$tmp" ] || [ -z "$grammars" ] ||
+ ! [ -d "$tmp" ] || ! [ -d "$grammars" ] ; then
+ pagestart "Error"
+ echo "upload.cgi is not properly configured"
+
+ # cgiconfig.sh must define tmp and grammars.
+ # cgiconfig.sh should minibar and gfshell to allow grammars to be tested.
+ endall
+else
case "$REQUEST_METHOD" in
POST)
case "$PATH_INFO" in
/tmp/gfse.*)
style_url="../../$style_url"
- dir="../tmp/${PATH_INFO##*/}"
+ dir="$tmp/${PATH_INFO##*/}"
check_grammar
;;
*)
@@ -75,3 +84,4 @@ case "$REQUEST_METHOD" in
endall
esac
esac
+fi