Ejemplo n.º 1
0
 function replaceTags($content, $subscriber, $list, $mailingId, $html, $tags = null)
 {
     global $_MAMBOTS;
     global $_VERSION, $mainframe, $database;
     $joomAca15 = $_VERSION->RELEASE != '1.0' && class_exists('JFactory') ? true : false;
     /*		$content = str_replace('href="mailto:' , '9aca7aca5', $content);  // mailto tag good ones
     		$content = str_replace('@', '9aca4aca1', $content);  // mailto tag good ones */
     $Itemid = $GLOBALS[ACA . 'itemidAca'];
     $listId = $list->id;
     if ($GLOBALS[ACA . 'use_sef'] == '1' and $GLOBALS['mosConfig_sef'] == '1' and function_exists('sefRelToAbs')) {
         $subscriptionslink = sefRelToAbs('index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=change&subscriber=' . $subscriber->id . '&cle=' . md5($subscriber->email) . '&listid=' . $listId);
         $unsubscribelink = sefRelToAbs('index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=unsubscribe&subscriber=' . $subscriber->id . '&cle=' . md5($subscriber->email) . '&listid=' . $listId);
     } else {
         $subscriptionslink = $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=change&subscriber=' . $subscriber->id . '&cle=' . md5($subscriber->email) . '&listid=' . $listId;
         $unsubscribelink = $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=unsubscribe&subscriber=' . $subscriber->id . '&cle=' . md5($subscriber->email) . '&listid=' . $listId;
     }
     if ($html) {
         $subscriptionslink = '<a href="' . $subscriptionslink . '" target="_blank"><span class="subscriptionlink_nws">' . _ACA_CHANGE_EMAIL_SUBSCRIPTION . '</span></a>';
         $unsubscribelink = '<a href="' . $unsubscribelink . '" target="_blank"><span class="subscriptionlink_nws">' . _ACA_UNSUBSCRIBE . '</span></a>';
         $subscriptionstext = '<p>' . $subscriptionslink . '<br />' . $unsubscribelink . '</p>';
     } else {
         $subscriptionslink = _ACA_CHANGE_EMAIL_SUBSCRIPTION . ' ( ' . $subscriptionslink . ' )';
         $unsubscribelink = _ACA_UNSUBSCRIBE . ' ( ' . $unsubscribelink . ' )';
         $subscriptionstext = "\r\n" . $subscriptionslink . "\r\n" . $unsubscribelink;
         if (substr_count($content, '[SUBSCRIPTIONS]') < 1) {
             $content .= "\r\n [SUBSCRIPTIONS] \r\n";
         }
     }
     if ($GLOBALS[ACA . 'show_signature'] == 1) {
         if ($html) {
             $signatureText = '<a href="http://www.joobisoft.com" target="_blank">';
             $signatureText .= '<br /><center><span style="color:#666666; font-size: .8em; text-align: center; ">Powered by Joobi</span></center>';
             $signatureText .= '</a>';
         } else {
             $signatureText = 'Powered by Joobi ( http://www.joobisoft.com )';
         }
         $subscriptionstext .= "\r\n\r\n" . $signatureText;
     }
     if ($GLOBALS['mosConfig_sef'] == '1' and $GLOBALS[ACA . 'use_sef'] == '1' and function_exists('sefRelToAbs')) {
         $confirmlink = sefRelToAbs('index.php?option=com_acajoom&act=confirm&listid=' . $listId . '&cle=' . md5($subscriber->email) . '&subscriber=' . $subscriber->id);
     } else {
         $confirmlink = $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_acajoom&act=confirm&listid=' . $listId . '&cle=' . md5($subscriber->email) . '&subscriber=' . $subscriber->id;
     }
     if ($html) {
         $confirmlink = '<a href="' . $confirmlink . '" target="_blank">' . _ACA_CONFIRM_LINK . '</a>';
     } else {
         $confirmlink = _ACA_CONFIRM_LINK . "\n" . $confirmlink;
     }
     $tname = explode(" ", $subscriber->name);
     $firstname = $tname[0];
     $content = str_replace('[CONFIRM]', $confirmlink, $content);
     $content = str_replace('[NAME]', $subscriber->name, $content);
     $content = str_replace('[FIRSTNAME]', $firstname, $content);
     if (class_exists('auto')) {
         auto::tags($content, $tags);
     }
     if ($list->footer == '0') {
         $content = str_replace('[SUBSCRIPTIONS]', '', $content);
     } else {
         $content = str_replace('[SUBSCRIPTIONS]', $subscriptionstext, $content);
     }
     if (class_exists('tags') and $tags) {
         tags::replace($content, $tags);
     }
     if (!empty($mailingId) and $GLOBALS[ACA . 'enable_statistics'] == 1) {
         if ($GLOBALS[ACA . 'statistics_per_subscriber'] == 1) {
             if ($html) {
                 $content .= '<img src="' . $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=log&listid=' . $listId . '&mailingid=' . $mailingId . '&subscriber=' . $subscriber->id . '" border="0" width="1" height="1" />';
             }
         } else {
             if ($html) {
                 $content .= '<img src="' . $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=log&listid=' . $listId . '&mailingid=' . $mailingId . '" border="0" width="1" height="1" />';
             }
         }
     }
     // replace for images
     //  put the good mailto tag back (replaced before the content mambot)
     $replaceTag = array('href="mailto:', '@', 'href="#');
     $replaceBy = array('9aca7aca5', '9aca4aca1', '9aca12aca3');
     $content = str_replace($replaceTag, $replaceBy, $content);
     $content = preg_replace('#src[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'src="' . $GLOBALS['mosConfig_live_site'] . '/', $content);
     $content = preg_replace('#href[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'href="' . $GLOBALS['mosConfig_live_site'] . '/', $content);
     $content = str_replace($replaceBy, $replaceTag, $content);
     $content = preg_replace('#\\.(jpg|gif|jpeg|png)(?:(?!").)?"#', '.\\1"', $content);
     if (!$html) {
         $content = str_replace('&amp;', '&', $content);
     }
     if ($html) {
         $textonly = '';
         acajoom_mail::replaceClass($content, $textonly);
     }
     return $content;
 }
Ejemplo n.º 2
0
/**
* @copyright Copyright (C) 2009 Joobi Limited All rights reserved.
* @license This file is released under the GPL license (http://www.gnu.org/licenses )
* @link http://www.ijoobi.com
*/
function mailing($action, $task, $listId, $listType, $mailingId, $message)
{
    $showMailings = false;
    switch ($task) {
        case 'edit':
            if (ACA_CMSTYPE) {
                // joomla 15
                $issue_nb = intval(JRequest::getVar('issue_nb', 1));
            } else {
                //joomla 1x
                $issue_nb = intval(mosGetParam($_REQUEST, 'issue_nb', 1));
            }
            //endif
            $list = lists::getOneList($listId);
            $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new);
            $show = lisType::showType($mailing->list_type, 'editmailing');
            if ($mailing->published != 1 or $mailing->list_type != 1 or isset($show['admin']) and $show['admin']) {
                $forms['main'] = " <form action='index2.php' method='post' enctype='multipart/form-data' name='adminForm'> \n ";
                xmailing::_header($task, $action, $mailing->list_type, $message, 'edit');
                mailingsHTML::editMailing($mailing, $new, $listId, $forms, $show);
                $go[] = acajoom::makeObj('act', $action);
                backHTML::formEnd($go);
            } else {
                $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
                xmailing::_header($task, $action, $mailing->list_type, $message);
                //backHTML::formStart();
                mailingsHTML::viewMailing($mailing, $forms);
                $go[] = acajoom::makeObj('act', 'mailing');
                $go[] = acajoom::makeObj('task', 'viewmailing');
                $go[] = acajoom::makeObj('listid', $mailing->list_id);
                backHTML::formEnd($go);
            }
            break;
        case 'new':
        case 'add':
            if ($listId == 0) {
                echo "<script> alert('" . addslashes(_ACA_SELCT_MAILING) . "'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $total = xmailing::countMailings($listId, '');
                $total++;
                compa::redirect('index2.php?option=com_acajoom&act=mailing&task=edit&mailingid=0&issue_nb=' . $total . '&listid=' . $listId);
            }
            break;
        case 'saveSend':
            xmailing::saveMailing($mailingId, $listId);
        case 'sendNewsletter':
            if ($listId < 1 or $listType < 0) {
                $mailing = xmailing::getOneMailing('', $mailingId, '', $new, true);
                $listId = $mailing->list_id;
                $listType = $mailing->list_type;
            }
            if (lisType::sendType($listType)) {
                $checkStatus = lists::checkStatus($listId);
                if ($checkStatus == false) {
                    $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NOT_PUBLISHED);
                    $showMailings = true;
                } else {
                    $receivers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, 'sub_emailA');
                    if (empty($receivers)) {
                        $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NO_SUSCRIBERS);
                        $showMailings = true;
                    } else {
                        $status = queue::sendNewsletter(true, $mailingId, $listId, $receivers, $message);
                        $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message);
                        $showMailings = true;
                        flush();
                        sleep(5);
                        compa::redirect('index2.php?option=com_acajoom&act=mailing&listype=' . $listType, $message);
                    }
                }
            } else {
                if (class_exists('auto')) {
                    $message = acajoom::printYN(auto::processQueue(true), _ACA_QUEUE_SENT_SUCCESS, _ACA_ERROR);
                }
                $showMailings = true;
            }
            break;
        case 'savePreview':
            xmailing::saveMailing($mailingId, $listId);
        case 'preview':
            if (ACA_CMSTYPE) {
                // joomla 15
                $emailaddress = JRequest::getVar('emailaddress', '');
            } else {
                //joomla 1x
                $emailaddress = mosGetParam($_REQUEST, 'emailaddress', '');
            }
            //endif
            if (!empty($emailaddress)) {
                $status = xmailing::preview($mailingId, $listId, $message);
                $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message);
            }
            backHTML::_header(_ACA_PREVIEW_TITLE, 'preview_f2.png', $message, $task, $action);
            mailingsHTML::previewMailingHTML($mailingId, $listId, $listType);
            if ($listId > 0) {
                $archivemailing = xmailing::getMailingView($mailingId, $listId);
            } else {
                $archivemailing = xmailing::getMailingView($mailingId);
            }
            $forms['main'] = '';
            $list = lists::getOneList($archivemailing->list_id);
            $textonly = '';
            acajoom_mail::getContent($archivemailing->images, $list->layout, $archivemailing->htmlcontent, $textonly);
            acajoom_mail::replaceClass($archivemailing->htmlcontent, $textonly);
            mailingsHTML::viewMailing($archivemailing, $forms);
            break;
        case 'view':
            if ($mailingId != 0) {
                if ($listId > 0) {
                    $archivemailing = xmailing::getMailingView($mailingId, $listId);
                } else {
                    $archivemailing = xmailing::getMailingView($mailingId);
                }
                $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
                xmailing::_header($task, $action, $listType, $message);
                backHTML::formStart('', 0, '');
                mailingsHTML::viewMailing($archivemailing, $forms);
                $go[] = acajoom::makeObj('act', 'mailing');
                $go[] = acajoom::makeObj('task', 'viewmailing');
                $go[] = acajoom::makeObj('listid', $archivemailing->list_id);
                backHTML::formEnd($go);
            }
            break;
        case 'deleteMailing':
            $d['mailing'] = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::delete($d), @constant($GLOBALS[ACA . 'listname' . $d['mailing']->list_type]) . _ACA_SUCCESS_DELETED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cancel':
            compa::redirect('index2.php?option=com_acajoom');
            break;
        case 'copy':
            $message = acajoom::printYN(xmailing::copyMailing($mailingId), _ACA_MAILING_COPY, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cancelMailing':
            $showMailings = true;
            break;
        case 'publishMailing':
            $mailing = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::publishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_PUBLISHED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'unpublishMailing':
            $mailing = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::unpublishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_UNPUBLISHED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cpanel':
            backHTML::controlPanel();
            break;
        case 'save':
            $message = acajoom::printYN(xmailing::saveMailing($mailingId, $listId), _ACA_MAILING_SAVED, _ACA_ERROR);
            $showMailings = true;
            unset($GLOBALS["task"]);
            unset($_REQUEST["task"]);
            break;
        case 'show':
        default:
            $showMailings = true;
            break;
    }
    if ($showMailings) {
        xmailing::showMailings($task, $action, $listId, $listType, $message, true, _ACA_MENU_MAILING);
    }
    return true;
}
Ejemplo n.º 3
0
 function sendSchedule($d, $showHTML, $receivers, $list, &$message, &$max, $tags = null)
 {
     static $countEmails = 0;
     $mailing = $d['mailing'];
     $h = '';
     $xf = new xonfig();
     if (empty($mailing)) {
         $message = _ACA_NO_MAILING_ENTERED;
         return false;
     } elseif (empty($receivers)) {
         $message = _ACA_NO_ADDRESS_ENTERED;
         return false;
     } elseif (empty($list)) {
         $message = _ACA_NO_LIST_ENTERED;
         return false;
     } else {
         $message = '';
     }
     $mailingId = $mailing->id;
     $issue_nb = $mailing->issue_nb;
     $subject = $mailing->subject;
     $content = $mailing->htmlcontent;
     $textonly = $mailing->textonly;
     $fromname = $mailing->fromname;
     $fromemail = $mailing->fromemail;
     $images = $mailing->images;
     $listId = $list->id;
     $html = $list->html;
     $layout = $list->layout;
     $totalsofar = number_format(0, 4, ',', '');
     $nbPause = 0;
     $tags['issuenb'] = $issue_nb;
     //Just in case of...
     @ini_set('max_execution_time', 0);
     @ini_set('memory_limit', '128M');
     ignore_user_abort(true);
     ### create the mail
     $mail = acajoom_mail::getMailer($mailing);
     ### create content
     acajoom_mail::getContent($images, $layout, $content, $textonly, true);
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $starttime = $mtime;
     $html_sent = 0;
     $text_sent = 0;
     $size = sizeof($receivers);
     $format = defined('_DATE_FORMAT_LC') ? _DATE_FORMAT_LC : JText::_('DATE_FORMAT_LC');
     $log_detailed = "\r\n" . "\r\n" . '*** ' . strftime($format) . ' ***' . "\r\n";
     //variables used in integration of jLinks
     $mailCatID = null;
     $convertedLinks = null;
     foreach ($receivers as $receiver) {
         $tags['user_id'] = $receiver->user_id;
         if ($html && intval($receiver->receive_html) == 1) {
             $mail->IsHTML(true);
             $ashtml = 1;
             $Altbody = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, 0, $tags);
             $mail->AltBody = acajoom_mail::safe_utf8_encode($Altbody, $mail->CharSet);
             $html_sent++;
             $mail->Body = acajoom_mail::replaceTags($content, $receiver, $list, $mailingId, $ashtml, $tags);
             acajoom_mail::replaceClass($mail->Body, $mail->AltBody, $receiver);
         } else {
             $mail->IsHTML(false);
             $mail->AltBody = '';
             $ashtml = 0;
             $text_sent++;
             $mail->Body = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, $ashtml, $tags);
             $simpleText = '';
             acajoom_mail::replaceClass($mail->Body, $simpleText, $receiver);
         }
         $tname = explode(" ", $receiver->name);
         $firstname = $tname[0];
         $toUser = $GLOBALS[ACA . 'minisendmail'] ? '' : $receiver->name;
         $mail->AddAddress($receiver->email, $toUser);
         if (!empty($receiver->id)) {
             $mail->addCustomHeader("X-SubscriberID: {$receiver->id}");
         }
         $username = empty($receiver->username) ? $firstname : $receiver->username;
         $date = ACA_CMSTYPE ? JHTML::_('date', acajoom::getNow(), JText::_('DATE_FORMAT_LC1'), 0) : mosFormatDate(acajoom::getNow(), '', 0);
         $replaceWhat = array('[NAME]', '[FIRSTNAME]', '[USERNAME]', '[DATE]');
         $replaceBy = array($receiver->name, $firstname, $username, $date);
         $sujetReplaced = str_replace($replaceWhat, $replaceBy, $subject);
         if (class_exists('auto')) {
             auto::tags($sujetReplaced, $tags);
         }
         $mail->Subject = $sujetReplaced;
         if ($GLOBALS[ACA . 'embed_images']) {
             acajoom_mail::embedImages($mail);
         }
         $mailssend = $mail->Send();
         $countEmails++;
         if ($countEmails >= $GLOBALS[ACA . 'cron_max_emails']) {
             $max = true;
         }
         if (!$mailssend || $mail->error_count > 0) {
             static $info = false;
             if (!$info and acajoom::checkPermissions('admin')) {
                 echo '<br/>Mailer Error : ' . $mail->ErrorInfo;
                 echo " : Newsletter '{$sujetReplaced}' to {$receiver->email}";
                 $info = true;
             }
             $log_detailed .= '[' . $mailingId . '] ' . $subject . ' : ' . $receiver->email . ' -> ' . _ACA_MESSAGE_NOT . "\r\n" . _ACA_MAILER_ERROR . ': ' . $mail->ErrorInfo . "\r\n";
             if ($html && intval($receiver->receive_html) == 1) {
                 $html_sent--;
             } else {
                 $text_sent--;
             }
             if (!subscribers::validEmail($receiver->email, true)) {
                 $deleteQueue = array();
                 $deleteQueue[0] = queue::whatQID($mailingId, $receiver->id, $d['listype']);
                 queue::deleteQueues($deleteQueue);
             }
         } else {
             $log_detailed .= '[' . $mailingId . '] ' . $subject . ' : ' . $receiver->email . ' -> ' . _ACA_MESSAGE_SENT_SUCCESSFULLY . "\r\n";
             if ($GLOBALS[ACA . 'enable_statistics'] == 1 and $GLOBALS[ACA . 'statistics_per_subscriber'] == 1) {
                 xmailing::insertStats($mailingId, $receiver->id, $ashtml);
             }
             $d['qids'] = array();
             $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
             if ($d['listype'] == '2') {
                 $d['qids'][0] = queue::whatQID($mailingId, $receiver->id, $d['listype']);
                 $erro->ck = auto::updateAutoresponderSent($d);
                 $erro->Eck(__LINE__, '8137', $d);
             } elseif ($d['listype'] == '1' || $d['listype'] == '7') {
                 $d['qids'][0] = queue::whatQID($mailingId, $receiver->id, $d['listype']);
                 $erro->ck = queue::deleteQueues($d['qids']);
                 $erro->Eck(__LINE__, '8127', $d);
             }
         }
         $mail->ClearAddresses();
     }
     if ($GLOBALS[ACA . 'enable_statistics'] == 1) {
         xmailing::updateStatsGlobal($mailingId, $html_sent, $text_sent, false);
     }
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $endtime = $mtime;
     if ($totalsofar > 0) {
         $totaltime = $totalsofar;
         $totalstr = strval($totaltime);
     } else {
         $totaltime = number_format($endtime - $starttime - $nbPause * $GLOBALS[ACA . 'pause_time'], 4, ',', '');
         $totalstr = strval($totaltime);
     }
     $xf->plus('totalmailingsent' . $list->list_type, $html_sent + $text_sent);
     $xf->plus('totalmailingsent0', $html_sent + $text_sent);
     $log_simple = 'Time to send: ' . $totalstr . ' ' . _ACA_SECONDS . "\r\n" . 'Number of subscribers: ' . ($text_sent + $html_sent) . "\r\n" . 'HTML format: ' . $html_sent . "\r\n" . 'Text format: ' . $text_sent . "\r\n";
     $log_detailed = $log_simple . 'Details: ' . "\r\n" . $log_detailed . "\r\n";
     if (class_exists('lisType')) {
         acajoom_mail::writeLogs($list, $log_simple, $log_detailed);
     }
     if ($d['listype'] == '2') {
         echo '<br/>' . _ACA_QUEUE_AUTO_PROCESSED;
     } elseif ($d['listype'] == '1') {
         echo '<br/>' . _ACA_QUEUE_NEWS_PROCESSED;
     }
     if ($html_sent + $text_sent > 0) {
         return true;
     } else {
         $message = xmailing::M('no', _ACA_NO_MAILING_SENT);
         return false;
     }
 }
