|
|
@ -16,7 +16,7 @@ sub captcha { |
|
|
|
my ($self) = @_; |
|
|
|
my ($self) = @_; |
|
|
|
|
|
|
|
|
|
|
|
eval { |
|
|
|
eval { |
|
|
|
my $table = $c->app->config->{captcha}->{table}; |
|
|
|
my $table = $self->app->config->{captcha}->{table}; |
|
|
|
my @sort = qw(shown tries); |
|
|
|
my @sort = qw(shown tries); |
|
|
|
$self->app->db->begin; |
|
|
|
$self->app->db->begin; |
|
|
|
my ($cid, $data) = $self->app->db->select($table, ['id', 'data'], undef, \@sort)->list; |
|
|
|
my ($cid, $data) = $self->app->db->select($table, ['id', 'data'], undef, \@sort)->list; |
|
|
@ -45,7 +45,7 @@ sub c_list { |
|
|
|
eval { |
|
|
|
eval { |
|
|
|
if (my $sid = $self->app->sid_by_name($ref->{site})) { |
|
|
|
if (my $sid = $self->app->sid_by_name($ref->{site})) { |
|
|
|
my @cm = (); |
|
|
|
my @cm = (); |
|
|
|
if (my $pid = $self->app->pid_by_hash($sid, $hash)) { |
|
|
|
if (my $pid = $self->app->pid_by_hash($sid, $ref->{hash})) { |
|
|
|
my @tm = $self->app->comments_by_pid($pid); |
|
|
|
my @tm = $self->app->comments_by_pid($pid); |
|
|
|
# TODO: processing |
|
|
|
# TODO: processing |
|
|
|
@cm = @tm; |
|
|
|
@cm = @tm; |
|
|
@ -54,7 +54,7 @@ sub c_list { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$self->res->code(400); |
|
|
|
$self->res->code(400); |
|
|
|
$self->render(text => "no such site\n"); |
|
|
|
$self->render(text => "no such site\n"); |
|
|
|
} |
|
|
|
} 1; |
|
|
|
} or do { |
|
|
|
} or do { |
|
|
|
chomp $@; |
|
|
|
chomp $@; |
|
|
|
my $msg = sprintf "Error when listing comments for %s/%s: %s", |
|
|
|
my $msg = sprintf "Error when listing comments for %s/%s: %s", |
|
|
|