3 export LC_ALL=de_DE.UTF-8
10 debug() { #change to false to disable debugging
11 #true && echo "$*" >>debug
12 true && [ -n "$*" ] && echo -E "$*" >>/dev/stderr
13 true && [ -z "$*" ] && tee /dev/stderr
16 # this program is supposed to be symlinked into a http root directory
17 # we will use the http root as object storage (data directory) and call sub
18 # programs from the directory in which the real executable resides
19 # therefore we need to identify the code and data directories _EXEC and _DATA
21 real="$(readlink -f $call)"
22 _EXEC="$(dirname "$real")" #execution directory
23 _DATA="$(dirname "$call")" #storage directory
25 [ -w "$_DATA" ] && [ -d "$_DATA" ] || die "storage directory must be writable"
27 # create directories for object storage
28 for each in "$_DATA"/{vcard,ical,cache,temp}; do
29 [ ! -e "$each" ] && mkdir "$each"
30 [ -w "$each" ] && [ -d "$each" ] || die "storage $each must be a writable directory"
33 # create htaccess file
34 [ -f .htaccess ] || cat >.htaccess <<EOF
36 AddHandler cgi-script .cgi
37 DirectoryIndex index.cgi
39 [ -f .htaccess ] || die "no htaccess file present and unable to create one"
45 . "$_EXEC/constants.sh"
47 if [ -n "$_GET[\"action\"]" ]; then
49 elif [ -n "$_GET[\"export\"]" ]; then