2009-01-08 19:08:02 -07:00
|
|
|
fn bridge_init {
|
2009-01-25 20:56:05 -07:00
|
|
|
if(! ~ $#enable_comments 0 && test -f $local_path.md) {
|
|
|
|
ll_add handlers_body_foot template apps/bridge/foot.tpl
|
2009-01-10 20:03:46 -07:00
|
|
|
if(get_post_args comment_text) {
|
|
|
|
d=`{date -n} # FIXME Obvious race
|
|
|
|
d=$local_path^'_werc/comments/'^$d/
|
2009-01-08 19:08:02 -07:00
|
|
|
|
2009-01-10 20:03:46 -07:00
|
|
|
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) {
|
2009-01-25 08:54:03 -07:00
|
|
|
u=$comment_user_name':'$comment_user_password
|
2009-01-10 20:03:46 -07:00
|
|
|
d=$d^'_pending'
|
|
|
|
}
|
|
|
|
if not
|
|
|
|
u = $logged_user
|
2009-01-08 19:08:02 -07:00
|
|
|
}
|
|
|
|
|
2009-01-10 20:03:46 -07:00
|
|
|
umask 002
|
2009-01-23 23:11:39 -07:00
|
|
|
if(mkdir -m 775 -p $d) { # Rudimentary perm checking
|
|
|
|
echo $u > $d/user
|
|
|
|
echo $comment_text > $d/body
|
|
|
|
}
|
2009-01-10 20:03:46 -07:00
|
|
|
}
|
2009-01-08 19:08:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2009-01-10 20:03:46 -07:00
|
|
|
|