Ejemplo n.º 4
0
 function mailingOptions($action, $task, $listId, $mailingId, $subscriberId, $listType)
 {
     global $Itemid;
     if (ACA_CMSTYPE) {
         // joomla 15
         $acl =& JFactory::getACL();
         $database =& JFactory::getDBO();
         $my =& JFactory::getUser();
     } else {
         //joomla 1x
         global $acl, $database, $my;
     }
     //endif
     if ($listType < 1) {
         if (isset($_POST['droplist'])) {
             $maliste = explode('-', $_POST['droplist']);
             $listType = $maliste[0];
             $listId = $maliste[1];
         } elseif ($listId > 0) {
             $maliste = lists::getLists($listId, 0, null, 'listnameA', false, false, false, false);
             $listType = $maliste[0]->list_type;
         }
     }
     switch ($task) {
         case 'edit':
             frontEnd::mailingEdit($subscriberId, $mailingId, $listId, $listType, 'savemailing');
             break;
         case 'new':
         case 'add':
             break;
         case 'archive':
             if (class_exists('pro')) {
                 $gidFront = $acl->get_group_id('Public Frontend', 'ARO');
                 if (isset($my->id) && $my->id > 0) {
                     $aro_id = $acl->get_object_id('users', $my->id, 'ARO');
                     $qacl = "SELECT `group_id` FROM `#__core_acl_groups_aro_map` WHERE `aro_id` =" . $aro_id;
                     $database->setQuery($qacl);
                     $gidd = $database->loadResult();
                 } else {
                     $gidd = $gidFront;
                 }
                 $gid = $gidd > 0 ? $gidd : $gidFront;
                 $ex_groups = $acl->get_group_parents($gid, 'ARO', 'RECURSE');
                 $gidAdmin = $acl->get_group_id('Public Backend', 'ARO');
                 if (in_array($gidAdmin, $ex_groups)) {
                     $ex_groups2 = $acl->get_group_children($gidFront, 'ARO', 'RECURSE');
                     $ex_groups2[] = $gidFront;
                     $ex_groups = array_merge($ex_groups, $ex_groups2);
                 }
                 $ex_groups[] = $gid;
                 $list = lists::getOneList($listId);
                 if (!in_array($list->acc_id, $ex_groups)) {
                     break;
                 }
             }
             frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, true, _ACA_MENU_VIEW_ARCHIVE . ' ');
             break;
         case 'view':
             if ($mailingId != 0) {
                 if ($listId > 0) {
                     $archivemailing = xmailing::getMailingView($mailingId, $listId);
                 } else {
                     $archivemailing = xmailing::getMailingView($mailingId);
                 }
                 acajoom_mail::replaceClass($archivemailing->htmlcontent, $archivemailing->textonly);
                 $archivemailing->htmlcontent = str_replace('[SUBSCRIPTIONS]', '', $archivemailing->htmlcontent);
                 $linkZ = '.php?option=com_acajoom';
                 compa::completeLink($linkZ, false);
                 $forms['main'] = '<form method="post" action="' . $linkZ . '" onsubmit="submitbutton();return false;" name="mosForm" >' . "\n\r";
                 $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
                 frontHTML::formStart($archivemailing->subject, 0, '');
                 mailingsHTML::viewMailing($archivemailing, $forms);
                 $go[] = acajoom::makeObj('act', 'mailing');
                 $go[] = acajoom::makeObj('task', 'viewmailing');
                 $go[] = acajoom::makeObj('listid', $archivemailing->list_id);
                 frontHTML::formEnd('', $go);
             } else {
                 frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, false, _ACA_MENU_MAILING);
             }
             break;
         default:
             if (acajoom::checkPermissions('Registered')) {
                 frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, false, _ACA_MENU_MAILING);
             }
             $link = '.php?option=com_acajoom&act=mailing&task=edit&listid=' . $listId . '&listype=' . $listType . '&Itemid=' . $Itemid;
             compa::completeLink($link, false);
             if ($listType > 0 and $listId > 0) {
                 echo '<br/><a href="' . $link . '"><span style="font-weight: bold;">' . _ACA_MAILING_NEW_FRONT . '</span></a><br/>';
             }
             break;
     }
     return true;
 }