From f53d084c0061c47c571cbbce7c0d893289055191 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 19 Feb 2008 11:26:08 +1300 Subject: [PATCH] bug 1803 - fix error page handling Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- .htaccess | 10 ++--- Makefile.PL | 2 +- {koha-tmpl/errors => errors}/400.pl | 0 {koha-tmpl/errors => errors}/401.pl | 0 {koha-tmpl/errors => errors}/402.pl | 0 {koha-tmpl/errors => errors}/403.pl | 0 {koha-tmpl/errors => errors}/404.pl | 0 {koha-tmpl/errors => errors}/500.pl | 0 etc/koha-httpd.conf | 13 +++++++ .../opac-tmpl/prog/en/modules/errors/400.tmpl | 29 +++++++++++++++ .../opac-tmpl/prog/en/modules/errors/401.tmpl | 30 +++++++++++++++ .../opac-tmpl/prog/en/modules/errors/403.tmpl | 29 +++++++++++++++ .../opac-tmpl/prog/en/modules/errors/404.tmpl | 29 +++++++++++++++ .../opac-tmpl/prog/en/modules/errors/500.tmpl | 29 +++++++++++++++ opac/errors/400.pl | 37 +++++++++++++++++++ opac/errors/401.pl | 37 +++++++++++++++++++ opac/errors/402.pl | 37 +++++++++++++++++++ opac/errors/403.pl | 37 +++++++++++++++++++ opac/errors/404.pl | 37 +++++++++++++++++++ opac/errors/500.pl | 37 +++++++++++++++++++ 20 files changed, 387 insertions(+), 6 deletions(-) rename {koha-tmpl/errors => errors}/400.pl (100%) rename {koha-tmpl/errors => errors}/401.pl (100%) rename {koha-tmpl/errors => errors}/402.pl (100%) rename {koha-tmpl/errors => errors}/403.pl (100%) rename {koha-tmpl/errors => errors}/404.pl (100%) rename {koha-tmpl/errors => errors}/500.pl (100%) create mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/errors/400.tmpl create mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/errors/401.tmpl create mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/errors/403.tmpl create mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/errors/404.tmpl create mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/errors/500.tmpl create mode 100755 opac/errors/400.pl create mode 100755 opac/errors/401.pl create mode 100755 opac/errors/402.pl create mode 100755 opac/errors/403.pl create mode 100755 opac/errors/404.pl create mode 100755 opac/errors/500.pl diff --git a/.htaccess b/.htaccess index 179a894e29..493fba56e2 100755 --- a/.htaccess +++ b/.htaccess @@ -1,9 +1,9 @@ # .htaccess -ErrorDocument 400 /cgi-bin/koha/koha-tmpl/errors/400.pl -ErrorDocument 401 /cgi-bin/koha/koha-tmpl/errors/401.pl -ErrorDocument 403 /cgi-bin/koha/koha-tmpl/errors/403.pl -ErrorDocument 404 /cgi-bin/koha/koha-tmpl/errors/404.pl -ErrorDocument 500 /cgi-bin/koha/koha-tmpl/errors/500.pl +ErrorDocument 400 /cgi-bin/koha/errors/400.pl +ErrorDocument 401 /cgi-bin/koha/errors/401.pl +ErrorDocument 403 /cgi-bin/koha/errors/403.pl +ErrorDocument 404 /cgi-bin/koha/errors/404.pl +ErrorDocument 500 /cgi-bin/koha/errors/500.pl diff --git a/Makefile.PL b/Makefile.PL index bac9ff9fdc..d0e277d499 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -250,7 +250,7 @@ my $target_map = { './help.pl' => 'INTRANET_CGI_DIR', './installer-CPAN.pl' => 'NONE', './installer' => 'INTRANET_CGI_DIR', - './koha-tmpl/errors' => {target => 'INTRANET_CGI_DIR', trimdir => 2}, + './errors' => {target => 'INTRANET_CGI_DIR'}, './koha-tmpl/intranet-tmpl' => {target => 'INTRANET_TMPL_DIR', trimdir => -1}, './koha-tmpl/opac-tmpl' => {target => 'OPAC_TMPL_DIR', trimdir => -1}, './kohaversion.pl' => 'INTRANET_CGI_DIR', diff --git a/koha-tmpl/errors/400.pl b/errors/400.pl similarity index 100% rename from koha-tmpl/errors/400.pl rename to errors/400.pl diff --git a/koha-tmpl/errors/401.pl b/errors/401.pl similarity index 100% rename from koha-tmpl/errors/401.pl rename to errors/401.pl diff --git a/koha-tmpl/errors/402.pl b/errors/402.pl similarity index 100% rename from koha-tmpl/errors/402.pl rename to errors/402.pl diff --git a/koha-tmpl/errors/403.pl b/errors/403.pl similarity index 100% rename from koha-tmpl/errors/403.pl rename to errors/403.pl diff --git a/koha-tmpl/errors/404.pl b/errors/404.pl similarity index 100% rename from koha-tmpl/errors/404.pl rename to errors/404.pl diff --git a/koha-tmpl/errors/500.pl b/errors/500.pl similarity index 100% rename from koha-tmpl/errors/500.pl rename to errors/500.pl diff --git a/etc/koha-httpd.conf b/etc/koha-httpd.conf index 542e2e6fd4..d8fc9232a6 100644 --- a/etc/koha-httpd.conf +++ b/etc/koha-httpd.conf @@ -18,6 +18,12 @@ SetEnv PERL5LIB "__PERL_MODULE_DIR__" Options +FollowSymLinks + ErrorDocument 400 /cgi-bin/koha/errors/400.pl + ErrorDocument 401 /cgi-bin/koha/errors/401.pl + ErrorDocument 403 /cgi-bin/koha/errors/403.pl + ErrorDocument 404 /cgi-bin/koha/errors/404.pl + ErrorDocument 500 /cgi-bin/koha/errors/500.pl + # Rewrite Rules RewriteEngine On @@ -46,6 +52,13 @@ SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml" SetEnv PERL5LIB "__PERL_MODULE_DIR__" Options +FollowSymLinks + + ErrorDocument 400 /cgi-bin/koha/errors/400.pl + ErrorDocument 401 /cgi-bin/koha/errors/401.pl + ErrorDocument 403 /cgi-bin/koha/errors/403.pl + ErrorDocument 404 /cgi-bin/koha/errors/404.pl + ErrorDocument 500 /cgi-bin/koha/errors/500.pl + RewriteEngine On # Uncomment to turn on rewrite logging # RewriteLog __LOG_DIR__/koha-intranet-rewrite.log diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/errors/400.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/errors/400.tmpl new file mode 100644 index 0000000000..b4a0c90d48 --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/modules/errors/400.tmpl @@ -0,0 +1,29 @@ +Koha Online Catalog › An Error Has Occurred + + + + + + +
+
+
+
+

