View | Details | Raw Unified | Return to bug 5010
Collapse All | Expand All

(-)a/C4/Auth.pm (-6 / +1 lines)
Lines 388-393 sub get_template_and_user { Link Here
388
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
388
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
389
        marcflavour        => C4::Context->preference("marcflavour"),
389
        marcflavour        => C4::Context->preference("marcflavour"),
390
        persona            => C4::Context->preference("persona"),
390
        persona            => C4::Context->preference("persona"),
391
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
391
    );
392
    );
392
    if ( $in->{'type'} eq "intranet" ) {
393
    if ( $in->{'type'} eq "intranet" ) {
393
        $template->param(
394
        $template->param(
Lines 458-468 sub get_template_and_user { Link Here
458
            $opac_name = C4::Context->userenv->{'branch'};
459
            $opac_name = C4::Context->userenv->{'branch'};
459
        }
460
        }
460
461
461
        # FIXME Under Plack the CGI->https method always returns 'OFF' ($using_https will be set to 0 in this case)
462
        my $opac_base_url = C4::Context->preference("OPACBaseURL");    #FIXME uses $using_https below as well
463
        if ( !$opac_base_url ) {
464
            $opac_base_url = $ENV{'SERVER_NAME'} . ( $ENV{'SERVER_PORT'} eq ( $using_https ? "443" : "80" ) ? '' : ":$ENV{'SERVER_PORT'}" );
465
        }
466
        $template->param(
462
        $template->param(
467
            OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
463
            OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
468
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
464
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
Lines 481-487 sub get_template_and_user { Link Here
481
            OPACUserCSS                           => "" . C4::Context->preference("OPACUserCSS"),
477
            OPACUserCSS                           => "" . C4::Context->preference("OPACUserCSS"),
482
            OPACViewOthersSuggestions             => "" . C4::Context->preference("OPACViewOthersSuggestions"),
478
            OPACViewOthersSuggestions             => "" . C4::Context->preference("OPACViewOthersSuggestions"),
483
            OpacAuthorities                       => C4::Context->preference("OpacAuthorities"),
479
            OpacAuthorities                       => C4::Context->preference("OpacAuthorities"),
484
            OPACBaseURL                           => ( $using_https ? "https://" : "http://" ) . $opac_base_url,
485
            opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
480
            opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
486
            opac_search_limit                     => $opac_search_limit,
481
            opac_search_limit                     => $opac_search_limit,
487
            opac_limit_override                   => $opac_limit_override,
482
            opac_limit_override                   => $opac_limit_override,
(-)a/C4/Auth_with_shibboleth.pm (-1 / +15 lines)
Lines 113-119 sub _get_uri { Link Here
113
113
114
    my $protocol = "https://";
114
    my $protocol = "https://";
115
115
116
    my $return = $protocol . C4::Context->preference('OPACBaseURL');
116
    my $uri = C4::Context->preference('OPACBaseURL') // '';
117
    if ($uri eq '') {
118
        $debug and warn 'OPACBaseURL not set!';
119
    }
120
    if ($uri =~ /(.*):\/\/(.*)/) {
121
        my $oldprotocol = $1;
122
        if ($oldprotocol ne 'https') {
123
            $debug
124
                and warn
125
                  'Shibboleth requires OPACBaseURL to use the https protocol!';
126
        }
127
        $uri = $2;
128
    }
129
130
    my $return = $protocol . $uri;
117
    return $return;
131
    return $return;
118
}
132
}
119
133
(-)a/C4/Context.pm (+5 lines)
Lines 638-643 sub set_preference { Link Here
638
638
639
    $value = 0 if ( $type && $type eq 'YesNo' && $value eq '' );
639
    $value = 0 if ( $type && $type eq 'YesNo' && $value eq '' );
640
640
641
    # force explicit protocol on OPACBaseURL
642
    if ($var eq 'opacbaseurl' && substr($value,0,4) !~ /http/) {
643
        $value = 'http://' . $value;
644
    }
645
641
    my $sth = $dbh->prepare( "
646
    my $sth = $dbh->prepare( "
642
      INSERT INTO systempreferences
647
      INSERT INTO systempreferences
643
        ( variable, value )
648
        ( variable, value )
(-)a/catalogue/detail.pl (-6 lines)
Lines 396-407 if ( (C4::Context->preference("HTML5MediaEnabled") eq 'both') or (C4::Context->p Link Here
396
    $template->param( C4::HTML5Media->gethtml5media($record));
396
    $template->param( C4::HTML5Media->gethtml5media($record));
397
}
397
}
398
398
399
400
# Get OPAC URL
401
if (C4::Context->preference('OPACBaseURL')){
402
     $template->param( OpacUrl => C4::Context->preference('OPACBaseURL') );
403
}
404
405
# Displaying tags
399
# Displaying tags
406
400
407
my $tag_quantity;
401
my $tag_quantity;
(-)a/installer/data/mysql/de-DE/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 100-106 VALUES ( Link Here
100
100
101
Ihr Bibliothekskonto wurde angelegt. Bitte bestätigen Sie Ihre E-Mail-Adresse indem Sie auf folgenden Link klicken:
101
Ihr Bibliothekskonto wurde angelegt. Bitte bestätigen Sie Ihre E-Mail-Adresse indem Sie auf folgenden Link klicken:
102
102
103
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
103
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
104
104
105
Wenn Sie keine Kontoanmeldung durchgeführt haben, können Sie diese Benachrichtigung ignorieren. Sie wird in Kürze ungültig.
105
Wenn Sie keine Kontoanmeldung durchgeführt haben, können Sie diese Benachrichtigung ignorieren. Sie wird in Kürze ungültig.
106
106
(-)a/installer/data/mysql/en/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 113-119 VALUES ( Link Here
113
113
114
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
114
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
115
115
116
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
116
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
117
117
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
119
);
119
);
(-)a/installer/data/mysql/es-ES/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 111-117 VALUES ( Link Here
111
111
112
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
112
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
113
113
114
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
114
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
115
115
116
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
116
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
117
);
117
);
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql (-1 / +1 lines)
Lines 114-120 VALUES ( Link Here
114
114
115
Votre compte de bibliothèque a été créé. Veuillez valider votre adresse email et le processus d''inscription en cliquant sur ce lien:
115
Votre compte de bibliothèque a été créé. Veuillez valider votre adresse email et le processus d''inscription en cliquant sur ce lien:
116
116
117
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
117
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
118
118
119
Si vous n''êtes pas à l''origine de cette inscription, vous pouvez ignorer ce message.'
119
Si vous n''êtes pas à l''origine de cette inscription, vous pouvez ignorer ce message.'
120
);
120
);
(-)a/installer/data/mysql/it-IT/necessari/notices.sql (-1 / +1 lines)
Lines 113-119 VALUES ( Link Here
113
113
114
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
114
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
115
115
116
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
116
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
117
117
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
119
);
119
);
(-)a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql (-1 / +1 lines)
Lines 134-140 VALUES ( Link Here
134
134
135
D har blitt registrert som bruker av biblioteket. Verifiser epostadressen din ved å klikke på lenka nedenfor:
135
D har blitt registrert som bruker av biblioteket. Verifiser epostadressen din ved å klikke på lenka nedenfor:
136
136
137
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
137
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
138
138
139
Dersom du ikke har bedt om å bli registret som bruker av biblioteket kan du se bort fra denne engangsmeldingen. Forespørselen vil snart gå ut på dato.'
139
Dersom du ikke har bedt om å bli registret som bruker av biblioteket kan du se bort fra denne engangsmeldingen. Forespørselen vil snart gå ut på dato.'
140
);
140
);
(-)a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 113-119 VALUES ( Link Here
113
113
114
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
114
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
115
115
116
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
116
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
117
117
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
119
);
119
);
(-)a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 114-120 VALUES ( Link Here
114
114
115
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
115
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
116
116
117
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
117
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
118
118
119
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
119
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
120
);
120
);
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 242-248 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
242
('OPACAllowUserToChooseBranch','1','1','Allow the user to choose the branch they want to pickup their hold from','YesNo'),
242
('OPACAllowUserToChooseBranch','1','1','Allow the user to choose the branch they want to pickup their hold from','YesNo'),
243
('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'),
243
('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'),
244
('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'),
244
('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'),
245
('OPACBaseURL',NULL,NULL,'Specify the Base URL of the OPAC, e.g., opac.mylibrary.com, the http:// will be added automatically by Koha.','Free'),
245
('OPACBaseURL',NULL,NULL,'Specify the Base URL of the OPAC, e.g., http://opac.mylibrary.com, including the protocol (http:// or https://). Otherwise, the http:// will be added automatically by Koha upon saving.','Free'),
246
('opacbookbag','1','','If ON, enables display of Cart feature','YesNo'),
246
('opacbookbag','1','','If ON, enables display of Cart feature','YesNo'),
247
('OpacBrowser','0',NULL,'If ON, enables subject authorities browser on OPAC (needs to set misc/cronjob/sbuild_browser_and_cloud.pl)','YesNo'),
247
('OpacBrowser','0',NULL,'If ON, enables subject authorities browser on OPAC (needs to set misc/cronjob/sbuild_browser_and_cloud.pl)','YesNo'),
248
('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'),
248
('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'),
(-)a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 113-119 VALUES ( Link Here
113
113
114
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
114
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
115
115
116
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
116
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
117
117
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
119
);
119
);
(-)a/installer/data/mysql/updatedatabase.pl (+24 lines)
Lines 10267-10272 if ( CheckVersion($DBversion) ) { Link Here
10267
    SetVersion($DBversion);
10267
    SetVersion($DBversion);
10268
}
10268
}
10269
10269
10270
$DBversion = '3.19.00.XXX';
10271
if ( CheckVersion($DBversion) ) {
10272
    my $OPACBaseURL = C4::Context->preference('OPACBaseURL');
10273
    if (defined($OPACBaseURL) && substr($OPACBaseURL,0,4) ne "http") {
10274
        my $explanation = q{Specify the Base URL of the OPAC, e.g., http://opac.mylibrary.com, including the protocol (http:// or https://). Otherwise, the http:// will be added automatically by Koha upon saving.};
10275
        $OPACBaseURL = 'http://' . $OPACBaseURL;
10276
        my $sth_OPACBaseURL = $dbh->prepare( q{
10277
            UPDATE systempreferences SET value=?,explanation=?
10278
            WHERE variable='OPACBaseURL'; } );
10279
        $sth_OPACBaseURL->execute($OPACBaseURL,$explanation);
10280
    }
10281
    if (defined($OPACBaseURL)) {
10282
        $dbh->do( q{ UPDATE letter
10283
                     SET content=replace(content,
10284
                                         'http://<<OPACBaseURL>>',
10285
                                         '<<OPACBaseURL>>')
10286
                     WHERE content LIKE "%http://<<OPACBaseURL>>%"; } );
10287
    }
10288
10289
    print "Upgrade to $DBversion done (Bug 5010: Fix OPACBaseURL to include protocol)\n";
10290
    SetVersion($DBversion);
10291
}
10292
10270
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10293
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10271
# SEE bug 13068
10294
# SEE bug 13068
10272
# if there is anything in the atomicupdate, read and execute it.
10295
# if there is anything in the atomicupdate, read and execute it.
Lines 10280-10285 while ( my $file = readdir $dirh ) { Link Here
10280
    my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1;
10303
    my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1;
10281
}
10304
}
10282
10305
10306
10283
=head1 FUNCTIONS
10307
=head1 FUNCTIONS
10284
10308
10285
=head2 TableExists($table)
10309
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-2 / +2 lines)
Lines 13-22 OPAC: Link Here
13
                  prog: prog
