public static function unsubscribe($subscriber, $subscriberId, $cle = '', $mailingId, $action) { $Itemid = JRequest::getInt('Itemid'); $db = JFactory::getDBO(); echo '<div class="jNewsUnsubscribe">'; if (!empty($subscriberId) and !empty($cle)) { $i = 0; if (md5($subscriber->email) == $cle) { //$subscriber frontHTML::formStart(_JNEWS_SUBSCRIPTIONS, 0, 'unsubscribe'); $query = 'SELECT L.`list_name`, L.`list_desc`, L.`hidden` ,L.`acc_level`, L.`id`, LM.`list_id`,L.`list_type` FROM `#__jnews_lists` AS L ' . 'LEFT JOIN `#__jnews_listmailings` AS LM ON L.`id` = LM.`list_id` ' . 'LEFT JOIN `#__jnews_listssubscribers` AS LS ON L.`id` = LS.`list_id` ' . 'WHERE LM.`mailing_id`=' . $mailingId . ' AND LS.`subscriber_id`=' . $subscriberId; $query .= ' AND LS.`unsubscribe`= 0'; // $query .= ' AND ( L.`hidden`!=0 AND L.`published`!=0 )';//7788744 $query .= ' AND ( L.`published`!=0 )'; $query .= jnews::orderBy('list_idA'); $db->setQuery($query); $lists = $db->loadObjectList(); if (empty($lists)) { //invisible or unpublished jnews::printM('ok', _JNEWS_LISTS_UNSUBMSG); return false; } $checked = 1; $checkedPrint = $checked != 0 ? 'checked="checked"' : ''; $mainLink = 'option=' . JNEWS_OPTION; $mainLink = jNews_Tools::completeLink($mainLink, false, false); echo '<form method="post" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="mosForm" >' . "\n\r"; echo '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; if (!empty($lists)) { foreach ($lists as $list) { $i++; $checkedPrint = $checked != 0 ? 'checked="checked"' : ''; echo "\n" . '<input id="wz_3' . $i . '" type="checkbox" class="inputbox" value="1" name="unsubscribed[' . $i . ']" ' . $checkedPrint . ' />'; echo "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />'; echo "\n" . '<span class="aca_list_name"'; echo '>' . jNews_Tools::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, '', 1) . '</span>'; echo '<br>'; } } echo '<br>'; $link = 'option=' . JNEWS_OPTION . '&act=change&subscriber=' . $subscriberId . '&cle=' . $cle . '&Itemid=' . $Itemid; $link = jNews_Tools::completeLink($link, false); ?> <input type="hidden" name="option" value="<?php echo JNEWS_OPTION; ?> " /> <input type="hidden" name="act" value="<?php echo $action; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="subscriber_id" value="<?php echo $subscriber->id; ?> " /> <input type="hidden" name="cle" value="<?php echo md5($subscriber->email); ?> " /> <div class="subscribe"> <?php if ($i == 1) { echo _JNEWS_UNSUBSCRIBE_MESSAGE . '<br /><br />'; } else { echo _JNEWS_UNSUBSTOLISTS_MESSAGE; } ?> </div> <div id="otherreasons"> <label for="other"><?php echo _JNEWS_UNSUBSCRIBE_MESSAGE_TEXTAREA; ?> </label><br> <textarea rows="5" cols="50" id="other" name="textareamess"></textarea> </div> <?php frontHTML::formEndUnsubscribe($link, $cle, $subscriberId); //for unsubscribe all if ($GLOBALS[JNEWS . 'show_unsubscribe_all']) { $link = 'option=' . JNEWS_OPTION . '&act=unsubscribeall&subscriber=' . $subscriberId . '&cle=' . $cle . '&Itemid=' . $Itemid; $link = jNews_Tools::completeLink($link, false); echo '<a href="' . $link . '"> ' . _JNEWS_UNSUBSCRIBE_ALL_OR . '</a>'; echo '<br /><br /><br />'; } } else { return false; } } else { return false; } echo '</div>'; }