Commit dde972d5 authored by Leif Andersson's avatar Leif Andersson
Browse files

Tog bort hantering av mailinglistor

parent d23880cf
......@@ -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);
......
......@@ -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);
......
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment