Lines 15-31
Link Here
|
15 |
# You should have received a copy of the GNU General Public License |
15 |
# You should have received a copy of the GNU General Public License |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
17 |
|
18 |
use strict; |
18 |
use Modern::Perl; |
19 |
use warnings; |
19 |
|
20 |
use C4::Templates; |
20 |
use C4::Templates; |
21 |
use CGI qw ( -utf8 ); |
21 |
use CGI qw ( -utf8 ); |
22 |
|
22 |
|
23 |
my $query = new CGI; |
23 |
my $query = new CGI; |
24 |
my $language = $query->param('language'); |
24 |
my $language = $query->param('language'); |
|
|
25 |
|
25 |
# Detect where the user came from and save that url |
26 |
# Detect where the user came from and save that url |
26 |
my $requestedUrl = $query->url(-base => 1) ; |
27 |
my $requestedUrl = $query->url( -base => 1 ); |
|
|
28 |
|
27 |
# Use referer url if it matches $requestedUrl else use $requestedUrl as the url . |
29 |
# Use referer url if it matches $requestedUrl else use $requestedUrl as the url . |
28 |
my $url = $query->referer()=~$requestedUrl ? $query->referer() : $requestedUrl; |
30 |
my $url = |
|
|
31 |
$query->referer() =~ $requestedUrl ? $query->referer() : $requestedUrl; |
29 |
|
32 |
|
30 |
# warn "Language : $query // $language // $url"; |
33 |
# warn "Language : $query // $language // $url"; |
31 |
|
34 |
|
Lines 33-38
my $url = $query->referer()=~$requestedUrl ? $query->referer() : $requestedUrl
Link Here
|
33 |
# 'language=' should be removed from url string, otherwise |
36 |
# 'language=' should be removed from url string, otherwise |
34 |
# the language picker will not work |
37 |
# the language picker will not work |
35 |
$url =~ s|(.)language=[\w-]*&?|$1|; |
38 |
$url =~ s|(.)language=[\w-]*&?|$1|; |
36 |
$url =~ s|(&\|\?)$||; # Remove extraneous ? or & |
39 |
$url =~ s|(&\|\?)$||; # Remove extraneous ? or & |
37 |
|
40 |
|
38 |
C4::Templates::setlanguagecookie( $query, $language, $url ); |
41 |
C4::Templates::setlanguagecookie( $query, $language, $url ); |
39 |
- |
|
|