Revert "Bug 4460 - Amazon's AssociateID tag not used in links so referred revenue...
[koha.git] / about.pl
blobdaf682950f3992673f632b89a57f3547e6c84574
1 #!/usr/bin/perl
3 # Copyright Pat Eyler 2003
4 # Copyright Biblibre 2006
5 # Parts Copyright Liblime 2008
6 # Parts Copyright Chris Nighswonger 2010
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
13 # version.
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along
20 # with Koha; if not, write to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 use strict;
24 use warnings;
26 use CGI;
27 use LWP::Simple;
28 use XML::Simple;
29 use Config;
31 use C4::Output;
32 use C4::Auth;
33 use C4::Context;
34 use C4::Installer;
36 #use Smart::Comments '####';
38 my $query = new CGI;
39 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
41 template_name => "about.tmpl",
42 query => $query,
43 type => "intranet",
44 authnotrequired => 0,
45 flagsrequired => { catalogue => 1 },
46 debug => 1,
50 my $kohaVersion = C4::Context::KOHAVERSION;
51 my $osVersion = `uname -a`;
52 my $perl_path = $^X;
53 if ($^O ne 'VMS') {
54 $perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
56 my $perlVersion = $];
57 my $mysqlVersion = `mysql -V`;
58 my $apacheVersion = `httpd -v`;
59 $apacheVersion = `httpd2 -v` unless $apacheVersion;
60 $apacheVersion = (`/usr/sbin/apache2 -V`)[0] unless $apacheVersion;
61 my $zebraVersion = `zebraidx -V`;
63 # Additional system information for warnings
64 my $prefNoZebra = C4::Context->preference('nozebra');
65 my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
66 my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities');
67 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
69 my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords');
70 my $prefUseControlNumber = C4::Context->preference('UseControlNumber');
71 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
73 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
75 $template->param(
76 kohaVersion => $kohaVersion,
77 osVersion => $osVersion,
78 perlPath => $perl_path,
79 perlVersion => $perlVersion,
80 perlIncPath => [ map { perlinc => $_ }, @INC ],
81 mysqlVersion => $mysqlVersion,
82 apacheVersion => $apacheVersion,
83 zebraVersion => $zebraVersion,
84 prefNoZebra => $prefNoZebra,
85 prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
86 prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
87 warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
88 warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords,
89 errZebraConnection => $errZebraConnection,
92 my @components = ();
94 my $perl_modules = C4::Installer::PerlModules->new;
95 $perl_modules->version_info;
97 my @pm_types = qw(missing_pm upgrade_pm current_pm);
99 foreach my $pm_type(@pm_types) {
100 my $modules = $perl_modules->get_attr($pm_type);
101 foreach (@$modules) {
102 my ($module, $stats) = each %$_;
103 push(
104 @components,
106 name => $module,
107 version => $stats->{'cur_ver'},
108 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
109 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
110 current => ($pm_type eq 'current_pm' ? 1 : 0),
111 require => $stats->{'required'},
117 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
119 my $counter=0;
120 my $row = [];
121 my $table = [];
122 foreach (@components) {
123 push (@$row, $_);
124 unless (++$counter % 4) {
125 push (@$table, {row => $row});
126 $row = [];
129 # Processing the last line (if there are any modules left)
130 if (scalar(@$row) > 0) {
131 # Extending $row to the table size
132 $$row[3] = '';
133 # Pushing the last line
134 push (@$table, {row => $row});
136 ## ## $table
138 $template->param( table => $table );
141 ## ------------------------------------------
142 ## Koha time line code
144 #get file location
145 my $dir = C4::Context->config('intranetdir');
146 open( my $file, "<", "$dir" . "/docs/history.txt" );
147 my $i = 0;
149 my @rows2 = ();
150 my $row2 = [];
152 my @lines = <$file>;
153 close($file);
155 shift @lines; #remove header row
157 foreach (@lines) {
158 my ( $date, $desc, $tag ) = split(/\t/);
159 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
160 ($date, $desc)= ($`, $');
162 push(
163 @rows2,
165 date => $date,
166 desc => $desc,
171 my $table2 = [];
172 #foreach my $row2 (@rows2) {
173 foreach (@rows2) {
174 push (@$row2, $_);
175 push( @$table2, { row2 => $row2 } );
176 $row2 = [];
179 $template->param( table2 => $table2 );
181 output_html_with_http_headers $query, $cookie, $template->output;