From dde972d560b0fa8cfcaa26dc84ba7a18f4d9b2cf Mon Sep 17 00:00:00 2001
From: Leif Andersson <leif.andersson@control.lth.se>
Date: Wed, 3 May 2017 12:49:09 +0200
Subject: [PATCH] Tog bort hantering av mailinglistor

---
 action.changeGroups.php |  4 ++--
 lib/class.Groups.php    | 32 +++++++++++++++++---------------
 lib/class.Person.php    |  4 ++--
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/action.changeGroups.php b/action.changeGroups.php
index 4138117..4d5fc2c 100644
--- a/action.changeGroups.php
+++ b/action.changeGroups.php
@@ -30,13 +30,13 @@ $smarty->assign('headline',$headline);
 if (isset($params['setMember']))  {
   $GroupID = $params['nonmembers'];
   Groups::setMember($ID,$GroupID);
-  Groups::setMailLists();
+  //Groups::setMailLists();   // Inactivated.
 }
 
 if (isset($params['unsetMember']))  {
   $GroupID = $params['members'];
   Groups::UnsetMember($ID,$GroupID);
-  Groups::setMailLists();
+  //Groups::setMailLists();  // Inactivated.
 }
 
 $members = Groups::getMembers($ID);
diff --git a/lib/class.Groups.php b/lib/class.Groups.php
index 1997ee7..39b1492 100644
--- a/lib/class.Groups.php
+++ b/lib/class.Groups.php
@@ -88,7 +88,7 @@ EOS;
   }
  
   public function updateRecord() {
-    global $gCms; if (!isset($gCms)) exit;
+    //global $gCms; if (!isset($gCms)) exit;
     $db = AddressDB::getDB();
     if ($this->ID == '') { $this->createRecord(); }
 
@@ -135,7 +135,7 @@ EOS;
   /* } */
   
   public static function getMembers($GruppID) {
-    global $gCms; if (!isset($gCms)) exit;
+    //global $gCms; if (!isset($gCms)) exit;
     $db = AddressDB::getDB();
     $result = $db->Execute(self::$queryMembership,array($GruppID));
     if ($result === false) { die("Database error!<br>" . $db->ErrorMsg()); }
@@ -158,7 +158,7 @@ EOS;
   }
     
   public static function setMember($ID,$GroupID) {
-    global $gCms; if (!isset($gCms)) exit;
+    //global $gCms; if (!isset($gCms)) exit;
     $db = AddressDB::getDB();
     $values = array($ID, $GroupID);
     $result = $db->Execute(self::$querySetGroup,$values);
@@ -166,7 +166,7 @@ EOS;
   }  
 
   public static function unsetMember($ID,$GroupID) {
-    global $gCms; if (!isset($gCms)) exit;
+    //global $gCms; if (!isset($gCms)) exit;
     $db = AddressDB::getDB();
     $values = array($ID, $GroupID);
     //   echo '<pre>'; print_r($queryUnsetGroup); print_r($values); echo '</pre>';exit;
@@ -176,7 +176,9 @@ EOS;
   }  
 
   public static function setMailLists() {
-    global $gCms; if (!isset($gCms)) exit;
+    // This function should be inactivated.
+    return;
+    //global $gCms; if (!isset($gCms)) exit;
     $config =& $gCms->GetConfig();
     $maildir = $config['root_path'] . '/uploads/mailinglists';
     $db = AddressDB::getDB();
@@ -190,22 +192,22 @@ EOS;
       $result = $db->Execute(self::$queryMail,$values);
       if ($result === false) { die("Database error!<br>" . $db->ErrorMsg()); }
       while ($row = $result->FetchRow()) {
-	if (!$row['Epost']) continue;
-	$epost[] = $row['Epost'];
+        if (!$row['Epost']) continue;
+        $epost[] = $row['Epost'];
       }
       if (count($epost) > 0) {
-	//	echo '<pre>'; print_r($epost); echo '</pre>';
-	$filename  = $maildir . '/' . $group->Gruppnamn;
-	$file = fopen($filename,'w');
-	if ($file === false) die('Cannot write '.$filename);
-	foreach ($epost as $line) fwrite($file,$line.PHP_EOL);
-	fclose($file);
+        //	echo '<pre>'; print_r($epost); echo '</pre>';
+        $filename  = $maildir . '/' . $group->Gruppnamn;
+        $file = fopen($filename,'w');
+        if ($file === false) die('Cannot write '.$filename);
+        foreach ($epost as $line) fwrite($file,$line.PHP_EOL);
+        fclose($file);
       }
     }
-    //  exit;
   }
+  
   public static function removeAddress($AdressID = null) {
-    global $gCms; if (!isset($gCms)) exit;
+    //global $gCms; if (!isset($gCms)) exit;
     $db = AddressDB::getDB();
     if (is_null($AdressID))
       die('Strange error in removeAddress. No ID.'.PHP_EOL);
diff --git a/lib/class.Person.php b/lib/class.Person.php
index c73a233..125b524 100644
--- a/lib/class.Person.php
+++ b/lib/class.Person.php
@@ -47,7 +47,7 @@ EOS;
     if (is_array($param)) {
       if (isset($param['ID'])) $this->fromDB($param['ID']);
       foreach (self::$personFields as $field) {
-	if ($field == 'ID') continue;
+        if ($field == 'ID') continue;
         if (isset($param[$field])) $this->$field = $param[$field];
       }
       return;
@@ -176,7 +176,7 @@ EOS;
     while ($row = $result->FetchRow()) {
       $person = new $class();
       foreach ($row as $key => $value) {
-	$person->$key = $value;
+        $person->$key = $value;
       }
       $records[] = $person;
     }
-- 
GitLab