[vhffs-dev] [svn] commit: r281 - in /trunk: vhffs-api/src/Vhffs/Services/Mail.pm vhffs-panel/user/prefs_save.pl

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


Author: gradator
Date: Sun Nov  5 05:05:48 2006
New Revision: 281

Log:
Fixing a _BIG_ bug in the Mail API which created a hash entry "changed" in the mail object, so the commit fonction created a popbox or alias named "changed" in all mails objects. Modified a bit the output of prefs_save in the meanwhile.


Modified:
    trunk/vhffs-api/src/Vhffs/Services/Mail.pm
    trunk/vhffs-panel/user/prefs_save.pl

Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm Sun Nov  5 05:05:48 2006
@@ -243,7 +243,7 @@
 	#COMMIT THE BOX PART
 	foreach $name ( keys %{$self->{'boxes'}} )
 	{
-		next if( ( defined $self->{'boxes'}{'changed'}{'changed'} ) && ( $self->{'boxes'}{'changed'}{'changed'} == 0 ) );
+		next if( ( defined $self->{'boxes'}{'changed'} ) && ( $self->{'boxes'}{'changed'} == 0 ) );
 		
     	$request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_boxes WHERE domain='" . $self->{'domain'} . "' AND local_part='".$name."'");
 	    $rows = $request->execute;
@@ -277,7 +277,7 @@
 	#COMMIT THE FORWARD PART
 	foreach $name ( keys %{$self->{'forward'}} )
 	{
-		next if( ( defined $self->{'forward'}{'changed'}{'changed'} ) && ( $self->{'forward'}{'changed'}{'changed'} == 0 ) );
+		next if( ( defined $self->{'forward'}{'changed'} ) && ( $self->{'forward'}{'changed'} == 0 ) );
 #		next if( ! defined $self->{'forward'}{$name}{'remote'} );
     	$request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_forward WHERE domain='" . $self->{'domain'} . "' AND local_part='".$name."'");
 	    $rows = $request->execute;

Modified: trunk/vhffs-panel/user/prefs_save.pl
==============================================================================
--- trunk/vhffs-panel/user/prefs_save.pl (original)
+++ trunk/vhffs-panel/user/prefs_save.pl Sun Nov  5 05:05:48 2006
@@ -89,7 +89,7 @@
 {
 	$message = gettext( "CGI Error!" );
 }
-elsif( ! ( $zipcode =~ /^[\d]+$/ ) )
+elsif( ! ( $zipcode =~ /^[\w\d\s\-]+$/ ) )
 {
 	$message = gettext( "Zipcode is not correct !" );
 }
@@ -161,7 +161,6 @@
 			$novirus = 0;
 		}
 
-		
 		if( ( defined $mail_activate ) && ( $mail_activate eq "on" ) )
 		{
 			my $usage = $cgi->param( "mail_usage" );
@@ -193,7 +192,7 @@
 					}
 					else
 					{
-						$message .= "<br>";
+						$message .= "<br/>";
 						$message .= gettext("Mailbox successfully added");
 					}
 				}
@@ -206,57 +205,38 @@
 						$mu->addbox( $pass1 );
 					}
 
-					#We change  the spam status. if the spam status change
+					# We change the spam status. if the spam status changed
 					if( $vhffs->get_config->use_nospam == 1 )
 					{
-						if( ( $nospam == 1 ) && ( $mu->use_nospam == 0 ) )
+						if( $nospam != $mu->use_nospam )
 						{
 							if( $mu->change_spam_status == 1 )
 							{
 								$message .= gettext( "Change spam protection status for your account\n" );
+								$message .= "<br/>";
 							}
 							else
 							{
 								$message .= gettext( "Error for spam protection\n" );
-							}
-						}
-						if( ( $nospam == 0 ) && ( $mu->use_nospam == 1 ) )
-						{
-							if( $mu->change_spam_status == 1 )
-							{
-								$message .= gettext( "Change spam protection status for your account\n" );
+								$message .= "<br/>";
+							}
+						}
+					}
+
+					# As spam, the virus status changes only if the user changed values
+					if( $vhffs->get_config->use_novirus == 1 )
+					{
+						if( $novirus != $mu->use_novirus )
+						{
+							if( $mu->change_virus_status == 1 )
+							{
+								$message .= gettext( "Change anti-virus status for your account\n" );
+								$message .= "<br/>";
 							}
 							else
 							{
-								$message .= gettext( "Error for spam protection\n" );
-							}
-						}
-					}
-
-					#As spam, the virus status changes only if the user changed values
-					if( $vhffs->get_config->use_novirus == 1 )
-					{
-						if( ( $novirus == 1 ) && ( $mu->use_novirus == 0 ) )
-						{
-							if( $mu->change_virus_status == 1 )
-							{
-								$message .= gettext( "Change anti-virus status for your account\n" );
-							}
-							else
-							{
 								$message .= gettext( "Error for virus protection\n" );
-							}
-						}
-
-						if( ( $novirus == 0 ) && ( $mu->use_novirus == 1 ) )
-						{
-							if( $mu->change_virus_status  == 1 )
-							{
-								$message .= gettext( "Change anti-virus status for your account\n" );
-							}
-							else
-							{
-								$message .= gettext( "Error for virus protection\n" );
+								$message .= "<br/>";
 							}
 						}
 					}
@@ -300,7 +280,6 @@
 			$mu->delbox;
 			$mu->delforward;
 		}
-		
 	}
 	
 }




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