import rt 3.4.4
[freeside.git] / rt / html / autohandler
index b21d261..c854c2b 100644 (file)
@@ -1,8 +1,8 @@
-%# {{{ BEGIN BPS TAGGED BLOCK
+%# BEGIN BPS TAGGED BLOCK {{{
 %# 
 %# COPYRIGHT:
 %#  
-%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
 %#                                          <jesse@bestpractical.com>
 %# 
 %# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,7 @@
 %# works based on those contributions, and sublicense and distribute
 %# those contributions and any derivatives thereof.
 %# 
-%# }}} END BPS TAGGED BLOCK
+%# END BPS TAGGED BLOCK }}}
 <%INIT>
 
 # Roll back any dangling transactions from a previous failed connection
@@ -61,21 +61,15 @@ if ($m->request_comp->attr_exists('AutoFlush')) {
     # passed just one, a scalar whatever they are, mark them as utf8
     my $type = ref($_);
     (!$type)
-       ? Encode::decode(utf8 => $_, Encode::FB_PERLQQ) :
+       ? Encode::is_utf8($_) ? $_ : Encode::decode(utf8 => $_, Encode::FB_PERLQQ) :
        ($type eq 'ARRAY')
-       ? [ map { ref($_) ? $_ : Encode::decode(utf8 => $_, Encode::FB_PERLQQ) } @$_ ] :
+       ? [ map { (ref($_) or Encode::is_utf8($_)) ? $_ : Encode::decode(utf8 => $_, Encode::FB_PERLQQ) } @$_ ] :
        ($type eq 'HASH')
-       ? { map { ref($_) ? $_ : Encode::decode(utf8 => $_, Encode::FB_PERLQQ) } %$_ } : $_
+       ? { map { (ref($_) or Encode::is_utf8($_)) ? $_ : Encode::decode(utf8 => $_, Encode::FB_PERLQQ) } %$_ } : $_
     } %ARGS;
 
-if ($ARGS{'Debug'}) {
-        require Time::HiRes;
-        $m->{'rt_base_time'} = [Time::HiRes::gettimeofday()];
+$m->{'rt_base_time'} = [Time::HiRes::gettimeofday()];
         
-}
-else {
-        $m->{'rt_base_time'} = time;
-}
 $m->comp('/Elements/SetupSessionCookie', %ARGS);
 
 unless ($session{'CurrentUser'} && $session{'CurrentUser'}->Id) {
@@ -169,7 +163,7 @@ elsif ( $RT::WebExternalAuth ) {
     elsif ($RT::WebFallbackToInternalAuth) {
        unless (defined($session{'CurrentUser'})) {
                $m->comp('/Elements/Login', %ARGS,
-                         Error=> loc('XXX CHANGEME You are not an authorized user'));
+                         Error=> loc('You are not an authorized user'));
                 $m->abort();
        }
     } else {
@@ -193,8 +187,8 @@ if (!$session{'CurrentUser'} && defined ($user) && defined ($pass) ){
     if (!$session{'CurrentUser'}->id() ||
         !$session{'CurrentUser'}->IsPassword($pass))
     {
-       $RT::Logger->error("FAILED LOGIN for $user from $ENV{'REMOTE_ADDR'}");
         delete $session{'CurrentUser'};
+       $RT::Logger->error("FAILED LOGIN for $user from $ENV{'REMOTE_ADDR'}");
         $m->comp('/Elements/Login', %ARGS,
                  Error => loc('Your username or password is incorrect'));
         $m->abort();