From d3160c04203753f81f6a8ce5321997b726312caf Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 12 Jun 2013 17:15:39 +0200 Subject: [PATCH] =?utf8?q?Versionsanzeige=20im=20Adminlogin=20nach=20for?= =?utf8?q?=C3=A7iertem=20Logout=20fixen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Admin.pm | 2 +- SL/Form.pm | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/SL/Controller/Admin.pm b/SL/Controller/Admin.pm index c1b2ec1e8..5fdc308fc 100644 --- a/SL/Controller/Admin.pm +++ b/SL/Controller/Admin.pm @@ -455,7 +455,7 @@ sub use_multiselect_js { sub login_form { my ($self, %params) = @_; $::request->layout->focus('#admin_password'); - $self->render('admin/adminlogin', title => t8('kivitendo v#1 administration', $::form->{version}), %params); + $self->render('admin/adminlogin', title => t8('kivitendo v#1 administration', $::form->read_version), %params); } sub edit_user_form { diff --git a/SL/Form.pm b/SL/Form.pm index 330799766..8a82587e9 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -86,6 +86,17 @@ sub disconnect_standard_dbh { undef $standard_dbh; } +sub read_version { + my ($self) = @_; + + open VERSION_FILE, "VERSION"; # New but flexible code reads version from VERSION-file + my $version = ; + $version =~ s/[^0-9A-Za-z\.\_\-]//g; # only allow numbers, letters, points, underscores and dashes. Prevents injecting of malicious code. + close VERSION_FILE; + + return $version; +} + sub new { $main::lxdebug->enter_sub(); @@ -101,10 +112,7 @@ sub new { bless $self, $type; - open VERSION_FILE, "VERSION"; # New but flexible code reads version from VERSION-file - $self->{version} = ; - close VERSION_FILE; - $self->{version} =~ s/[^0-9A-Za-z\.\_\-]//g; # only allow numbers, letters, points, underscores and dashes. Prevents injecting of malicious code. + $self->{version} = $self->read_version; $main::lxdebug->leave_sub(); -- 2.20.1