function deleteEmailList($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pEmaillist = new paloSantoEmaillist($pDB); $pDB->beginTransaction(); foreach ($_POST as $key => $value) { if ($value == "on") { if ($pEmaillist->listExistsbyId($key)) { $listName = $pEmaillist->getListName($key); if (is_null($listName)) { $pDB->rollBack(); $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("Mailman could not remove the list")); return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); } $id_domain = $pEmaillist->getIdDomainofList($key); if (is_null($id_domain)) { $pDB->rollBack(); $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("Mailman could not remove the list")); return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); } $domainName = $pEmaillist->getDomainName($id_domain); if (is_null($domainName)) { $pDB->rollBack(); $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("Mailman could not remove the list")); return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); } if (!$pEmaillist->deleteEmailList($key)) { $pDB->rollBack(); $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", $pEmaillist->getError()); return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); } if (!$pEmaillist->mailmanRemoveList($listName, $domainName)) { $pDB->rollBack(); $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("Mailman could not remove the list")); return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); } } } } $pDB->commit(); $smarty->assign("mb_title", _tr("Message")); $smarty->assign("mb_message", _tr("The email list(s) were successfully deleted")); return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); }