function AMP_subscribe_to_list($addresses, $list_id)
{
    if (AMP_MODULE_BLAST == 'PHPlist') {
        require_once 'Modules/Blast/API.inc.php';
        $_PHPlist = new PHPlist_API($this->dbcon);
        return $_PHPlist->add_subscribers($addresses, $list_id);
    }
    if (AMP_MODULE_BLAST == 'DIA') {
        require_once 'DIA/API.php';
        if (!isset($api)) {
            $api = DIA_API::create();
        }
        $result = $api->addMembersByEmail($addresses, $list_id);
        return sizeof($result);
    }
    return false;
}
Esempio n. 2
0
 function subscribe_set($set, $api = null)
 {
     if (!(isset($_POST['blastlist_id']) && ($list_id = $_POST['blastlist_id']))) {
         return 'Please select a list';
     }
     $ids = split(",", $set);
     $emailSet =& AMPSystem_Lookup::instance('userDataEmails');
     $new_subscribers =& array_combine_key($ids, $emailSet);
     if (AMP_MODULE_BLAST == 'PHPlist') {
         require_once 'Modules/Blast/API.inc.php';
         $_PHPlist = new PHPlist_API($this->dbcon);
         $count = $_PHPlist->add_subscribers($new_subscribers, $list_id);
     } elseif (AMP_MODULE_BLAST == 'DIA') {
         require_once 'DIA/API.php';
         if (!isset($api)) {
             $api = DIA_API::create();
         }
         $result = $api->addMembersByEmail($new_subscribers, $list_id);
         $count = sizeof($result);
     }
     $listSet =& AMPSystem_Lookup::instance('lists');
     return $count . ' users subscribed to ' . $listSet[$list_id];
 }