]> git.plutz.net Git - busy/blobdiff - Wiki.page
honor login status when directing to writer script
[busy] / Wiki.page
index 9e135ad1ae1bee697e693724458aa593f667aa2e..49d4687b2ba255df85f00e5e2f2bb38569a342b3 100755 (executable)
--- a/Wiki.page
+++ b/Wiki.page
@@ -6,6 +6,8 @@ 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)"
 
+[ -z "$ACL_WIKIEDIT" ] && ACL_WIKIEDIT=false
+
 [ -n "$rev" ] && rev=".$rev"
 if [ -n "$search" ]; then
   info=''
@@ -24,7 +26,7 @@ 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/wikiedit.cgi?i=$edit" method="post" accept-charset="UTF-8">
+    <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">
@@ -100,7 +102,7 @@ WikiEND
 $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/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>Comment:</b><br>
           <textarea name="comm" rows="6" style="width:99%;"></textarea><br>
           <input type="submit" value="Submit">
@@ -139,7 +141,7 @@ WikiEND
   $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/wikimeta.cgi" method="post" accept-charset="UTF-8">
+      <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>
@@ -163,12 +165,12 @@ WikiEND
         <a name="$info" href="/?p=Wiki&amp;i=$info"><h1>$title</h1></a>
         $description<br><br>
         <a class="function" href="/?p=Wiki&amp;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>