Example #1
0
 /**
  * Runs this cron task.
  *
  * @return null
  */
 public function run()
 {
     if (!class_exists('queue')) {
         include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
     }
     $queue = new \queue();
     $queue->process();
 }
Example #2
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;
     if (ini_get('safe_mode')) {
     } else {
         @set_time_limit(60 * $GLOBALS[ACA . 'script_timeout']);
     }
     ignore_user_abort(true);
     ### create the mail
     $mail = acajoom_mail::getMailer($mailing);
     ### create content
     acajoom_mail::getContent($images, $layout, $content, $textonly);
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $starttime = $mtime;
     $html_sent = 0;
     $text_sent = 0;
     $size = sizeof($receivers);
     $log_detailed = "\r\n" . "\r\n" . '*** ' . strftime(_DATE_FORMAT_LC) . ' ***' . "\r\n";
     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);
         } else {
             $mail->IsHTML(false);
             $mail->AltBody = '';
             $ashtml = 0;
             $text_sent++;
             $mail->Body = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, $ashtml, $tags);
             // if we are in TEXT Mode, Why do we add embedded images???
             if (!empty($images)) {
                 foreach ($images as $image) {
                     $img = explode('|', $image);
                     $attrib = explode("/", $img[0]);
                     $path = $GLOBALS['mosConfig_absolute_path'] . '/images/stories/';
                     if (count($img) == 1) {
                         $imageName = $img[0];
                     } else {
                         $imageName = $attrib[count($attrib) - 1];
                         for ($index = 0; $index < sizeof($attrib) - 1; $index++) {
                             $path .= $attrib[$index] . '/';
                         }
                     }
                     $mail->AddAttachment($path . $imageName);
                 }
             }
         }
         $tname = explode(" ", $receiver->name);
         $firstname = $tname[0];
         $mail->AddAddress($receiver->email, $receiver->name);
         $sujetReplaced = str_replace('[NAME]', $receiver->name, $subject);
         $sujetReplaced = str_replace('[FIRSTNAME]', $firstname, $sujetReplaced);
         if (class_exists('auto')) {
             auto::tags($sujetReplaced, $tags);
         }
         $mail->Subject = $sujetReplaced;
         $mailssend = $mail->Send();
         $countEmails++;
         if ($countEmails >= $GLOBALS[ACA . 'cron_max_emails']) {
             $max = true;
         }
         if ($mail->error_count > 0) {
             static $info = false;
             if (!$info and acajoom::checkPermissions('admin')) {
                 echo '<br/>Mailer Error : ' . $mail->ErrorInfo;
                 $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--;
             }
         } 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);
     }
     if ($GLOBALS[ACA . 'send_data'] == 1) {
         acajoom_mail::sendReport($fromemail, $totalstr, $html_sent, $text_sent);
     }
     $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;
     }
 }
