[vhffs-dev] [381] Removed every $user-> fetch since any defined user is now a complete user |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 381
Author: beuss
Date: 2006-12-21 07:39:52 +0000 (Thu, 21 Dec 2006)
Log Message:
-----------
Removed every $user->fetch since any defined user is now a complete user
Reworked vhffs-jabber/vhffspipe to manually check for connection lost, as a consequence Vhffs::Main now has a reconnect method.
Modified Paths:
--------------
branches/vhffs_4.1/Makefile
branches/vhffs_4.1/vhffs-api/src/Vhffs/Functions.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Main.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Cvs.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/DNS.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Group.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/LargeFile.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mail.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mailinglist.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mysql.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Pgsql.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Repository.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Svn.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/User.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Web.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/Group.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/Mailing.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/User.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/MailUser.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm
branches/vhffs_4.1/vhffs-jabber/vhffspipe.pl
branches/vhffs_4.1/vhffs-panel/dns/dns_type_submit.pl
branches/vhffs_4.1/vhffs-panel/subscribe.pl
branches/vhffs_4.1/vhffs-robots/src/cvs_fixperms.pl
branches/vhffs_4.1/vhffs-robots/src/delete_users.pl
branches/vhffs_4.1/vhffs-robots/src/fix_quota.pl
branches/vhffs_4.1/vhffs-robots/src/fix_quota_repository.pl
branches/vhffs_4.1/vhffs-robots/src/mailing.pl
branches/vhffs_4.1/vhffs-robots/src/refused_cvs.pl
branches/vhffs_4.1/vhffs-robots/src/refused_dns.pl
branches/vhffs_4.1/vhffs-robots/src/refused_groups.pl
branches/vhffs_4.1/vhffs-robots/src/refused_largefile.pl
branches/vhffs_4.1/vhffs-robots/src/refused_mail.pl
branches/vhffs_4.1/vhffs-robots/src/refused_ml.pl
branches/vhffs_4.1/vhffs-robots/src/refused_mysql.pl
branches/vhffs_4.1/vhffs-robots/src/refused_postgres.pl
branches/vhffs_4.1/vhffs-robots/src/refused_repository.pl
branches/vhffs_4.1/vhffs-robots/src/refused_svn.pl
branches/vhffs_4.1/vhffs-robots/src/refused_web.pl
Added Paths:
-----------
branches/vhffs_4.1/vhffs-panel/js/
branches/vhffs_4.1/vhffs-tools/mans/vhffs-makeadmin.1
Modified: branches/vhffs_4.1/Makefile
===================================================================
--- branches/vhffs_4.1/Makefile 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/Makefile 2006-12-21 07:39:52 UTC (rev 381)
@@ -235,6 +235,7 @@
install -d -m 755 $(PANELDIR)/dns
install -d -m 755 $(PANELDIR)/group
install -d -m 755 $(PANELDIR)/help
+ install -d -m 755 $(PANELDIR)/js
install -d -m 755 $(PANELDIR)/largefile
install -d -m 755 $(PANELDIR)/repository
install -d -m 755 $(PANELDIR)/mail
@@ -269,6 +270,7 @@
install -m 755 vhffs-panel/cvs/*.pl $(PANELDIR)/cvs/
install -m 755 vhffs-panel/dns/*.pl $(PANELDIR)/dns/
install -m 755 vhffs-panel/group/*.pl $(PANELDIR)/group/
+ install -m 755 vhffs-panel/js/*.js $(PANELDIR)/js/
install -m 755 vhffs-panel/help/*.html $(PANELDIR)/help/
install -m 755 vhffs-panel/largefile/*.pl $(PANELDIR)/largefile/
install -m 755 vhffs-panel/repository/*.pl $(PANELDIR)/repository/
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Functions.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Functions.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -417,7 +417,7 @@
$file = Vhffs::Constants::MAILS_DIR . "/" . $template;
- return( -1 ) if( $user->fetch != 1 );
+ return( -1 ) if( ! defined $user );
return( -1 ) if( ! -f $file );
return( -1 ) if( ! -r $file );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -527,7 +527,7 @@
{
my( $self , $user ) = @_;
- return -1 if( $user->fetch < 0 );
+ return -1 if( ! defined $user );
my $query = 'INSERT INTO vhffs_user_group( uid, gid, state) VALUES( ?, ?, ? )';
my $request = $self->{'db'}->prepare( $query ) or return -2;
@@ -716,7 +716,7 @@
my $state = shift;
my $user = shift;
my $name;
- return undef if( $user->fetch < 0 );
+ return undef if( ! defined $user );
my $db = $vhffs->get_db_object;
my @result;
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Main.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Main.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Main.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -35,7 +35,6 @@
use strict;
use DBI;
use Vhffs::Functions;
-use Vhffs::DB;
use Vhffs::Conf;
use constant
@@ -112,10 +111,21 @@
sub is_valid
{
- my $self = shift;
- return 0 if( ! ( defined( $self->get_db_object ) ) );
+ my $self = shift;
+ return (defined $self->{db} && $self->{db}->ping() > 0);
+}
- return 1;
+sub reconnect {
+ my $self = shift;
+
+ $db_config = $self->{config}->get_database();
+
+ $dbh = Vhffs::Functions::db_connect $db_config;
+ if(defined $dbh) {
+ $self->{'db'} = $dbh;
+ } else {
+ warn "Unable to open database connection\n";
+ }
}
1;
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Cvs.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Cvs.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Cvs.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -87,7 +87,7 @@
{
my( $main , $cvsroot , $user , $group ) = @_;
- return -1 if( $user->fetch < 0 );
+ return -1 if( ! defined $user );
return -2 if( $group->fetch < 0 );
my $cvs = new Vhffs::Services::Cvs( $main , $cvsroot , $user , $group );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/DNS.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/DNS.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/DNS.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -87,7 +87,7 @@
sub create_dns
{
my ( $main , $dns_name , $user , $group ) = @_;
- return undef if( $user->fetch < 0 );
+ return undef if( ! defined $user );
return undef if( $group->fetch < 0 );
my $dns = new Vhffs::Services::DNS( $main , $dns_name , $user , $group );
@@ -109,7 +109,7 @@
{
my ( $user , $main ) = @_ ;
- return undef if ( $user->fetch < 0 );
+ return undef if ( ! defined $user );
my $query = "SELECT ns.domain, ns.object_id FROM vhffs_dns_global ns, vhffs_acl acl ,vhffs_users WHERE vhffs_users.object_id=acl.oid_src AND acl.oid_dst=ns.object_id AND vhffs_users.username='".$user->{'username'}."'";
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Group.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Group.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Group.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -97,7 +97,7 @@
{
my ( $user , $main ) = @_;
- return undef if ( $user->fetch < 0 );
+ return undef if ( ! defined $user );
my $query = "SELECT g.groupname , g.object_id, o.state FROM vhffs_groups g, vhffs_user_group ug , vhffs_object o WHERE o.object_id=g.object_id AND ug.gid=g.gid AND ug.uid='".$user->{'uid'}."'";
@@ -132,8 +132,6 @@
{
my( $groupname , $user , $main, $description ) = @_;
- #return undef if( $user->fetch < 0);
-
#my $group = new Vhffs::Group( $main , $groupname , $user->get_uid) ;
#return -1 if( ! defined $group );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/LargeFile.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/LargeFile.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/LargeFile.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -111,7 +111,7 @@
my $user = shift;
my $group = shift;
- return -1 if( $user->fetch < 0 );
+ return -1 if( ! defined $user );
return -2 if( $group->fetch < 0 );
my $file = new Vhffs::Services::LargeFile( $vhffs , $filename , $user , $group );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mail.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mail.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mail.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -113,7 +113,7 @@
{
my( $main , $domain , $user , $group ) = @_;
- return -1 if( $user->fetch < 0 );
+ return -1 if( ! defined $user );
return -2 if( $group->fetch < 0 );
my $mail = new Vhffs::Services::Mail( $main , $domain , $user , $group );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mailinglist.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mailinglist.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mailinglist.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -94,7 +94,7 @@
my $user = shift;
my $group = shift;
- return -5 if( $user->fetch < 0 );
+ return -5 if( ! defined $user );
return -5 if( $group->fetch < 0 );
my $list = new Vhffs::Services::Mailing( $main , $lpart , $domain );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Main.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -148,7 +148,7 @@
{
#Try to verify if the user exist and is allowed to browse panel
#Then, set some preferences
- unless( defined($user = Vhffs::User::get_by_uid($vhffs, $uid)) ) {
+ if( ! defined($user = Vhffs::User::get_by_uid($vhffs, $uid)) ) {
$bad_news = gettext("User does not exist");
} elsif( $user->get_status != Vhffs::Constants::ACTIVATED ) {
$bad_news = gettext("You're are not allowed to browse panel");
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mysql.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mysql.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mysql.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -86,7 +86,7 @@
{
my( $main , $dbname , $user , $group , $dbuser, $dbpass ) = @_;
- return -1 if( $user->fetch < 0 );
+ return -1 if( ! defined $user );
return -2 if( $group->fetch < 0 );
my $mysql = new Vhffs::Services::Mysql( $main , $dbname , $user , $group );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Pgsql.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Pgsql.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Pgsql.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -152,7 +152,7 @@
{
my( $main , $dbname , $user , $group , $dbuser , $dbpass ) = @_;
- return -1 if( $user->fetch < 0 );
+ return -1 if( ! defined $user );
return -2 if( $group->fetch < 0 );
my $pgsql = new Vhffs::Services::Postgres( $main , $dbname , $user , $group );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Repository.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Repository.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Repository.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -87,7 +87,7 @@
{
my( $main , $name , $user , $group ) = @_;
- return -1 if( $user->fetch < 0 );
+ return -1 if( ! defined $user );
return -2 if( $group->fetch < 0 );
my $repo = new Vhffs::Services::Repository( $main , $name , $user , $group );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Svn.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Svn.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Svn.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -112,7 +112,7 @@
my $group = shift;
- return -1 if( $user->fetch < 0 );
+ return -1 if( ! defined $user );
return -2 if( $group->fetch < 0 );
my $svn = new Vhffs::Services::Svn( $main , $repo , $user , $group );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/User.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/User.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/User.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -94,8 +94,6 @@
return -1 if ( ( ! defined $user ) || ( ! defined $lang ) );
- return -2 if( $user->fetch < 0 );
-
my $uid = $user->get_uid;
my $query = "SELECT * FROM vhffs_panel_user_prefs WHERE uid='".$uid."'";
@@ -122,8 +120,6 @@
return -1 if ( ( ! defined $user ) || ( ! defined $theme ) );
- return -2 if( $user->fetch < 0 );
-
my $uid = $user->get_uid;
my $query = "SELECT * FROM vhffs_panel_user_prefs WHERE uid='".$uid."'";
@@ -147,8 +143,6 @@
my $user = shift;
return -1 if( ! defined $user );
- return -2 if( $user->fetch < 0 );
-
my $uid = $user->get_uid;
my $query = "SELECT language FROM vhffs_panel_user_prefs WHERE uid='".$uid."'";
@@ -173,8 +167,6 @@
my $user = shift;
return -1 if( ! defined $user );
- return -2 if( $user->fetch < 0 );
-
my $uid = $user->get_uid;
my $query = "SELECT theme FROM vhffs_panel_user_prefs WHERE uid='".$uid."'";
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Web.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Web.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Web.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -101,7 +101,7 @@
{
my( $main , $servername , $user , $group ) = @_;
- return -1 if( $user->fetch < 0 );
+ return -1 if( !defined $user );
return -2 if( $group->fetch < 0 );
my $web = new Vhffs::Services::Httpd( $main , $servername , $user , $group );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/Group.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/Group.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/Group.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -162,7 +162,7 @@
my $group = shift;
my $main = shift;
- return -1 if( $user->fetch < 0);
+ return -1 if( ! defined $user );
return -2 if( $group->fetch < 0);
my $path = $user->get_home . "/" . $group->get_groupname;
@@ -183,7 +183,7 @@
my $group = shift;
my $main = shift;
- return -1 if( $user->fetch < 0);
+ return -1 if( ! defined $user );
return -1 if( $group->fetch < 0);
my $path = $user->get_home . "/" . $group->get_groupname;
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/Mailing.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/Mailing.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/Mailing.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -46,54 +46,5 @@
return( $request->fetchall_hashref('id_mailing') );
}
-#sub get_all_home_to_create
-#{
-# my( $main ) = @_;
-#
-# my $query = "SELECT u.username,u.uid,u.homedir FROM vhffs_users u, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND u.object_id = o.object_id";
-#
-# $request = $main->{'db'}->prepare( $query ) or return -2;
-# return undef if ( $request->execute() <= 0 );
-#
-# return( $request->fetchall_hashref('username') );
-#
-#}
-#
-#sub create_home
-#{
-# my( $main , $username , $user , $homedir , @subdirs , $path , $value );
-#
-# ( $main , $username ) = @_;
-#
-# $user = new Vhffs::User( $main , $username , '401');
-#
-# if( $user->fetch > 0 )
-# {
-# $user->add_history( "Ok, robots take now the creation of the user" );
-# $homedir = $user->get_home;
-#
-# @subdirs = split( /\// , $homedir );
-# @subdirs = reverse @subdirs;
-#
-# $path = "";
-#
-# while( defined ( $value = pop ( @subdirs ) ) )
-# {
-# $path .= "/".$value if( $value ne '' );
-# Vhffs::Functions::create_dir( $path );
-# #return -1 if( mkdir( $path ) == false );
-# }
-# chown $user->get_uid , $user->get_gid , $path ;
-#
-# $user->add_history( "Creation complete for user. Homedir is now created." );
-# $user->set_status( Vhffs::Constants::ACTIVATED );
-# $user->generate_password( 1 );
-# $user->commit;
-# }
-#
-# return 1;
-#}
-
-
1;
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/User.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/User.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/User.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -63,7 +63,7 @@
sub create
{
my $user = shift;
- return if( $user->fetch < 0);
+ return if( ! defined $user );
create_home( $user->{'main'} , $user->get_username );
}
@@ -72,7 +72,7 @@
{
my $vhffs = shift;
my $user = shift;
- return if( $user->fetch < 0 );
+ return if( ! defined $user );
delete_home( $vhffs , $user );
}
@@ -85,7 +85,7 @@
$main = shift;
$user = shift;
- if( $user->fetch > 0 )
+ if( defined $user )
{
$user->add_history( "Ok, robots take now the creation of the user" );
$homedir = $user->get_home;
@@ -121,7 +121,7 @@
$main = shift;
$user = shift;
- if( $user->fetch > 0 )
+ if( defined $user )
{
$user->add_history( "Ok, robots take now the creation of the user" );
$homedir = $user->get_home;
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -59,7 +59,6 @@
$this = {};
- #return undef if( $user->fetch < 0);
$this = $class->SUPER::new( $main , 1 , '401' );
return undef if( ! ($servername =~ /^[a-z0-9](([a-z0-9]\-{0,1})+\.)+[a-z]{2,4}$/ ) );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -60,7 +60,6 @@
#If the domain is not specified by argument, return an undef instance
return undef if ( ! defined $domain );
- #return undef if( $user->fetch < 0);
$this = $class->SUPER::new( $main , 1 , '401' );
return undef if( ! ( $domain =~ /^[a-zA-Z0-9\-\.]+$/) );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/MailUser.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/MailUser.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/MailUser.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -76,7 +76,7 @@
return -1 if( ! defined $config );
return -1 if( ( ! defined $config->{activate} ) || ( $config->{activate} ne "yes" ) );
- if( $user->fetch < 0 )
+ if( ! defined $user )
{
return -1;
}
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -69,7 +69,6 @@
return undef if ( ! defined $domain );
return undef if ( ! defined $local );
- #return undef if( $user->fetch < 0);
$this = $class->SUPER::new( $main , 1 , '401' );
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm 2006-12-21 07:39:52 UTC (rev 381)
@@ -979,8 +979,8 @@
use Vhffs::Main;
$vhffs = init Vhffs::Main;
- $user = new Vhffs::User( $vhffs , "myuser" , 401 );
- if( $user->fetch > 0 )
+ $user = Vhffs::User::get_by_username( $vhffs , "myuser" );
+ if( defined $user )
{
print "User exists\n";
}
Modified: branches/vhffs_4.1/vhffs-jabber/vhffspipe.pl
===================================================================
--- branches/vhffs_4.1/vhffs-jabber/vhffspipe.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-jabber/vhffspipe.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -40,19 +40,11 @@
$vhffs = init Vhffs::Main if ( ! defined $vhffs );
return undef if ( ! defined $vhffs );
+ # DB connection lost !
+ $vhffs->reconnect() if( !$vhffs->is_valid() );
my $user = Vhffs::User::get_by_username( $vhffs , $username );
- return undef if( ! defined $user );
+ return undef unless( defined $user );
- my $ret = $user->fetch;
-
- # connection lost to database
- if( $ret == -2 ) {
- undef $vhffs;
- $vhffs = init Vhffs::Main;
- $ret = $user->fetch if ( defined $vhffs );
- }
- undef $user if( $ret < 0 );
-
undef $user if( $user->have_activegroups <= 0 );
return $user;
Modified: branches/vhffs_4.1/vhffs-panel/dns/dns_type_submit.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/dns_type_submit.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-panel/dns/dns_type_submit.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -62,7 +62,7 @@
my $prefix = $cgi->param("PREFIX");
my $ip = $cgi->param("IP");
-my question = $cgi->param("QUESTION");
+my $question = $cgi->param("QUESTION");
my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name );
my $templatedir = $vhffs->get_config->get_templatedir;
@@ -83,13 +83,13 @@
if( $dns->add_a( $prefix , $ip ) < 0 )
{
- $message = "Error while create a type $retour";
+ $message = "Error while create a type A";
}
else
{
if( $dns->commit < 0)
{
- $message = "Error while update object $retour";
+ $message = "Error while update object";
}
else
{
Modified: branches/vhffs_4.1/vhffs-panel/subscribe.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/subscribe.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-panel/subscribe.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -40,6 +40,7 @@
use POSIX qw(locale_h);
use CGI;
use locale;
+use strict;
use Locale::gettext;
use HTML::Template;
@@ -51,40 +52,31 @@
use Vhffs::Panel::Confirmation;
#Get some basics informations with CGI
-my $cgi;
my $uid;
-my $good_news;
-my $vhffs;
-my $templatedir;
-my $cid;
-my $realcode;
-my $code;
-$cgi = new CGI;
+my $cgi = new CGI;
-#Initialize vars
-$good_news = "";
-
#Init the Vhffs Main System
-$vhffs = init Vhffs::Main;
-$templatedir = $vhffs->get_config->get_templatedir;
+my $vhffs = init Vhffs::Main;
+my $templatedir = $vhffs->get_config->get_templatedir;
Vhffs::Panel::Main::check( $vhffs );
Vhffs::Panel::Main::cookie_lang( $vhffs );
-$submitted = $cgi->param( "CREATE_SUBMIT" );
-$mail = $cgi->param( "MAIL" );
-$username = $cgi->param( "USERNAME" );
-$firstname = $cgi->param( "FIRSTNAME");
-$lastname = $cgi->param( "LASTNAME" );
-$city = $cgi->param("CITY");
-$zipcode = $cgi->param("ZIPCODE");
-$country = $cgi->param("COUNTRY");
-$address = $cgi->param("ADDRESS");
-$cid = $cgi->param("CID");
-$code = $cgi->param("CONFIRMATION");
-$realcode = Vhffs::Panel::Confirmation::get_code( $vhffs , $cid );
+my $submitted = $cgi->param( "CREATE_SUBMIT" );
+my $mail = $cgi->param( "MAIL" );
+my $username = $cgi->param( "USERNAME" );
+my $firstname = $cgi->param( "FIRSTNAME");
+my $lastname = $cgi->param( "LASTNAME" );
+my $city = $cgi->param("CITY");
+my $zipcode = $cgi->param("ZIPCODE");
+my $country = $cgi->param("COUNTRY");
+my $address = $cgi->param("ADDRESS");
+my $cid = $cgi->param("CID");
+my $code = $cgi->param("CONFIRMATION");
+my $realcode = Vhffs::Panel::Confirmation::get_code( $vhffs , $cid );
+my @errors = ();
my $template;
my $message;
@@ -96,7 +88,6 @@
$template->param( MESSAGE => gettext("You cannot subscribe to VHFFS") );
} elsif( defined $submitted ) {
# don't check if form hasn't been submitted
- @errors = ();
if( ( ! defined $cid ) || ( ! defined $code ) || ( $code ne $realcode ) )
{
push(@errors, {error => gettext("Codes do not match")});
@@ -162,7 +153,7 @@
{
my $retour;
my $user = Vhffs::User::create( $vhffs, $username, &Vhffs::Functions::generate_random_password(),
- 0, $mail, $firstnam, $lastname, $city, $zipcode, $country, $address);
+ 0, $mail, $firstname, $lastname, $city, $zipcode, $country, $address);
if(! defined $user )
{
@@ -170,19 +161,8 @@
}
else
{
- #Get user information
- $user->fetch;
-
#We set informations user fill in the form
- $user->set_mail( $mail );
- $user->set_firstname( $firstname );
- $user->set_lastname( $lastname );
- $user->set_city( $city );
- $user->set_zipcode( $zipcode );
- $user->set_country( $country );
- $user->set_address( $address );
$user->set_status( Vhffs::Constants::WAITING_FOR_CREATION );
- $user->set_password( Vhffs::Functions::generate_random_password );
#Commit all the changes for the current user
if( ( $retour = $user->commit ) < 0 )
@@ -191,8 +171,8 @@
}
else
{
- $good_news = gettext("User Successfully created");
- $good_news2 = gettext("Please wait while we are creating the account, it will take some minutes");
+ my $good_news = gettext("User Successfully created");
+ my $good_news2 = gettext("Please wait while we are creating the account, it will take some minutes");
$template = new HTML::Template( filename => $templatedir."/user/create_complete.tmpl" );
$template->param( TEXT_BACK => gettext("Back to Login") );
$template->param( GOOD_NEWS => $good_news );
@@ -218,8 +198,8 @@
$template = new HTML::Template( filename => $templatedir."/user/create.tmpl" );
}
-if( ( ! defined $submitted ) || ( ( defined @errors) && ( (scalar @errors) != 0 ) ) ) {
- $confirmation = Vhffs::Panel::Confirmation::create_code( $vhffs );
+if( ( ! defined $submitted ) || (scalar @errors) != 0 ) {
+ my $confirmation = Vhffs::Panel::Confirmation::create_code( $vhffs );
# $template is defined in every cases
Modified: branches/vhffs_4.1/vhffs-robots/src/cvs_fixperms.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/cvs_fixperms.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/cvs_fixperms.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -68,7 +68,7 @@
$user = $cvs->get_user;
$group = $cvs->get_group;
#First, update uid and gid informations on files
- if( ( $user->fetch > 0 ) && ( $group->fetch > 0 ) )
+ if( ( defined $user ) && ( $group->fetch > 0 ) )
{
Vhffs::Functions::change_owner_recur( $cvs->get_dir , $user->get_uid , $group->get_gid );
}
Modified: branches/vhffs_4.1/vhffs-robots/src/delete_users.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/delete_users.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/delete_users.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -47,7 +47,7 @@
foreach $user ( @{$lol} )
{
$ok = 1;
- if( ( defined $user ) && ( $user->fetch > 0 ))
+ if( defined $user )
{
$groups = $user->get_groups;
Modified: branches/vhffs_4.1/vhffs-robots/src/fix_quota.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/fix_quota.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/fix_quota.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -74,7 +74,7 @@
foreach $user ( @{$users} )
{
- if( $user->fetch > 0 )
+ if( defined $user )
{
$blocks = 1024;
$inodes = 1126400 / 100;
Modified: branches/vhffs_4.1/vhffs-robots/src/fix_quota_repository.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/fix_quota_repository.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/fix_quota_repository.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -102,7 +102,7 @@
foreach $user ( @{$users} )
{
- if( $user->fetch > 0 )
+ if( defined $user )
{
# give no space for all primary groups of users
if( Quota::setqlim($dev, $user->get_gid, 1, 1, 1, 1, 0, 1) )
Modified: branches/vhffs_4.1/vhffs-robots/src/mailing.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/mailing.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/mailing.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -98,7 +98,6 @@
foreach $user ( @{$users} )
{
next if( ! defined( $user ) );
- next if( $user->fetch < 0 );
Vhffs::Functions::send_mail( $from , $user->get_mail , $subject , $message , $vhffs );
}
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_cvs.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_cvs.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_cvs.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -65,7 +65,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your CVS request : %s ") , $object->get_cvsroot);
$message .= gettext("has been refused by the Moderators team")."\n";
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_dns.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_dns.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_dns.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -64,7 +64,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your DNS hosting request for the domain : %s ") , $object->get_domain );
$message .= gettext("has been refused by the Moderators team")."\n";
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_groups.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_groups.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_groups.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -64,7 +64,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your Group request : %s ") , $object->get_groupname);
$message .= gettext("has been refused by the Moderators team")."\n";
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_largefile.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_largefile.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_largefile.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -66,7 +66,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your file hosting request for the file : %s\n") , $object->get_filename);
$message .= gettext("has been refused by the Moderators team")."\n";
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_mail.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_mail.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_mail.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -64,7 +64,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your Mail hosting request for the domain: %s ") , $object->get_domain);
$message .= gettext("has been refused by the Moderators team")."\n";
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_ml.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_ml.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_ml.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -64,7 +64,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your Mailing-list request : %s ") , $object->get_listname);
$message .= gettext("has been refused by the Moderators team")."\n";
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_mysql.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_mysql.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_mysql.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -35,7 +35,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your MySQL database request : %s ") , $object->get_dbname );
$message .= gettext("has been refused by the Moderators team")."\n";
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_postgres.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_postgres.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_postgres.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -64,7 +64,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your PostgreSQL database request : %s ") , $object->get_dbname );
$message .= gettext("has been refused by the Moderators team")."\n";
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_repository.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_repository.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_repository.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -65,7 +65,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your Download repository request : %s ") , $object->get_name);
$message .= gettext("has been refused by the Moderators team")."\n";
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_svn.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_svn.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_svn.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -35,7 +35,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your Subversion repository request : %s") , $object->get_reponame);
$message .= gettext("has been refused by the Moderators team")."\n";
Modified: branches/vhffs_4.1/vhffs-robots/src/refused_web.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_web.pl 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_web.pl 2006-12-21 07:39:52 UTC (rev 381)
@@ -64,7 +64,7 @@
$user = $object->get_user;
$lang = Vhffs::Panel::User::get_lang( $user );
setlocale( LC_ALL , $lang ) if( defined $lang );
- if( $user->fetch > 0 )
+ if( defined $user )
{
$message = sprintf( gettext("Your web hosting request for the servername : %s ") , $object->get_servername);
$message .= gettext("has been refused by the Moderators team")."\n";
Added: branches/vhffs_4.1/vhffs-tools/mans/vhffs-makeadmin.1
===================================================================
--- branches/vhffs_4.1/vhffs-tools/mans/vhffs-makeadmin.1 2006-12-19 22:35:48 UTC (rev 380)
+++ branches/vhffs_4.1/vhffs-tools/mans/vhffs-makeadmin.1 2006-12-21 07:39:52 UTC (rev 381)
@@ -0,0 +1,14 @@
+.TH VHFFS\-MAKEADMIN 1
+.SH NAME
+vhffs\-userinfo \- Give VHFFS admin status to the specified user
+.SH SYNOPSIS
+.B vhffs\-makeadmin [username]
+.SH "DESCRIPTION"
+.B vhffs\-userinfo
+give admin status to the user given in parameter. If the user does not exists, die with an error message.
+.SH "SEE ALSO"
+http://www.vhffs.org
+.SH AUTHOR
+vhffs-userinfo was written by Sebastien Le Ray <beuss@xxxxxxxxxxxxx>
+
+