X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;ds=inline;f=constants.sh;fp=constants.sh;h=2636e0bd0a5cb8d6aaa1ef48d566896143d549d4;hb=f485895094cd72318b46f39689c3ba954eb37411;hp=0000000000000000000000000000000000000000;hpb=904730d1782749bfac15b0344fe5782433f3099b;p=busy
diff --git a/constants.sh b/constants.sh
new file mode 100755
index 0000000..2636e0b
--- /dev/null
+++ b/constants.sh
@@ -0,0 +1,44 @@
+#!/bin/zsh
+
+# Copyright 2014 Paul Hänsch
+#
+# This file is part of Confetti.
+#
+# Confetti is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Confetti is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Confetti. If not, see .
+
+umask=002
+#alias _wiki="stx2any --no-template --link-abbrevs --quote -T html"
+_wiki(){
+ markdown $* |sed -r 's:<(h[1-6])>(.+):<\1>\2\1>:g'
+}
+
+LOGIN=false
+USER="#NONE#"
+_GET["p"]=Home
+
+sessfile="$_DATA/auth/session$(sed -rn 's:^.*session=([a-zA-Z0-9]{32}).*$:\1:p' <<<"$HTTP_COOKIE")"
+if [ -r "$sessfile" ]; then
+ cat "$sessfile" |read user expire
+ if [ "$(date +%s)" -lt "$expire" ]; then
+ echo -E "$user $(($(date +%s) + 1800))" >"$sessfile"
+ USER="$user"
+ LOGIN=true
+ else
+ [ -f "$sessfile" ] && rm "$sessfile"
+ sess_msg="Your session has expired!"
+ fi
+fi
+
+unset sessfile user expire
+. $_DATA/auth/permissions.sh