3 # Copyright 2014 Paul Hänsch
5 # This file is part of Busy
7 # Busy is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # Busy is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with Busy. If not, see <http://www.gnu.org/licenses/>.
20 info="$(egrep -o '[0-9]{10}_[0-9]{3}' <<<"$_GET[\"i\"]")"
21 edit="$(egrep -o '[0-9]{10}_[0-9]{3}' <<<"$_GET[\"e\"]")"
22 rev="$(egrep -o '[0-9]{10}' <<<"$_GET[\"r\"]")"
23 search="$(sed 's:\t: :g;s:\r::g;s:\\:\\\\:g' <<<"$_GET[\"s\"]")"
25 [ -n "$rev" ] && rev=".$rev"
26 if [ -n "$search" ]; then
32 lock="$_DATA/Wiki/${info}.lock"
33 if ([ -r "$lock" ] && [ "$(cut -d: -f2 "$lock")" -lt "$(date +%s)" ]); then
36 elif [ -r "$lock" ]; then
37 lock="$(cut -d: -f1 "$lock")"
47 cat ${_EXEC}/templates/Wiki.css
50 #. ${_EXEC}/templates/text_wiki.sh
51 if [ -n "$edit" -a -r "$_DATA/Wiki/${edit}${rev}" ]; then
52 title="$(egrep -x 'title=.+' "$_DATA/Wiki/$edit.meta" |cut -d= -f2- || echo '(Untitled)')"
53 . ${_EXEC}/templates/Wiki_edit.page
54 elif [ -n "$info" -a -r "$_DATA/Wiki/${info}${rev}" ]; then
55 title="$(egrep -x 'title=.+' "$_DATA/Wiki/$info.meta" |cut -d= -f2- || echo '(Untitled)')"
56 . ${_EXEC}/templates/Wiki_show.page
57 elif [ -z "$info" ]; then
58 . ${_EXEC}/templates/Wiki_list.page