From 5e5ce6b7f9aa188209b0d9f6fd3b4f6e14d490cb Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Sun, 1 Jun 2008 21:43:30 -0500 Subject: [PATCH] calculate OPACBaseURL instead of using syspref Calculate OPACBaseURL from the CGI environment variables instead of using the system preference. As a result of this patch, it should be possible to change the hostname, protocol, or port of the OPAC without having to reset a system preference. Also added a FIXME to opac/unapi - the URL of the SRU/W server has no necessary relationship to the URL of the OPAC. Once this patch is confirmed, the syspref can be removed. Signed-off-by: Joshua Ferraro --- C4/Auth.pm | 4 +++- koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 4 ++-- koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl | 2 +- opac/unapi | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 3951892e57..6545681a1a 100755 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -317,7 +317,9 @@ sub get_template_and_user { TagsEnabled => C4::Context->preference("TagsEnabled"), GoogleJackets => C4::Context->preference("GoogleJackets"), AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"), - OPACBaseURL=> C4::Context->preference("OPACBaseURL"), + OPACBaseURL=> ($in->{'query'}->https() ? "https://" : "http://") . + $ENV{'SERVER_NAME'} . + ($ENV{'SERVER_PORT'} eq "80" ? '' : ":$ENV{'SERVER_PORT'}"), ); } $template->param(listloop=>[{shelfname=>"Freelist", shelfnumber=>110}]); diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc index adbdd39040..bdfd7f7007 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -115,10 +115,10 @@