;;
input) echo 'Invalid set of input data.'
;;
+ noaccess) echo '... because you were probably trying to do something nasty.'
+ ;;
*) echo 'Unknown generic fuckup :-('
;;
esac
HomeEND
$ACL_EDITINTRO && cat <<HomeEND
<div id="introedit" style="display: none;">
- <form action="/write/introedit.cgi?i=intro" method="post" accept-charset="UTF-8">
+ <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>
HomeEND
$ACL_EDITNEWS && cat <<HomeEND
<div id="edit_$info" style="display: none;">
- <form action="/write/introedit.cgi?i=$info" method="post" accept-charset="UTF-8">
+ <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>
#create task main dialog
[ -z "$info" -a -n "$new" ] && cat <<TaskEnd
-<form class="Task" style="height:20em;" method="post" action="write/taskmeta.cgi" accept-charset="UTF-8">
+<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">
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)"
+[ -z "$ACL_WIKIEDIT" ] && ACL_WIKIEDIT=false
+
[ -n "$rev" ] && rev=".$rev"
if [ -n "$search" ]; then
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>
- $($LOGIN && echo "<a class='function' href='#' onclick=\"javascript:show_screen('change_$info');hide_screen('display_$info');\">Change Info</a>")
+ $($ACL_WIKIEDIT && echo "<a class='function' href='#' onclick=\"javascript:show_screen('change_$info');hide_screen('display_$info');\">Change Info</a>")
</div>
WikiEND
- $LOGIN && cat <<WikiEND
+ $ACL_WIKIEDIT && cat <<WikiEND
<div id="change_$info" style="display: none;">
- <form action="/write/wikimeta.cgi?i=$info" method="post" accept-charset="UTF-8">
+ <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>
ANL_ADDNEWS="paul"
ANL_EDITNEWS="paul"
ANL_CREATETASK=".*"
+ANL_WIKIEDIT="paul"
[ -n "$REMOTE_USER" ] && USER="$REMOTE_USER" || USER="#NONE#"
-egrep -xq "$ANL_EDITINTRO" <<<"$USER" && ACL_EDITINTRO=true
-egrep -xq "$ANL_ADDNEWS" <<<"$USER" && ACL_ADDNEWS=true
-egrep -xq "$ANL_EDITNEWS" <<<"$USER" && ACL_EDITNEWS=true
-egrep -xq "$ANL_CREATETASK" <<<"$USER" && ACL_CREATETASK=true
+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
AddHandler cgi-script .cgi
DirectoryIndex index.cgi
-RewriteEngine On
-RewriteCond %{SERVER_PORT} 80
-RewriteRule ^.*(/write/.*)$ https://%{SERVER_NAME}/$1
+#RewriteEngine On
+#RewriteCond %{SERVER_PORT} 80
+#RewriteRule ^.*(/write/.*)$ https://%{SERVER_NAME}/$1
+<FilesMatch "^user_">
AuthType Basic
AuthName "Kinoserver Login"
AuthUserFile /sites/kinob.plutz.net/http/.htpasswd
Require valid-user
+</FilesMatch>
# 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/acl.sh
+
info="$(egrep -o '(^|&)i=([0-9]{10}_[0-9]{3}|intro|news)(&|$)' <<<"${QUERY_STRING}" |sed 's:&::g;s:i=::')"
-[ "$info" = "news" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
-[ "$info" != "intro" ] && info="${info}.news"
+[ "$info" = "news" ] && $ACL_ADDNEWS && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
+[ "$info" != "intro" ] && $ACL_EDITNEWS && info="${info}.news"
+[ "$info" = "intro" ] && ($ACL_EDITINTRO || info='')
+
+[ -n "$info" ] || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
+[ -n "$info" ] || exit 0
if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' |while read line; do
[ -z "$cancel" ] && grep -qx "${REMOTE_USER}" ../auth/admin.user && echo -e "${text}" >"../Home/$info"
-echo -n "Location: http://${HTTP_HOST}/?p=Home\n\n"
+echo -n "Location: ${proto}://${HTTP_HOST}/?p=Home\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/>.
+[ "$HTTPS" = "on" ] && proto=https || proto=http
+. ../auth/acl.sh
+$ACL_WIKIEDIT || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
+$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=&')
case "$page" in
- QandA) [ -f "../QandA/${edit}.qstn" ] && echo "${REMOTE_USER}:$(($(date +%s)+600))" >"../QandA/${edit}.lock"
- ;;
- Locations) [ -f "../Locations/${edit}.jpg" ] && echo "${REMOTE_USER}:$(($(date +%s)+600))" >"../Locations/${edit}.lock"
- ;;
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: http://${HTTP_HOST}/?${QUERY_STRING}\n\n"
+echo -n "Location: ${proto}://${HTTP_HOST}/?${QUERY_STRING}\n\n"
# 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/acl.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)"
touch "../Tasks/$info"
echo -e "author=${REMOTE_USER}" > "$commfile"
echo -e "${comment}" >> "$commfile"
- echo -n "Location: http://${HTTP_HOST}/?p=Tasks&i=$info\n\n"
+ 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: http://${HTTP_HOST}/?p=Tasks#$anchor\n\n"
+ echo -n "Location: ${proto}://${HTTP_HOST}/?p=Tasks#$anchor\n\n"
elif [ -n "$cancel" ]; then
- echo -n "Location: http://${HTTP_HOST}/?p=Tasks#$anchor\n\n"
+ 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
+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
# 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/acl.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"
[ -z "$cancel" -a -f "../Wiki/$info" ] && mv "../Wiki/$info" "../Wiki/$info.$(date +%s)"
[ -z "$cancel" ] && echo -e "${page}" >"../Wiki/$info"
-echo -n "Location: https://${HTTP_HOST}/?p=Wiki&i=$info\n\n"
+echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki&i=$info\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/>.
+[ "$HTTPS" = "on" ] && proto=https || proto=http
+. ../auth/acl.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)"
touch "../Wiki/$info"
echo -e "author=${REMOTE_USER}" > "$commfile"
echo -e "${comment}" >> "$commfile"
- echo -n "Location: https://${HTTP_HOST}/?p=Wiki&i=$info\n\n"
+ 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: https://${HTTP_HOST}/?p=Wiki#$anchor\n\n"
+ echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki#$anchor\n\n"
elif [ -n "$cancel" ]; then
- echo -n "Location: https://${HTTP_HOST}/?p=Wiki#$anchor\n\n"
+ echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki#$anchor\n\n"
fi