gforge-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gforge-commits] gforge/cronjobs/mail mailaliases.php,1.8,1.9


From: tperdue
Subject: [Gforge-commits] gforge/cronjobs/mail mailaliases.php,1.8,1.9
Date: Wed, 04 Aug 2004 11:18:41 -0500

Update of /cvsroot/gforge/gforge/cronjobs/mail
In directory db.perdue.net:/home/tperdue/share/dev.gforge.org/cronjobs/mail

Modified Files:
        mailaliases.php 
Log Message:
RBAC, DELETION, AND FORUM EMAIL GATEWAY

Index: mailaliases.php
===================================================================
RCS file: /cvsroot/gforge/gforge/cronjobs/mail/mailaliases.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mailaliases.php     26 Jul 2004 17:50:25 -0000      1.8
+++ mailaliases.php     4 Aug 2004 16:18:35 -0000       1.9
@@ -1,9 +1,39 @@
 #! /usr/bin/php4 -f
 <?php
+/**
+ * GForge Mail Aliases Facility
+ *
+ * Copyright 2002-2004 GForge, LLC
+ * http://gforge.org/
+ *
+ * @version   $Id$
+ *
+ * This file is part of GForge.
+ *
+ * GForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
 require ('squal_pre.php');
 require ('common/include/cron_utils.php');
 
+//
+//     IMPORTANT - modify this to your correct cron path
+//
+//define("CRON_PATH","/path/to/gforge/cronjobs");
+define("CRON_PATH","/var/www/gforge3/cronjobs");
+
 if (!file_exists('/etc/aliases.org')) {
        $err .= "CANNOT PROCEED - you must first backup your /etc/aliases file";
        exit;
@@ -33,23 +63,43 @@
 fclose($h);
 
 //
-//     Read in the mailman aliases
+//     Set up the forum aliases
 //
-$h2 = fopen("/tmp/mailman-aliases","r");
-$mailmancontents = fread($h2,filesize("/tmp/mailman-aliases"));
-$mailmanlines = explode("\n",$mailmancontents);
-for($k = 0; $k < count($mailmanlines); $k++) {
-       $mailmanline = explode(":",$mailmanlines[$k]);
-       if ($def_aliases[strtolower($mailmanline[0])]) {
-               //alias is already taken - perhaps by default
-       } else {
-               $def_aliases[strtolower($mailmanline[0])]=1;
-               fwrite($fp,$mailmanlines[$k]."\n");
+if ($sys_use_forum) {
+       $resforum=db_query("SELECT groups.unix_group_name,lower(fgl.forum_name) 
AS forum_name
+               FROM forum_group_list fgl,groups
+               WHERE fgl.group_id=groups.group_id
+               AND groups.status='A'");
+       for ($forres=0; $forres<db_numrows($resforum); $forres++) {
+               
$forname=strtolower(db_result($resforum,$forres,'unix_group_name').'-'.strtolower(db_result($resforum,$forres,'forum_name')));
+               if ($def_aliases[$forname]) {
+                       //alias is already taken - perhaps by default
+               } else {
+                       $def_aliases[$forname]=1;
+                       fwrite($fp,"$forname:   
|\"".CRON_PATH."/forum_gateway.php 
".db_result($resforum,$forres,'unix_group_name')." 
".strtolower(db_result($resforum,$forres,'forum_name'))."\"\n");
+               }
        }
 }
-$err .= "\n$k Mailman Lines";
-fclose($h2);
 
+if ($sys_use_mail) {
+       //
+       //      Read in the mailman aliases
+       //
+       $h2 = fopen("/tmp/mailman-aliases","r");
+       $mailmancontents = fread($h2,filesize("/tmp/mailman-aliases"));
+       $mailmanlines = explode("\n",$mailmancontents);
+       for     ($k = 0; $k < count($mailmanlines); $k++) {
+               $mailmanline = explode(":",$mailmanlines[$k]);
+               if ($def_aliases[strtolower($mailmanline[0])]) {
+                       //alias is already taken - perhaps by default
+               } else {
+                       $def_aliases[strtolower($mailmanline[0])]=1;
+                       fwrite($fp,$mailmanlines[$k]."\n");
+               }
+       }
+       $err .= "\n$k Mailman Lines";
+       fclose($h2);
+}
 
 //
 //     Write out the user aliases





reply via email to

[Prev in Thread] Current Thread [Next in Thread]