[vhffs-dev] [393] New management for theme and lang, now totally fixed ( except for public area because it needs a rewrite from scratch), new functions has been created like new_light and display_light |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
- To: vhffs-dev@xxxxxxxxx
- Subject: [vhffs-dev] [393] New management for theme and lang, now totally fixed ( except for public area because it needs a rewrite from scratch), new functions has been created like new_light and display_light
- From: subversion@xxxxxxxxx
- Date: Tue, 09 Jan 2007 01:22:36 +0100
Revision: 393
Author: gradator
Date: 2007-01-09 00:22:35 +0000 (Tue, 09 Jan 2007)
Log Message:
-----------
New management for theme and lang, now totally fixed (except for public area because it needs a rewrite from scratch), new functions has been created like new_light and display_light
Modified Paths:
--------------
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm
branches/vhffs_4.1/vhffs-panel/auth.pl
branches/vhffs_4.1/vhffs-panel/login.pl
branches/vhffs_4.1/vhffs-panel/logout.pl
branches/vhffs_4.1/vhffs-panel/lost.pl
branches/vhffs_4.1/vhffs-panel/lost_ack.pl
branches/vhffs_4.1/vhffs-panel/panel.pl
branches/vhffs_4.1/vhffs-panel/subscribe.pl
branches/vhffs_4.1/vhffs-panel/user/prefs_save.pl
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm 2007-01-08 22:41:53 UTC (rev 392)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm 2007-01-09 00:22:35 UTC (rev 393)
@@ -51,20 +51,89 @@
}
-sub get_theme
+sub list_themes
{
my $vhffs = shift;
- my $theme = CGI->cookie( "theme" );
+ return -1 if( ! defined $vhffs );
+ my @themes;
+
+ my $dir = $vhffs->get_config->get_themesdir;
+
+ return undef if( ! ( defined $dir ) );
+
+ opendir( DIR , $dir) or return -2;
+
+ my @files = readdir( DIR );
+
+ foreach( @files )
+ {
+ next if( /\./);
+ if( -d $dir."/".$_ )
+ {
+ push @themes , $_;
+ }
+ }
+
+ closedir( DIR );
+
+ return @themes;
+}
+
+
+sub cookie_theme
+{
+ my $vhffs;
+ my $cgi;
+ my $cookie;
+ my $theme;
+
+ $vhffs = shift;
+ $cgi = shift;
+
+ $theme = $cgi->param( "theme" ) if ( defined $cgi );
+ $cookie = CGI->cookie( -name=>"theme", -value=>$theme, -expires=>'+10y' ) if ( defined $theme );
+ $theme = CGI->cookie( "theme" ) if ( ! defined $theme );
$theme = $vhffs->get_config->get_default_theme() if ( ! defined $theme );
+ $theme = "vhffs" if ( ! defined $theme || ! -f $vhffs->get_config->get_themesdir . "/" . $theme . "/main.css" );
- my $themetestfile = $vhffs->get_config->get_themesdir . "/" . $theme . "/main.css";
- return $theme if ( -f $themetestfile );
+ return ( $theme, $cookie );
+}
- $themetestfile = $vhffs->get_config->get_themesdir . "/vhffs/main.css";
- return "vhffs" if ( -f $themetestfile );
+
+sub get_theme
+{
+ my $vhffs = shift;
+ my ( $theme, $cookie ) = cookie_theme( $vhffs );
+ return $theme;
+}
+
+
+sub list_languages
+{
+ my $vhffs = shift;
+ return -1 if( ! defined $vhffs );
+
+ my @langs;
- return undef;
+ my $dir = $vhffs->get_config->get_intldir;
+ return undef if( ! ( defined $dir ) );
+
+# push @langs , "en_US";
+
+ opendir( DIR , $dir) or return @langs;
+ my @files = readdir( DIR );
+ foreach( @files )
+ {
+ next if( /\./);
+ if( -d $dir."/".$_ )
+ {
+ push @langs , $_;
+ }
+ }
+ closedir( DIR );
+
+ return @langs;
}
@@ -82,33 +151,39 @@
return $txt;
}
+
sub cookie_lang
{
- use CGI;
my $vhffs;
my $cgi;
my $cookie;
my $lang;
$vhffs = shift;
- $cgi = new CGI;
+ $cgi = shift;
- $lang = $cgi->param( "lang" );
+ $lang = $cgi->param( "lang" ) if ( defined $cgi );
+ $cookie = CGI->cookie( -name=>"language", -value=>$lang, -expires=>'+10y' ) if ( defined $lang );
$lang = CGI->cookie( "language" ) if ( ! defined $lang );
- if ( defined $lang ){
- $cookie = CGI->cookie( -name=>"language", -value=>$lang, -expires=>'+1y' );
- } else {
- $lang = $vhffs->get_config->get_default_language();
- $lang = "en_US" if ( ! defined $lang );
- }
+ $lang = $vhffs->get_config->get_default_language() if ( ! defined $lang );
+ $lang = "en_US" if ( ! defined $lang );
setlocale(LC_ALL, $lang );
bindtextdomain("vhffs", $vhffs->get_config->get_intldir);
textdomain("vhffs");
- return $cookie;
+ return ( $lang, $cookie );
}
+
+sub get_lang
+{
+ my $vhffs = shift;
+ my ( $lang, $cookie ) = cookie_lang( $vhffs );
+ return $lang;
+}
+
+
sub new
{
my $bad_news;
@@ -116,6 +191,8 @@
my $user;
my $username;
my $uid;
+ my ( $lang, $langcookie );
+ my ( $theme, $themecookie );
# get current cgi
my $cgi = new CGI;
@@ -153,7 +230,7 @@
} elsif( $user->get_status != Vhffs::Constants::ACTIVATED ) {
$bad_news = gettext("You're are not allowed to browse panel");
} else {
- cookie_lang( $vhffs );
+ ( $lang, $langcookie ) = cookie_lang( $vhffs , $cgi );
}
}
@@ -184,7 +261,7 @@
my $maintemplate = new HTML::Template( filename => $templatedir."/main/panel.tmpl" );
$maintemplate->param( PANEL_TITLE => gettext("VHFFS Panel") );
- my $theme = get_theme( $vhffs );
+ ( $theme, $themecookie ) = cookie_theme( $vhffs , $cgi );
$maintemplate->param( THEME => $theme );
@@ -196,7 +273,10 @@
$data->{'user'} = $user;
$data->{'cgi'} = $cgi;
$data->{'config'} = $config;
+ $data->{'lang'} = $lang;
+ $data->{'langcookie'} = $langcookie;
$data->{'theme'} = $theme;
+ $data->{'themecookie'} = $themecookie;
if( defined $group ) {
$data->{'group'} = $group;
$data->{'groupname'} = $projectname;
@@ -208,6 +288,7 @@
return $data;
}
+
sub right_first
{
my ( $class , $vhffs , $session , $user ) = @_;
@@ -221,6 +302,7 @@
return $template;
}
+
sub project_info
{
my ( $class , $vhffs, $group ) = @_;
@@ -524,15 +606,15 @@
sub display
{
- my ( $class , $panel , $content, $cookie, $cookie2 ) = @_;
+ my ( $class , $panel , $content, $cookie ) = @_;
- if( ref( $class ) eq 'HASH' )
- {
- $cookie2 = $cookie;
- $cookie = $content;
- $content = $panel;
- $panel = $class;
- }
+# if( ref( $class ) eq 'HASH' )
+# {
+# $cookie2 = $cookie;
+# $cookie = $content;
+# $content = $panel;
+# $panel = $class;
+# }
my $maintemplate = $panel->{'template'};
$maintemplate->param( CENTRE => $content );
@@ -542,109 +624,62 @@
$maintemplate->param( GROUPNAME => sprintf( gettext( "Current group: %s" ) , $panel->{'group'}->get_groupname ) );
}
- if( ! defined $cookie )
- {
- print CGI->header( -type=>"text/html", -charset=>"utf-8" );
- }
- else
- {
- if( ! defined $cookie2)
- {
- print CGI->header( -cookie=>$cookie, -type=>"text/html", -charset=>"utf-8" );
- }
- else
- {
- print CGI->header( -cookie=>[$cookie,$cookie2], -type=>"text/html", -charset=>"utf-8" );
- }
- }
+ my $langcookie = "";
+ $langcookie = $panel->{'langcookie'} if ( defined $panel->{'langcookie'} );
+ my $themecookie = "";
+ $themecookie = $panel->{'themecookie'} if ( defined $panel->{'themecookie'} );
+ $cookie = "" if ( ! defined $cookie );
+ print CGI->header( -cookie=>[$langcookie,$themecookie,$cookie], -type=>"text/html", -charset=>"utf-8" );
+
print $maintemplate->output;
-
return;
}
-sub display_light
+sub new_light
{
- my ( $class , $vhffs, $template, $cookie ) = @_;
+ my $vhffs = init Vhffs::Main;
+ 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 );
- if( ! $cookie )
- {
- print CGI->header( -type=>"text/html", -charset=>"utf-8" );
- }
- else
- {
- print CGI->header( -cookie=>$cookie, -type=>"text/html", -charset=>"utf-8" );
- }
+ my $data = {};
+ $data->{'vhffs'} = $vhffs;
+ $data->{'templatedir'} = $templatedir;
+ $data->{'cgi'} = $cgi;
+ $data->{'config'} = $config;
+ $data->{'lang'} = $lang;
+ $data->{'langcookie'} = $langcookie;
+ $data->{'theme'} = $theme;
+ $data->{'themecookie'} = $themecookie;
- my $theme = get_theme( $vhffs );
- $template->param( THEME => $theme );
-
- print $template->output;
-
- return;
+ return $data;
}
-
-sub list_themes
+sub display_light
{
- my $vhffs = shift;
- return -1 if( ! defined $vhffs );
+ my ( $class, $panel, $template, $cookie ) = @_;
- my @themes;
-
- my $dir = $vhffs->get_config->get_themesdir;
+ my $langcookie = "";
+ $langcookie = $panel->{'langcookie'} if ( defined $panel->{'langcookie'} );
+ my $themecookie = "";
+ $themecookie = $panel->{'themecookie'} if ( defined $panel->{'themecookie'} );
+ $cookie = "" if ( ! defined $cookie );
- return undef if( ! ( defined $dir ) );
+ print CGI->header( -cookie=>[$langcookie,$themecookie,$cookie], -type=>"text/html", -charset=>"utf-8" );
- opendir( DIR , $dir) or return -2;
-
- my @files = readdir( DIR );
+ my $theme = get_theme( $panel->{'vhffs'} );
+ $template->param( THEME => $theme );
- foreach( @files )
- {
- next if( /\./);
- if( -d $dir."/".$_ )
- {
- push @themes , $_;
- }
- }
-
- closedir( DIR );
-
- return @themes;
+ print $template->output;
+ return;
}
-sub list_languages
-{
- my $vhffs = shift;
- return -1 if( ! defined $vhffs );
-
- my @langs;
-
- my $dir = $vhffs->get_config->get_intldir;
- return undef if( ! ( defined $dir ) );
-
-# push @langs , "en_US";
-
- opendir( DIR , $dir) or return @langs;
- my @files = readdir( DIR );
- foreach( @files )
- {
- next if( /\./);
- if( -d $dir."/".$_ )
- {
- push @langs , $_;
- }
- }
- closedir( DIR );
-
- return @langs;
-}
-
-
sub open_template
{
my ( $arg1 , $arg2 , $arg3 , $vhffs , $path , $template , $tmp );
Modified: branches/vhffs_4.1/vhffs-panel/auth.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/auth.pl 2007-01-08 22:41:53 UTC (rev 392)
+++ branches/vhffs_4.1/vhffs-panel/auth.pl 2007-01-09 00:22:35 UTC (rev 393)
@@ -43,9 +43,6 @@
my $vhffs = init Vhffs::Main;
-#Set the language cookie
-my $cookie = Vhffs::Panel::Main::cookie_lang( $vhffs );
-
my $templatedir = $vhffs->get_config->get_templatedir;
my $hostname = $vhffs->get_config->get_host_name;
my $cgi = new CGI;
@@ -53,6 +50,8 @@
Vhffs::Panel::Main::check( $vhffs );
+my $panel = new_light Vhffs::Panel::Main();
+
$template = new HTML::Template( filename => $templatedir."/main/auth.tmpl", associate => $cgi );
$template->param( TITLE => gettext("VHFFS Login") );
@@ -84,4 +83,4 @@
$template->param( TEXT_PUBLIC => gettext( "Go to public area" ) );
}
-display_light Vhffs::Panel::Main( $vhffs , $template , $cookie );
+display_light Vhffs::Panel::Main( $panel , $template );
Modified: branches/vhffs_4.1/vhffs-panel/login.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/login.pl 2007-01-08 22:41:53 UTC (rev 392)
+++ branches/vhffs_4.1/vhffs-panel/login.pl 2007-01-09 00:22:35 UTC (rev 393)
@@ -44,42 +44,40 @@
use Vhffs::Main;
use Vhffs::Panel::Main;
-# nettoyage de la session precedente
+my $panel = new_light Vhffs::Panel::Main();
+my $vhffs = $panel->{'vhffs'};
+
+# we try to clean the previous session
my $oldsid = CGI->cookie("session");
-if($oldsid) {
+if( $oldsid ) {
my $oldsession = new CGI::Session(undef, $oldsid, {Directory=>'/tmp'});
$oldsession->delete();
}
-# Init the Vhffs Main System
-my $vhffs = init Vhffs::Main;
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $cookie = Vhffs::Panel::Main::cookie_lang( $vhffs );
-
-# recuperation des donnees des champs du form de login
-my $current_cgi = new CGI;
-my $username = $current_cgi->param("username");
-my $password = $current_cgi->param("password");
+# fetch user login and password
+my $cgi = $panel->{'cgi'};
+my $username = $cgi->param("username");
+my $password = $cgi->param("password");
my $user = Vhffs::User::get_by_username( $vhffs, $username );
-my $auth = 0;
-
+my $templatedir = $panel->{'templatedir'};
my $template;
#If platform is closed, the user cannot log in
if( $vhffs->get_config->get_panel_open == 0 )
{
- $template = new HTML::Template( filename => $templatedir."/main/close.tmpl" );
- $template->param( TITLE => gettext("Platform temporary closed") );
- $template->param( TEXT_CLOSE => gettext("Platform temporary closed.") );
- $template->param( TEXT_EXPLAIN => gettext("This platform is temporary closed. Administrators are performing some maintenances tasks. Please come back in a few minutes to log in.") );
- display_light Vhffs::Panel::Main( $vhffs , $template );
+ $template = new HTML::Template( filename => $templatedir."/main/close.tmpl" );
+ $template->param( TITLE => gettext("Platform temporary closed") );
+ $template->param( TEXT_CLOSE => gettext("Platform temporary closed.") );
+ $template->param( TEXT_EXPLAIN => gettext("This platform is temporary closed. Administrators are performing some maintenances tasks. Please come back in a few minutes to log in.") );
+ display_light Vhffs::Panel::Main( $panel , $template );
exit 0;
}
+
+#Incomplete input
if( ( ! defined( $username ) ) || ( ! defined ( $password ) ) || ( ! defined $user ) )
{
@@ -88,37 +86,34 @@
$template->param( TEXT_LOGINFAILED => gettext("Login failed !") );
$template->param( TEXT_LOGIN => gettext("Login") );
- display_light Vhffs::Panel::Main( $vhffs , $template );
+ display_light Vhffs::Panel::Main( $panel , $template );
+ exit 0;
}
-else
+
+#Validate password and user
+if( $user->check_password( $password ) && $user->get_status == Vhffs::Constants::ACTIVATED )
{
- $auth=1 if ( $user->check_password( $password ) && ( $user->get_status == Vhffs::Constants::ACTIVATED ) );
+ my $session = new CGI::Session("driver:File", undef, {Directory=>'/tmp'});
+ $session->expires("+1h");
+ $session->param("username", $user->get_username);
+ $session->param("uid", $user->get_uid);
- if( $auth == 1 )
- {
- my $session = new CGI::Session("driver:File", undef, {Directory=>'/tmp'});
- $session->expires("+1h");
- $session->param("username", $user->get_username);
- $session->param("uid", $user->get_uid);
+ my $sid = $session->id();
+ my $cookie = CGI->cookie(session => $sid);
- my $sid = $session->id();
- my $cookie = CGI->cookie(session => $sid);
-
- $template = new HTML::Template( filename => $templatedir."/main/login_ok.tmpl" );
- $template->param( TITLE => gettext("VHFFS Login OK") );
- $template->param( TEXT_PLEASEWAIT => gettext("Login OK, please wait...") );
- $template->param( TEXT_PANEL => gettext("Panel Access") );
+ $template = new HTML::Template( filename => $templatedir."/main/login_ok.tmpl" );
+ $template->param( TITLE => gettext("VHFFS Login OK") );
+ $template->param( TEXT_PLEASEWAIT => gettext("Login OK, please wait...") );
+ $template->param( TEXT_PANEL => gettext("Panel Access") );
- display_light Vhffs::Panel::Main( $vhffs , $template , $cookie);
- }
- else
- {
-
- $template = new HTML::Template( filename => $templatedir."/main/login_failed.tmpl" );
- $template->param( TITLE => gettext("VHFFS Login failed") );
- $template->param( TEXT_LOGINFAILED => gettext("Login failed !") );
- $template->param( TEXT_LOGIN => gettext("Login") );
-
- display_light Vhffs::Panel::Main( $vhffs , $template );
- }
+ display_light Vhffs::Panel::Main( $panel , $template , $cookie);
+ exit 0;
}
+
+
+$template = new HTML::Template( filename => $templatedir."/main/login_failed.tmpl" );
+$template->param( TITLE => gettext("VHFFS Login failed") );
+$template->param( TEXT_LOGINFAILED => gettext("Login failed !") );
+$template->param( TEXT_LOGIN => gettext("Login") );
+
+display_light Vhffs::Panel::Main( $panel , $template );
Modified: branches/vhffs_4.1/vhffs-panel/logout.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/logout.pl 2007-01-08 22:41:53 UTC (rev 392)
+++ branches/vhffs_4.1/vhffs-panel/logout.pl 2007-01-09 00:22:35 UTC (rev 393)
@@ -39,18 +39,16 @@
use strict;
use Vhffs::Panel::Main;
-# Init the Vhffs Main System
-my $vhffs = init Vhffs::Main;
-my $templatedir = $vhffs->get_config->get_templatedir;
+my $panel = new_light Vhffs::Panel::Main();
+my $vhffs = $panel->{'vhffs'};
+my $templatedir = $panel->{'templatedir'};
-Vhffs::Panel::Main::cookie_lang( $vhffs );
-
#clean session
my $sid = CGI->cookie("session");
-if($sid)
+if( $sid )
{
- my $session = new CGI::Session(undef, $sid, {Directory=>'/tmp'});
- $session->delete();
+ my $session = new CGI::Session(undef, $sid, {Directory=>'/tmp'});
+ $session->delete();
}
@@ -60,4 +58,4 @@
$template->param( TEXT_LOGOUT => gettext("You left your VHFFS session!") );
$template->param( TEXT_LOGIN => gettext("Access to panel") );
-display_light Vhffs::Panel::Main( $vhffs , $template );
+display_light Vhffs::Panel::Main( $panel , $template );
Modified: branches/vhffs_4.1/vhffs-panel/lost.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/lost.pl 2007-01-08 22:41:53 UTC (rev 392)
+++ branches/vhffs_4.1/vhffs-panel/lost.pl 2007-01-09 00:22:35 UTC (rev 393)
@@ -40,14 +40,12 @@
use Vhffs::Panel::Main;
-# Init the Vhffs Main System
-my $vhffs = init Vhffs::Main;
-my $templatedir = $vhffs->get_config->get_templatedir;
+my $panel = new_light Vhffs::Panel::Main();
+my $vhffs = $panel->{'vhffs'};
+my $templatedir = $panel->{'templatedir'};
-my $cgi = new CGI;
+my $cgi = $panel->{'cgi'};
-my $cookie = Vhffs::Panel::Main::cookie_lang( $vhffs );
-
my $tmpl = new HTML::Template( filename => $templatedir."/main/lost.tmpl", associate => $cgi );
#$tmpl->param( TITLE => gettext("VHFFS Password Lost") );
@@ -57,4 +55,4 @@
$tmpl->param( TEXT_BUTTON => gettext("Give me a new password") );
$tmpl->param( TEXT_BACK => gettext("Back to login page") );
-display_light Vhffs::Panel::Main( $vhffs , $tmpl );
+display_light Vhffs::Panel::Main( $panel , $tmpl );
Modified: branches/vhffs_4.1/vhffs-panel/lost_ack.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/lost_ack.pl 2007-01-08 22:41:53 UTC (rev 392)
+++ branches/vhffs_4.1/vhffs-panel/lost_ack.pl 2007-01-09 00:22:35 UTC (rev 393)
@@ -42,15 +42,13 @@
use Vhffs::Main;
use Vhffs::Panel::Main;
+my $panel = new_light Vhffs::Panel::Main();
+my $vhffs = $panel->{'vhffs'};
+my $templatedir = $panel->{'templatedir'};
-# Init the Vhffs Main System
-my $vhffs = init Vhffs::Main;
-my $templatedir = $vhffs->get_config->get_templatedir;
-my $cookie = Vhffs::Panel::Main::cookie_lang( $vhffs );
-
# recuperation des donnees des champs du form de login
-my $cgi = new CGI;
+my $cgi = $panel->{'cgi'};
my $username = $cgi->param("username");
my $user = Vhffs::User::get_by_username( $vhffs, $username );
my $template;
@@ -70,7 +68,7 @@
$template->param( TEXT_WAITPASS => sprintf( gettext("Please wait %s, a new password will be sent to you in a few minutes..."), $username ) );
$template->param( TEXT_LOGIN => gettext("Login") );
- display_light Vhffs::Panel::Main( $vhffs , $template );
+ display_light Vhffs::Panel::Main( $panel , $template );
}
else
{
@@ -81,5 +79,5 @@
$template->param( TEXT_FAILED => gettext("Password recovery failed!") );
$template->param( TEXT_LOGIN => gettext("Login") );
- display_light Vhffs::Panel::Main( $vhffs , $template );
+ display_light Vhffs::Panel::Main( $panel , $template );
}
Modified: branches/vhffs_4.1/vhffs-panel/panel.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/panel.pl 2007-01-08 22:41:53 UTC (rev 392)
+++ branches/vhffs_4.1/vhffs-panel/panel.pl 2007-01-09 00:22:35 UTC (rev 393)
@@ -73,13 +73,13 @@
{
$user = undef;
$user = $user_bis;
- $session->clear("username");
- $session->clear("uid");
- $session->param("username", $user_bis->get_username);
- $session->param("uid", $user_bis->get_uid);
+ $session->clear("username");
+ $session->clear("uid");
+ $session->param("username", $user_bis->get_username);
+ $session->param("uid", $user_bis->get_uid);
$session->flush();
$panel = new Vhffs::Panel::Main();
- $message = gettext( sprintf( "Su successfull with name %s " , $su_user) );
+ $message = gettext( sprintf( "Su successful with name %s " , $su_user) );
}
else
{
@@ -112,4 +112,3 @@
}
display Vhffs::Panel::Main($panel, $template->output);
-
Modified: branches/vhffs_4.1/vhffs-panel/subscribe.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/subscribe.pl 2007-01-08 22:41:53 UTC (rev 392)
+++ branches/vhffs_4.1/vhffs-panel/subscribe.pl 2007-01-09 00:22:35 UTC (rev 393)
@@ -51,19 +51,14 @@
use Vhffs::Panel::Main;
use Vhffs::Panel::Confirmation;
-#Get some basics informations with CGI
+my $panel = new_light Vhffs::Panel::Main();
+my $vhffs = $panel->{'vhffs'};
+my $templatedir = $panel->{'templatedir'};
+my $cgi = $panel->{'cgi'};
my $uid;
-my $cgi = new CGI;
-
-#Init the Vhffs Main System
-my $vhffs = init Vhffs::Main;
-my $templatedir = $vhffs->get_config->get_templatedir;
-
Vhffs::Panel::Main::check( $vhffs );
-Vhffs::Panel::Main::cookie_lang( $vhffs );
-
my $submitted = $cgi->param( "CREATE_SUBMIT" );
my $mail = $cgi->param( "MAIL" );
my $username = $cgi->param( "USERNAME" );
@@ -222,4 +217,4 @@
}
$template->param( TITLE => gettext("Subscribe") );
-display_light Vhffs::Panel::Main( $vhffs , $template );
+display_light Vhffs::Panel::Main( $panel , $template );
Modified: branches/vhffs_4.1/vhffs-panel/user/prefs_save.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/user/prefs_save.pl 2007-01-08 22:41:53 UTC (rev 392)
+++ branches/vhffs_4.1/vhffs-panel/user/prefs_save.pl 2007-01-09 00:22:35 UTC (rev 393)
@@ -77,10 +77,10 @@
# We set informations user fill in the form
-my $cookie = CGI->cookie(theme => $theme);
+$panel->{'themecookie'} = CGI->cookie( -name=>"theme", -value=>$theme, -expires=>'+10y' );
Vhffs::Panel::User::set_theme( $user, $theme );
-my $cookie2 = CGI->cookie(language => $lang);
+$panel->{'langcookie'} = CGI->cookie( -name=>"language", -value=>$lang, -expires=>'+10y' );
Vhffs::Panel::User::set_lang( $user, $lang );
@@ -287,4 +287,4 @@
$template->param( MESSAGE => $message );
set_refresh_url Vhffs::Panel::Main($panel, "/user/prefs.pl", 0);
-display Vhffs::Panel::Main($panel, $template->output, $cookie, $cookie2);
+display Vhffs::Panel::Main($panel, $template->output);