our $Dev = $ENV{HTTP_HOST} =~ /\bdev\./;
}
-our $Request = decode_utf8($ENV{PATH_INFO} =~ s{^/}{}r);
+our $Request //= decode_utf8($ENV{PATH_INFO} =~ s{^/}{}r);
our $style;
-our $showkeys = !exists $get{keys} ? undef :
+our $showkeys //= !exists $get{keys} ? undef :
($get{keys} ne '0' && ($get{keys} || 'always'));
$header{content_type} = 'text/html; charset=utf-8';
<(common.inc.plp)><:
+if ($Request and $Request =~ s{^edit/?}{}) {
+ Include 'writer.plp';
+ exit;
+}
+
my $lang = $get{lang} || 'en';
my $wordlist = "data/wordlist.$lang.inc.pl";
my $limit = $get{v} // (exists $get{v} ? 4 : 3);
} or Abort('Database error', 501, $@);
my $user = eval {
+ my $rootpath = ($ENV{REQUEST_URI} // '/writer') =~ s{(?<!^)/.+}{}r;
if (defined $post{username}) {
$cookie{login} = EncodeURI(join ':', @post{qw( username pass )});
}
if (AddCookie(CGI::Cookie->new(
-name => 'login',
-value => '',
- -path => '/writer',
+ -path => $rootpath,
-expires => 'now',
)->as_string)) {
delete $cookie{login};
my $httpcookie = CGI::Cookie->new(
-name => 'login',
-value => join(':', @{$found}{qw( username pass )}),
- -path => '/writer',
+ -path => $rootpath,
) or die "prepared object is empty\n";
AddCookie($httpcookie->as_string);
} or Abort(["Unable to create login cookie", $@], 403);