thirdculture-werc/apps/bridge/app.rc
Uriel 219ec79f69 Only allow comments for .md files, this avoids silly things like comments for
loggin form pages, but will need to be improved to become more general.

Simplify some code a bit and cosmetic improvements.
2009-01-26 04:56:05 +01:00

29 lines
953 B
Text

fn bridge_init {
if(! ~ $#enable_comments 0 && test -f $local_path.md) {
ll_add handlers_body_foot template apps/bridge/foot.tpl
if(get_post_args comment_text) {
d=`{date -n} # FIXME Obvious race
d=$local_path^'_werc/comments/'^$d/
u=$logged_user
if(~ $#logged_user 0) {
get_post_args comment_user_name comment_user_password
# XXX Should do this too if user not in required group
if(! login_user $comment_user_name $comment_user_password) {
u=$comment_user_name':'$comment_user_password
d=$d^'_pending'
}
if not
u = $logged_user
}
umask 002
if(mkdir -m 775 -p $d) { # Rudimentary perm checking
echo $u > $d/user
echo $comment_text > $d/body
}
}
}
}