13
                  prog: prog
14
            - theme as the fallback theme on the OPAC.
14
            - theme as the fallback theme on the OPAC.
15
        -
15
        -
16
            - "The OPAC is located at http://"
16
            - "The OPAC is located at "
17
            - pref: OPACBaseURL
17
            - pref: OPACBaseURL
18
              class: url
18
              class: url
19
            - . Do not include a trailing slash in the URL. (This must be filled in correctly for RSS, unAPI, and search plugins to work.)
19
            - . This should be a complete URL, starting with <code>http://</code> or <code>https://</code>. Do not include a trailing slash in the URL. (This must be filled in correctly for RSS, unAPI, and search plugins to work.)
20
        -
20
        -
21
            - Show
21
            - Show
22
            - pref: LibraryName
22
            - pref: LibraryName
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +2 lines)
Lines 445-453 function verify_images() { Link Here
445
</li>
445
</li>
446
    [% END %]
446
    [% END %]
447
    
447
    
448
    [% IF ( OpacUrl ) %]
448
    [% IF ( OPACBaseURL ) %]
449
        <li><strong>OPAC view:</strong>
449
        <li><strong>OPAC view:</strong>
450
    	<a href="http://[% OpacUrl %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]" target="_blank">Open in new window</a>
450
	<a href="[% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]" target="_blank">Open in new window</a>
451
		</li>
451
		</li>
452
	[% END %]
452
	[% END %]
453
        <li id="catalogue_detail_marc_preview">
453
        <li id="catalogue_detail_marc_preview">
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl (-1 / +1 lines)
Lines 937-943 Link Here
937
937
938
        <xsl:if test="$OPACBaseURL!=''">
938
        <xsl:if test="$OPACBaseURL!=''">
939
        <span class="results_summary"><span class="label">OPAC view: </span>
939
        <span class="results_summary"><span class="label">OPAC view: </span>
940
            <a><xsl:attribute name="href">http://<xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
940
            <a><xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
941
        </span>
941
        </span>
942
        </xsl:if>
942
        </xsl:if>
943
943
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl (-1 / +1 lines)
Lines 588-594 Link Here
588
        <!-- This will only work if the OPACBaseURL syspref is set. -->
588
        <!-- This will only work if the OPACBaseURL syspref is set. -->
589
        <xsl:if test="string-length($OPACBaseURL) > 0">
589
        <xsl:if test="string-length($OPACBaseURL) > 0">
590
        <p>OPAC View: <a>
590
        <p>OPAC View: <a>
591
                      <xsl:attribute name="href">http://<xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
591
                      <xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
592
                      <xsl:attribute name="target">_blank</xsl:attribute>
592
                      <xsl:attribute name="target">_blank</xsl:attribute>
593
                      Open in new window
593
                      Open in new window
594
                      </a></p>
594
                      </a></p>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-5 / +5 lines)
