function check_if_subscribed($email_address, $list_id) { tep_db_list_connect(); $existing_email_query = tep_db_list_query("select id, email from " . PHPLIST_TABLE_PREFIX . "user_user where email = '" . $email_address . "'"); $listname = getListName($list_id); tep_db_list_connect(); if (tep_db_num_rows($existing_email_query) > 0) { $existing_email = tep_db_fetch_array($existing_email_query); $list = tep_db_list_query("SELECT userid, listid from " . PHPLIST_TABLE_PREFIX . "listuser where listid = '" . $list_id . "' and userid = '" . $existing_email['id'] . "'"); if (tep_db_num_rows($list) > 0) { tep_db_list_close(); tep_db_connect(); return $listname . '|1'; } else { tep_db_list_close(); tep_db_connect(); return $listname . '|0'; } } else { tep_db_list_close(); tep_db_connect(); return $listname . '|0'; } tep_db_list_close(); tep_db_connect(); }
foreach ($lists as $key => $list) { if (isset($_POST['newsletters_' . $list])) { $subscription = put_user_in_list($list, 'subscribe', $email_address, $firstname . ' ' . $lastname); } else { $subscription = put_user_in_list($list, 'unsubscribe', $email_address, $firstname . ' ' . $lastname); } if ($subscription == '1') { $subscription_text .= sprintf(Translate('U bent nu ingeschreven op %s.'), getListName($list)) . '<br />'; } else { if ($subscription == '2') { $subscription_text .= sprintf(Translate('U bent reeds ingeschreven op %s.'), getListName($list)) . '<br />'; } else { if ($subscription == '3') { $subscription_text .= sprintf(Translate('U bent nu uitgeschreven van %s.'), getListName($list)) . '<br />'; } else { $subscription_text .= sprintf(Translate('Dit email adres is niet ingeschreven op %s.'), getListName($list)) . '<br />'; } } } } $messageStack->add_session('account', $subscription_text, 'success'); tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); } $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_NEWSLETTERS, '', 'SSL')); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?> >
?> <tr> <td valign="top" colspan="3"> <h2 style="margin: 20px 0 0px 0;" class="subtitle"><?php echo Translate('Nieuwsbrief'); ?> </h2></td> </tr> <tr> <td valign="top"> <table cellpadding="5" cellspacing="5" width="100%" class="loginpage_boxes"> <?php $lists = PHPLIST_LISTNUMBERS; $lists = explode(';', $lists); foreach ($lists as $key => $list) { $newsletter = getListName($list); echo '<tr><td width="20">' . tep_draw_checkbox_field('newsletters_' . $list, '1', false, 'id="newsletters_' . $list . '"') . '</td>'; echo '<td><label for="newsletters_' . $list . '" class="formLabel">' . $newsletter . '</label></td></tr>'; } tep_db_list_close(); tep_db_connect(); ?> </table> </td> </tr> <?php } if (CREATE_ACCOUNT_MODE == 'Direct access' || CREATE_ACCOUNT_MODE == 'Moderated access') { ?> <tr> <td valign="top">