An Error has Occurred

+

Error 404

+
    +
  • This error means that the Koha is pointed an invalid link.
  • +
  • To report this error, you can + ">email the Koha Administrator.
  • +
  • Use top menu bar to navigate to another part of Koha.
  • +
+
+
+
+
+
+ + + + + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/errors/401.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/errors/401.tmpl new file mode 100644 index 0000000000..7d70c01279 --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/modules/errors/401.tmpl @@ -0,0 +1,30 @@ +Koha Online Catalog › An Error Has Occurred + + + + + + +
+
+
+
+

An Error has Occurred

+

Error 404

+
    +
  • This error means that the you are trying to access a link that you're not authorized to see.
  • +
  • Try logging in to the catalog
  • +
  • To report this error, you can + ">email the Koha Administrator.
  • +
  • Use top menu bar to navigate to another part of Koha.
  • +
+
+
+
+
+
+ + + + + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/errors/403.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/errors/403.tmpl new file mode 100644 index 0000000000..d8fc6b29dd --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/modules/errors/403.tmpl @@ -0,0 +1,29 @@ +Koha Online Catalog › An Error Has Occurred + + + + + + +
+
+
+
+

An Error has Occurred

+

Error 404

+
    +
  • This error means that you are forbidden for some reason to see this page.
  • +
  • To report this error, you can + ">email the Koha Administrator.
  • +
  • Use top menu bar to navigate to another part of Koha.
  • +