Lines 1117-1128 Link Here
1117
                [% IF ( SocialNetworks ) %]
1117
                [% IF ( SocialNetworks ) %]
1118
                    <div id="social_networks" class="clearfix">
1118
                    <div id="social_networks" class="clearfix">
1119
                        <span>Share</span>
1119
                        <span>Share</span>
1120
                        <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% protocol %][% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
1120
                        <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
1121
                        <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% protocol %][% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
1121
                        <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
1122
                        <div><a id="delicious" href="http://www.delicious.com/save?url=[% protocol %][% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
1122
                        <div><a id="delicious" href="http://www.delicious.com/save?url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
1123
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% protocol %][% current_url |url %])" title="Share by email">Email</a></div>
1123
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1124
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1124
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1125
                        <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title %]" data-lang="[% lang %]">Tweet</a></div>
1125
                        <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title |url %]" data-lang="[% lang %]">Tweet</a></div>
1126
                    </div>
1126
                    </div>
1127
                [% END %]
1127
                [% END %]
1128
            </div> <!-- / .ulactioncontainer -->
1128
            </div> <!-- / .ulactioncontainer -->
(-)a/opac/opac-shareshelf.pl (-2 / +1 lines)
Lines 179-186 sub send_invitekey { Link Here
179
    my ($param) = @_;
179
    my ($param) = @_;
180
    my $fromaddr = C4::Context->preference('KohaAdminEmailAddress');
180
    my $fromaddr = C4::Context->preference('KohaAdminEmailAddress');
181
    my $url =
181
    my $url =
182
        'http://'
182
        C4::Context->preference('OPACBaseURL')
183
      . C4::Context->preference('OPACBaseURL')
184
      . "/cgi-bin/koha/opac-shareshelf.pl?shelfnumber="
183
      . "/cgi-bin/koha/opac-shareshelf.pl?shelfnumber="
185
      . $param->{shelfnumber}
184
      . $param->{shelfnumber}
186
      . "&op=accept&key=";
185
      . "&op=accept&key=";
(-)a/t/Auth_with_shibboleth.t (-2 / +24 lines)
Lines 27-33 use C4::Context; Link Here
27
27
28
BEGIN {
28
BEGIN {
29
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
29
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
30
        plan tests => 6;
30
        plan tests => 9;
31
    } else {
31
    } else {
32
        plan skip_all => "Need Test::DBIx::Class"
32
        plan skip_all => "Need Test::DBIx::Class"
33
    }
33
    }
Lines 59-64 sub mockedConfig { Link Here
59
}
59
}
60
60
61
### Mock ->preference
61
### Mock ->preference
62
my $OPACBaseURL = "testopac.com";
62
$context->mock( 'preference', \&mockedPref );
63
$context->mock( 'preference', \&mockedPref );
63
64
64
sub mockedPref {
65
sub mockedPref {
Lines 66-72 sub mockedPref { Link Here
66
    my $return;
67
    my $return;
67
68
68
    if ( $param eq 'OPACBaseURL' ) {
69
    if ( $param eq 'OPACBaseURL' ) {
69
        $return = "testopac.com";
70
        $return = $OPACBaseURL;
70
    }
71
    }
71
72
72
    return $return;
73
    return $return;
Lines 237-244 subtest "checkpw_shib tests" => sub { Link Here
237
};
238
};
238
239
239
## _get_uri
240
## _get_uri
241
$OPACBaseURL = "testopac.com";
240
is( C4::Auth_with_shibboleth::_get_uri(),
242
is( C4::Auth_with_shibboleth::_get_uri(),
241
    "https://testopac.com", "https opac uri returned" );
243
    "https://testopac.com", "https opac uri returned" );
242
244
245
$OPACBaseURL = "http://testopac.com";
246
my $result;
247
warnings_are { $result = C4::Auth_with_shibboleth::_get_uri() }
248
             [ { carped =>
249
                 'Shibboleth requires OPACBaseURL to use the https protocol!' },
250
             ],
251
             "improper protocol - received expected warning";
252
is( $result, "https://testopac.com", "https opac uri returned" );
253
254
$OPACBaseURL = "https://testopac.com";
255
is( C4::Auth_with_shibboleth::_get_uri(),
256
    "https://testopac.com", "https opac uri returned" );
257
258
$OPACBaseURL = undef;
259
warnings_are { $result = C4::Auth_with_shibboleth::_get_uri() }
260
             [ { carped => 'OPACBaseURL not set!' },
261
             ],
262
             "undefined OPACBaseURL - received expected warning";
263
is( $result, "https://", "https opac uri returned" );
264
243
## _get_shib_config
265
## _get_shib_config
244
# Internal helper function, covered in tests above
266
# Internal helper function, covered in tests above
(-)a/t/db_dependent/Auth.t (-1 / +29 lines)
Lines 8-14 use Modern::Perl; Link Here
8
use CGI qw ( -utf8 );
8
use CGI qw ( -utf8 );
9
use Test::MockModule;
9
use Test::MockModule;
10
use List::MoreUtils qw/all any none/;
10
use List::MoreUtils qw/all any none/;
11
use Test::More tests => 6;
11
use Test::More tests => 8;
12
use C4::Members;
12
use C4::Members;
13
use Koha::AuthUtils qw/hash_password/;
13
use Koha::AuthUtils qw/hash_password/;
14
14
Lines 107-112 $dbh->{RaiseError} = 1; Link Here
107
        'BZ9735: invalid language, then default to en');
107
        'BZ9735: invalid language, then default to en');
