Example #1
0
 function __construct()
 {
     $ml = new MailingList4u();
     $ml->setName("kino");
     $ml->addEmail("*****@*****.**");
     $ml->addEmail("*****@*****.**");
     $this->mls["kino"] = $ml;
     $ml = new MailingList4u();
     $ml->setName("official");
     $ml->addEmail("*****@*****.**");
     $ml->addEmail("*****@*****.**");
     $ml->setEnabled(false);
     $ml->setReplyTo(ReplyTo4u::$MAILING_LIST);
     $this->mls["official"] = $ml;
 }
Example #2
0
// http://www.phplivex.com/example/submitting-html-forms-with-ajax
extract($_POST);
if (!isset($groupService)) {
    throw new Exception("Missing required groupService");
}
if (!isset($mlName)) {
    throw new Exception("Missing form attribute 'mlName'");
}
if (!isset($mlcontent)) {
    throw new Exception("Missing form attribute 'mlcontent'");
}
if (!isset($mlReplyTo)) {
    throw new Exception("Missing form attribute 'replyTo'");
}
if (!isset($domainId)) {
    throw new Exception("Missing domainId");
}
try {
    $ml = new MailingList4u($mlName);
    foreach (array_unique(explode("\n", $mlcontent)) as $line) {
        $s = trim($line);
        if (isset($s) and strlen($s) > 0) {
            $ml->addEmail($s);
        }
    }
    $ml->setReplyTo($mlReplyTo);
    $groupService->saveOrUpdateMailingListContent($domainId, $ml);
    echo "ok";
} catch (InvalidEmailException $ex) {
    echo $ex;
}
Example #3
0
 public function getMailingList($domainId, $mlName)
 {
     global $dbh, $domainID;
     global $firephp;
     $sql = self::$SELECT . " where `domain_id` = :domain_id and `name` = :name" . " order by `name`, `email`";
     $firephp->log($sql, 'sql');
     $sth = $dbh->prepare($sql);
     $sth->execute(array(':domain_id' => $domainId, ':name' => $mlName));
     $mls = array();
     $ml = null;
     while ($row = $sth->fetch()) {
         if ($ml == null) {
             $ml = new MailingList4u($row['name']);
             $ml->setEnabled($row['enabled'] != 0);
             //$ml->setEmailCount($row['memberCount']);
             $ml->setReplyTo($row['replyTo']);
         }
         $ml->addEmail($row['email']);
     }
     return $ml;
 }