+
+
+
+
+
+ + + + + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/errors/404.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/errors/404.tmpl new file mode 100644 index 0000000000..bb07e535ac --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/modules/errors/404.tmpl @@ -0,0 +1,29 @@ +Koha Online Catalog › An Error Has Occurred + + + + + + +
+
+
+
+

An Error has Occurred

+

Error 404

+
    +
  • This error means that the link was broken and that the page doesn't exist.
  • +
  • To report this error, you can + ">email the Koha Administrator.
  • +
  • Use top menu bar to navigate to another part of Koha.
  • +
+
+
+
+
+
+ + + + + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/errors/500.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/errors/500.tmpl new file mode 100644 index 0000000000..27121ff2a9 --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/modules/errors/500.tmpl @@ -0,0 +1,29 @@ +Koha Online Catalog › An Error Has Occurred + + + + + + +
+
+
+
+

An Error has Occurred

+

Error 404

+
    +
  • An error occurred while try to process your request.
  • +
  • To report this error, you can + ">email the Koha Administrator.
  • +
  • Use top menu bar to navigate to another part of Koha.
  • +
+
+
+
+
+
+ + + + + diff --git a/opac/errors/400.pl b/opac/errors/400.pl new file mode 100755 index 0000000000..16c169c06c --- /dev/null +++ b/opac/errors/400.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + + +use strict; +use CGI; +use C4::Auth; +use C4::Output; +use C4::Context; + +my $query = new CGI; +my $admin = C4::Context->preference('KohaAdminEmailAddress'); +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "errors/400.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + debug => 1, + } +); +$template->param( admin => $admin ); +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/errors/401.pl b/opac/errors/401.pl new file mode 100755 index 0000000000..c6573f4b7f --- /dev/null +++ b/opac/errors/401.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + + +use strict; +use CGI; +use C4::Auth; +use C4::Output; +use C4::Context; + +my $query = new CGI; +my $admin = C4::Context->preference('KohaAdminEmailAddress'); +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "errors/401.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + debug => 1, + } +); +$template->param( admin => $admin ); +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/errors/402.pl b/opac/errors/402.pl new file mode 100755 index 0000000000..8620f88cb6 --- /dev/null +++ b/opac/errors/402.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + + +use strict; +use CGI; +use C4::Auth; +use C4::Output; +use C4::Context; + +my $query = new CGI; +my $admin = C4::Context->preference('KohaAdminEmailAddress'); +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "errors/402.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + debug => 1, + } +); +$template->param( admin => $admin ); +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/errors/403.pl b/opac/errors/403.pl new file mode 100755 index 0000000000..d223ffb6da --- /dev/null +++ b/opac/errors/403.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + + +use strict; +use CGI; +use C4::Auth; +use C4::Output; +use C4::Context; + +my $query = new CGI; +my $admin = C4::Context->preference('KohaAdminEmailAddress'); +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "errors/403.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + debug => 1, + } +); +$template->param( admin => $admin ); +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/errors/404.pl b/opac/errors/404.pl new file mode 100755 index 0000000000..0c5408c99d --- /dev/null +++ b/opac/errors/404.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + + +use strict; +use CGI; +use C4::Auth; +use C4::Output; +use C4::Context; + +my $query = new CGI; +my $admin = C4::Context->preference('KohaAdminEmailAddress'); +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "errors/404.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + debug => 1, + } +); +$template->param( admin => $admin ); +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/errors/500.pl b/opac/errors/500.pl new file mode 100755 index 0000000000..29ee3e082f --- /dev/null +++ b/opac/errors/500.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + + +use strict; +use CGI; +use C4::Auth; +use C4::Output; +use C4::Context; + +my $query = new CGI; +my $admin = C4::Context->preference('KohaAdminEmailAddress'); +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "errors/500.tmpl", + query => $query, + type => "opac", + koha-tmpl/authnotrequired => 1, + debug => 1, + } +); +$template->param( admin => $admin ); +output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.2