# ------- Remote Comment ---------------------------------------------------- sub rcomment { &record_sanitize_input($vars); while (my ($vkey,$vval) = each %$vars) { $vars->{$vkey} =~ s/\0/,/g; # Replace 'multi' delimiter with comma } die "Not allowwed to comment" unless (&is_allowed("create",$table)); # Do some stuff my $refer = $ENV{HTTP_REFERER}; my $table="post"; my $post = { post_type => 'link', post_link => $refer, post_description => $vars->{description}, post_title => $vars->{title}, post_author => $vars->{author}, post_feed => $vars->{feed}, post_id => "new", post_pub_date => &cal_date(time), post_crdate => time, post_creator => $Person->{person_id}, }; # Uniqueness Constraints my $l; if (($l = &db_locate($dbh,"post",{post_link => $post->{post_link}})) || ($l = &db_locate($dbh,"post",{post_title => $post->{post_title}})) ) { print "Content-type: text/html\n\n"; my $url = $Site->{st_url} . "post/" . $l; printf(qq|

Duplicate Entry: Post %s

|,$url,$l); exit; } # Clean up post->{post_description} =~ s/href=('|'|')(.*?)"/href="$2"/ig; #' # Submit and print record my $id_number = &db_insert($dbh,$query,$table,$post) || die "Couldn't inset post"; &rcomment_keylist_update($id_number,"author",$post->{post_author}) || die "Couldn't associate author"; &rcomment_keylist_update($id_number,"feed",$post->{post_feed}) || die "Couldn't associate author"; print_record($dbh,$query,"post",$id_number,"html",$Site->{context}); # Send WebMention my $content = get($post->{post_link}); die "Source page is unreachable" unless ($content); my $endpoint = &find_webmention_endpoint($content); if ($endpoint) { &send_webmention($endpoint,$post->{post_link},$Site->{st_url}."post/".$id_number); } print "Content-type: text/html\n"; print "Location: ".$refer."#$id_number!\n\n"; exit; }