Example #3
0
}
/**
* Run cron-like action
* Real cron-based layer will be introduced in 3.2
*/
switch ($cron_type) {
    case 'queue':
        if (time() - $config['queue_interval'] <= $config['last_queue_run'] || !file_exists($phpbb_root_path . 'cache/queue.' . $phpEx)) {
            break;
        }
        // A user reported using the mail() function while using shutdown does not work. We do not want to risk that.
        if ($use_shutdown_function && !$config['smtp_delivery']) {
            $use_shutdown_function = false;
        }
        include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
        $queue = new queue();
        if ($use_shutdown_function) {
            register_shutdown_function(array(&$queue, 'process'));
        } else {
            $queue->process();
        }
        break;
    case 'tidy_cache':
        if (time() - $config['cache_gc'] <= $config['cache_last_gc'] || !method_exists($cache, 'tidy')) {
            break;
        }
        if ($use_shutdown_function) {
            register_shutdown_function(array(&$cache, 'tidy'));
        } else {
            $cache->tidy();
        }
Example #4
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 subscribers($action, $task, $userid, $listId, $cid)
{
    $erro = new xerr(__FILE__, __FUNCTION__);
    if (ACA_CMSTYPE) {
        // joomla 15
        $subscriberId = intval(JRequest::getVar('subscriber_id', ''));
        $message = JRequest::getVar('message', '');
    } else {
        //joomla 1x
        $subscriberId = intval(mosGetParam($_REQUEST, 'subscriber_id', ''));
        $message = mosGetParam($_REQUEST, 'message', '');
    }
    //endif
    $doShowSubscribers = true;
    subscribers::updateSubscribers();
    switch ($task) {
        case 'updateOneSub':
            $doShowSubscribers = true;
            $message = acajoom::printYN(subscribers::updateOneSubscriber(), _ACA_UPDATED_SUCCESSFULLY, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'deleteOneSub':
            $doShowSubscribers = true;
            $message = acajoom::printYN(subscribers::deleteOneSubscriber($subscriberId), _ACA_SUBSCRIBER_DELETED, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'cancelSub':
            $doShowSubscribers = true;
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'edit':
            foreach ($cid as $id) {
                compa::redirect('index2.php?option=com_acajoom&act=subscribers&task=show&userid=' . $id);
            }
            break;
        case 'show':
            $doShowSubscribers = false;
            $qid[0] = $userid;
            $subscriber = subscribers::getSubscribersFromId($qid, false);
            $lists = lists::getLists(0, 0, 1, '', false, false);
            $queues = queue::getSubscriberLists($userid);
            $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n";
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            backHTML::formStart('', 0, '');
            echo subscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, acajoom::checkPermissions('admin'), false, false);
            $go[] = acajoom::makeObj('act', $action);
            $go[] = acajoom::makeObj('subscriber_id', $subscriber->id);
            $go[] = acajoom::makeObj('user_id', $subscriber->user_id);
            backHTML::formEnd($go);
            break;
        case 'new':
        case 'add':
            $doShowSubscribers = false;
            $newSubscriber->id = '';
            $newSubscriber->user_id = 0;
            $newSubscriber->name = '';
            $newSubscriber->email = '';
            $newSubscriber->receive_html = 1;
            $newSubscriber->confirmed = 1;
            $newSubscriber->blacklist = 0;
            $newSubscriber->timezone = '00:00:00';
            $newSubscriber->language_iso = 'eng';
            $newSubscriber->params = '';
            $newSubscriber->subscribe_date = acajoom::getNow();
            $lists = lists::getLists(0, 0, 1, '', false, false);
            $queues = '';
            $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n";
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            backHTML::formStart('', 0, '');
            echo subscribersHTML::editSubscriber($newSubscriber, $lists, $queues, $forms, acajoom::checkPermissions('admin'), false, false);
            $go[] = acajoom::makeObj('act', $action);
            $go[] = acajoom::makeObj('subscriber_id', $newSubscriber->id);
            $go[] = acajoom::makeObj('user_id', $newSubscriber->user_id);
            backHTML::formEnd($go);
            break;
        case 'doNew':
            $doShowSubscribers = true;
            $message = acajoom::printYN(subscribers::insertOneSubscriber(), _ACA_UPDATED_SUCCESSFULLY, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'delete':
            if (!is_array($cid) || count($cid) < 1) {
                echo "<script> alert('Select an item to delete'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $status = true;
                foreach ($cid as $id) {
                    $erro->ck = subscribers::deleteOneSubscriber($id);
                    if (!$erro->ck) {
                        $status = false;
                    }
                }
                $message = acajoom::printYN($status, _ACA_SUBSCRIBER_DELETED, _ACA_ERROR);
                backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            }
            break;
        case 'update':
            if (!is_array($cid) || count($cid) < 1) {
                echo "<script> alert('Select an item to update'); window.history.go(-1);</script>\n";
                return false;
            } else {
                foreach ($cid as $id) {
                    if (ACA_CMSTYPE) {
                        // joomla 15
                        $changes = JRequest::getVar($id, array(0));
                    } else {
                        //joomla 1x
                        $changes = mosGetParam($_REQUEST, $id, array(0));
                    }
                    //endif
                    if (!isset($changes['receive_html'])) {
                        $changes['receive_html'] = 0;
                    }
                    if (!isset($changes['confirmed'])) {
                        $changes['confirmed'] = 0;
                    }
                }
            }
            $message = acajoom::print_message(_ACA_UPDATED_SUCCESSFULLY, 1);
            break;
        case 'export':
            $doShowSubscribers = false;
            subscribersHTML::export($action, $listId);
            break;
        case 'doExport':
            $message = acajoom::printYN(subscribers::export($listId), _EXPORT, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'import':
            $doShowSubscribers = false;
            $lists = lists::getLists(0, 0, 1, 'listnameA', false, false, true);
            subscribersHTML::import($action, $lists);
            break;
        case 'doImport':
            $message = acajoom::printYN(subscribers::import($listId), _ACA_IMPORT_FINISHED, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
            break;
        case 'subscribeAll':
            break;
        case 'unsubscribeAll':
            break;
        case 'cancel':
            if ($listId != 0) {
                $listId = 0;
            } else {
                compa::redirect('index2.php?option=com_acajoom');
            }
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'cpanel':
            backHTML::controlPanel();
            $doShowSubscribers = 0;
            break;
        default:
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
    }
    if ($doShowSubscribers) {
        if (ACA_CMSTYPE) {
            // joomla 15
            $start = intval(JRequest::getVar('start', 0));
            $conf =& JFactory::getConfig();
            $mail->Mailer = $conf->getValue('config.mailer');
            // $GLOBALS['mosConfig_mailer'];
            $limit = intval(JRequest::getVar('limit', $conf->getValue('config.list_limit')));
            $emailsearch = JRequest::getVar('emailsearch', '');
        } else {
            //joomla 1x
            $mail->Mailer = $GLOBALS['mosConfig_mailer'];
            $start = intval(mosGetParam($_REQUEST, 'start', 0));
            $limit = intval(mosGetParam($_REQUEST, 'limit', $GLOBALS['mosConfig_list_limit']));
            $emailsearch = mosGetParam($_REQUEST, 'emailsearch', '');
        }
        //endif
        $total = 0;
        $subscribers = subscribers::getSubscribers($start, $limit, $emailsearch, $total, $listId, '', '', '', 'sub_dateD');
        if ($listId != 0) {
            $showAdmin = true;
        } else {
            $showAdmin = false;
        }
        $dropDownList = lisType::getListsDropList(0, '', '');
        if (ACA_CMSTYPE) {
            // joomla 15
            $lists['listid'] = JHTML::_('select.genericlist', $dropDownList, 'listid', 'class="inputbox" size="1" onchange="document.AcajoomFilterForm.submit();"', 'id', 'list_name', $listId);
        } else {
            //joomla 1x
            $lists['listid'] = mosHTML::selectList($dropDownList, 'listid', 'class="inputbox" size="1" onchange="document.AcajoomFilterForm.submit();"', 'id', 'list_name', $listId);
        }
        //endif
        $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n";
        $forms['select'] = " <form action='index2.php' method='post' name='AcajoomFilterForm'> \n";
        backHTML::formStart('show_mailing', 0, '');
        subscribersHTML::showSubscribers($subscribers, $action, $listId, $lists, $start, $limit, $total, $showAdmin, $listId, $emailsearch, $forms);
    }
    return true;
}
Example #5
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;
     }
 }
Example #6
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;
}
function script_close($save = true)
{
    global $_CORE_CONFIG, $site_file_root, $_CLASS;
    if (!empty($_CLASS['core_user'])) {
        // phpbb 2.1.2 only remove.
        if (file_exists($site_file_root . 'cache/queue.php')) {
            require_once $site_file_root . 'includes/forums/functions_messenger.php';
            $queue = new queue();
            $queue->process();
        }
        if ($save) {
            //if ($_CLASS['core_user']->is_admin && $_CORE_CONFIG['server']['error_options'])
            if ($_CORE_CONFIG['server']['error_options']) {
                if (!empty($_CLASS['core_db']->query_list)) {
                    $_CLASS['core_user']->session_data_set('query_list', $_CLASS['core_db']->query_list);
                    $_CLASS['core_user']->session_data_set('query_details', $_CLASS['core_db']->query_details);
                }
                if (isset($_CLASS['core_error_handler']) && !empty($_CLASS['core_error_handler']->error_array)) {
                    $_CLASS['core_user']->session_data_set('debug', $_CLASS['core_error_handler']->error_array);
                }
            }
            $_CLASS['core_user']->save();
        }
    }
    if (!empty($_CLASS['core_cache'])) {
        $_CLASS['core_cache']->save();
    }
    if (!empty($_CLASS['core_db'])) {
        $_CLASS['core_db']->disconnect();
    }
    if (!empty($_CLASS['core_error_handler'])) {
        $_CLASS['core_error_handler']->stop();
    }
    die;
}
Example #8
0
 function getEditTab($tab, $user, $ui)
 {
     global $Itemid;
     if (ACA_CMSTYPE) {
         // joomla 15
         $my =& JFactory::getUser();
         if ($my->get('id') < 1) {
             echo JText::_('ALERTNOTAUTH');
             echo "<br />" . JText::_('You need to login.');
             return false;
         }
     } else {
         //joomla 1x
         global $my;
         if (intval($my->id) < 1) {
             mosNotAuth();
             return false;
         }
     }
     //endif
     if (!getAcajoomTab::checkInstalled()) {
         return _UE_NEWSLETTERNOTINSTALLED;
     }
     $html = '';
     require_once ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php';
     require_once ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/subscribers.acajoom.html.php';
     if (!empty($user->id)) {
         $userId = $user->id;
         $subscriber = subscribers::getSubscriberInfoFromUserId($userId);
         if (empty($subscriber)) {
             subscribers::syncSubscribers(true);
             $subscriber = subscribers::getSubscriberInfoFromUserId($userId);
         }
         $subscriberId = $subscriber->id;
         $queues = queue::getSubscriberLists($subscriberId);
         $access = acajoom::checkPermissions('admin', $my->id);
     } else {
         $userId = 0;
         $queues = '';
         $access = false;
         $subscriberId = 0;
         $subscriber->id = '';
         $subscriber->user_id = 0;
         $subscriber->name = '';
         $subscriber->email = '';
         $subscriber->receive_html = 1;
         $subscriber->confirmed = 1;
         $subscriber->blacklist = 0;
         $subscriber->timezone = '00:00:00';
         $subscriber->language_iso = 'eng';
         $subscriber->params = '';
         $subscriber->subscribe_date = acajoom::getNow();
     }
     $lists = lists::getLists(0, 0, $subscriberId, '', false, true, false);
     $doShowSubscribers = false;
     $mainLink = '.php?option=com_acajoom';
     $selectLink = '.php?option=com_acajoom&act=subscriber';
     compa::completeLink($mainLink, false);
     compa::completeLink($selectLink, false);
     $forms['main'] = '<form method="post" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="mosForm" >' . "\n\r";
     $forms['select'] = '<form method="post" action="' . $selectLink . '"  name="AcajoomFilterForm">';
     $html .= subscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, $access, false, true);
     //$html .= '<input type="hidden" name="Itemid" value="'.$Itemid.'" />';
     $html .= '<input type="hidden" name="subscriber_id" value="' . $subscriber->id . '" />';
     return $html;
 }
Example #9
0
    function create()
    {
        global $my, $mainframe;
        $Itemid = $GLOBALS[ACA . 'itemidAca'];
        if (!empty($Itemid)) {
            $item = '&Itemid=' . $Itemid;
        } else {
            $item = '';
        }
        $hidden = '';
        $htmlOK = false;
        $h = '';
        if (!empty($this->lists)) {
            if ($my->id > 0) {
                $loggedin = true;
                $subscriber = subscribers::getSubscriberInfoFromUserId($my->id);
            } else {
                $loggedin = false;
            }
            if (!$loggedin and $GLOBALS[ACA . 'allow_unregistered'] and $this->num == 1) {
                $h .= '
				<script language="javascript" type="text/javascript">
					function submitacajoommod(formname) {
						var form = eval(\'document.\'+formname);' . 'var place = form.email.value.indexOf("@",1);' . 'var point = form.email.value.indexOf(".",place+1);';
                if ($this->shownamefield) {
                    $h .= '
						if (form.name.value == "" || form.name.value == "' . addslashes(_ACA_NAME) . '") {
							alert( "' . addslashes(_ACA_REGWARN_NAME) . '" );' . 'return false;
						} else
				';
                }
                $h .= ' if (form.email.value == "" || form.email.value == "' . addslashes(_ACA_EMAIL) . '") {' . 'alert( "' . addslashes(_ACA_REGWARN_MAIL) . '" );' . 'return false;
						} else {' . 'if ((place > -1)&&(form.email.value.length >2)&&(point > 1)){' . 'form.submit();' . 'return true;
							} ' . 'else {' . 'alert( "' . addslashes(_ACA_REGWARN_MAIL) . '" );' . 'return false;' . '}' . '}' . '}' . '</script>';
            }
            mosCommonHTML::loadOverlib();
            $h .= '<link rel="stylesheet" href="' . $GLOBALS['mosConfig_live_site'] . '/components/com_acajoom/css/acajoom.css" type="text/css" >';
            $linkForm = 'index.php?option=com_acajoom';
            if ($GLOBALS[ACA . 'use_sef'] and function_exists('sefRelToAbs')) {
                $h .= '<form action="' . sefRelToAbs($linkForm) . '" method="post" name="modacajoomForm' . $this->num . '">
			<div class="' . $this->moduleclass_sfx . '" style="text-align:' . $this->mod_align . '">';
            } else {
                $h .= '<form action="' . $linkForm . '" method="post" name="modacajoomForm' . $this->num . '">
			<div class="' . $this->moduleclass_sfx . '" style="text-align:' . $this->mod_align . '">';
            }
            if (!empty($this->introtext)) {
                $text = '<span class="pretext' . $this->moduleclass_sfx . '">' . $this->introtext . '</span>';
                $h .= acajoom::printLine($this->linear, $text);
            }
            $i = 0;
            $accessLevel = 0;
            if ($loggedin) {
                $queues = queue::getSubscriberLists($subscriber->id);
            } else {
                $queues = '';
            }
            if ($this->showListName) {
                foreach ($this->lists as $list) {
                    $i++;
                    $subscribed = 0;
                    $accessLevel = 0;
                    if ($loggedin) {
                        if (!empty($queues)) {
                            foreach ($queues as $queue) {
                                if ($list->id == $queue->list_id) {
                                    $subscribed = 1;
                                    $accessLevel = $queue->acc_level;
                                }
                            }
                        }
                    }
                    if ($list->html == 1) {
                        $htmlOK = true;
                    }
                    $checked = 0;
                    if ($loggedin) {
                        $checked = $subscribed;
                    } else {
                        if ($this->defaultchecked) {
                            $checked = 1;
                        }
                        $subscriber->blacklist = 0;
                    }
                    if ($checked != 0) {
                        $checkedPrint = ' checked="checked" ';
                    } else {
                        $checkedPrint = '';
                    }
                    if ($list->hidden == 1) {
                        if ($subscriber->blacklist == 0) {
                            $text = "\n" . '<input id="wz_3' . $i . '" type="checkbox" class="inputbox" value="1" name="subscribed[' . $i . ']" ' . $checkedPrint . ' />';
                        } else {
                            $text = "\n" . '<input type="checkbox" class="inputbox" value="1" name="subscribedfake[' . $i . ']" ' . $checkedPrint . '  />';
                            $text .= "\n" . '<input type="hidden" value="0" name="subscribed[' . $i . ']"  />';
                        }
                        $text .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />';
                        $link = ($list->list_type == '1' or $list->list_type == '7') && $GLOBALS[ACA . 'show_archive'] ? 'index.php?option=com_acajoom' . $item . '&act=mailing&task=archive&listid=' . $list->id . '&listype=' . $list->list_type : '#';
                        $text .= "\n" . '<span class="aca_list_name"';
                        if ($link == "#") {
                            $text .= " onClick='return false;' ";
                        }
                        $text .= '>' . compa::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, $link, 1) . '</span>';
                        $h .= acajoom::printLine($this->linear, $text);
                        $h .= "\n" . '<input type="hidden" name="acc_level[' . $i . ']" value="' . $accessLevel . '" />' . "\n\r";
                    } else {
                        if (!$loggedin) {
                            $h .= '<input type="hidden"  value="' . $checked . '" name="subscribed[' . $i . ']" />';
                            $h .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />';
                        }
                    }
                }
            } else {
                foreach ($this->lists as $list) {
                    $i++;
                    $subscribed = 0;
                    $accessLevel = 0;
                    if ($loggedin) {
                        if (!empty($queues)) {
                            foreach ($queues as $queue) {
                                if ($list->id == $queue->list_id) {
                                    $subscribed = 1;
                                    $accessLevel = $queue->acc_level;
                                }
                            }
                        }
                    }
                    if ($list->html == 1) {
                        $htmlOK = true;
                    }
                    $checked = 0;
                    if ($loggedin) {
                        $checked = $subscribed;
                    } else {
                        if ($this->defaultchecked) {
                            $checked = 1;
                        }
                    }
                    $h .= '<input type="hidden"  value="' . $checked . '" name="subscribed[' . $i . ']" />';
                    $h .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />';
                    $h .= "\n" . '<input type="hidden" name="acc_level[' . $i . ']" value="' . $accessLevel . '" />';
                    if ($list->html == 1) {
                        $htmlOK = true;
                    }
                }
            }
            if (!$loggedin) {
                if ($GLOBALS[ACA . 'allow_unregistered']) {
                    if ($this->shownamefield) {
                        $text = '<input id="wz_11" type="text" size="' . $this->fieldsize . '" value="' . addslashes(_ACA_NAME) . '" class="inputbox" name="name" onblur="if(this.value==\'\') this.value=\'' . addslashes(_ACA_NAME) . '\';" onfocus="if(this.value==\'' . addslashes(_ACA_NAME) . '\') this.value=\'\' ; " />';
                        $h .= acajoom::printLine($this->linear, $text);
                    } else {
                        $text = '<input id="wz_11" type="hidden" value="" name="name" />';
                    }
                    $text = '<input id="wz_12" type="text" size="' . $this->fieldsize . '" value="' . addslashes(_ACA_EMAIL) . '" class="inputbox" name="email" onblur="if(this.value==\'\') this.value=\'' . addslashes(_ACA_EMAIL) . '\';" onfocus="if(this.value==\'' . addslashes(_ACA_EMAIL) . '\') this.value=\'\' ; " />';
                    $h .= acajoom::printLine($this->linear, $text);
                } else {
                    $h .= acajoom::printLine($this->linear, acajoom::printM('green', _ACA_REGISTER_REQUIRED));
                    $text = _NO_ACCOUNT . " ";
                    if (isset($GLOBALS[ACA . 'cb_integration']) && $GLOBALS[ACA . 'cb_integration']) {
                        $linkme = 'index.php?option=com_comprofiler&amp;task=registers';
                    } else {
                        $linkme = 'index.php?option=com_registration&amp;task=register';
                    }
                    if ($GLOBALS[ACA . 'use_sef'] and function_exists('sefRelToAbs')) {
                        $text .= '<a href="' . sefRelToAbs($linkme) . '">';
                    } else {
                        $text .= '<a href="' . $linkme . '">';
                    }
                    $text .= _CREATE_ACCOUNT . "</a>";
                    $h .= acajoom::printLine($this->linear, $text);
                    $htmlOK = false;
                }
            }
            if ($htmlOK) {
                if ($loggedin and !empty($subscriber)) {
                    $checked = $subscriber->receive_html;
                } else {
                    $checked = $this->receivehtmldefault;
                }
                if ($this->showreceivehtml) {
                    if ($checked != 0) {
                        $checkedPrint = ' checked="checked" ';
                    } else {
                        $checkedPrint = '';
                    }
                    $text = '<input id="wz_2" type="checkbox" class="inputbox" value="1" name="receive_html" ' . $checkedPrint . ' />';
                    $text .= ' ' . _ACA_RECEIVE_HTML;
                    $h .= acajoom::printLine($this->linear, $text);
                } else {
                    $hidden .= '<input id="wz_2" type="hidden" value="' . $checked . '" name="receive_html" />' . "\n";
                }
            } else {
                $hidden .= '<input id="wz_2" type="hidden" value="0" name="receive_html" />' . "\n";
            }
            if (!empty($this->posttext)) {
                $text = '<span class="postext' . $this->moduleclass_sfx . '">' . $this->posttext . '</span>';
                $h .= acajoom::printLine($this->linear, $text);
            }
            if (!$loggedin) {
                if ($GLOBALS[ACA . 'allow_unregistered']) {
                    if (isset($this->imgUnregistered)) {
                        $text = '<input id="aca_22" type="image" src="' . $this->imgUnregistered . '" value="' . $this->buttonUnregistered . '" alt="' . $this->buttonUnregistered . '" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />';
                    } else {
                        $text = '<input id="aca_22" type="button" value="' . $this->buttonUnregistered . '" class="button" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />';
                    }
                    $h .= acajoom::printLine($this->linear, $text);
                    $h .= '
					</div>
						<input type="hidden" name="act" value="subscribe" />
						<input type="hidden" name="redirectlink" value="' . $this->redirectURL . '" />
						<input type="hidden" name="listname" value="' . $this->showListName . '" />
					';
                } else {
                    $h .= '</div>';
                }
            } else {
                if (isset($this->notifType) and $subscribed) {
                    if (isset($this->imgUnregistered)) {
                        $text = '<input id="aca_22" type="image" src="' . $this->imgUnregistered . '" value="' . $this->buttonUnregistered . '" alt="' . $this->buttonUnregistered . '" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />';
                    } else {
                        $text = '<input id="aca_22" type="button" value="' . $this->buttonUnregistered . '" class="button" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />';
                    }
                    $h .= acajoom::printLine($this->linear, $text);
                    $h .= '
					</div>
						<input type="hidden" name="act" value="subscribe" />
						<input type="hidden" name="redirectlink" value="' . $this->redirectURL . '" />
						<input type="hidden" name="listname" value="' . $this->showListName . '" />
					';
                } else {
                    if (isset($this->imgRegistered)) {
                        $text = '<input id="aca_22" type="image" src="' . $this->imgRegistered . '" value="' . $this->buttonRegistered . '" alt="' . $this->buttonRegistered . '" name="' . $this->buttonRegistered . '">';
                    } else {
                        $text = '<input id="aca_22"  type="submit" value="' . $this->buttonRegistered . '" name="' . $this->buttonRegistered . '" class="button" />';
                    }
                    $h .= acajoom::printLine($this->linear, $text);
                    $h .= '
					</div>
						<input type="hidden" name="act" value="updatesubscription" />
						<input type="hidden" name="redirectlink" value="' . $this->redirectURL . '" />
						<input type="hidden" name="listname" value="' . $this->showListName . '" />
					';
                }
            }
            $h .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
            $h .= $hidden . '</form>';
        } else {
            $h .= acajoom::printM('blue', _ACA_LIST_NOT_AVAIL);
        }
        $this->_content = $h;
        return $h;
    }
