Description:
Box Code:
return "Sorry, you don't have permission to submit a feed."
unless $S->have_perm('submit_rdf');
my $action = $S->{CGI}->param('action') || 'showform';
if ($action eq 'showform') {
return &disp_form();
} elsif ($action eq 'save') {
my $url = $S->{CGI}->param('url');
return ('Please fill in the URL field') unless $url;
# check to see if this RDF already exists
my $is_dup = 0;
my $channels = $S->rdf_channels;
foreach my $c (@{$channels}) {
$is_dup = 1 if $c->{rdf_link} eq $url;
}
return &disp_form('That RDF already exists, or has been submitted already.') if $is_dup;
my $do_fetch = $S->{UI}->{VARS}->{allow_rdf_fetch} ? 1 : 0;
my ($id, $res) = $S->rdf_add_channel($url, $do_fetch, $S->{NICK});
unless ($res) {
$S->rdf_remove_channel($id);
return &disp_form('Error adding RDF file: $res');
}
my $fetched_msg = qq|
%%norm_font%%Your RDF has been fetched. An admin will check it out as soon as possible%%norm_font_end%%|;
return $fetched_msg;
}
sub disp_form {
my $form = qq|
%%norm_font%% %%submit_rdf_message%% %%norm_font_end%%
<p>
<form action="%%rootdir%%/?" method="GET">
<input type="hidden" name="op" value="submitrdf">
<input type="hidden" name="action" value="save">
<table border=0 cellspacing=0 cellpadding=0>|;
$form .= qq|
<tr>
<td><FONT color="#FF0000">%%norm_font%%$_[0]%%norm_font_end%%</font></td>
</tr>| if $_[0];
$form .= qq|
<tr>
<td>%%norm_font%%URL of RDF file:%%norm_font_end%% <input type="text" name="url" size="50"></td>
</tr>
<tr>
<td><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
|;
return $form;
}
|