Example #1
0
function exportMembers($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials)
{
    $pEmailList = new paloSantoEmailList($pDB);
    $id_list = getParameter("id");
    if ($credentials['userlevel'] == 'superadmin') {
        $emailList = $pEmailList->getEmailList($id_list);
    } else {
        $emailList = $pEmailList->getEmailList($id_list, $credentials['domain']);
    }
    if ($emailList == false) {
        $smarty->assign("mb_title", _tr("Error"));
        $error = $emailList === false ? _tr("Couldn't be retrieved Email List data") : _tr("Email List does not exist");
        $smarty->assign("mb_message", $error);
        return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
    }
    $listName = $emailList['listname'];
    $text = "";
    if (!is_null($listName)) {
        $totalMembers = $pEmailList->getTotalMembers($id_list);
        $members = $pEmailList->getMembers($totalMembers, 0, $id_list, null, "");
        foreach ($members as $key => $value) {
            if ($text != "") {
                $text .= "\n";
            }
            if (isset($value["namemember"]) && $value["namemember"] != "") {
                $text .= $value["namemember"] . " <{$value['mailmember']}>";
            } else {
                $text .= $value["mailmember"];
            }
        }
    } else {
        $listName = "";
    }
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: public");
    header("Content-Description: txt file");
    header("Content-Type: application/download");
    header("Content-Disposition: attachment; filename={$listName}" . "_members.txt");
    header("Content-Transfer-Encoding: binary");
    header("Content-length: " . strlen($text));
    echo $text;
}
Example #2
0
function exportMembers($smarty, $module_name, $local_templates_dir, $pDB, $arrConf)
{
    $pEmailList = new paloSantoEmailList($pDB);
    $id_list = getParameter("id");
    $listName = $pEmailList->getListName($id_list);
    $text = "";
    if (!is_null($listName)) {
        $totalMembers = $pEmailList->getTotalMembers($id_list);
        $members = $pEmailList->getMembers($totalMembers, 0, $id_list, null, "");
        foreach ($members as $key => $value) {
            if ($text != "") {
                $text .= "\n";
            }
            if (isset($value["namemember"]) && $value["namemember"] != "") {
                $text .= $value["namemember"] . " <{$value['mailmember']}>";
            } else {
                $text .= $value["mailmember"];
            }
        }
    } else {
        $listName = "";
    }
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: public");
    header("Content-Description: txt file");
    header("Content-Type: application/download");
    header("Content-Disposition: attachment; filename={$listName}" . "_members.txt");
    header("Content-Transfer-Encoding: binary");
    header("Content-length: " . strlen($text));
    echo $text;
}