[vhffs-dev] [461] Display an error message instead "internal server error" when vhffs cannot connect to the database

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


Revision: 461
Author:   gradator
Date:     2007-02-16 17:00:25 +0000 (Fri, 16 Feb 2007)

Log Message:
-----------
Display an error message instead "internal server error" when vhffs cannot connect to the database

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm


Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm	2007-02-16 16:10:43 UTC (rev 460)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm	2007-02-16 17:00:25 UTC (rev 461)
@@ -197,6 +197,10 @@
 
 	my $cgi = new CGI;
 	my $vhffs = init Vhffs::Main;
+	if ( ! defined $vhffs )  {
+		print CGI->header( -type=>"text/html", -charset=>"utf-8" ), "Unable to open database connection\n";
+		exit 1;
+	}
 
 	( $lang, $langcookie ) = cookie_lang( $vhffs , $cgi );
 	( $theme, $themecookie ) = cookie_theme( $vhffs , $cgi );
@@ -242,7 +246,7 @@
 		$template->param( TEXT_LOGINFAILED => $bad_news);
 		$template->param( TEXT_LOGIN => gettext("Login") );
 		$template->param( THEME => get_theme( $vhffs ) );
-        print CGI->header( -type=>"text/html", -charset=>"utf-8" ), $template->output;
+		print CGI->header( -type=>"text/html", -charset=>"utf-8" ), $template->output;
 		return 0;
 	}
 
@@ -623,10 +627,15 @@
 
 sub new_light
 {
+	my $cgi = new CGI;
 	my $vhffs = init Vhffs::Main;
+	if ( ! defined $vhffs )  {
+		print CGI->header( -type=>"text/html", -charset=>"utf-8" ), "Unable to open database connection\n";
+		exit 1;
+	}
+
 	my $config = $vhffs->get_config;
 	my $templatedir = $vhffs->get_config->get_templatedir;
-	my $cgi = new CGI;
 	my ( $lang, $langcookie ) = cookie_lang( $vhffs , $cgi );
 	my ( $theme, $themecookie ) = cookie_theme( $vhffs , $cgi );
 


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