+++ /dev/null
-#!/bin/zsh
-
-metafile=project.meta
-userlist="$(sed -rn 's|^([a-zA-Z0-9_+-]):.+$|\1|p' auth/htpasswd)"
-
-if [ "$ACL_ADMIN" = "false" ]; then
- reason=noaccess
- . "./Error.page"
-else
-
- echo "
- <div id='LEFT'></div>
- <div id='MAIN'>
- <div class='section'><form method='post' accept-charset='utf-8' action='write/$($LOGIN && echo user_)projectmeta.cgi'>
- <h1>General</h1>
-
- <fieldset><legend>Title Display</legend>
- <div class='key'>Project Name</div>
- <div class='value'><input type='text' name='appName' value='$(sed -rn 's:^name=(.*)$:\1:p' "$metafile")'></div><br>
- <div class='key'>Project Slogan</div>
- <div class='value'><input type='text' name='appSlogan' value='$(sed -rn 's:^slogan=(.*)$:\1:p' "$metafile")'></div><br>
- </fieldset>
-
- <fieldset><legend>Code Browser</legend>
- <div class='key'><input type='radio' name='repoType' value='svn' $(grep -q repoType=svn $metafile && echo checked)>SVN Repository</div>
- <div class='value'><input type='text' name='svnRepo' value='$(sed -rn 's:^svnRepo=(.*)$:\1:p' "$metafile")'></div><br>
- <div class='key'><input type='radio' name='repoType' value='git' $(grep -q repoType=git $metafile && echo checked)>GIT Repository</div>
- <div class='value'><input type='text' name='gitRepo' value='$(sed -rn 's:^gitRepo=(.*)$:\1:p' "$metafile")'></div><br>
- </fieldset>
-
- <fieldset><legend>Donations</legend>
- <div class='key'><input type='checkbox' name='useFlattr' value='yes' $(grep -q useFlattr=yes $metafile && echo checked)>Flattr \"Thing\" URL</div>
- <div class='value'><input type='text' name='flattrThingURL' value='$(sed -rn 's:^flattrThingURL=(.*)$:\1:p' "$metafile")'></div><br>
- <div class='key'><input type='checkbox' name='useBitcoin' value='yes' $(grep -q useBitcoin=yes $metafile && echo checked)>Bitcoin Address</div>
- <div class='value'><input type='text' name='btcAddress' value='$(sed -rn 's:^btcAddress=(.*)$:\1:p' "$metafile")'></div><br>
- <div class='key'><input type='checkbox' name='usePaypal' value='yes' $(grep -q usePaypal=yes $metafile && echo checked)>Paypal Address</div>
- <div class='value'><input type='text' name='paypalAddress' value='$(sed -rn 's:^paypalAddress=(.*)$:\1:p' "$metafile")'></div><br>
- </fieldset>
-
- <fieldset><legend>Advertisement</legend>
- <div class='key'><input type='radio' name='advertise' value='no' $(grep -q advertise=no $metafile && echo checked)>No Advertisement</div><br>
- <div class='key'><input type='radio' name='advertise' value='btcAd' $(grep -q advertise=btcAd $metafile && echo checked)>
- <a target='_blank' href='http://bitcoinadvertisers.com'>BitCoinAdvertisers.com</a><br>Bitcoin Address:</div>
- <div class='value'>
- <input type='text' name='btcAdAddress' value='$(sed -rn 's:^btcAdAddress=(.*)$:\1:p' "$metafile")'>
- <input type='checkbox' name='btcAdGamble' value='yes' $(egrep -q 'btcAdContent=[13]' project.meta && echo checked)>Allow gambling ads
- <input type='checkbox' name='btcAdErotic' value='yes' $(egrep -q 'btcAdContent=[12]' project.meta && echo checked)>Allow erotic ads
- </div><br>
- </fieldset>
- <input type='submit'>
- </form></div>
-
- </div>
- <div id='RIGHT'></div>
- "
-fi
+++ /dev/null
-#!/bin/zsh
-search="$(egrep -o '(^|&)(s=).+(&|$)' <<<"${QUERY_STRING}" |sed -r 's:^&?s=::;s:\+: :g;s:%:\\x:g')"
-search="$(echo -e "${search}" |sed 's:\t: :g;s:\r::g;s:\\:\\\\:g' |head -n1)"
-
-cat <<WikiEND
- <div id="LEFT">
- <form method="GET" action="/${SCRIPTNAME}" accept-charset="utf-8">
- <input type="hidden" name="p" value="Home">
- <input type="text" name="s" placeholder="Search"><br>
- <input type="submit" value="Search News">
- </form>
- <hr>
-WikiEND
-if [ -n "$search" ]; then
- echo "<h1>News search results for: $search</h1>"
- for each in $(grep -ile "$search" Home/<0000000000-9999999999>_<000-999>.news); do
- id=$(sed -r 's:^.*/::;s:.news$::' <<<$each)
- echo "<div class='search'><a href='#news_$id'><h2>$(date -d @$(cut -d_ -f1 <<<"$id"))</h2></a>"
- grep -C1 -ie "$search" "$each" |sed "s:$search:<b>&</b>:g;s:$:<br>:g"
- echo '</div>'
- done
- echo '<hr>'
-fi
-
-cat <<HomeEND
- </div>
-
- <div id="MAIN">
- <div id="INTRO">
- <div id="introtext"><div class="wikitext">
- $([ -r "Home/intro" ] && _wiki "Home/intro")
- $($ACL_EDITINTRO && echo "<hr><a class='function' href='#' onclick='javascript:hide_screen(\"introtext\");show_screen(\"introedit\");'>Edit</a>" )
- </div></div>
-HomeEND
-$ACL_EDITINTRO && cat <<HomeEND
- <div id="introedit" style="display: none;">
- <form action="/write/$($LOGIN && echo user_)introedit.cgi?i=intro" method="post" accept-charset="UTF-8">
- <textarea name="text" rows="10">$([ -r "Home/intro" ] && cat Home/intro)</textarea><br>
- <input type="submit">
- <a class="function" href="#" onclick="javascript:hide_screen('introedit');show_screen('introtext');">Cancel</a>
- </form>
- </div>
-HomeEND
-echo '</div>'
-
-$ACL_ADDNEWS && cat <<HomeEND
- <div class="NEWS">
- <a id="new" class='function' href='#add' onclick='javascript:hide_screen("new");show_screen("add");'>Add News</a>
- <div id="add" style="display: none;">
- <form action="/write/$($LOGIN && echo user_)introedit.cgi?i=news" method="post" accept-charset="UTF-8">
- <textarea name="text" rows="10">$([ -r "$each" ] && cat $each)</textarea><br>
- <input type="submit">
- <a class="function" href="#new" onclick="javascript:hide_screen('add');show_screen('new');">Cancel</a>
- </form>
- </div>
- </div>
-HomeEND
-
-stat -c '' Home/<0000000000-9999999999>_<000-999>.news && for each in $(ls -c Home/<0000000000-9999999999>_<000-999>.news); do
- info="$(sed 's:Home/::;s:.news::' <<<"$each")"
- cat <<HomeEND
- <div class="NEWS">
- <div id="news_$info"><div class="wikitext">
- $([ -r "$each" ] && _wiki "$each")
- $($ACL_EDITNEWS && echo "<hr><a class='function' href='#edit_$info' onclick='javascript:hide_screen(\"news_$info\");show_screen(\"edit_$info\");'>Edit</a>" )
- </div></div>
-HomeEND
- $ACL_EDITNEWS && cat <<HomeEND
- <div id="edit_$info" style="display: none;">
- <form action="/write/$($LOGIN && echo user_)introedit.cgi?i=$info" method="post" accept-charset="UTF-8">
- <textarea name="text" rows="10">$([ -r "$each" ] && cat $each)</textarea><br>
- <input type="submit">
- <a class="function" href="#news_$info" onclick="javascript:hide_screen('edit_$info');show_screen('news_$info');">Cancel</a>
- </form>
- </div>
-HomeEND
- echo '</div>'
-done
-
-cat <<HomeEND
- </div>
- <div id="RIGHT">
- $(grep -q 'advertise=btcAd' project.meta && echo '<h1>Sponsored Links:</h1>
- <iframe src="http://bitcoinadvertisers.com/a.php?p='$(sed -rn 's:^btcAdAddress=(.+):\1:p' project.meta)'&a='$(sed -rn 's:^btcAdContent=([1-4]):\1:p' project.meta)'&bg=FFFFFF&link=3366FF&text=414141" scrolling="no" style="width:120px;height:300px;border:1px solid #f2f2f2;"></iframe>
- <iframe src="http://bitcoinadvertisers.com/a.php?p='$(sed -rn 's:^btcAdAddress=(.+):\1:p' project.meta)'&a='$(sed -rn 's:^btcAdContent=([1-4]):\1:p' project.meta)'&bg=FFFFFF&link=3366FF&text=414141" scrolling="no" style="width:120px;height:300px;border:1px solid #f2f2f2;"></iframe>'
- )
- </div>
-HomeEND
+++ /dev/null
-#!/bin/zsh
-
-info="$(sed -r 's:(^|.*&)i=([0-9]{10}_[0-9]{3}).*|.*:\2:;s:&.*::' <<<"${QUERY_STRING}")"
-edit="$(sed -r 's:(^|.*&)e=([0-9]{10}_[0-9]{3}).*|.*:\2:;s:&.*::' <<<"${QUERY_STRING}")"
-search="$(sed -r 's:(^|.*&)s=(.*)|.*:\2:;s:&.*::;s:\+: :g;s:%:\\x:g' <<<"${QUERY_STRING}")"
-search="$(echo -e "${search}" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
-new="$(sed -r 's:(^|.*&)n=(.*)|.*:\2:;s:&.*::;s:\+: :g;s:%:\\x:g' <<<"${QUERY_STRING}")"
-new="$(echo -e "${new}" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
-
-[ -z "$ACL_CREATETASK" ] && ACL_CREATETASK=false
-
-cat <<TasksEND
- <div id="LEFT">
- <form method="GET" action="/${SCRIPTNAME}" accept-charset="utf-8">
- <input type="hidden" name="p" value="Tasks">
- <input type="text" name="s" placeholder="Search"><br>
- <input type="submit" value="Search Tasks">
- </form>
- <hr>
-TasksEND
-#search results
-if [ -n "$search" ]; then
- echo "<h1>Tasks search results for: $search</h1>"
- for each in $(grep -ile "$search" Tasks/<0000000000-9999999999>_<000-999>); do
- id=$(sed -r 's:^.*/::;s:.task$::' <<<$each)
- echo "<div class='search'><a href='${SCRIPTNAME}?p=Tasks&i=$id'><h2>$(date -d @$(cut -d_ -f1 <<<"$id"))</h2></a>"
- grep -C1 -ie "$search" "$each" |sed "s:$search:<b>&</b>:g;s:$:<br>:g"
- echo '</div>'
- done
- echo '<hr>'
-fi
-echo '</div><div id="MAIN">'
-
-#Display single task
-if [ -n "$info" -a -r "Tasks/$info" -a -r "Tasks/$info.meta" ]; then
- datafile="Tasks/$info"
- metafile="Tasks/$info.meta"
- headline="$(sed -rn '/^headline=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
- taskstatus="$(sed -rn '/^status=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
- section="$(sed -rn '/^section=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
- attendant="$(sed -rn '/^attendant=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
- [ -z "$section" ] && section='(none)'
- [ -z "$attendant" ] && attendant='(none)'
- cat <<TasksEND
- <div class="Task">
- <div class="wikitext">
- <h1>$headline</h1>
- $(_wiki "$datafile")
- </div>
- <table><tr>
- <td><b>Status</b><br>
- $taskstatus</td>
- <td><b>Section</b><br>
- $section</td>
- <td><b>Attendant</b><br>
- $attendant</td>
- </tr></table>
- </div>
-TasksEND
-fi
-
-#create task main dialog
-[ -z "$info" -a -n "$new" ] && cat <<TaskEnd
-<form class="Task" style="height:20em;" method="post" action="write/$($LOGIN && echo user_)taskmeta.cgi" accept-charset="UTF-8">
- <h1>$new</h1>
- <input type="hidden" name="headline" value="$new">
- <input type="hidden" name="status" value="new">
- <div style="width:60%;left:3.5em;">
- <b>Description:</b><br>
- <textarea name="description" rows="11"></textarea>
- </div><div style="width:30%;right:.5em;">
- <b>Section:</b><br>
- <select name="section" size="6" style="width:80%">
- $(for each in $(egrep -hx 'section=.+' Tasks/<0000000000-9999999999>_<000-999>.meta |sort -u); do
- echo "<option>$(sed 's:section=::' <<<"$each")</option>"
- done)
- </select><br>
- <b>other section:</b><br>
- <input type="text" name="section">
- <input type="submit" name="submit" value="Robots click here" style="display:none;">
- <input type="submit" name="submit" value="Create Task">
- <input type="submit" name="submit" value="Robots click here" style="display:none;">
- </div>
-</form>
-TaskEnd
-
-#Plain list of tasks (default)
-[ -z "$info" -a -z "$new" ] && stat -c '' Tasks/<0000000000-9999999999>_<000-999>.meta && for each in Tasks/<0000000000-9999999999>_<000-999>.meta(.om); do
- info="$(basename "$each" |sed 's:.meta$::')"
- headline="$(sed -rn '/^headline=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
- taskstatus="$(sed -rn '/^status=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
- section="$(sed -rn '/^section=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
- attendant="$(sed -rn '/^attendant=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
- [ -z "$section" ] && section='(none)'
- [ -z "$attendant" ] && attendant='(none)'
- cat <<TasksEND
- <div class="Task">
- <a href="${SCRIPTNAME}?p=Tasks&i=${info}"><b>$headline</b></a><br>
- <span><b>Status:</b> $taskstatus</span>
- <span><b>Section:</b> $section</span>
- <span><b>Attendant:</b> $attendant</span>
- </div>
-TasksEND
-done
-
-#dropdown dialog for adding a task
-echo '</div> <div id="RIGHT">'
-$ACL_CREATETASK && [ -z "$new" ] && cat <<TasksEND
- <a id='newTask_button' class='function' href='#' onclick='javascript:show_screen("newTask");hide_screen("newTask_button");'>New Task</a>
- <div id="newTask" style="display: none;">
- <form action="/${SCRIPTNAME}" method="get" accept-charset="UTF-8">
- <b>Headline:</b><br>
- <input type="hidden" name="p" value="Tasks">
- <textarea name="n" rows="2" style="width:99%;"></textarea><br>
- <input type="submit" value="Submit">
- <a class="function" href="#" onclick="javascript:hide_screen('newTask');show_screen('newTask_button');">Cancel</a>
- </form>
- </div>
-TasksEND
-echo '</div>'
+++ /dev/null
-#!/bin/zsh
-
-info="$(egrep -o '(^|&)(i=)[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&i=')"
-edit="$(egrep -o '(^|&)(e=)[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&e=')"
-rev="$(egrep -o '(^|&)(r=)[0-9]{10}(&|$)' <<<"${QUERY_STRING}" |tr -d '&r=')"
-search="$(egrep -o '(^|&)(s=).+(&|$)' <<<"${QUERY_STRING}" |sed -r 's:^&?s=::;s:\+: :g;s:%:\\x:g')"
-search="$(echo -e "${search}" |sed 's:\t: :g;s:\r::g;s:\\:\\\\:g' |head -n1)"
-
-[ -n "$rev" ] && rev=".$rev"
-if [ -n "$search" ]; then
- info=''
- edit=''
- rev=''
-fi
-
-lock="Wiki/$info.lock"
-[ -r "$lock" -o -n "$lock" ] && if [ "$(cut -d: -f2 "$lock")" -lt "$(date +%s)" ]; then
- rm "$lock"
- lock=''
-else
- lock="$(cut -d: -f1 "$lock")"
-fi
-
-if [ -n "$edit" -a -r "Wiki/${edit}${rev}" ]; then
- title="$(egrep -x 'title=.+' "Wiki/$edit.meta" |cut -d= -f2- || echo '(Untitled)')"
- cat <<WikiEND
- <form class="edit" action="write/$($LOGIN && echo user_)wikiedit.cgi?i=$edit" method="post" accept-charset="UTF-8">
- <div id="LEFT">
- Editing <b>$title</b><br>
- <input type="submit" value="Submit">
- <input type="submit" name="cancel" value="Cancel">
- <hr>
- </div>
- <div id="MAIN">
- <div class="wiki">
- <h1>$title</h1>
- <textarea name="page" rows=30 cols=40>$(cat "Wiki/${edit}${rev}")</textarea>
- </div>
- </div>
- </form>
- <div id="RIGHT">
- $(stat -c '' Wiki/${edit}.comment.<0000000000-9999999999>_<000-999> && for each in $(ls -c Wiki/${edit}.comment.<0000000000-9999999999>_<000-999>); do
- author=$(grep -m1 '^author=' "$each" |cut -d= -f2-)
- echo "<div class='comment'><h1>$author wrote:</h1><div class='wikitext'>"
- tail -n+2 $each |_wiki
- echo '</div></div>'
- done)
- </div>
-WikiEND
-
-elif [ -n "$info" -a -r "Wiki/${info}${rev}" ]; then
- title="$(egrep -x 'title=.+' "Wiki/$info.meta" |cut -d= -f2- || echo '(Untitled)')"
-
- cat <<WikiEND
- <div id="LEFT">
- <form method="GET" action="/${SCRIPTNAME}" accept-charset="utf-8">
- <input type="hidden" name="p" value="Wiki">
- <input type="text" name="s" placeholder="Search"><br>
- <input type="submit" value="Search Wiki">
- </form>
- <hr>
-
- <b>Revisions:</b>
- $(rno=1; for each in Wiki/$info.<0000000000-9999999999>; do
- revi=$(cut -d. -f2 <<<"$each")
- echo "<a class='rev' href='?p=Wiki&i=$info&r=$revi'>$rno</a>"
- rno=$(($rno+1))
- done) <a class='rev' href='?p=Wiki&i=$info'>Latest</a><br>
- <hr>
- $($LOGIN && if [ -z "$lock" ]; then
- [ -z "$rev" ] && echo "<a class='function' href='write/$($LOGIN && echo user_)lock.cgi?p=Wiki&e=$info'>edit this page</a>"
- [ -n "$rev" ] && echo "Click <a class='function' href='write/$($LOGIN && echo user_)lock.cgi?p=Wiki&e=${info}&r=${rev:s/.//}'>edit</a> to derive a new page revision from this one."
- else
- echo "<b>This page is currently being edited by $lock</b><a class='function' href='write/$($LOGIN && echo user_)lock.cgi?p=Wiki&e=$info'>edit anyway</a>"
- fi
- $LOGIN && echo '<hr>')
- <h1>Table of Content</h1>
- <div class="toc">
- $(cat Wiki/"${info}${rev}" |while read line; do
- if (egrep -q '^ *!!!' <<<"$line"); then
- echo "<a class='i2' href='#$(sed 's,^ *!!! *,,;s,[^a-zA-Z0-9],.,g' <<<"$line")'>$(sed 's,^ *!!!,,' <<<"$line")</a><br>"
- elif (egrep -q '^ *!!' <<<"$line"); then
- echo "<a class='i1' href='#$(sed 's,^ *!! *,,;s,[^a-zA-Z0-9],.,g' <<<"$line")'>$(sed 's,^ *!!,,' <<<"$line")</a><br>"
- elif (egrep -q '^ *!' <<<"$line"); then
- echo "<a class='i0' href='#$(sed 's,^ *! *,,;s,[^a-zA-Z0-9],.,g' <<<"$line")'>$(sed 's,^ *!,,' <<<"$line")</a><br>"
- fi
- done)
- </div>
- <hr>
- </div>
- <div id="MAIN">
- <div class="wiki"><div class="wikitext">
- <h1>$title</h1>
- $(_wiki Wiki/"${info}${rev}")
- </div></div>
- </div>
-WikiEND
-
- echo '<div id="RIGHT">'
-$LOGIN && cat <<WikiEND
- <a id='comment_button' class='function' href='#' onclick='javascript:show_screen("comment");hide_screen("comment_button");'>Comment / Ask</a>
- <div id="comment" style="display: none;">
- <form action="/write/$($LOGIN && echo user_)wikimeta.cgi?i=$info" method="post" accept-charset="UTF-8">
- <b>Comment:</b><br>
- <textarea name="comm" rows="6" style="width:99%;"></textarea><br>
- <input type="submit" value="Submit">
- <a class="function" href="#" onclick="javascript:hide_screen('comment');show_screen('comment_button');">Cancel</a>
- </form>
- </div>
-WikiEND
- stat -c '' Wiki/${info}.comment.<0000000000-9999999999>_<000-999> && for each in $(ls -c Wiki/${info}.comment.<0000000000-9999999999>_<000-999>); do
- author=$(grep -m1 '^author=' "$each" |cut -d= -f2-)
- echo "<div class='comment'><h1>$author wrote:</h1><div class='wikitext'>"
- tail -n+2 $each |_wiki
- echo '</div></div>'
- done
- echo '</div>'
-
-elif [ -z "$info" ]; then
- cat <<WikiEND
- <div id="LEFT">
- <form method="GET" action="/${SCRIPTNAME}" accept-charset="utf-8">
- <input type="hidden" name="p" value="Wiki">
- <input type="text" name="s" placeholder="Search"><br>
- <input type="submit" value="Search Wiki">
- </form>
- <hr>
-WikiEND
- if [ -n "$search" ]; then
- echo "<h1>Wiki search results for: $search</h1>"
- for each in $(grep -ile "$search" Wiki/<0000000000-9999999999>_<000-999>); do
- echo "<div class='search'><a href='?p=Wiki&i=${each:t}'><h2>$(grep '^title=' "$each.meta" |cut -d= -f2-)</h2></a>"
- grep -C1 -ie "$search" "$each" |sed "s:$search:<b>&</b>:g;s:$:<br>:g"
- echo '</div>'
- done
- echo '<hr>'
- fi
- echo '</div><div id="RIGHT">'
- $LOGIN && cat <<WikiEND
- <a id='addp_button' class='function' href='#' onclick='javascript:show_screen("add_page");hide_screen("addp_button");'>Add a new Page</a>
- <div id="add_page" style="display: none;">
- <form action="/write/$($LOGIN && echo user_)wikimeta.cgi" method="post" accept-charset="UTF-8">
- <br><b>Title:</b><br>
- <input type="text" name="title" placeholder="Fill in a title"><br>
- <b>Description:</b><br>
- <textarea name="desc" rows="6" ></textarea><br>
- <input type="submit" value="Submit">
- <a class="function" href="#" onclick="javascript:hide_screen('add_page');show_screen('addp_button');">Cancel</a>
- </form>
- </div>
-WikiEND
- echo '</div><div id="MAIN">'
-
- stat -c '' Wiki/<0000000000-9999999999>_<000-999> && for each in Wiki/<0000000000-9999999999>_<000-999>; do
- info=$(sed 's,Wiki/,,' <<<"$each")
- title="$(egrep -x 'title=.+' "$each.meta" |cut -d= -f2- || echo '(Untitled)')"
- description="$(egrep -x 'description=.+' "$each.meta" |cut -d= -f2-)"
- owner="$(egrep -x 'owner=.+' "$each.meta" |cut -d= -f2-)"
-
- cat <<WikiEND
- <div class="article">
- <div id="display_$info">
- <a name="$info" href="/?p=Wiki&i=$info"><h1>$title</h1></a>
- $description<br><br>
- <a class="function" href="/?p=Wiki&i=$info">View</a>
- $($ACL_WIKIEDIT && echo "<a class='function' href='#' onclick=\"javascript:show_screen('change_$info');hide_screen('display_$info');\">Change Info</a>")
- </div>
-WikiEND
- $ACL_WIKIEDIT && cat <<WikiEND
- <div id="change_$info" style="display: none;">
- <form action="/write/$($LOGIN && echo user_)wikimeta.cgi?i=$info" method="post" accept-charset="UTF-8">
- <b>Title:</b> <input type="text" name="title" value="$title"><br>
- <b>Description:</b><br>
- <textarea name="desc" rows="6" style="width:100%;">$description</textarea><br>
- <input type="submit" value="Submit">
- <a class="function" href="#" onclick="javascript:hide_screen('change_$info');show_screen('display_$info');">Cancel</a>
- </form>
- </div>
-WikiEND
- echo '</div>'
- done
- echo '</div>'
-fi
--- /dev/null
+#!/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 <http://www.gnu.org/licenses/>.
+
+ACTION="$(echo "$_GET[\"action\"]" |egrep '^[a-zA-Z0-9_-]+$')"
+ACTION="${_EXEC}/actions/${ACTION}.sh"
+[ -x "$ACTION" ] || echo -n "Location: http://$HTTP_HOST/?page=error\n\n"
+
+. $ACTION
#!/bin/zsh
-# Copyright 2011 Paul Haensch
+# Copyright 2011 - 2014 Paul Haensch
# This file is part of Busy
#
# Busy is free software: you can redistribute it and/or modify
# You should have received a copy of the GNU Affero General Public License
# along with Busy. If not, see <http://www.gnu.org/licenses/>.
-[ "$HTTPS" = "on" ] && proto=https || proto=http
-. ../auth/permissions.sh
-info="$(egrep -o '(^|&)i=([0-9]{10}_[0-9]{3}|intro|news)(&|$)' <<<"${QUERY_STRING}" |sed 's:&::g;s:i=::')"
+info="$(echo -E "$_GET[\"i\"]" |grep -Ex 'intro|news')"
if [ "$info" = "news" ]; then
$ACL_ADDNEWS || info=''
elif [ -z "$info" ]; then
$ACL_EDITNEWS || info=''
fi
-[ -n "$info" ] || echo -n "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
+[ -n "$info" ] || echo -n "Location: //${HTTP_HOST}/?p=Error&i=noaccess\n\n"
[ -n "$info" ] || exit 0
[ "$info" = "news" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
[ "$info" != "intro" ] && info="${info}.news"
[ "$info" = "intro" ] && ($ACL_EDITINTRO || info='')
-if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
-(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' |while read line; do
- if (echo "${line}" | egrep -xq 'text=.+'); then
- text="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- text=$(echo -e "${text}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g')
- elif (echo "${line}" | egrep -xq 'cancel=.+'); then
- cancel=true
- fi
-done
-fi
+cgi_post
-[ -z "$cancel" ] && echo -e "${text}" >"../Home/$info"
+[ -z "$_POST[\"cancel\"]" ] && echo -E "$_POST[\"text\"]" >"$_DATA/Home/$info"
-echo -n "Location: ${proto}://${HTTP_HOST}/?p=Home\n\n"
+echo -n "Location: ${HTTP_REFERER}\n\n"
# You should have received a copy of the GNU Affero General Public License
# along with Busy. If not, see <http://www.gnu.org/licenses/>.
-if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
-(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' |while read line; do
- if (echo "${line}" | egrep -xq 'user=.+'); then
- user="$(echo "${line}" |cut -d= -f2- |sed 's/+/ /g;s/%/\\x/g')"
- user=$(echo -e "${user}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)
- elif (echo "${line}" | egrep -xq 'pass=.+'); then
- pass="$(echo "${line}" |cut -d= -f2- |sed 's/+/ /g;s/%/\\x/g')"
- pass=$(echo -e "${pass}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g')
- fi
-done
-fi
+$ACL_WIKIEDIT || echo "Location: //${HTTP_HOST}/?p=Error&i=noaccess\n\n"
+$ACL_WIKIEDIT || exit 0
-echo -n "Location: https://${user}:${pass}@${HTTP_HOST}/session.cgi?${QUERY_STRING}\n\n"
+page="$(echo -E "$_GET[\"p\"]" |egrep -Ex 'Wiki')"
+edit="$(echo -E "$_GET[\"e\"]" |egrep -Ex '[0-9]{10}_[0-9]{3}(_[0-9]{1,4})?')"
+
+case "$page" in
+ Wiki) [ -f "$_DATA/Wiki/${edit}" ] && echo "${USER}:$(($(date +%s)+600))" >"$_DATA/Wiki/${edit}.lock"
+ echo -n "Location: //${HTTP_HOST}/?p=Wiki&e=$edit\n\n"
+ ;;
+ *) echo -n "Location: //${HTTP_HOST}/?p=Error&r=input&$page\n\n"
+ exit 0
+ ;;
+esac
--- /dev/null
+#!/bin/zsh
+# Copyright 2011 Paul Haensch
+# 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/>.
+
+cgi_post
+
+user="$(echo -E "$_POST[\"user\"]" |sed -rn '1{/^[a-zA-Z0-9_+@.-]+$/p}')"
+pass="$_POST[\"pass\"]"
+userfile="$_DATA/auth/user$(echo -E "$user" |sha1sum |cut -c1-40)"
+
+if [ -r "$userfile" ]; then
+ salt=$(sed -nr 's:^salt=(.+)$:\1:p' "$userfile")
+ ssum=$(sed -nr 's:^auth=(.+)$:\1:p' "$userfile")
+ rsum=$(echo -E "$salt$pass" |sha1sum |cut -c1-40)
+fi
+if [ "$ssum" = "$rsum" ]; then
+ sid="$(apg -n1 -a1 -m32 -x32 -M CLN)"
+ sessionfile="$_DATA/auth/session$sid"
+ echo -E "$user $(($(date +%s) + 1800))" >"$sessionfile"
+ echo -E "Location: $HTTP_REFERER"
+ echo -E "Set-Cookie: session=$sid; HttpOnly"
+else
+ echo -E "Location: $HTTP_REFERER"
+fi
+echo ''
--- /dev/null
+#!/bin/zsh
+
+# 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/>.
+
+sessfile="$_DATA/auth/session$(sed -rn 's:^.*session=([a-zA-Z0-9]{32}).*$:\1:p' <<<"$HTTP_COOKIE")"
+[ -f "$sessfile" ] && rm "$sessfile"
+
+echo -E "Location: $HTTP_REFERER"
+echo ''
+
--- /dev/null
+#!/bin/zsh
+
+# Copyright 2012 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/>.
+
+metafile="$_DATA/project.meta"
+
+$ACL_ADMIN || echo "Location: //${HTTP_HOST}/?p=Error&i=noaccess\n\n"
+$ACL_ADMIN || exit 0
+
+cgi_post
+
+[ "$_POST[\"btcAdGamble\"]" = yes -a "$_POST[\"btcAdErotic\"]" = yes ] && btcAdContent=1
+[ "$_POST[\"btcAdGamble\"]" != yes -a "$_POST[\"btcAdErotic\"]" = yes ] && btcAdContent=2
+[ "$_POST[\"btcAdGamble\"]" = yes -a "$_POST[\"btcAdErotic\"]" != yes ] && btcAdContent=3
+[ "$_POST[\"btcAdGamble\"]" != yes -a "$_POST[\"btcAdErotic\"]" != yes ] && btcAdContent=4
+
+echo -E "\
+name=$_POST[\"appName\"]
+slogan=$_POST[\"appSlogan\"]
+repoType=$(echo -E "$_POST[\"repoType\"]" |grep -Ex 'svn|git')
+svnRepo=$_POST[\"svnRepo\"]
+gitRepo=$_POST[\"gitRepo\"]
+useFlattr=$(echo -E "$_POST[\"useFlattr\"]" |grep -Ex 'yes')
+flattrThingURL=$_POST[\"flattrThingURL\"]
+usePaypal=$(echo -E "$_POST[\"usePaypal\"]" |grep -Ex 'yes')
+paypalAddress=$_POST[\"paypalAddress\"]
+useBitcoin=$(echo -E "$_POST[\"useBitcoin\"]" |grep -Ex 'yes')
+btcAddress=$_POST[\"btcAddress\"]
+advertise=$(echo -E "$_POST[\"advertise\"]" |grep -Ex 'btcAd|no')
+btcAdAddress=$_POST[\"btcAdAddress\"]
+btcAdContent=$btcAdContent
+" >"$metafile"
+
+echo -n "Location: ${HTTP_REFERER}\n\n"
--- /dev/null
+#!/bin/zsh
+# Copyright 2011 Paul Haensch
+# 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/>.
+
+$ACL_CREATETASK || echo "Location: //${HTTP_HOST}/?p=Error&i=noaccess\n\n"
+$ACL_CREATETASK || exit 0
+
+info="$_GET[\"i\"]"
+
+[ -z "$info" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
+descfile="$_DATA/Tasks/$info.meta"
+commfile="$_DATA/Tasks/$info.comment.$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
+
+[ -f "$_DATA/Tasks/$info.lock" ] && rm "$_DATA/Wiki/$info.lock"
+anchor=$(ls $_DATA/Tasks |grep -A2 $info |grep '.meta$' |tail -n1 |cut -d. -f1)
+
+cgi_post
+headline="$_POST[\"headline\"]"
+taskstatus="$_POST[\"status\"]"
+section="$_POST[\"section\"]"
+description="$_POST[\"description\"]"
+comment="$_POST[\"comm\"]"
+[ -n "$_POST[\"cancel\"]" ] && cancel=true
+[ "$_POST[\"submit\"]" = "Robots click here" ] && cancel=true
+
+if [ -z "$cancel" -a -n "$comment" ]; then
+ touch "$_DATA/Tasks/$info"
+ echo -e "author=${USER}" > "$commfile"
+ echo -e "${comment}" >> "$commfile"
+ echo -n "Location: //${HTTP_HOST}/?p=Tasks&i=$info\n\n"
+elif [ -z "$cancel" -a -n "$description" ]; then
+ touch "$_DATA/Tasks/$info"
+ echo -e "headline=${headline}" > "$descfile"
+ echo -e "status=${taskstatus}" >> "$descfile"
+ echo -e "section=${section}" >> "$descfile"
+ echo -e "${description}" >> "$_DATA/Tasks/$info"
+ echo -n "Location: //${HTTP_HOST}/?p=Tasks#$anchor\n\n"
+elif [ -n "$cancel" ]; then
+ echo -n "Location: //${HTTP_HOST}/?p=Tasks#$anchor\n\n"
+fi
# You should have received a copy of the GNU Affero General Public License
# along with Busy. If not, see <http://www.gnu.org/licenses/>.
-[ "$HTTPS" = "on" ] && proto=https || proto=http
-. ../auth/permissions.sh
$ACL_WIKIEDIT || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
-$ACL_WIKIEDIT || exit 0
+$ACL_WIKIEDIT || exit 0
-page=$(egrep -o '(^|&)p=(QandA|Locations|Wiki)(&|$)' <<<"${QUERY_STRING}" |sed 's,p=,,;s,&,,g')
-edit=$(egrep -o '(^|&)e=[0-9]{10}_[0-9]{3}(_[0-9]{1,4})?(&|$)' <<<"${QUERY_STRING}" |tr -d 'e=&')
+info="$(echo "$_GET[\"i\"]" |grep -Ex '[0-9]{10}_[0-9]{3}')"
+[ -f "$_DATA/Wiki/$info.lock" ] && rm "$_DATA/Wiki/$info.lock"
-case "$page" in
- Wiki) [ -f "../Wiki/${edit}" ] && echo "${REMOTE_USER}:$(($(date +%s)+600))" >"../Wiki/${edit}.lock"
- ;;
- *) echo -n "Location: http://$host/?p=Error&r=input&$page\n\n"
- exit 0
- ;;
-esac
-echo -n "Location: ${proto}://${HTTP_HOST}/?${QUERY_STRING}\n\n"
+cgi_post
+page="$_POST[\"page\"]"
+[ -n "$_POST[\"cancel\"]" ] && cancel=true
+
+[ -z "$cancel" -a -f "$_DATA/Wiki/$info" ] && mv "$_DATA/Wiki/$info" "$_DATA/Wiki/$info.$(date +%s)"
+[ -z "$cancel" ] && echo -e "${page}" >"$_DATA/Wiki/$info"
+
+echo -n "Location: //${HTTP_HOST}/?p=Wiki&i=$info\n\n"
--- /dev/null
+#!/bin/zsh
+# Copyright 2011 - 2014 Paul Haensch
+# 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/>.
+
+$ACL_WIKIEDIT || echo "Location: //${HTTP_HOST}/?p=Error&i=noaccess\n\n"
+$ACL_WIKIEDIT || exit 0
+
+info="$(egrep -o '(^|&)i=[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&i=')"
+info="$(echo -E "$_GET[\"i\"]" |grep -Ex '[0-9]{10}_[0-9]{3}')"
+
+[ -z "$info" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
+descfile="$_DATA/Wiki/$info.meta"
+commfile="$_DATA/Wiki/$info.comment.$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
+
+[ -f "$_DATA/Wiki/$info.lock" ] && rm "$_DATA/Wiki/$info.lock"
+anchor=$(ls "$_DATA/Wiki" |grep -A2 $info |grep '.meta$' |tail -n1 |cut -d. -f1)
+
+cgi_post
+title="$_POST[\"title\"]"
+description="$_POST[\"desc\"]"
+comment="$_POST[\"comm\"]"
+[ -n "$_POST[\"cancel\"]" ] && cancel=true
+
+if [ -z "$cancel" -a -n "$comment" ]; then
+ touch "$_DATA/Wiki/$info"
+ echo -e "author=${USER}" > "$commfile"
+ echo -e "${comment}" >> "$commfile"
+ echo -n "Location: //${HTTP_HOST}/?p=Wiki&i=$info\n\n"
+elif [ -z "$cancel" -a -n "$description" ]; then
+ touch "$_DATA/Wiki/$info"
+ echo -e "title=${title}" > "$descfile"
+ echo -e "description=${description}" >> "$descfile"
+ echo -n "Location: //${HTTP_HOST}/?p=Wiki#$anchor\n\n"
+elif [ -n "$cancel" ]; then
+ echo -n "Location: //${HTTP_HOST}/?p=Wiki#$anchor\n\n"
+fi
+++ /dev/null
-ANL_ADMIN="paul"
-ANL_EDITINTRO="paul"
-ANL_ADDNEWS="paul"
-ANL_EDITNEWS="paul"
-ANL_CREATETASK=".*"
-ANL_WIKIEDIT="paul"
-
-[ -n "$REMOTE_USER" ] && USER="$REMOTE_USER" || USER="#NONE#"
-egrep -xq "$ANL_ADMIN" <<<"$USER" && ACL_ADMIN=true || ACL_ADMIN=false
-egrep -xq "$ANL_EDITINTRO" <<<"$USER" && ACL_EDITINTRO=true || ACL_EDITINTRO=false
-egrep -xq "$ANL_ADDNEWS" <<<"$USER" && ACL_ADDNEWS=true || ACL_ADDNEWS=false
-egrep -xq "$ANL_EDITNEWS" <<<"$USER" && ACL_EDITNEWS=true || ACL_EDITNEWS=false
-egrep -xq "$ANL_CREATETASK" <<<"$USER" && ACL_CREATETASK=true || ACL_CREATETASK=false
-egrep -xq "$ANL_WIKIEDIT" <<<"$USER" && ACL_WIKIEDIT=true || ACL_WIKIEDIT=false
-
--- /dev/null
+#!/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 <http://www.gnu.org/licenses/>.
+
+declare -A _GET
+declare -A _POST
+declare -A _REF
+
+cgi_get() { # parse HTTP GET string
+ echo "$QUERY_STRING" |tr '&' '\n' |while read query; do
+ key="$(echo -E "$query" |sed -r 's:^([a-zA-Z0-9_-]*)=(.*)$:\1:')"
+ val="$(echo -E "$query" |sed -r 's:^([a-zA-Z0-9_-]*)=(.*)$:\2:')"
+ _GET["$key"]="$(echo -e "$(echo -E "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g')")"
+ done
+}
+
+cgi_post() { # parse HTTP POST string
+ sed -u 1q |tr '&' '\n' |while read query; do
+ key="$(echo -E "$query" |sed -r 's:^([a-zA-Z0-9_-]*)=(.*)$:\1:')"
+ val="$(echo -E "$query" |sed -r 's:^([a-zA-Z0-9_-]*)=(.*)$:\2:')"
+ value="$(echo -e "$(echo -E "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g;')")"
+ if [ -n "$_POST[\"$key\"]" ]; then
+ n=0
+ while [ -n "$_POST[\"$key$n\"]" ]; do n=$(($n + 1)); done
+ _POST["$key$n"]="$value"
+ else
+ _POST["$key"]="$value"
+ fi
+ #debug "_POST[$key] => $value"
+ done
+}
+
+cgi_refdata() { # Parse GET data from referer
+ echo "$HTTP_REFERER" |cut -d'?' -f2- |tr '&' '\n' |while read query; do
+ key="$(echo -E "$query" |sed -r 's:^([a-zA-Z0-9_-]*)=(.*)$:\1:')"
+ val="$(echo -E "$query" |sed -r 's:^([a-zA-Z0-9_-]*)=(.*)$:\2:')"
+ _REF["$key"]="$(echo -e "$(echo -E "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g')")"
+ done
+}
--- /dev/null
+#!/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 <http://www.gnu.org/licenses/>.
+
+umask=002
+#alias _wiki="stx2any --no-template --link-abbrevs --quote -T html"
+_wiki(){
+ markdown $* |sed -r 's:<(h[1-6])>(.+)</h[1-6]>:<\1><a name="\2">\2</a></\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
+++ /dev/null
-#!/bin/zsh
-
-# Copyright 2011 Paul Haensch
-# 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/>.
-
-umask=002
-alias _wiki="stx2any --no-template --link-abbrevs --quote -T html"
-. auth/permissions.sh
-
-page=$(egrep -o '(^|&)p=[a-zA-Z0-9/_-]+(&|$)' <<<"${QUERY_STRING}" |sed 's,&,,g;s,p=,,')
-
-[ -z "$LOGIN" ] && LOGIN=false
-[ -z "$page" ] && page=Home
-
-if (! $LOGIN && egrep -qx "https?://${HTTP_HOST}/(session.cgi\?|write/).*" <<<"${HTTP_REFERER}"); then
- echo -n "Location: https://${HTTP_HOST}/session.cgi?${QUERY_STRING}\n\n"
- exit 0
-fi
-
-echo -n "Content-type: text/html\n\n"
-
-cat <<END_index.cgi
-<!DOCTYPE HTML>
-<!-- DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" -->
-
-<html>
- <head>
- <title>$(sed -rn 's:^name=(.*)$:\1:p' project.meta) - Busy</title>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
- <link rel="stylesheet" type="text/css" href="busy.css">
- <link rel="stylesheet" type="text/css" href="wikitext.css">
- $([ -r "${page}.css" ] && echo '<link rel="stylesheet" type="text/css" href="'"$page"'.css">')
- <style type="text/css"><!-- --></style>
-
- <script type="text/javascript">
- <!--
- function show_screen(id){
- document.getElementById(id).style.display = "inline";
- }
- function hide_screen(id){
- document.getElementById(id).style.display = "none";
- }
- -->
- </script>
-
- <!-- Script for Flattr Button -->
- <script type="text/javascript">
- /* <![CDATA[ */
- (function() {
- var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
- s.type = 'text/javascript';
- s.async = true;
- s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
- t.parentNode.insertBefore(s, t);
- })();
- /* ]]> */</script>
-
- </head>
- <body onload="init();">
- <div id="TITLE">
- <h1 id="NAME">$(egrep '^name=.*$' project.meta |cut -d= -f2-)</h1>
- <span id="SLOGAN">$(egrep '^slogan=.*$' project.meta |cut -d= -f2-)</span>
- </div>
- <div id="USERMENU">
-$( $LOGIN || echo '<form action="https://'${HTTP_HOST}'/login.cgi?'${QUERY_STRING:gs/&/&/}'" method="post" accept-charset="UTF-8">
- Login:<br>
- <input type="text" name="user" value placeholder="Username"><br>
- <input type="password" name="pass" value placeholder="Password"><br>
- <input type="submit" value="Go!">
- </form>')
-$( $LOGIN && echo "You are loggeed in as <b>${REMOTE_USER}</b><br>")
-$( $LOGIN && $ACL_ADMIN && echo '<a href="?p=Admin">Admin</a><br>')
-$( $LOGIN && echo '<a href="?p=Settings">My Settings</a><br>')
- </div>
- <div id="ACCOUNTING">
- $(btcAddress="$(sed -rn 's:^btcAddress=(.*)$:\1:p' project.meta)"
- flattrThingURL=$(sed -rn 's:^flattrThingURL=(.*)$:\1:p' project.meta)
-
- grep -q 'useBitcoin=yes' project.meta && [ \! -f "QRcodes/bitcoin:${btcAddress}.png" ] &&\
- qrencode -o "QRcodes/bitcoin:${btcAddress}.png" "bitcoin:$btcAddress"
- grep -q 'useBitcoin=yes' project.meta && echo '
- <a href="#" onclick="javascript:show_screen('\'btcqr\'')"><img src="http://bitcoin.it/img/bc_logo_135.png" height="60"></a>
- <div id='btcqr' style="display:none;">
- <a href="#" onclick="javascript:hide_screen('\'btcqr\'')">close</a><br>
- <img src="QRcodes/bitcoin:'$btcAddress'.png"><br>
- Address:<br><a href="bitcoin:'$btcAddress'">'$btcAddress'</a>
- </div>
- '
- grep -q 'useFlattr=yes' project.meta && echo '
- <a class="FlattrButton" style="display:none;" href="http://'${HTTP_HOST}'"></a>
- <noscript> <a href="'$flattrThingURL'" target="_blank">
- <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" />
- </a></noscript>
- ')
- </div>
- <div id="MENU">
- <a href='/?p=Home'>Home</a>
- <a href='/?p=Wiki'>Wiki</a>
- <a href='/?p=Subversion'>Code</a>
- <a href='/?p=Tasks'>Tasks</a>
- </div>
- $(if [ -r "./${page}.page" ]; then
- . "./${page}.page"
- else
- echo '<h2>Page not found or nevermore</h2>'
- echo 'Quoth the Raven: 404'
- fi
- )
- </body>
-</html>
-END_index.cgi
-
+++ /dev/null
-Wiki.page
\ No newline at end of file
--- /dev/null
+#!/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 <http://www.gnu.org/licenses/>.
+
+echo -n "Content-Type: text/html;charset=utf-8\n\n"
+
+PAGE="$(echo -E "$_GET[\"p\"]" |egrep '^[a-zA-Z0-9_-]+$')"
+PAGE="${_EXEC}/pages/${PAGE}.sh"
+[ -x "$PAGE" ] || PAGE="${_EXEC}/pages/error.sh"
+
+NAVIGATION() {
+ for each in "${_EXEC}"/pages/*.sh; do
+ link="$(echo -E "$each" |sed -r "s:^.*/([^/]*)\.sh$:\1:")"
+ title="$($each title)"
+ [ -n "$title" ] && echo -E "/?page=$link $title"
+ done
+}
+
+. ${_EXEC}/templates/frame.html.sh
--- /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/>.
+
+metafile=$_DATA/project.meta
+
+case "$1" in
+ title)
+ echo "Admin"
+ ;;
+ css)
+ cat ${_EXEC}/templates/Admin.css
+ ;;
+ body)
+ #. ${_EXEC}/templates/text_admin.sh
+ if [ "$ACL_ADMIN" = "false" ]; then
+ reason=noaccess
+ . ${_EXEC}/templates/Error.page
+ else
+ . ${_EXEC}/templates/Admin.page
+ fi
+ ;;
+esac
+
--- /dev/null
+#!/bin/zsh
+
+# 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/>.
+
+
+searchresults() {
+ search="$(echo "$_GET[\"s\"]" |sed 's:\t: :g;s:\r::g;s:\\:\\\\:g')"
+
+ if [ -n "$search" ]; then
+ echo "<h1>News search results for: $search</h1>"
+ for each in $(grep -ile "$search" Home/<0000000000-9999999999>_<000-999>.news); do
+ id=$(sed -r 's:^.*/::;s:.news$::' <<<$each)
+ echo "<div class='search'><a href='#news_$id'><h2>$(date -d @$(cut -d_ -f1 <<<"$id"))</h2></a>"
+ grep -C1 -ie "$search" "$each" |sed "s:$search:<b>&</b>:g;s:$:<br>:g"
+ echo '</div>'
+ done
+ echo '<hr>'
+ fi
+}
+
+sponsored() {
+ btcAdAddress="$(sed -rn 's:^btcAdAddress=(.+):\1:p' project.meta)"
+ btcAdContent="$(sed -rn 's:^btcAdContent=([1-4]):\1:p' project.meta)"
+ grep -q 'advertise=btcAd' project.meta && cat <<EOF
+ <h1>Sponsored Links:</h1>
+ <iframe src="http://bitcoinadvertisers.com/a.php?p=${btcAdAddress}&a=${btcAdContent}&bg=FFFFFF&link=3366FF&text=414141"
+ scrolling="no" style="width:120px;height:300px;border:1px solid #f2f2f2;"></iframe>
+ <iframe src="http://bitcoinadvertisers.com/a.php?p=${btcAdAddress}&a=${btcAdContent}&bg=FFFFFF&link=3366FF&text=414141"
+ scrolling="no" style="width:120px;height:300px;border:1px solid #f2f2f2;"></iframe>
+EOF
+}
+
+case "$1" in
+ title)
+ echo "Home"
+ ;;
+ css)
+ cat ${_EXEC}/templates/Home.css
+ ;;
+ body)
+ #. ${_EXEC}/templates/text_home.sh
+ . ${_EXEC}/templates/Home.page
+ ;;
+esac
+
-#!/bin/zsh
-# Copyright 2011 Paul Haensch
-# This file is part of Busy
+#!/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/>.
+# along with Busy. If not, see <http://www.gnu.org/licenses/>.
-# This file must be password protected by the webserver (e.g. via a Files clause in .htaccess)
-LOGIN=true
-. ./index.cgi
+case "$1" in
+ title)
+ echo "Settings"
+ ;;
+ css)
+ cat ${_EXEC}/templates/Settings.css
+ ;;
+ body)
+ #. ${_EXEC}/templates/text_settings.sh
+ . ${_EXEC}/templates/Settings.page
+ ;;
+esac
+
--- /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/>.
+
+url="$(echo "$_GET[\"i\"]" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
+rev="$(echo "$_GET[\"r\"]" |sed -rn '1{/^[0-9]+$/p}')"
+
+baseuri=$(sed -rn 's:^svnRepo=(.*)$:\1:p' project.meta)
+lastrev=$(svn info "$baseuri" |sed -rn 's;^Revision: *([0-9]+);\1;p')
+[ -z "$rev" ] && rev="$lastrev"
+
+case "$1" in
+ title)
+ echo "Code"
+ ;;
+ css)
+ cat ${_EXEC}/templates/Subversion.css
+ ;;
+ body)
+ #. ${_EXEC}/templates/text_subversion.sh
+ . ${_EXEC}/templates/Subversion.page
+ ;;
+esac
+
--- /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="$(echo "$_GET[\"i\"]" |sed -rn '1{/^[0-9]{10}_[0-9]{3}$/p}')"
+edit="$(echo "$_GET[\"e\"]" |sed -rn '1{/^[0-9]{10}_[0-9]{3}$/p}')"
+search="$(echo "$_GET[\"s\"]" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
+new="$(echo -e "$_GET[\"n\"]" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
+
+[ -z "$ACL_CREATETASK" ] && ACL_CREATETASK=false
+
+
+case "$1" in
+ title)
+ echo "Tasks"
+ ;;
+ css)
+ cat ${_EXEC}/templates/Tasks.css
+ ;;
+ body)
+ #. ${_EXEC}/templates/text_tasks.sh
+ . ${_EXEC}/templates/Tasks.page
+ ;;
+esac
+
--- /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
+
--- /dev/null
+#!/bin/sh
+
+# 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 <http://www.gnu.org/licenses/>.
+
+case "$1" in
+ title)
+ ;;
+ css)
+ ;;
+ body)
+cat <<EOF
+Page not found or nevermore<br />
+Quoth the server: 404
+EOF
+ ;;
+esac
+
+++ /dev/null
-name=Busy
-slogan=Letting You do the Work.
-repoType=svn
-svnRepo=http://svn.plutz.net/busy
-gitRepo=http://d00m.org/~someone/git/qtc.git
-useFlattr=yes
-flattrThingURL=http://flattr.com/thing/599434/Busy-Software-Project-Management
-usePaypal=
-paypalAddress=
-useBitcoin=yes
-btcAddress=1PriLnvqxVmq68oiW54WTnveQ2e7eWiJmL
-advertise=btcAd
-btcAdAddress=1PswQ3kEKQSRHsMQYaTSgfrWEvHPZbkpZN
-btcAdContent=3
-
--- /dev/null
+#!/bin/zsh
+
+cat <<AdminEND
+ <div id="LEFT"></div>
+ <div id="MAIN">
+ <div class="section"><form method="post" accept-charset="utf-8" action="/?action=projectmeta">
+ <h1>General</h1>
+
+ <fieldset><legend>Title Display</legend>
+ <div class="key">Project Name</div>
+ <div class="value"><input type="text" name="appName" value="$(sed -rn 's:^name=(.*)$:\1:p' "$metafile")"></div><br>
+ <div class="key">Project Slogan</div>
+ <div class="value"><input type="text" name="appSlogan" value="$(sed -rn 's:^slogan=(.*)$:\1:p' "$metafile")"></div><br>
+ </fieldset>
+
+ <fieldset><legend>Code Browser</legend>
+ <div class="key"><input type="radio" name="repoType" value="svn" $(grep -q repoType=svn $metafile && echo checked)>SVN Repository</div>
+ <div class="value"><input type="text" name="svnRepo" value="$(sed -rn 's:^svnRepo=(.*)$:\1:p' "$metafile")"></div><br>
+ <div class="key"><input type="radio" name="repoType" value="git" $(grep -q repoType=git $metafile && echo checked)>GIT Repository</div>
+ <div class="value"><input type="text" name="gitRepo" value="$(sed -rn 's:^gitRepo=(.*)$:\1:p' "$metafile")"></div><br>
+ </fieldset>
+
+ <fieldset><legend>Donations</legend>
+ <div class="key"><input type="checkbox" name="useFlattr" value="yes" $(grep -q useFlattr=yes $metafile && echo checked)>Flattr \"Thing\" URL</div>
+ <div class="value"><input type="text" name="flattrThingURL" value="$(sed -rn 's:^flattrThingURL=(.*)$:\1:p' "$metafile")"></div><br>
+ <div class="key"><input type="checkbox" name="useBitcoin" value="yes" $(grep -q useBitcoin=yes $metafile && echo checked)>Bitcoin Address</div>
+ <div class="value"><input type="text" name="btcAddress" value="$(sed -rn 's:^btcAddress=(.*)$:\1:p' "$metafile")"></div><br>
+ <div class="key"><input type="checkbox" name="usePaypal" value="yes" $(grep -q usePaypal=yes $metafile && echo checked)>Paypal Address</div>
+ <div class="value"><input type="text" name="paypalAddress" value="$(sed -rn 's:^paypalAddress=(.*)$:\1:p' "$metafile")"></div><br>
+ </fieldset>
+
+ <fieldset><legend>Advertisement</legend>
+ <div class="key"><input type="radio" name="advertise" value="no" $(grep -q advertise=no $metafile && echo checked)>No Advertisement</div><br>
+ <div class="key"><input type="radio" name="advertise" value="btcAd" $(grep -q advertise=btcAd $metafile && echo checked)>
+ <a target="_blank" href="http://bitcoinadvertisers.com">BitCoinAdvertisers.com</a><br>Bitcoin Address:</div>
+ <div class="value">
+ <input type="text" name="btcAdAddress" value="$(sed -rn 's:^btcAdAddress=(.*)$:\1:p' "$metafile")">
+ <input type="checkbox" name="btcAdGamble" value="yes" $(egrep -q 'btcAdContent=[13]' project.meta && echo checked)>Allow gambling ads
+ <input type="checkbox" name="btcAdErotic" value="yes" $(egrep -q 'btcAdContent=[12]' project.meta && echo checked)>Allow erotic ads
+ </div><br>
+ </fieldset>
+ <input type="submit">
+ </form></div>
+
+ </div>
+ <div id="RIGHT"></div>
+AdminEND
--- /dev/null
+#!/bin/zsh
+
+switchbutton(){
+ hide="$1"; shift 1;
+ show="$1"; shift 1;
+ text="$*"
+ cat <<EOF
+ <a class="function" href="#${show}" onclick='javascript:hide_screen("${hide}");show_screen("${show}");'>${text}</a>
+EOF
+}
+
+edit_intro(){
+ cat <<HomeEND
+ <div id="introedit" style="display: none;">
+ <form action="/?action=introedit&i=intro" method="post" accept-charset="UTF-8">
+ <textarea name="text" rows="10">$([ -r "Home/intro" ] && cat Home/intro)</textarea><br>
+ <input type="submit">
+ $(switchbutton introedit introtext Cancel)
+ </form>
+ </div>
+HomeEND
+}
+
+add_news(){
+ cat <<HomeEND
+ <div class="NEWS">
+ <a id="new" class='function' href='#add' onclick='javascript:hide_screen("new");show_screen("add");'>Add News</a>
+ <div id="add" style="display: none;">
+ <form action="/?action=introedit&i=news" method="post" accept-charset="UTF-8">
+ <textarea name="text" rows="10"></textarea><br>
+ <input type="submit">
+ $(switchbutton add new Cancel)
+ </form>
+ </div>
+ </div>
+HomeEND
+}
+
+edit_news(){
+ each="$1"
+ info="$(sed 's:Home/::;s:.news::' <<<"$each")"
+
+ cat <<HomeEND
+ <div id="edit_$info" style="display: none;">
+ <form action="/?action=introedit&i=$info" method="post" accept-charset="UTF-8">
+ <textarea name="text" rows="10">$([ -r "$each" ] && cat $each)</textarea><br>
+ <input type="submit">
+ $(switchbutton edit_$info news_$info Cancel)
+ </form>
+ </div>
+HomeEND
+}
+
+show_news(){
+ stat -c '' Home/<0000000000-9999999999>_<000-999>.news && for each in $(ls -c Home/<0000000000-9999999999>_<000-999>.news); do
+ info="$(sed 's:Home/::;s:.news::' <<<"$each")"
+
+ cat <<HomeEND
+ <div class="NEWS">
+ <div id="news_$info"><div class="wikitext">
+ $([ -r "$each" ] && _wiki "$each")
+ $($ACL_EDITNEWS && echo "<hr/>$(switchbutton news_$info edit_$info Edit)")
+ </div></div>
+ $($ACL_EDITNEWS && edit_news $each)
+ </div>
+HomeEND
+ done
+}
+
+cat <<HomeEND
+ <div id="LEFT">
+ <form method="GET" action="/${SCRIPTNAME}" accept-charset="utf-8">
+ <input type="hidden" name="p" value="Home">
+ <input type="text" name="s" placeholder="Search"><br>
+ <input type="submit" value="Search News">
+ </form>
+ <hr>
+ $(searchresults)
+ </div>
+
+ <div id="MAIN">
+ <div id="INTRO">
+ <div id="introtext"><div class="wikitext">
+ $([ -r "Home/intro" ] && _wiki "Home/intro")
+ $($ACL_EDITINTRO && echo "<hr/> $(switchbutton introtext introedit Edit)")
+ </div></div>
+ $($ACL_EDITINTRO && edit_intro)
+ </div>
+
+ $($ACL_ADDNEWS && add_news)
+
+ $(show_news)
+ </div>
+ <div id="RIGHT">
+ $(sponsored)
+ </div>
+HomeEND
#!/bin/zsh
-url="$(sed -rn 's:\+: :g;s:%:\\x:g;s:^(.*&)?i=([^&]+)(&.*)?$:\2:p' <<<"${QUERY_STRING}")"
-url="$(echo -e "${url}" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
-rev="$(sed -rn 's:\+: :g;s:%:\\x:g;s:^(.*&)?r=([0-9]+)(&.*)?$:\2:p' <<<"${QUERY_STRING}")"
-
-baseuri=$(sed -rn 's:^svnRepo=(.*)$:\1:p' project.meta)
-lastrev=$(svn info "$baseuri" |sed -rn 's;^Revision: *([0-9]+);\1;p')
-[ -z "$rev" ] && rev="$lastrev"
cat <<SVNEND
<div id="LEFT">
--- /dev/null
+#!/bin/zsh
+
+show_search(){
+ if [ -n "$search" ]; then
+ echo "<h1>Tasks search results for: $search</h1>"
+ for each in $(grep -ile "$search" Tasks/<0000000000-9999999999>_<000-999>); do
+ id=$(sed -r 's:^.*/::;s:.task$::' <<<$each)
+ echo "<div class='search'><a href='${SCRIPTNAME}?p=Tasks&i=$id'><h2>$(date -d @$(cut -d_ -f1 <<<"$id"))</h2></a>"
+ grep -C1 -ie "$search" "$each" |sed "s:$search:<b>&</b>:g;s:$:<br>:g"
+ echo '</div>'
+ done
+ echo '<hr>'
+ fi
+}
+
+show_task(){
+ datafile="Tasks/$info"
+ metafile="Tasks/$info.meta"
+ headline="$(sed -rn '/^headline=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
+ taskstatus="$(sed -rn '/^status=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
+ section="$(sed -rn '/^section=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
+ attendant="$(sed -rn '/^attendant=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
+ [ -z "$section" ] && section='(none)'
+ [ -z "$attendant" ] && attendant='(none)'
+ cat <<TasksEND
+ <div class="Task">
+ <div class="wikitext">
+ <h1>$headline</h1>
+ $(_wiki "$datafile")
+ </div>
+ <table><tr>
+ <td><b>Status</b><br>
+ $taskstatus</td>
+ <td><b>Section</b><br>
+ $section</td>
+ <td><b>Attendant</b><br>
+ $attendant</td>
+ </tr></table>
+ </div>
+TasksEND
+}
+
+setup_taks(){
+ cat <<TaskEnd
+ <form class="Task" style="height:20em;" method="post" action="write/$($LOGIN && echo user_)taskmeta.cgi" accept-charset="UTF-8">
+ <h1>$new</h1>
+ <input type="hidden" name="headline" value="$new">
+ <input type="hidden" name="status" value="new">
+ <div style="width:60%;left:3.5em;">
+ <b>Description:</b><br>
+ <textarea name="description" rows="11"></textarea>
+ </div><div style="width:30%;right:.5em;">
+ <b>Section:</b><br>
+ <select name="section" size="6" style="width:80%">
+ $(for each in $(egrep -hx 'section=.+' Tasks/<0000000000-9999999999>_<000-999>.meta |sort -u); do
+ echo "<option>$(sed 's:section=::' <<<"$each")</option>"
+ done)
+ </select><br>
+ <b>other section:</b><br>
+ <input type="text" name="section">
+ <input type="submit" name="submit" value="Robots click here" style="display:none;">
+ <input type="submit" name="submit" value="Create Task">
+ <input type="submit" name="submit" value="Robots click here" style="display:none;">
+ </div>
+ </form>
+TaskEnd
+}
+
+list_tasks(){
+ stat -c '' Tasks/<0000000000-9999999999>_<000-999>.meta \
+ && for each in Tasks/<0000000000-9999999999>_<000-999>.meta(.om); do
+ info="$(basename "$each" |sed 's:.meta$::')"
+ headline="$(sed -rn '/^headline=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
+ taskstatus="$(sed -rn '/^status=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
+ section="$(sed -rn '/^section=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
+ attendant="$(sed -rn '/^attendant=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
+ [ -z "$section" ] && section='(none)'
+ [ -z "$attendant" ] && attendant='(none)'
+ cat <<TasksEND
+ <div class="Task">
+ <a href="${SCRIPTNAME}?p=Tasks&i=${info}"><b>$headline</b></a><br>
+ <span><b>Status:</b> $taskstatus</span>
+ <span><b>Section:</b> $section</span>
+ <span><b>Attendant:</b> $attendant</span>
+ </div>
+TasksEND
+ done
+}
+
+new_task(){
+ cat <<TasksEND
+ <a id='newTask_button' class='function' href='#' onclick='javascript:show_screen("newTask");hide_screen("newTask_button");'>New Task</a>
+ <div id="newTask" style="display: none;">
+ <form action="/${SCRIPTNAME}" method="get" accept-charset="UTF-8">
+ <b>Headline:</b><br>
+ <input type="hidden" name="p" value="Tasks">
+ <textarea name="n" rows="2" style="width:99%;"></textarea><br>
+ <input type="submit" value="Submit">
+ <a class="function" href="#" onclick="javascript:hide_screen('newTask');show_screen('newTask_button');">Cancel</a>
+ </form>
+ </div>
+TasksEND
+}
+
+cat <<TasksEND
+ <div id="LEFT">
+ <form method="GET" action="/${SCRIPTNAME}" accept-charset="utf-8">
+ <input type="hidden" name="p" value="Tasks">
+ <input type="text" name="s" placeholder="Search"><br>
+ <input type="submit" value="Search Tasks">
+ </form>
+ <hr>
+ $(show_search)
+ </div><div id="MAIN">
+
+ $([ -n "$info" -a -r "Tasks/$info" -a -r "Tasks/$info.meta" ] && show_task)
+ $([ -z "$info" -a -n "$new" ] && setup_task)
+ $([ -z "$info" -a -z "$new" ] && list_tasks)
+ </div> <div id="RIGHT">
+ $($ACL_CREATETASK && [ -z "$new" ] && new_task)
+ </div>
+TasksEND
--- /dev/null
+#!/bin/zsh
+
+list_comments() {
+ base="$1"
+
+ stat -c '' Wiki/${base}.comment.<0000000001-9999999999>_<000-999> \
+ && for each in $(ls -c Wiki/${base}.comment.<0000000001-9999999999>_<000-999>); do
+ author=$(grep -m1 '^author=' "$each" |cut -d= -f2-)
+ echo "<div class='comment'><h1>$author wrote:</h1><div class='wikitext'>"
+ tail -n+2 $each |_wiki
+ echo '</div></div>'
+ done
+}
+
+cat <<WikiEND
+ <form class="edit" action="/?action=wikiedit&i=$edit" method="post" accept-charset="UTF-8">
+ <div id="LEFT">
+ Editing <b>$title</b><br>
+ <input type="submit" value="Submit">
+ <input type="submit" name="cancel" value="Cancel">
+ <hr>
+ </div>
+ <div id="MAIN">
+ <div class="wiki">
+ <h1>$title</h1>
+ <textarea name="page" rows=30 cols=40>$(cat "$_DATA/Wiki/${edit}${rev}")</textarea>
+ </div>
+ </div>
+ </form>
+ <div id="RIGHT">
+ $(list_comments $edit)
+ </div>
+WikiEND
--- /dev/null
+#!/bin/zsh
+
+list_search(){
+ if [ -n "$search" ]; then
+ echo "<h1>Wiki search results for: $search</h1>"
+ for each in $(grep -ile "$search" Wiki/<0000000000-9999999999>_<000-999>); do
+ echo "<div class='search'><a href='?p=Wiki&i=${each:t}'><h2>$(grep '^title=' "$each.meta" |cut -d= -f2-)</h2></a>"
+ grep -C1 -ie "$search" "$each" |sed "s:$search:<b>&</b>:g;s:$:<br>:g"
+ echo '</div>'
+ done
+ echo '<hr>'
+ fi
+}
+
+change_wiki(){
+ info="$1"
+
+ cat <<WikiEND
+ <div id="change_$info" style="display: none;">
+ <form action="/?action=wikimeta&i=$info" method="post" accept-charset="UTF-8">
+ <b>Title:</b> <input type="text" name="title" value="$title"><br>
+ <b>Description:</b><br>
+ <textarea name="desc" rows="6" style="width:100%;">$description</textarea><br>
+ <input type="submit" value="Submit">
+ <a class="function" href="#" onclick="javascript:hide_screen('change_$info');show_screen('display_$info');">Cancel</a>
+ </form>
+ </div>
+WikiEND
+}
+
+add_page() {
+ cat <<WikiEND
+ <a id='addp_button' class='function' href='#' onclick='javascript:show_screen("add_page");hide_screen("addp_button");'>Add a new Page</a>
+ <div id="add_page" style="display: none;">
+ <form action="/?action=wikimeta" method="post" accept-charset="UTF-8">
+ <br><b>Title:</b><br>
+ <input type="text" name="title" placeholder="Fill in a title"><br>
+ <b>Description:</b><br>
+ <textarea name="desc" rows="6" ></textarea><br>
+ <input type="submit" value="Submit">
+ <a class="function" href="#" onclick="javascript:hide_screen('add_page');show_screen('addp_button');">Cancel</a>
+ </form>
+ </div>
+WikiEND
+}
+
+list_wikis(){
+ stat -c '' Wiki/<0000000000-9999999999>_<000-999> \
+ && for each in Wiki/<0000000000-9999999999>_<000-999>; do
+ info=$(sed 's,Wiki/,,' <<<"$each")
+ title="$(egrep -x 'title=.+' "$each.meta" |cut -d= -f2- || echo '(Untitled)')"
+ description="$(egrep -x 'description=.+' "$each.meta" |cut -d= -f2-)"
+ owner="$(egrep -x 'owner=.+' "$each.meta" |cut -d= -f2-)"
+
+ cat <<WikiEND
+ <div class="article">
+ <div id="display_$info">
+ <a name="$info" href="/?p=Wiki&i=$info"><h1>$title</h1></a>
+ $description<br><br>
+ <a class="function" href="/?p=Wiki&i=$info">View</a>
+ $($ACL_WIKIEDIT && echo "<a class='function' href='#' onclick=\"javascript:show_screen('change_$info');hide_screen('display_$info');\">Change Info</a>")
+ </div>
+ $($ACL_WIKIEDIT && change_wiki $info)
+ </div>
+WikiEND
+ done
+}
+
+cat <<WikiEND
+ <div id="LEFT">
+ <form method="GET" action="/${SCRIPTNAME}" accept-charset="utf-8">
+ <input type="hidden" name="p" value="Wiki">
+ <input type="text" name="s" placeholder="Search"><br>
+ <input type="submit" value="Search Wiki">
+ </form>
+ <hr>
+ $(list_search)
+ </div><div id="RIGHT">
+ $($LOGIN && add_page)
+ </div><div id="MAIN">
+ $(list_wikis)
+ </div>
+WikiEND
--- /dev/null
+#!/bin/zsh
+
+list_comments() {
+ base="$1"
+
+ stat -c '' Wiki/${base}.comment.<0000000001-9999999999>_<000-999> \
+ && for each in $(ls -c Wiki/${base}.comment.<0000000001-9999999999>_<000-999>); do
+ author=$(grep -m1 '^author=' "$each" |cut -d= -f2-)
+ echo "<div class='comment'><h1>$author wrote:</h1><div class='wikitext'>"
+ tail -n+2 $each |_wiki
+ echo '</div></div>'
+ done
+}
+
+add_comment(){
+ info="$1"
+
+ cat <<WikiEND
+ <a id='comment_button' class='function' href='#'
+ onclick='javascript:show_screen("comment");hide_screen("comment_button");'>Comment / Ask</a>
+ <div id="comment" style="display: none;">
+ <form action="/?action=wikimeta&i=$info" method="post" accept-charset="UTF-8">
+ <b>Comment:</b><br>
+ <textarea name="comm" rows="6" style="width:99%;"></textarea><br>
+ <input type="submit" value="Submit">
+ <a class="function" href="#" onclick="javascript:hide_screen('comment');show_screen('comment_button');">Cancel</a>
+ </form>
+ </div>
+WikiEND
+}
+
+cat <<WikiEND
+ <div id="LEFT">
+ <form method="GET" action="/${SCRIPTNAME}" accept-charset="utf-8">
+ <input type="hidden" name="p" value="Wiki">
+ <input type="text" name="s" placeholder="Search"><br>
+ <input type="submit" value="Search Wiki">
+ </form>
+ <hr>
+
+ <b>Revisions:</b>
+ $(rno=1; for each in Wiki/$info.<0000000000-9999999999>; do
+ revi=$(cut -d. -f2 <<<"$each")
+ echo "<a class='rev' href='?p=Wiki&i=$info&r=$revi'>$rno</a>"
+ rno=$(($rno+1))
+ done) <a class='rev' href='?p=Wiki&i=$info'>Latest</a><br>
+ <hr>
+ $($LOGIN && if [ -z "$lock" ]; then
+ [ -z "$rev" ] && echo "<a class='function' href='/?action=lock&p=Wiki&e=$info'>edit this page</a>"
+ [ -n "$rev" ] && echo "Click <a class='function' href='/?action=lock&p=Wiki&e=${info}&r=${rev:s/.//}'>edit</a> to derive a new page revision from this one."
+ else
+ echo "<b>This page is currently being edited by $lock</b><a class='function' href='/?action=lock&p=Wiki&e=$info'>edit anyway</a>"
+ fi
+ $LOGIN && echo '<hr>')
+ <h1>Table of Content</h1>
+ <div class="toc">
+ $(cat Wiki/"${info}${rev}" |while read line; do
+ if (egrep -q '^ *###' <<<"$line"); then
+ echo "<a class='i2' href='#$(sed 's,^ *### *,,;' <<<"$line")'>$(sed 's,^ *###,,' <<<"$line")</a><br>"
+ elif (egrep -q '^ *##' <<<"$line"); then
+ echo "<a class='i1' href='#$(sed 's,^ *## *,,;' <<<"$line")'>$(sed 's,^ *##,,' <<<"$line")</a><br>"
+ elif (egrep -q '^ *#' <<<"$line"); then
+ echo "<a class='i0' href='#$(sed 's,^ *# *,,;' <<<"$line")'>$(sed 's,^ *#,,' <<<"$line")</a><br>"
+ fi
+ done)
+ </div>
+ <hr>
+ </div>
+ <div id="MAIN">
+ <div class="wiki"><div class="wikitext">
+ <h1>$title</h1>
+ $(_wiki Wiki/"${info}${rev}")
+ </div></div>
+ </div>
+
+ <div id="RIGHT">
+ $($LOGIN && add_comment $info)
+ $(list_comments $info)
+ </div>
+WikiEND
--- /dev/null
+# Copyright 2011 - 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/>.
+
+list_accounts(){
+ btcAddress="$(sed -rn 's:^btcAddress=(.*)$:\1:p' project.meta)"
+ flattrThingURL=$(sed -rn 's:^flattrThingURL=(.*)$:\1:p' project.meta)
+
+ grep -q 'useBitcoin=yes' project.meta \
+ && [ \! -f "QRcodes/bitcoin:${btcAddress}.png" ] \
+ && qrencode -o "QRcodes/bitcoin:${btcAddress}.png" "bitcoin:${btcAddress}"
+ grep -q 'useBitcoin=yes' project.meta \
+ && cat <<PageEND
+ <a href="#" onclick="javascript:show_screen('btcqr')"><img src="http://bitcoin.it/img/bc_logo_135.png" height="60"></a>
+ <div id="btcqr" style="display:none;">
+ <a href="#" onclick="javascript:hide_screen('btcqr')">close</a><br>
+ <img src="QRcodes/bitcoin:${btcAddress}.png"><br>
+ Address:<br><a href="bitcoin:${btcAddress}">$btcAddress</a>
+ </div>
+PageEND
+
+ grep -q 'useFlattr=yes' project.meta \
+ && cat <<PageEND
+ <a class="FlattrButton" style="display:none;" href="http://${HTTP_HOST}"></a>
+ <noscript> <a href="${flattrThingURL}" target="_blank">
+ <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" />
+ </a></noscript>
+PageEND
+}
+
+cat <<EOF
+<!Doctype HTML>
+
+<html>
+ <head>
+ <title>$(sed -rn 's:^name=(.*)$:\1:p' $_DATA/project.meta) - Busy $(. $PAGE title)</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <style type="text/css"><!--
+ $(cat $_EXEC/templates/busy.css)
+ $(cat $_EXEC/templates/wikitext.css)
+ $(. $PAGE css)
+ --></style>
+
+ <script type="text/javascript">
+ <!--
+ function show_screen(id){
+ document.getElementById(id).style.display = "inline";
+ }
+ function hide_screen(id){
+ document.getElementById(id).style.display = "none";
+ }
+ -->
+ </script>
+
+ <!-- Script for Flattr Button -->
+ <script type="text/javascript">
+ /* <![CDATA[ */
+ (function() {
+ var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
+ s.type = 'text/javascript';
+ s.async = true;
+ s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
+ t.parentNode.insertBefore(s, t);
+ })();
+ /* ]]> */</script>
+
+ </head>
+
+ <body onload="init();">
+ <div id="TITLE">
+ <h1 id="NAME">$(egrep '^name=.*$' project.meta |cut -d= -f2-)</h1>
+ <span id="SLOGAN">$(egrep '^slogan=.*$' project.meta |cut -d= -f2-)</span>
+ </div>
+ <div id="USERMENU">
+ $( $LOGIN || echo '<form action="/?action=login" method="post" accept-charset="UTF-8">
+ Login:<br>
+ <input type="text" name="user" value placeholder="Username"><br>
+ <input type="password" name="pass" value placeholder="Password"><br>
+ <input type="submit" value="Go!">
+ </form>')
+ $( $LOGIN && echo "You are loggeed in as <b>${USER}</b><br>")
+ $( $LOGIN && $ACL_ADMIN && echo '<a href="?p=Admin">Admin</a><br>')
+ $( $LOGIN && echo '<a href="?p=Settings">My Settings</a><br>')
+ $( $LOGIN && echo '<a href="?action=logout">Log Out</a><br>')
+ $sess_msg
+ </div>
+ <div id="ACCOUNTING">
+ $(list_accounts)
+ </div>
+ <div id="MENU">
+ <a href='/?p=Home'>Home</a>
+ <a href='/?p=Wiki'>Wiki</a>
+ <a href='/?p=Subversion'>Code</a>
+ <a href='/?p=Tasks'>Tasks</a>
+ </div>
+
+ $(. $PAGE body)
+ </body>
+</html>
+EOF
+
+# vi:set filetype=html:
+++ /dev/null
-Options +ExecCGI
-AddHandler cgi-script .cgi
-DirectoryIndex index.cgi
-
-#RewriteEngine On
-#RewriteCond %{SERVER_PORT} 80
-#RewriteRule ^.*(/write/.*)$ https://%{SERVER_NAME}/$1
-
-<FilesMatch "^user_">
-AuthType Basic
-AuthName "Busy Login"
-AuthUserFile /srv/busy.plutz.net/http/auth/htpasswd
-Require valid-user
-</FilesMatch>
+++ /dev/null
-#!/bin/zsh
-
-# Copyright 2012 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/>.
-
-metafile="../project.meta"
-
-[ "$HTTPS" = "on" ] && proto=https || proto=http
-. ../auth/permissions.sh
-$ACL_ADMIN || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
-$ACL_ADMIN || exit 0
-
-if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
-(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' \
- |sed -rn '/^((appName|appSlogan|svnRepo|gitRepo|flattrThingURL|paypalAddress|btcAddress|btcAdAddress)=.*|repoType=(svn|git)|(useFlattr|usePaypal|useBitcoin|btcAdGamble|btcAdErotic)=yes|advertise=(btcAd|no))$/{
- s:\+: :g;s:%:\\x:g;p}' \
- |while line="$(line)"; do
- eval "$(echo -e "$line" |sed -r 's:[\n\r'\'']::g;s:^([a-zA-Z0-9_+-]+)=(.*)$:\1='"'\2'"':;')"
- done
-fi
-
-[ "$btcAdGamble" = yes -a "$btcAdErotic" = yes ] && btcAdContent=1
-[ "$btcAdGamble" != yes -a "$btcAdErotic" = yes ] && btcAdContent=2
-[ "$btcAdGamble" = yes -a "$btcAdErotic" != yes ] && btcAdContent=3
-[ "$btcAdGamble" != yes -a "$btcAdErotic" != yes ] && btcAdContent=4
-
-echo "\
-name=$appName
-slogan=$appSlogan
-repoType=$repoType
-svnRepo=$svnRepo
-gitRepo=$gitRepo
-useFlattr=$useFlattr
-flattrThingURL=$flattrThingURL
-usePaypal=$usePaypal
-paypalAddress=$paypalAddress
-useBitcoin=$useBitcoin
-btcAddress=$btcAddress
-advertise=$advertise
-btcAdAddress=$btcAdAddress
-btcAdContent=$btcAdContent
-" >"$metafile"
-
-echo -n "Location: ${proto}://${HTTP_HOST}/?p=Admin\n\n"
+++ /dev/null
-#!/bin/zsh
-# Copyright 2011 Paul Haensch
-# 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 '(^|&)i=[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&i=')"
-[ "$HTTPS" = "on" ] && PROTO=https || proto=http
-
-. ../auth/permissions.sh
-$ACL_CREATETASK || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
-$ACL_CREATETASK || exit 0
-
-info="$(sed -r 's:(^|.*&)i=(.*)|.*:\2:;s:&.*::' <<<"${QUERY_STRING}")"
-
-[ -z "$info" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
-descfile="../Tasks/$info.meta"
-commfile="../Tasks/$info.comment.$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
-
-[ -f "../Tasks/$info.lock" ] && rm "../Wiki/$info.lock"
-anchor=$(ls ../Tasks |grep -A2 $info |grep '.meta$' |tail -n1 |cut -d. -f1)
-
-if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
-(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' |while read line; do
- if (egrep -xq 'headline=.+' <<<"${line}"); then
- headline="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- headline="$(echo -e "${headline}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)"
- elif (egrep -xq 'status=.+' <<<"${line}"); then
- taskstatus="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- taskstatus="$(echo -e "${taskstatus}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)"
- elif (egrep -xq 'section=.+' <<<"${line}"); then
- section="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- section="$(echo -e "${section}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)"
- elif (egrep -xq 'description=.+' <<<"${line}"); then
- description="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- description="$(echo -e "${description}" |sed 's/\r//g;s/\\/\\\\/g')"
- elif (egrep -xq 'comm=.+' <<<"${line}"); then
- comment="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- comment="$(echo -e "${comment}" |sed 's/\r//g;s/\\/\\\\/g')"
- elif (egrep -xq 'cancel=.+' <<<"${line}"); then
- cancel="true"
- elif (egrep -xq 'submit=Robots click here' <<<"${line}"); then
- cancel="true"
- fi
-done
-fi
-
-if [ -z "$cancel" -a -n "$comment" ]; then
- touch "../Tasks/$info"
- echo -e "author=${REMOTE_USER}" > "$commfile"
- echo -e "${comment}" >> "$commfile"
- echo -n "Location: ${proto}://${HTTP_HOST}/?p=Tasks&i=$info\n\n"
-elif [ -z "$cancel" -a -n "$description" ]; then
- touch "../Tasks/$info"
- echo -e "headline=${headline}" > "$descfile"
- echo -e "status=${taskstatus}" >> "$descfile"
- echo -e "section=${section}" >> "$descfile"
- echo -e "${description}" >> "../Tasks/$info"
- echo -n "Location: ${proto}://${HTTP_HOST}/?p=Tasks#$anchor\n\n"
-elif [ -n "$cancel" ]; then
- echo -n "Location: ${proto}://${HTTP_HOST}/?p=Tasks#$anchor\n\n"
-fi
+++ /dev/null
-introedit.cgi
\ No newline at end of file
+++ /dev/null
-lock.cgi
\ No newline at end of file
+++ /dev/null
-projectmeta.cgi
\ No newline at end of file
+++ /dev/null
-taskmeta.cgi
\ No newline at end of file
+++ /dev/null
-wikiedit.cgi
\ No newline at end of file
+++ /dev/null
-wikimeta.cgi
\ No newline at end of file
+++ /dev/null
-#!/bin/zsh
-# Copyright 2011 Paul Haensch
-# 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/>.
-
-[ "$HTTPS" = "on" ] && proto=https || proto=http
-. ../auth/permissions.sh
-$ACL_WIKIEDIT || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
-$ACL_WIKIEDIT || exit 0
-
-info="$(egrep -o '(^|&)i=[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&=i')"
-[ -f "../Wiki/$info.lock" ] && rm "../Wiki/$info.lock"
-
-if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
-(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' |while read line; do
- if (echo "${line}" | egrep -xq 'page=.+'); then
- page="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- page=$(echo -e "${page}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g')
- elif (echo "${line}" | egrep -xq 'cancel=.+'); then
- cancel=true
- fi
-done
-fi
-
-[ -z "$cancel" -a -f "../Wiki/$info" ] && mv "../Wiki/$info" "../Wiki/$info.$(date +%s)"
-[ -z "$cancel" ] && echo -e "${page}" >"../Wiki/$info"
-
-echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki&i=$info\n\n"
+++ /dev/null
-#!/bin/zsh
-# Copyright 2011 Paul Haensch
-# 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/>.
-
-[ "$HTTPS" = "on" ] && proto=https || proto=http
-. ../auth/permissions.sh
-env >../debug
-$ACL_WIKIEDIT || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
-$ACL_WIKIEDIT || exit 0
-
-info="$(egrep -o '(^|&)i=[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&i=')"
-
-[ -z "$info" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
-descfile="../Wiki/$info.meta"
-commfile="../Wiki/$info.comment.$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
-
-[ -f "../Wiki/$info.lock" ] && rm "../Wiki/$info.lock"
-anchor=$(ls ../Wiki |grep -A2 $info |grep '.meta$' |tail -n1 |cut -d. -f1)
-
-if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
-(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' |while read line; do
- if (egrep -xq 'title=.+' <<<"${line}"); then
- title="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- title="$(echo -e "${title}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)"
- elif (egrep -xq 'desc=.+' <<<"${line}"); then
- description="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- description="$(echo -e "${description}" |sed 's/\r//g;s/\\/\\\\/g')"
- elif (egrep -xq 'comm=.+' <<<"${line}"); then
- comment="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- comment="$(echo -e "${comment}" |sed 's/\r//g;s/\\/\\\\/g')"
- elif (egrep -xq 'cancel=.+' <<<"${line}"); then
- cancel="true"
- fi
-done
-fi
-
-if [ -z "$cancel" -a -n "$comment" ]; then
- touch "../Wiki/$info"
- echo -e "author=${REMOTE_USER}" > "$commfile"
- echo -e "${comment}" >> "$commfile"
- echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki&i=$info\n\n"
-elif [ -z "$cancel" -a -n "$description" ]; then
- touch "../Wiki/$info"
- echo -e "title=${title}" > "$descfile"
- echo -e "description=${description}" >> "$descfile"
- echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki#$anchor\n\n"
-elif [ -n "$cancel" ]; then
- echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki#$anchor\n\n"
-fi