[vhffs-dev] [1568] I hadn't seen this line at top of the page...

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1568
Author:   beuss
Date:     2010-03-19 08:02:20 +0100 (Fri, 19 Mar 2010)
Log Message:
-----------
I hadn't seen this line at top of the page... Seems we've to send all header at once

Modified Paths:
--------------
    branches/vhffs-design/vhffs-api/src/Vhffs/Panel.pm

Modified: branches/vhffs-design/vhffs-api/src/Vhffs/Panel.pm
===================================================================
--- branches/vhffs-design/vhffs-api/src/Vhffs/Panel.pm	2010-03-19 06:54:59 UTC (rev 1567)
+++ branches/vhffs-design/vhffs-api/src/Vhffs/Panel.pm	2010-03-19 07:02:20 UTC (rev 1568)
@@ -392,7 +392,7 @@
 
 	my $sid = $cgi->cookie( CGI::Session::name() );
 	unless( defined $sid )  {
-        print $cgi->header(-status => '401 Authorization needed');
+        $cgi->{_status} = '401 Authorization needed';
         $cgi->delete_all();
         # We cannot use add_error since auth.pl instanciate a
         # Vhffs::Panel::Anonymous instance...
@@ -403,7 +403,7 @@
 
 	my $session = new CGI::Session( undef, $sid, {Directory=>'/tmp'} );
 	unless( defined $session )  {
-        $cgi->header(-status => '500 Internal server error');
+        $cgi->{_status} = '500 Internal server error';
         $cgi->delete_all();
         $cgi->param('error', gettext('Cannot create or fetch session file, please check that /tmp is readable and writeable') );
         require 'auth.pl';
@@ -413,7 +413,7 @@
 	my $username = $session->param('username');
 	my $uid = $session->param('uid');
 	unless(  defined $username  &&  defined $uid  &&  !$session->is_new()  )  {
-        print $cgi->header(-status => '401 Authorization needed');
+        $cgi->{_status} = '401 Authorization needed';
         $cgi->delete_all();
 		$cgi->param('error', gettext('Expired session ! Please login again') );
 		$session->delete();
@@ -423,7 +423,7 @@
 
 	my $user = Vhffs::User::get_by_uid($vhffs, $uid);
 	unless ( defined $user )  {
-        print $cgi->header(-status => '403 Forbidden');
+        $cgi->{_status} = '403 Forbidden';
         $cgi->delete_all();
         $cgi->param('error', gettext('User does not exist') );
 		$session->delete();
@@ -432,7 +432,7 @@
 	}
 
 	unless( $user->get_status == Vhffs::Constants::ACTIVATED )  {
-        print $cgi->header(-status => '403 Forbidden');
+        $cgi->{_status} = '403 Forbidden';
         $cgi->delete_all();
         $cgi->param('error', gettext('You\'re are not allowed to browse panel') );
 		$session->delete();
@@ -935,9 +935,11 @@
 	my $template = new Template($create_vars);
 
 	binmode STDOUT , ':utf8';	
-	
-	print CGI->header( -cookie=>[ @{$self->{cookies}} ], -type=>'text/html', -charset=>'utf-8' );
 
+    my $status = $self->{cgi}{_status};
+    $status = '200 OK' unless(defined $status);
+	print CGI->header( -cookie=>[ @{$self->{cookies}} ], -type=>'text/html', -charset=>'utf-8', -status => $status );
+
 	$template->process($file, $vars) 
 		|| die('Error while processing template: '.$template->error());
 	


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/