From 9e973bc5fa6723a0ab712c6272a8fbbd9800eff8 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 15 Oct 2021 12:42:28 +0200 Subject: [PATCH] word/edit: replace hardcoded urls to the current page --- word/edit.plp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/word/edit.plp b/word/edit.plp index 31fca23..f7d3948 100644 --- a/word/edit.plp +++ b/word/edit.plp @@ -1,6 +1,8 @@ <(../common.inc.plp)><: +my $editorurl = '/word/edit'; s{\Aedit(/|\z)}{} for $Request // (); + Html({ title => 'words cheat sheet admin', version => '1.0', @@ -21,7 +23,6 @@ my $db = eval { } or Abort('Database error', 501, $@); my $user = eval { - my $rootpath = '/word/edit'; if (defined $post{username}) { $cookie{login} = EncodeURI(join ':', @post{qw( username pass )}); } @@ -30,7 +31,7 @@ my $user = eval { if (AddCookie(CGI::Cookie->new( -name => 'login', -value => '', - -path => $rootpath, + -path => $editorurl, -expires => 'now', )->as_string)) { delete $cookie{login}; @@ -50,7 +51,7 @@ my $user = eval { my $httpcookie = CGI::Cookie->new( -name => 'login', -value => join(':', @{$found}{qw( username pass )}), - -path => $rootpath, + -path => $editorurl, ) or die "prepared object is empty\n"; AddCookie($httpcookie->as_string); } or Abort(["Unable to create login cookie", $@], 403); @@ -115,7 +116,7 @@ if (my $search = $fields{q}) { my $results = $db->select(word => '*', \%filter); say '

Search

\n"; @@ -283,7 +284,7 @@ if (not $row->{ref}) { printf( $ref->{id} ? '%s' : '', - "trans-$ref->{lang}", "/writer/$ref->{id}", Entity($ref->{form} // ''), + "trans-$ref->{lang}", "$editorurl/$ref->{id}", Entity($ref->{form} // ''), ); } say ''; @@ -292,7 +293,7 @@ if (not $row->{ref}) {

- +

@@ -306,15 +307,15 @@ if ($row->{id}) { say '