Example #10
0
 function upgrade_News3()
 {
     global $my, $database;
     $xf = new xonfig();
     $newLists = array();
     $idImportedList = array();
     $i = 0;
     $database->setQuery("SELECT * FROM #__newsletter_letters");
     $newsletters = $database->loadObjectList();
     $error = $database->getErrorMsg();
     if (!empty($error)) {
         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error getting newsletters. Database error: <br />' . $error . '</p>';
         return false;
     } else {
         foreach ($newsletters as $newsletter) {
             $list->list_name = $newsletter->list_name;
             $list->list_desc = $newsletter->list_desc;
             $list->sendername = $newsletter->sendername;
             $list->senderemail = $newsletter->senderemail;
             $list->bounceadres = $newsletter->bounceadres;
             $list->layout = $newsletter->layout;
             $list->template = 0;
             $list->subscribemessage = $newsletter->subscribemessage;
             $list->unsubscribemessage = $newsletter->unsubscribemessage;
             $list->html = $newsletter->html;
             $list->hidden = !$newsletter->hidden;
             $list->unsubscribesend = 1;
             $list->list_type = '1';
             $list->auto_add = 0;
             $list->user_choose = 0;
             $list->cat_id = 0;
             $list->delay_min = 0;
             $list->delay_max = 0;
             $list->follow_up = 0;
             $list->owner = $my->id;
             $list->auto_add = 0;
             $list->acc_level = $newsletter->aid;
             $list->acc_id = 29;
             $list->published = 1;
             $list->createdate = acajoom::getNow();
             $list->footer = 1;
             $list->notify_id = 0;
             $list->notification = 0;
             $query = 'INSERT INTO `#__acajoom_lists` (`list_name`) VALUES (\'' . $list->list_name . '\'  )';
             $database->setQuery($query);
             $database->query();
             $error = $database->getErrorMsg();
             if (!empty($error)) {
                 echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error adding list to database. Database error: <br />' . $error . '</p><br /><br />Are you trying to insert a list name which is already in use?    The list name has to be different for each list! <br /><br />';
             } else {
                 $query = 'SELECT * FROM `#__acajoom_lists` WHERE `list_name`= \'' . $list->list_name . '\'';
                 $database->setQuery($query);
                 $database->loadObject($mynewlist);
                 $error = $database->getErrorMsg();
                 $xf->plus('totallist0', 1);
                 $xf->plus('act_totallist0', 1);
                 $xf->plus('totallist1', 1);
                 $xf->plus('act_totallist1', 1);
                 if (!empty($error)) {
                     echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting listname. Database error: <br />' . $error . '</p>';
                     return false;
                 } else {
                     $idImportedList[$newsletter->id] = $mynewlist->id;
                     $newLists[$i] = $mynewlist->id;
                     $i++;
                     $list->id = $mynewlist->id;
                     $error = lists::updateListData($list);
                     if (!$error) {
                         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting list. Database error: <br />' . $error . '</p>';
                     } else {
                         echo '<br /><b>' . @constant($GLOBALS[ACA . 'listnames1']) . ': </b>' . $list->list_name . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS);
                         $database->setQuery("SELECT * FROM #__newsletter_mailing WHERE `list_id`=" . $newsletter->id);
                         $mailingsImports = $database->loadObjectList();
                         $error = $database->getErrorMsg();
                         if (!empty($error)) {
                             echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting mailings. Database error: <br />' . $error . '</p>';
                             return false;
                         } else {
                             $issue_nb = 1;
                             foreach ($mailingsImports as $mailingsImport) {
                                 $mailings->list_id = $mynewlist->id;
                                 $mailings->list_type = '1';
                                 $mailings->send_date = $mailingsImport->send_date;
                                 $mailings->subject = $mailingsImport->subject;
                                 $mailings->htmlcontent = $mailingsImport->htmlcontent;
                                 $mailings->textonly = $mailingsImport->textonly;
                                 $mailings->attachments = $mailingsImport->attachments;
                                 $mailings->images = $mailingsImport->images;
                                 $mailings->published = $mailingsImport->published;
                                 $mailings->visible = $mailingsImport->visible;
                                 $mailings->html = $mynewlist->html;
                                 $mailings->fromname = $list->sendername;
                                 $mailings->fromemail = $list->senderemail;
                                 $mailings->frombounce = $list->bounceadres;
                                 $mailings->author_id = $my->id;
                                 $mailings->delay = 0;
                                 $mailings->issue_nb = $issue_nb;
                                 $mailings->acc_level = 25;
                                 $mailings->createdate = $list->createdate;
                                 $issue_nb++;
                                 $error = xmailing::insertMailingData($mailings);
                                 if (!$error) {
                                     echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error inserting mailing. Database error: <br />' . $error . '</p>';
                                 } else {
                                     echo '<br /><b>' . _ACA_MENU_MAILING_TITLE . ': </b>' . $mailingsImport->subject . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS);
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $database->setQuery("SELECT * FROM #__newsletter_subscribers");
         $subscribers = $database->loadObjectList();
         $error = $database->getErrorMsg();
         if (!empty($error)) {
             echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting subscribers. Database error: <br />' . $error . '</p>';
             return false;
         } else {
             foreach ($subscribers as $subscriber) {
                 $newSubs = true;
                 $acajoomsubscribers = subscribers::getSubscribers(-1, -1, '', $total, 0, '', '', '', '');
                 foreach ($acajoomsubscribers as $acajoomsubscriber) {
                     if ($subscriber->subscriber_email == $acajoomsubscriber->email) {
                         $newSubs = false;
                         $subId[0] = $acajoomsubscriber->id;
                     }
                 }
                 if ($newSubs) {
                     $newSubscriber->user_id = $subscriber->userid;
                     $newSubscriber->name = $subscriber->subscriber_name;
                     $newSubscriber->email = $subscriber->subscriber_email;
                     $newSubscriber->receive_html = $subscriber->receive_html;
                     $newSubscriber->confirmed = $subscriber->confirmed;
                     $newSubscriber->subscribe_date = $subscriber->subscribe_date;
                     $newSubscriber->blacklist = 0;
                     $newSubscriber->timezone = '00:00:00';
                     $newSubscriber->language_iso = 'eng';
                     $newSubscriber->params = '';
                     $error = subscribers::insertSubscriber($newSubscriber, $subscriberId);
                     if (!empty($error)) {
                         if ($subscriberId < 1) {
                             echo ' Error inserting subscriber:' . $newSubscriber->name;
                         }
                         $error = '';
                         $subId[0] = $subscriberId;
                     } else {
                         echo '<br /><b>' . _ACA_MENU_SUBSCRIBERS . ': </b>' . $newSubscriber->name . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS);
                         $d['email'] = $subscriber->email;
                         $erro->ck = subscribers::getSubscriberIdFromEmail($d);
                         $erro->Eck(__LINE__, '8304');
                         $subId[0] = $d['subscriberId'];
                     }
                 } else {
                     echo '<br /><b>' . _ACA_MENU_SUBSCRIBERS . ': </b>' . $subscriber->subscriber_name . ': ' . acajoom::printM('red', _ACA_IMPORT_EXIST);
                 }
                 $j = 0;
                 $queue = queue::suscriptionExist($subId[0], $idImportedList[$subscriber->list_id]);
                 if (empty($queue)) {
                     $error = queue::insertQueuesForNews($subId, $idImportedList[$subscriber->list_id], 29);
                     if (!$error) {
                         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting queue. Database error: <br />' . $error . '</p>';
                     }
                 }
             }
         }
     }
     return true;
 }
Example #11
0
 public function testPublish()
 {
     queue::push('cleankvstore', array());
 }
Example #12
0
 function insertQidsForNews($subId, $listId, $acc_level)
 {
     $status = true;
     for ($k = 0; $k < count($subId); $k++) {
         $queue = new stdClass();
         $queue->id = 0;
         $queue->subscriber_id = $subId[$k];
         $queue->list_id = $listId;
         $queue->type = 1;
         $queue->mailing_id = 0;
         $queue->send_date = '0000-00-00 00:00:00';
         $queue->suspend = 0;
         $queue->delay = 0;
         $queue->acc_level = $acc_level;
         $queue->issue_nb = 0;
         $queue->published = 0;
         $queue->params = '';
         if (!queue::insert($queue)) {
             $status = false;
         }
     }
     return $status;
 }
Example #13
0
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
// Include library of functions
//
include 'classes.php';
include 'config.inc';
$__status['raw_queue_text'] = '';
$__queue = new queue($__config, $__status);
//
// Functions
//
function http_doc_type()
{
    echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
}
http_doc_type();
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 function updateUserstoAcajoom($force = false)
 {
     global $database;
     $time = isset($GLOBALS[ACA . 'last_sub_update']) && $GLOBALS[ACA . 'last_sub_update'] > 0 ? $GLOBALS[ACA . 'last_sub_update'] : 10000;
     $newTask = mktime(date("H") - 1, date("i"), date("s"), date("m"), date("d") - 1, date("Y"));
     if ($force or $newTask > $GLOBALS[ACA . 'last_sub_update']) {
         $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
         $xf = new xonfig();
         $newtime = mktime(date("H", $time) - 1, date("i", $time), date("s", $time), date("m", $time), date("d", $time), date("Y", $time));
         $oneDay = date('Y-m-d H:i:s', $newtime);
         $query = 'SELECT M.* FROM `#__users` AS M ' . ' LEFT JOIN `#__acajoom_subscribers` AS N ON M.id = N.user_id OR M.email = N.email ';
         $query .= ' WHERE M.registerDate > \'' . $oneDay . '\'';
         $query .= ' AND  N.id IS NULL AND M.block=0 ';
         $database->setQuery($query);
         $rows = $database->loadObjectList();
         $erro->err = $database->getErrorMsg();
         $erro->E(__LINE__, '8638', $database);
         if ($erro->result and !empty($rows)) {
             foreach ($rows as $row) {
                 $query = "INSERT INTO `#__acajoom_subscribers` (`user_id`,`subscribe_date`, `name`,`email`,`confirmed`)";
                 $query .= " VALUES ( {$row->id} , '{$row->registerDate}', '{$row->name}', '{$row->email}' , 1 ) ";
                 $database->setQuery($query);
                 $database->query();
                 $erro->err = $database->getErrorMsg();
                 $xf->plus('totalsubcribers0', 1);
                 $xf->plus('act_totalsubcribers0', 1);
                 $lists = lists::getLists(0, 0, null, '', true, false, false);
                 if (!empty($lists)) {
                     foreach ($lists as $list) {
                         $qid[0] = subscribers::getSubscriberId($row->registerDate);
                         $subscriber = subscribers::getSubscribersFromId($qid, false);
                         $subId = array();
                         $subId[0] = $subscriber->id;
                         $erro->ck = queue::updateQueues($subId, '', $list->id, @$list->acc_id, true);
                         $erro->Eck(__LINE__, '8640');
                     }
                 }
             }
         }
     }
 }
Example #15
0
 function saveMailing(&$mailingId, $listId)
 {
     global $database;
     $list = lists::getOneList($listId);
     $allow_html = compa::allow_html();
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     $xf = new xonfig();
     $listType = mosGetParam($_REQUEST, 'listype', 0);
     $senddate = mosGetParam($_REQUEST, 'senddate', '0000-00-00 00:00:00');
     if (mosGetParam($_REQUEST, 'task', '') == 'saveSend') {
         $senddate = acajoom::getNow();
     }
     $subject = mosGetParam($_REQUEST, 'subject', '', $allow_html);
     $content = mosGetParam($_REQUEST, 'content', '', $allow_html);
     $alt_content = mosGetParam($_REQUEST, 'alt_content', '', _MOS_ALLOWRAW);
     $published = mosGetParam($_REQUEST, 'published', 0);
     $visible = mosGetParam($_REQUEST, 'visible', 1);
     $html = mosGetParam($_REQUEST, 'html', 1);
     $new_list = mosGetParam($_REQUEST, 'new_list', 0);
     $fromname = mosGetParam($_REQUEST, 'fromname', '');
     $fromemail = mosGetParam($_REQUEST, 'fromemail', '');
     $frombounce = mosGetParam($_REQUEST, 'frombounce', '');
     $userid = mosGetParam($_REQUEST, 'userid', 0);
     $delay = mosGetParam($_REQUEST, 'delay', 1);
     $acc_level = mosGetParam($_REQUEST, 'acc_level', $list->acc_id);
     $issue_nb = mosGetParam($_REQUEST, 'issue_nb', 1);
     $delay = $delay * 24 * 60;
     $attachments = mosGetParam($_REQUEST, 'attachments', '');
     $attach = '';
     if (!empty($attachments)) {
         foreach ($attachments as $attachment) {
             $attach .= $attachment . "\n";
         }
     }
     if (!empty($_FILES['file_0']['name'])) {
         $otherAttachs = xmailing::uploadFiles();
         if (!empty($otherAttachs)) {
             foreach ($otherAttachs as $otherAttach) {
                 $attach .= '/' . $otherAttach . "\n";
             }
         }
     }
     $images = mosGetParam($_REQUEST, 'images', '');
     if ($html == 0) {
         $alt_content = $content;
     }
     if ($senddate != '0000-00-00 00:00:00' and $senddate > acajoom::getNow()) {
         $published = 2;
     }
     if ($new_list != 0) {
         $query = 'INSERT INTO `#__acajoom_mailings` (`list_id`, `list_type`, `send_date`, `subject`, `htmlcontent`, `textonly`, `attachments`, `images`, `published`, `html`, `visible`, `fromname`, `fromemail`, `frombounce`, `author_id`, `delay`, `issue_nb` , `acc_level` , `createdate`) VALUES( \'' . $listId . '\', \'' . $listType . '\', \'' . $senddate . '\', \'' . addslashes($subject) . '\', \'' . addslashes($content) . '\', \'' . addslashes($alt_content) . '\', \'' . $attach . '\', \'' . $images . '\', \'' . $published . '\', \'' . $html . '\', \'' . $visible . '\', \'' . $fromname . '\', \'' . $fromemail . '\', \'' . $frombounce . '\', \'' . $userid . '\', \'' . $delay . '\', \'' . $issue_nb . '\', \'' . $acc_level . '\' , \'' . acajoom::getNow() . '\' ) ';
         $database->setQuery($query);
         $database->query();
         $erro->err = $database->getErrorMsg();
         $query = 'SELECT max(id) FROM `#__acajoom_mailings` WHERE `list_id` = ' . $listId . ' AND `issue_nb` = \'' . $issue_nb . '\'';
         $query .= ' AND `published` != -1 ';
         $database->setQuery($query);
         $mailingId = $database->loadResult();
         $erro->err .= $database->getErrorMsg();
         if ($mailingId == 1) {
             $xf->update('firstmailing', $listType);
         }
         $xf->plus('totalmailing0', 1);
         $xf->plus('act_totalmailing0', 1);
         $xf->plus('totalmailing' . $listType, 1);
         $xf->plus('act_totalmailing' . $listType, 1);
         xmailing::insertStatsGlobal($mailingId);
     } else {
         $query = "UPDATE `#__acajoom_mailings` SET " . "\t`subject` = '" . addslashes($subject) . "', " . "\t`htmlcontent` = '" . addslashes($content) . "', " . "\t`textonly` = '" . addslashes($alt_content) . "', " . "\t`attachments` = '{$attach}', " . "\t`images` = '{$images}', " . "\t`published` = '{$published}', " . "\t`html` = {$html} , " . "\t`visible` = {$visible} , " . "\t`fromname` = '{$fromname}', " . "\t`fromemail` = '{$fromemail}', " . "\t`frombounce` = '{$frombounce}', " . "\t`author_id` =  '{$userid}' , " . "\t`delay` = {$delay} , " . "\t`acc_level` = {$acc_level} , " . "\t`send_date` = '{$senddate}' " . "\tWHERE `id` = {$mailingId} ";
         $database->setQuery($query);
         $database->query();
         $erro->err = $database->getErrorMsg();
     }
     if (!$erro->E(__LINE__, '8414', $database)) {
         return false;
     } else {
         lisType::updateNewsletters();
         if ($listType == 2) {
             if ($new_list) {
                 $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, '');
             } else {
                 $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, $mailingId, 1, 1, '');
             }
             $subsId = acajoom::convertObjectToIdList($subscribers, 'id');
             if (!empty($subsId)) {
                 $queues = queue::getAllOneList($listId);
                 if (!empty($queues)) {
                     if ($queues[0]->mailing_id == 0) {
                         $qids = acajoom::convertObjectToIdList($queues, 'qid');
                         $erro->ck = queue::updateQueues('', $qids, $listId, $acc_level, false);
                     } else {
                         $erro->ck = queue::updateQueues($subsId, '', $listId, $acc_level, false);
                     }
                 } else {
                     return true;
                 }
                 if (!$erro->Eck(__LINE__, '8415')) {
                     return false;
                 }
             }
         } elseif ($listType == 1 and $senddate > acajoom::getNow()) {
             $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, '');
             $subsId = acajoom::convertObjectToIdList($subscribers, 'id');
             if (!empty($subsId)) {
                 if ($new_list == 1) {
                     if (class_exists('auto')) {
                         $erro->ck = auto::insertQueuesForScheduledNews($subsId, $listId, $acc_level, $mailingId, $senddate);
                     }
                 } else {
                     $queues = queue::getQueueFromMailingId($mailingId);
                     if (!empty($queues)) {
                         $erro->ck = queue::updateQueueData('', $subsId, 1, $listId, $mailingId, $issue_nb, $senddate, 0, $acc_level, 2);
                         return $erro->Eck(__LINE__, '8417', 'put here 1 $d');
                     } else {
                         if (class_exists('auto')) {
                             $erro->ck = auto::insertQueuesForScheduledNews($subsId, $listId, $acc_level, $mailingId, $senddate);
                         }
                     }
                 }
                 return $erro->Eck(__LINE__, '8416', 'put here 2 $d');
             }
         }
         return true;
     }
 }
Example #16
0
 function unsubscribe($subscriberId, $cle = '', $listId, $action)
 {
     global $Itemid;
     if (!empty($subscriberId) and !empty($cle) and $listId > 0) {
         $qid[0] = $subscriberId;
         $subscriber = subscribers::getSubscribersFromId($qid, false);
         if (md5($subscriber->email) == $cle) {
             $queues = queue::getSubscriberLists($subscriberId);
             $lists = lists::getLists($listId, 0, null, '', false, false, true);
             $list = $lists[0];
             $mainLink = '.php?option=com_acajoom';
             compa::completeLink($mainLink, false);
             $forms['main'] = '<form method="post" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="mosForm" >' . "\n\r";
             $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
             $link = '.php?option=com_acajoom&act=change&subscriber=' . $subscriberId . '&cle=' . $cle . '&listid=' . $listId . '&Itemid=' . $Itemid;
             compa::completeLink($link, false);
             frontHTML::formStart(_ACA_SUBSCRIPTIONS, 0, 'unsubscribe');
             subscribersHTML::unsubscribe($subscriber, $list, $queues, $action, $forms);
             frontHTML::formEndYesNo($link, $cle, $subscriberId, $listId);
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Example #17
0
 function updateList($listId, $listUpdated, $status, $new)
 {
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     $total = 0;
     @set_time_limit(0);
     if ($listUpdated->list_type != '7' and $listUpdated->delay_min > $listUpdated->delay_max) {
         $listUpdated->delay_min = $listUpdated->delay_max;
     }
     $erro->ck = lists::updateListData($listUpdated);
     if (!$erro->Eck(__LINE__, '8304')) {
         return false;
     } else {
         if ($listUpdated->auto_add == 2) {
             subscribers::updateSubscribers(true);
             $subscribers = subscribers::getSubscribers(-1, -1, '', $total, 0, '', 1, 1, '');
             $subId = acajoom::convertObjectToIdList($subscribers, 'id');
             if (!empty($subId)) {
                 $erro->ck = queue::updateQueues($subId, '', $listId, $listUpdated->acc_id, $new);
                 if (!$erro->Eck(__LINE__, '8305')) {
                     return false;
                 }
             }
         } elseif ($status == '' and $listUpdated->list_type == 2) {
             $queues = queue::getAllOneList($listId);
             $qid = acajoom::convertObjectToIdList($queues, 'qid');
             $erro->ck = queue::updatePublished($qid, $status);
             if (!$erro->Eck(__LINE__, '8306')) {
                 return false;
             }
         } else {
             if (class_exists('auto')) {
                 auto::updateListNb($listUpdated->list_type, $listUpdated->id);
             }
         }
     }
     lisType::updateNewsletters();
     return true;
 }
Example #18
0
 function getEditTab($tab, $user, $ui)
 {
     global $my, $Itemid;
     if (intval($my->id) < 1) {
         mosNotAuth();
         return false;
     }
     if (!getAcajoomTab::checkInstalled()) {
         return _UE_NEWSLETTERNOTINSTALLED;
     }
     $html = '';
     require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/components/com_acajoom/classes/class.acajoom.php';
     require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/components/com_acajoom/subscribers.acajoom.html.php';
     if (!empty($user->id)) {
         $userId = $user->id;
         $subscriber = subscribers::getSubscriberInfoFromUserId($userId, false);
         $subscriberId = $subscriber->id;
         $queues = queue::getSubscriberLists($subscriberId);
         $access = acajoom::checkPermissions('admin', $my->id);
     } else {
         $userId = 0;
         $queues = '';
         $access = false;
         $subscriberId = 0;
         $subscriber->id = '';
         $subscriber->user_id = 0;
         $subscriber->name = '';
         $subscriber->email = '';
         $subscriber->receive_html = 1;
         $subscriber->confirmed = 1;
         $subscriber->blacklist = 0;
         $subscriber->timezone = '00:00:00';
         $subscriber->language_iso = 'eng';
         $subscriber->params = '';
         $subscriber->subscribe_date = acajoom::getNow();
     }
     $lists = lists::getLists(0, 0, $subscriberId, '', false, true, false);
     $doShowSubscribers = false;
     if ($ui == 1 and $GLOBALS[ACA . 'use_sef'] and function_exists('sefRelToAbs')) {
         $forms['main'] = '<form method="post" action="' . sefRelToAbs('index.php?option=com_acajoom') . '" onsubmit="submitbutton();return false;" name="mosForm" >' . "\n\r";
         $forms['select'] = '<form method="post" action="' . sefRelToAbs('index.php?option=com_acajoom&act=subscriber') . '"  name="AcajoomFilterForm">';
     } else {
         $forms['main'] = '<form method="post" action="index.php?option=com_acajoom" onsubmit="submitbutton();return false;" name="mosForm" >' . "\n\r";
         $forms['select'] = '<form method="post" action="index.php?option=com_acajoom&act=subscriber"  name="AcajoomFilterForm">';
     }
     $html .= subscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, $access, false, true);
     //$html .= '<input type="hidden" name="Itemid" value="'.$Itemid.'" />';
     $html .= '<input type="hidden" name="subscriber_id" value="' . $subscriber->id . '" />';
     return $html;
 }