Browse Source

+ LDV::Comments->new

master
Alex 'AdUser' Z 9 years ago
parent
commit
9f4291cd86
  1. 22
      lib/LDV/Comments.pm

22
lib/LDV/Comments.pm

@ -90,4 +90,26 @@ sub get {
$self->rendered(); $self->rendered();
} }
sub new {
my ($self) = @_;
eval {
die("request error\n")
unless $self->req->is_xnr;
my $ip = $self->tx->remote_address
or die("can't find remote ip\n");
$self->session({c_sectoken => $ip . '-' . time() + 60 * 7});
my $pageid = $self->_gen_pageid()
or die("can't get pageid\n");
$self->stash({pageid => $pageid});
$self->render(template => 'comments/new');
} or do {
chomp $@;
$self->app->log->error($@);
$@ = 'internal error' if $@ =~ m{line \d+}o;
$self->res->code(400);
$self->render(text => $@);
};
}
1; 1;

Loading…
Cancel
Save