Hi Mathieu,
Mathieu Roy wrote:
> There are several ways to contribute. For a one time contribution, the best
> is
> to send us patches and we'll see how we implement things. For long run
> contribution, we may grant you SVN access if necessary.
Well, for now... I'll just send you patches.
> We first need to take a look at your contribution to see how we can put it to
> make it fit.
>
> For instance, using sv_aliases to add mailman aliases is interesting but some
> installations may not want that. For instance, Gna! would not want that as it
> does not use the aliases file for mailing-list but a simple Exim
> transport+router to do it. So to add this contribution, we would have to
> study if we need to add a configuration option or to even put the code in a
> separate script.
Ok. Well, I realized that it wasn't even necessary/useful in my
installation either. So I reverted sv_aliases back to the original code.
> The possibility for sv_mailman to add, delete and reconfigure lists would be
> greatly appreciated.
I made some more modfications yesterday to improve the scalability of
the reconfigure functionality. I have attached a patch
(sv_mailman.patch) that modifies sv_mailman.pl and
frontend/php/mail/admin/index.php. The code includes comments to help
explain what I did. Essentially, I've added two additional status codes.
0 means deleted or non-existent. 2 means marked for reconfiguration.
> I would be interesting to have a gain in portability, indeed. Other NetBSD
> users may be interested into running Savane.
> Has the portable code any drawback by comparison to the one based the
> assumption that GNU date (that supports -d) is date?
> If it has, we may add a specific date function for that use GNU date if
> available and the other if not.
So far, the date change is the only non-path change I have made for
portability. Some of the scripts have paths hardcoded, which I had to
change. At first, I began tweaking the configure script to address path
issues, etc. But time restrictions didn't let me finish. I just went in
and hardcoded the paths as needed for my setup. I would like to finish
the configure script and send it along when ready. I'm not sure when
that will happen though.
The only drawback to the date change is that the scripts now require the
Date::Calc perl module, which I don't considre a major drawback at all.
I have attached a patch (sv_date.patch) that modifies all the sv_*.pl
scripts which used "date -d". These include:
sv_cleaner.pl
sv_extra_dead_projects.pl
sv_reminder.pl
sv_export.pl
Note: my patches include my path changes in the scripts, but that should
affect sv_mailman.pl
I hope you find the mods useful, and please keep me updated as to
whether you include them or not. Thanks...
--
Armando
www.armandocaro.net
diff -r -N -C 5 savane-snapshot/backend/accounts/sv_cleaner.pl savane/backend/accounts/sv_cleaner.pl
*** savane-snapshot/backend/accounts/sv_cleaner.pl Thu Sep 29 04:20:07 2005
--- savane/backend/accounts/sv_cleaner.pl Fri Feb 24 10:47:41 2006
***************
*** 37,46 ****
--- 37,47 ----
use Savane;
use Getopt::Long;
use Term::ANSIColor qw(:constants);
use POSIX qw(strftime);
use Time::Local;
+ use Date::Calc qw(Add_Delta_YMD);
# Import
our $sys_cron_cleaner;
my $script = "sv_cleaner";
***************
*** 115,125 ****
## Remove user account registration not confirmed after two days
##
#######################################################################
! my ($year, $month, $day) = split(",", `date -d "3 days ago" +%Y,%m,%d`);
my $date = timelocal("0","0","0",$day,($month-1),($year-1900));
my $result = DeleteUsers("status='P' AND add_date < $date");
print LOG strftime "[$script] %c ---- deleted $result unconfirmed user accounts\n", localtime if $result > 0;
--- 116,127 ----
## Remove user account registration not confirmed after two days
##
#######################################################################
! my ($year, $month, $day) = split(",", `date +%Y,%m,%d`);
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, 0,0,-3);
my $date = timelocal("0","0","0",$day,($month-1),($year-1900));
my $result = DeleteUsers("status='P' AND add_date < $date");
print LOG strftime "[$script] %c ---- deleted $result unconfirmed user accounts\n", localtime if $result > 0;
***************
*** 129,139 ****
##
## Remove inactive projects, usually registration interrupted
##
#######################################################################
! my ($year, $month, $day) = split(",", `date -d "1 days ago" +%Y,%m,%d`);
my $date = timelocal("0","0","0",$day,($month-1),($year-1900));
my $result = DeleteGroups("status='I' AND register_time < $date");
print LOG strftime "[$script] %c ---- deleted $result inactive groups\n", localtime if $result > 0;
--- 131,142 ----
##
## Remove inactive projects, usually registration interrupted
##
#######################################################################
! my ($year, $month, $day) = split(",", `date +%Y,%m,%d`);
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, 0,0,-1);
my $date = timelocal("0","0","0",$day,($month-1),($year-1900));
my $result = DeleteGroups("status='I' AND register_time < $date");
print LOG strftime "[$script] %c ---- deleted $result inactive groups\n", localtime if $result > 0;
***************
*** 155,165 ****
## Remove too old form_id, forms created more than two days ago an still
## not submitted
##
#######################################################################
! my ($year, $month, $day) = split(",", `date -d "1 days ago" +%Y,%m,%d`);
my $date = timelocal("0","0","0",$day,($month-1),($year-1900));
my $result = DeleteDB("form", "timestamp < $date");
print LOG strftime "[$script] %c ---- deleted $result outdated form ids\n", localtime if $result > 0;
--- 158,169 ----
## Remove too old form_id, forms created more than two days ago an still
## not submitted
##
#######################################################################
! my ($year, $month, $day) = split(",", `date +%Y,%m,%d`);
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, 0,0,-1);
my $date = timelocal("0","0","0",$day,($month-1),($year-1900));
my $result = DeleteDB("form", "timestamp < $date");
print LOG strftime "[$script] %c ---- deleted $result outdated form ids\n", localtime if $result > 0;
***************
*** 169,179 ****
##
## Remove too old sessions, session older than one year
##
#######################################################################
! my ($year, $month, $day) = split(",", `date -d "1 year ago" +%Y,%m,%d`);
my $date = timelocal("0","0","0",$day,($month-1),($year-1900));
my $result = DeleteDB("session", "time < $date");
print LOG strftime "[$script] %c ---- deleted $result sessions older than one year\n", localtime if $result > 0;
--- 173,184 ----
##
## Remove too old sessions, session older than one year
##
#######################################################################
! my ($year, $month, $day) = split(",", `date +%Y,%m,%d`);
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, -1,0,0);
my $date = timelocal("0","0","0",$day,($month-1),($year-1900));
my $result = DeleteDB("session", "time < $date");
print LOG strftime "[$script] %c ---- deleted $result sessions older than one year\n", localtime if $result > 0;
diff -r -N -C 5 savane-snapshot/backend/accounts/sv_reminder.pl savane/backend/accounts/sv_reminder.pl
*** savane-snapshot/backend/accounts/sv_reminder.pl Thu Dec 1 11:22:29 2005
--- savane/backend/accounts/sv_reminder.pl Fri Feb 24 10:47:41 2006
***************
*** 25,34 ****
--- 25,35 ----
use Savane::Mail;
use Getopt::Long;
use Term::ANSIColor qw(:constants);
use POSIX qw(strftime);
use Time::Local;
+ use Date::Calc qw(Add_Delta_YMD);
# Import
our $sys_cron_reminder;
our $sys_name;
our $sys_https_host;
***************
*** 149,165 ****
my ($year, $month, $day);
my $now = timelocal(localtime());
! ($year, $month, $day) = split(",", `date -d "1 day ago" +%Y,%m,%d`);
my $daybefore = timelocal("0","0","0",$day,($month-1),($year-1900));
! ($year, $month, $day) = split(",", `date -d "1 week ago" +%Y,%m,%d`);
my $weekbefore = timelocal("0","0","0",$day,($month-1),($year-1900));
! ($year, $month, $day) = split(",", `date -d "1 month ago" +%Y,%m,%d`);
my $monthbefore = timelocal("0","0","0",$day,($month-1),($year-1900));
print "DBG time: daybefore:$daybefore, weekbefore:$weekbefore; monthbefore:$monthbefore\n" if $debug;
#######################################################################
--- 150,169 ----
my ($year, $month, $day);
my $now = timelocal(localtime());
! my ($year, $month, $day) = split(",", `date +%Y,%m,%d`);
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, 0,0,-1);
my $daybefore = timelocal("0","0","0",$day,($month-1),($year-1900));
! my ($year, $month, $day) = split(",", `date +%Y,%m,%d`);
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, 0,0,-7);
my $weekbefore = timelocal("0","0","0",$day,($month-1),($year-1900));
! my ($year, $month, $day) = split(",", `date +%Y,%m,%d`);
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, 0,1,0);
my $monthbefore = timelocal("0","0","0",$day,($month-1),($year-1900));
print "DBG time: daybefore:$daybefore, weekbefore:$weekbefore; monthbefore:$monthbefore\n" if $debug;
#######################################################################
diff -r -N -C 5 savane-snapshot/backend/admin/sv_extra_dead_projects.pl savane/backend/admin/sv_extra_dead_projects.pl
*** savane-snapshot/backend/admin/sv_extra_dead_projects.pl Thu Sep 15 11:11:04 2005
--- savane/backend/admin/sv_extra_dead_projects.pl Fri Feb 24 10:47:41 2006
***************
*** 26,35 ****
--- 26,36 ----
use Getopt::Long;
use Savane;
use POSIX qw(strftime);
use Time::Local;
+ use Date::Calc qw(Add_Delta_YMD);
my $getopt;
my $help;
my $verbose;
***************
*** 63,73 ****
EOF
exit(1);
}
# Define epoch date of today
! my ($year, $month, $day) = split(",", `date -d "$delay" +%Y,%m,%d`);
my $limit = timelocal("0","0","0",$day,($month-1),($year-1900));
# We'll begin by storing project name in list
--- 64,96 ----
EOF
exit(1);
}
# Define epoch date of today
! my ($year, $month, $day) = split(",", `date +%Y,%m,%d`);
!
! # Armando L. Caro, Jr. <acaro--at--bbn--dot--com> 2/22/06
! # Parse delay string to use perl function of delta calc, which is more portable
! # than GNU's "date -d"
! my ($num, $unit, $direction) = split(" ", $delay);
! if ($unit =~ /week/) {
! $unit = "days";
! $num *= 7;
! }
! if ($direction =~ "ago") {
! $num = 0 - $num;
! }
! if ($unit =~ /day/) {
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, 0,0,$num);
! } elsif ($unit =~ /month/) {
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, 0,$num,0);
! } elsif ($unit =~ /year/) {
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, $num,0,0);
! } else {
! print STDERR "Cannot parse delay string: $delay\n";
! exit(1);
! }
my $limit = timelocal("0","0","0",$day,($month-1),($year-1900));
# We'll begin by storing project name in list
diff -r -N -C 5 savane-snapshot/backend/export/sv_export.pl savane/backend/export/sv_export.pl
*** savane-snapshot/backend/export/sv_export.pl Sat Dec 3 07:12:06 2005
--- savane/backend/export/sv_export.pl Fri Feb 24 10:47:41 2006
***************
*** 25,34 ****
--- 25,35 ----
use Savane::Mail;
use Getopt::Long;
use Term::ANSIColor qw(:constants);
use POSIX qw(strftime);
use Time::Local;
+ use Date::Calc qw(Add_Delta_YMD);
use XML::Writer;
use IO::File;
# Import
***************
*** 461,471 ****
"'$req_task_id', 'details', '$task_comment', '100', '$now'");
# Otherwise, update the timestamp
# Assume that the script is running the correct day, so we can easily
# just add 7 days to the current day
! my ($year, $month, $day) = split(",", `date -d "7 days next" +%Y,%m,%d`);
my $timestamp = timelocal("0","0",$req_frequency_hour,($day+7),($month-1),($year-1900));
SetDBSettings($export_table, "export_id='$req_id'", "date='$timestamp'");
}
--- 462,473 ----
"'$req_task_id', 'details', '$task_comment', '100', '$now'");
# Otherwise, update the timestamp
# Assume that the script is running the correct day, so we can easily
# just add 7 days to the current day
! my ($year, $month, $day) = split(",", `date +%Y,%m,%d`);
! ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, 0,0,7);
my $timestamp = timelocal("0","0",$req_frequency_hour,($day+7),($month-1),($year-1900));
SetDBSettings($export_table, "export_id='$req_id'", "date='$timestamp'");
}
diff -r -N -C 5 savane-snapshot/backend/mail/sv_mailman.pl savane/backend/mail/sv_mailman.pl
*** savane-snapshot/backend/mail/sv_mailman.pl Tue Sep 13 05:39:08 2005
--- savane/backend/mail/sv_mailman.pl Fri Feb 24 10:47:41 2006
***************
*** 21,30 ****
--- 21,52 ----
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
#
#
# FIXME: check the drawback explanation below.
+ #
+ # Drawback: I run here an SQL command to reset the status and to get
+ # the admin login for each list. I could be resources consuming, however
+ # I think we cannot expect this to be too heavy, not so many list should
+ # be created everyday.
+ # This scalability issue should be kept in mind, however.
+
+ ## Note about status of list:
+ ## - Status 0: list is deleted (ie, does not exist).
+ ## - Status 1: list is marked for creation.
+ ## - Status 2: list is marked for reconfiguration.
+ ## - Status 5: list has been created (ie, it exists).
+ ##
+ ## The frontend php script sets status to:
+ ## 0 if user deletes a list before the backend ever actually created it.
+ ## 1 if user adds a list
+ ## 2 if user reconfigures an _existing_ list (ie, status was 5)
+ ##
+ ## This backend sv_mailman.pl script sets status to:
+ ## 0 when a list is actually deleted
+ ## 5 when a list is actually created
+
use strict;
use Getopt::Long;
use Savane;
***************
*** 93,111 ****
die "There's a lock ($lockfile), exiting";
}
system("touch", $lockfile);
foreach my $line (GetDB("mail_group_list",
! "status='1' OR status='0'",
"group_list_id,list_name,is_public,password,list_admin,description")) {
chomp($line);
my ($id, $name, $is_public, $password, $admin, $description) = split(",", $line);
$admin = GetUserName($admin)."\@".$sys_mail_domain;
# Create the list.
! system("/usr/sbin/newlist",
"-q",
$name,
$admin,
$password);
print LOG strftime "[$script] %c - List $name <$admin> newlist.\n", localtime;
--- 115,158 ----
die "There's a lock ($lockfile), exiting";
}
system("touch", $lockfile);
+ # Armando L. Caro, Jr. <acaro--at--bbn--dot--com> 2/17/06
+ # Delete the lists which are marked for deletion (is_public=9), but haven't
+ # been deleted yet (status != 0).
+ #
+ foreach my $line (GetDB("mail_group_list",
+ "status!='0' AND is_public='9'",
+ "group_list_id,list_name,is_public,password,list_admin,description")) {
+ chomp($line);
+ my ($id, $name, $is_public, $password, $admin, $description) = split(",", $line);
+ $admin = GetUserName($admin)."\@".$sys_mail_domain;
+
+ # Remove the list.
+ system("/usr/pkg/lib/mailman/bin/rmlist", $name);
+ print LOG strftime "[$script] %c - List $name <$admin> rmlist.\n", localtime;
+
+ SetDBSettings("mail_group_list",
+ "list_name='$name'",
+ "status='0'");
+ print LOG strftime "[$script] %c - List $name <$admin> deleted.\n", localtime;
+ }
+
+ # Armando L. Caro, Jr. <acaro--at--bbn--dot--com> 2/17/06
+ # Add the lists which are marked public/private, but haven't been added
+ # yet (status = 1).
+ #
foreach my $line (GetDB("mail_group_list",
! "status='1' AND is_public!='9'",
"group_list_id,list_name,is_public,password,list_admin,description")) {
chomp($line);
my ($id, $name, $is_public, $password, $admin, $description) = split(",", $line);
$admin = GetUserName($admin)."\@".$sys_mail_domain;
# Create the list.
! system("/usr/pkg/lib/mailman/bin/newlist",
"-q",
$name,
$admin,
$password);
print LOG strftime "[$script] %c - List $name <$admin> newlist.\n", localtime;
***************
*** 118,137 ****
# mailman is not useful to fight spam, in fact being forced to use
# it's interface instead of having a spamassassin doing the job
# can be seen as a pain.
print $tmpcfgfh "require_explicit_destination = 0\n";
# Do not advertise, hide archives, require approval if private list
! print $tmpcfgfh "archive_private = 1\n" unless $is_public;
! print $tmpcfgfh "advertised = 0\n" unless $is_public;
! print $tmpcfgfh "subscribe_policy = 3\n" unless $is_public;
# Always give access to the member list only to list admins
print $tmpcfgfh "private_roster = 2\n";
# Set the message limit size reasonnably big
## Set in mm_cfg.py
## print TMPCFG "max_message_size = 10240\n";
close($tmpcfgfh);
! system("/usr/sbin/config_list",
"--inputfile",
$tmpcfg,
$name);
print LOG strftime "[$script] %c - List $name <$admin> config_list.\n", localtime;
--- 165,191 ----
# mailman is not useful to fight spam, in fact being forced to use
# it's interface instead of having a spamassassin doing the job
# can be seen as a pain.
print $tmpcfgfh "require_explicit_destination = 0\n";
# Do not advertise, hide archives, require approval if private list
! if($is_public) {
! print $tmpcfgfh "archive_private = 0\n";
! print $tmpcfgfh "advertised = 1\n";
! print $tmpcfgfh "subscribe_policy = 1\n";
! } else {
! print $tmpcfgfh "archive_private = 1\n";
! print $tmpcfgfh "advertised = 0\n";
! print $tmpcfgfh "subscribe_policy = 3\n";
! }
# Always give access to the member list only to list admins
print $tmpcfgfh "private_roster = 2\n";
# Set the message limit size reasonnably big
## Set in mm_cfg.py
## print TMPCFG "max_message_size = 10240\n";
close($tmpcfgfh);
!
! system("/usr/pkg/lib/mailman/bin/config_list",
"--inputfile",
$tmpcfg,
$name);
print LOG strftime "[$script] %c - List $name <$admin> config_list.\n", localtime;
***************
*** 154,178 ****
Regards,";
MailSend("", $admin, "Mailman list $name", $mail);
print LOG strftime "[$script] %c - Mail sent to $admin for list $name.\n", localtime;
- # Drawback1: I run here an SQL command to reset the status and to get
- # the admin login for each list. I could be resources consuming, however
- # I think we cannot expect this to be too heavy, not so many list should
- # be created everyday.
- # This scalability issue should be kept in mind, however.
- # Drawback2: currently this script only create list, does not
- # update them. This should be fixed in one way or another.
-
SetDBSettings("mail_group_list",
"list_name='$name'",
"status='5'");
! print LOG strftime "[$script] %c - List $name <$admin> created.\n", localtime;
!
}
# Final exit
print LOG strftime "[$script] %c - work finished\n", localtime;
print LOG "[$script] ------------------------------------------------------\n";
unlink($lockfile);
--- 208,271 ----
Regards,";
MailSend("", $admin, "Mailman list $name", $mail);
print LOG strftime "[$script] %c - Mail sent to $admin for list $name.\n", localtime;
SetDBSettings("mail_group_list",
"list_name='$name'",
"status='5'");
! print LOG strftime "[$script] %c - List $name <$admin> created.\n", localtime;
}
+ # Armando L. Caro, Jr. <acaro--at--bbn--dot--com> 2/17/06
+ # Reconfigure all lists marked for reconfiguration (status = 2), but
+ # that have not been deleted.
+ #
+ foreach my $line (GetDB("mail_group_list",
+ "status='2' AND is_public!='9'",
+ "group_list_id,list_name,is_public,password,list_admin,description")) {
+ chomp($line);
+ my ($id, $name, $is_public, $password, $admin, $description) = split(",", $line);
+ $admin = GetUserName($admin)."\@".$sys_mail_domain;
+
+ # Configure the list.
+ my ($tmpcfgfh, $tmpcfg) = tempfile(UNLINK => 1);
+
+ # Always set description
+ print $tmpcfgfh "description = '".Escape($description)."'\n";
+ # mailman is not useful to fight spam, in fact being forced to use
+ # it's interface instead of having a spamassassin doing the job
+ # can be seen as a pain.
+ print $tmpcfgfh "require_explicit_destination = 0\n";
+ # Do not advertise, hide archives, require approval if private list
+ if($is_public) {
+ print $tmpcfgfh "archive_private = 0\n";
+ print $tmpcfgfh "advertised = 1\n";
+ print $tmpcfgfh "subscribe_policy = 1\n";
+ } else {
+ print $tmpcfgfh "archive_private = 1\n";
+ print $tmpcfgfh "advertised = 0\n";
+ print $tmpcfgfh "subscribe_policy = 3\n";
+ }
+ # Always give access to the member list only to list admins
+ print $tmpcfgfh "private_roster = 2\n";
+ # Set the message limit size reasonnably big
+ ## Set in mm_cfg.py
+ ## print TMPCFG "max_message_size = 10240\n";
+ close($tmpcfgfh);
+
+ system("/usr/pkg/lib/mailman/bin/config_list",
+ "--inputfile",
+ $tmpcfg,
+ $name);
+ print LOG strftime "[$script] %c - List $name <$admin> config_list.\n", localtime;
+
+ SetDBSettings("mail_group_list",
+ "list_name='$name'",
+ "status='5'");
+ print LOG strftime "[$script] %c - List $name <$admin> reconfigured.\n", localtime;
+ }
# Final exit
print LOG strftime "[$script] %c - work finished\n", localtime;
print LOG "[$script] ------------------------------------------------------\n";
unlink($lockfile);
diff -r -N -C 5 savane-snapshot/frontend/php/mail/admin/index.php savane/frontend/php/mail/admin/index.php
*** savane-snapshot/frontend/php/mail/admin/index.php Wed Feb 1 12:37:31 2006
--- savane/frontend/php/mail/admin/index.php Fri Feb 24 10:42:22 2006
***************
*** 23,34 ****
# along with the Savane project; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
## Note about status of list:
! ## - when list are created, they got a status of 1
! ## - sv_mailman set status to 5 when it creates the list with mailman
## - when we create an alias, which mean someone was able, according to
## group type restriction to add to his project a list that was already
## inside the database, we add the list inside the database with a status
## of 5, so sv_mailman does not try to recreate it.
## In the worse case, if two persons creates the same list at the same
--- 23,46 ----
# along with the Savane project; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
## Note about status of list:
! ## - Status 0: list is deleted (ie, does not exist).
! ## - Status 1: list is marked for creation.
! ## - Status 2: list is marked for reconfiguration.
! ## - Status 5: list has been created (ie, it exists).
! ##
! ## This frontend php script sets status to:
! ## 0 if user deletes a list before the backend ever actually created it.
! ## 1 if user adds a list
! ## 2 if user reconfigures an _existing_ list (ie, status was 5)
! ##
! ## The backend sv_mailman.pl script sets status to:
! ## 0 when a list is actually deleted
! ## 5 when a list is actually created
! ##
## - when we create an alias, which mean someone was able, according to
## group type restriction to add to his project a list that was already
## inside the database, we add the list inside the database with a status
## of 5, so sv_mailman does not try to recreate it.
## In the worse case, if two persons creates the same list at the same
***************
*** 270,292 ****
}
}
} else if ($change_status) {
! # list name is fixed
! $sql="UPDATE mail_group_list SET is_public='$is_public', ".
! "description='". htmlspecialchars($description) ."' ".
! "WHERE group_list_id='$group_list_id' AND group_id='$group_id'";
! $result=db_query($sql);
! if (!$result || db_affected_rows($result) < 1)
! {
! fb(_("Error Updating List"),1);
! }
! else
! {
! fb(_("List Updated Successfully"));
! }
}
}
/***********************************************************
--- 282,349 ----
}
}
} else if ($change_status) {
! $res_status = db_query("SELECT * FROM mail_group_list " .
! "WHERE group_list_id='$group_list_id' AND group_id='$group_id'");
! $num = db_numrows($res_status);
! if (db_numrows($res_status) < 1)
! {
! fb(_("Error Updating List"),1);
! }
! else
! {
! $row_status = db_fetch_array($res_status);
!
! # Armando L. Caro, Jr. <acaro--at--bbn--dot--com> 2/23/06
! # Change the status based on what status is in mysql and what
! # is_public is being set to. We need to account for when
! # multiple changes are entered into mysql before the backend has
! # the opportunity to act on them.
! #
! switch($row_status['status'])
! {
! # Status of 0 or 1, means the mailing list doesn't exist. So
! # signal to backend to create as long as is_public is not set
! # to "deleted" (ie, 9).
! case '0':
! case '1':
! if ( $is_public != 9 )
! {
! $status = 1;
! }
! else
! {
! $status = 0;
! }
! break;
!
! # Status of 2 or 5, means the mailing list does exist, and
! # user is making a change. The change has to be signaled to
! # backend no matter what.
! case '2':
! case '5':
! $status = 2;
! break;
! }
!
! # list name is fixed
! $sql="UPDATE mail_group_list SET is_public='$is_public', ".
! "status='$status', ".
! "description='". htmlspecialchars($description) ."' ".
! "WHERE group_list_id='$group_list_id' AND group_id='$group_id'";
! $result=db_query($sql);
! if (!$result || db_affected_rows($result) < 1)
! {
! fb(_("Error Updating List"),1);
! }
! else
! {
! fb(_("List Updated Successfully"));
! }
! }
}
}
/***********************************************************
_______________________________________________
Savane-dev mailing list
[email protected]
https://mail.gna.org/listinfo/savane-dev