--- /dev/null
+#!/bin/sh
+
+# Copyright 2014 Paul Hänsch
+#
+# This file is part of Busy
+#
+# Busy 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.
+#
+# Busy 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 Busy. If not, see <http://www.gnu.org/licenses/>.
+
+info="$(egrep -o '[0-9]{10}_[0-9]{3}' <<<"$_GET[\"i\"]")"
+edit="$(egrep -o '[0-9]{10}_[0-9]{3}' <<<"$_GET[\"e\"]")"
+ rev="$(egrep -o '[0-9]{10}' <<<"$_GET[\"r\"]")"
+search="$(sed 's:\t: :g;s:\r::g;s:\\:\\\\:g' <<<"$_GET[\"s\"]")"
+
+[ -n "$rev" ] && rev=".$rev"
+if [ -n "$search" ]; then
+ info=''
+ edit=''
+ rev=''
+fi
+
+lock="$_DATA/Wiki/${info}.lock"
+if ([ -r "$lock" ] && [ "$(cut -d: -f2 "$lock")" -lt "$(date +%s)" ]); then
+ rm "$lock"
+ lock=''
+elif [ -r "$lock" ]; then
+ lock="$(cut -d: -f1 "$lock")"
+else
+ lock=''
+fi
+
+case "$1" in
+ title)
+ echo "Wiki"
+ ;;
+ css)
+ cat ${_EXEC}/templates/Wiki.css
+ ;;
+ body)
+ #. ${_EXEC}/templates/text_wiki.sh
+ if [ -n "$edit" -a -r "$_DATA/Wiki/${edit}${rev}" ]; then
+ title="$(egrep -x 'title=.+' "$_DATA/Wiki/$edit.meta" |cut -d= -f2- || echo '(Untitled)')"
+ . ${_EXEC}/templates/Wiki_edit.page
+ elif [ -n "$info" -a -r "$_DATA/Wiki/${info}${rev}" ]; then
+ title="$(egrep -x 'title=.+' "$_DATA/Wiki/$info.meta" |cut -d= -f2- || echo '(Untitled)')"
+ . ${_EXEC}/templates/Wiki_show.page
+ elif [ -z "$info" ]; then
+ . ${_EXEC}/templates/Wiki_list.page
+ fi
+ ;;
+esac
+