108
}
108
}
109
109
110
# Check that there is always an OPACBaseURL set.
111
my $input = CGI->new();
112
my ( $template1, $borrowernumber, $cookie );
113
( $template1, $borrowernumber, $cookie ) = get_template_and_user(
114
    {
115
        template_name => "opac-detail.tt",
116
        type => "opac",
117
        query => $input,
118
        authnotrequired => 1,
119
    }
120
);
121
122
ok( ( any { 'OPACBaseURL' eq $_ } keys %{$template1->{VARS}} ),
123
    'OPACBaseURL is in OPAC template' );
124
125
my ( $template2 );
126
( $template2, $borrowernumber, $cookie ) = get_template_and_user(
127
    {
128
        template_name => "catalogue/detail.tt",
129
        type => "intranet",
130
        query => $input,
131
        authnotrequired => 1,
132
    }
133
);
134
135
ok( ( any { 'OPACBaseURL' eq $_ } keys %{$template2->{VARS}} ),
136
    'OPACBaseURL is in Staff template' );
137
110
my $hash1 = hash_password('password');
138
my $hash1 = hash_password('password');
111
my $hash2 = hash_password('password');
139
my $hash2 = hash_password('password');
112
140
(-)a/t/db_dependent/Auth_with_cas.t (-1 / +1 lines)
Lines 38-44 my $dbh = C4::Context->dbh; Link Here
38
$dbh->{ AutoCommit } = 0;
38
$dbh->{ AutoCommit } = 0;
39
$dbh->{ RaiseError } = 1;
39
$dbh->{ RaiseError } = 1;
40
40
41
C4::Context->set_preference('OPACBaseURL','localhost');
41
C4::Context->set_preference('OPACBaseURL','http://localhost');
42
C4::Context->set_preference('staffClientBaseURL','localhost:8080');
42
C4::Context->set_preference('staffClientBaseURL','localhost:8080');
43
43
44
my $opac_base_url = C4::Context->preference('OpacBaseURL');
44
my $opac_base_url = C4::Context->preference('OpacBaseURL');
(-)a/t/db_dependent/Context.t (-1 / +27 lines)
Lines 18-25 BEGIN { Link Here
18
		use_ok('C4::Context');
18
		use_ok('C4::Context');
19
}
19
}
20
20
21
ok($koha = C4::Context->new,  'C4::Context->new');
22
ok($dbh = C4::Context->dbh(), 'Getting dbh from C4::Context');
21
ok($dbh = C4::Context->dbh(), 'Getting dbh from C4::Context');
22
23
$dbh->begin_work;
24
C4::Context->disable_syspref_cache();
25
C4::Context->set_preference('OPACBaseURL','junk');
26
C4::Context->clear_syspref_cache();
27
my $OPACBaseURL = C4::Context->preference('OPACBaseURL');
28
is($OPACBaseURL,'http://junk','OPACBaseURL saved with http:// when missing it');
29
30
C4::Context->set_preference('OPACBaseURL','https://junk');
31
C4::Context->clear_syspref_cache();
32
$OPACBaseURL = C4::Context->preference('OPACBaseURL');
33
is($OPACBaseURL,'https://junk','OPACBaseURL saved with https:// as specified');
34
35
C4::Context->set_preference('OPACBaseURL','http://junk2');
36
C4::Context->clear_syspref_cache();
37
$OPACBaseURL = C4::Context->preference('OPACBaseURL');
38
is($OPACBaseURL,'http://junk2','OPACBaseURL saved with http:// as specified');
39
40
C4::Context->set_preference('SillyPreference','random');
41
C4::Context->clear_syspref_cache();
42
my $SillyPeference = C4::Context->preference('SillyPreference');
43
is($SillyPeference,'random','SillyPreference saved as specified');
44
C4::Context->clear_syspref_cache();
45
C4::Context->enable_syspref_cache();
46
$dbh->rollback;
47
48
ok($koha = C4::Context->new,  'C4::Context->new');
23
ok($ret = C4::Context->KOHAVERSION, '  (function)  KOHAVERSION = ' . ($ret||''));
49
ok($ret = C4::Context->KOHAVERSION, '  (function)  KOHAVERSION = ' . ($ret||''));
24
ok($ret =       $koha->KOHAVERSION, '       $koha->KOHAVERSION = ' . ($ret||''));
50
ok($ret =       $koha->KOHAVERSION, '       $koha->KOHAVERSION = ' . ($ret||''));
25
ok(
51
ok(
(-)a/virtualshelves/sendshelf.pl (-6 lines)
Lines 101-111 if ($email) { Link Here
101
        push( @results, $dat );
101
        push( @results, $dat );
102
    }
102
    }
103
103
104
    if ( C4::Context->preference('OPACBaseURL') ) {
105
        $template2->param(
106
            OPACBaseURL => C4::Context->preference('OPACBaseURL') );
107
    }
108
109
    $template2->param(
104
    $template2->param(
110
        BIBLIO_RESULTS => \@results,
105
        BIBLIO_RESULTS => \@results,
111
        email_sender   => $mail{'from'},
106
        email_sender   => $mail{'from'},
112
- 

Return to bug 5010