function getMailings($listId, $listType, $start = -1, $limit = -1, $emailsearch, &$total, $order, $showOnlyPublished = true, $viewArchive = false) { if (ACA_CMSTYPE) { // joomla 15 $my =& JFactory::getUser(); $database =& JFactory::getDBO(); } else { //joomla 1x global $my, $database; } //endif $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); $where = array(); $flag = false; $sortList = false; $query = 'SELECT * FROM `#__acajoom_mailings`'; if ($listType > 0) { $where[] = ' `list_type` = ' . $listType . ' '; } elseif ($listId > 0) { $where[] = ' `list_id` = ' . $listId . ' '; $sortList = true; } if ($showOnlyPublished) { $where[] = ' `published` =1 '; $where[] = ' `visible`=1 '; } else { $where[] = ' `published`<>-1 '; } if (class_exists('pro') && $sortList) { } elseif (!acajoom::checkPermissions('admin') && !$viewArchive) { $where[] = ' `author_id` = ' . $my->id; } if (!empty($emailsearch)) { $where[] = ' (subject LIKE \'%' . $emailsearch . '%\' OR fromname LIKE \'%' . $emailsearch . '%\') '; } $query .= count($where) ? " WHERE " . implode(' AND ', $where) : ""; if (empty($order)) { $order = 'idD'; } $query .= acajoom::orderBy($order); if ($start != -1 && $limit != -1) { $query .= ' LIMIT ' . $start . ', ' . $limit; } $database->setQuery($query); $mailing = $database->loadObjectList(); $erro->err = $database->getErrorMsg(); if (!$erro->E(__LINE__, '8400', $database)) { return ''; } else { foreach ($mailing as $key => $mail) { $mailing[$key]->htmlcontent = stripslashes($mailing[$key]->htmlcontent); $mailing[$key]->subject = stripslashes($mailing[$key]->subject); $mailing[$key]->attachments = stripslashes($mailing[$key]->attachments); $mailing[$key]->images = stripslashes($mailing[$key]->images); $mailing[$key]->textonly = stripslashes($mailing[$key]->textonly); $mailing[$key]->send_date = stripslashes($mailing[$key]->send_date); } return $mailing; } }
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; } }
/** * @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; }
function showType($listType, $screen) { switch ($screen) { case 'editmailing': if (class_exists($GLOBALS[ACA . 'classes' . $listType])) { $view = new $GLOBALS[ACA . 'classes' . $listType](); $show = $view->editmailing(); } else { $show['sender_info'] = true; $show['published'] = true; $show['pub_date'] = true; $show['hide'] = true; $show['issuenb'] = true; $show['delay'] = false; $show['htmlcontent'] = true; $show['textcontent'] = true; $show['attachement'] = true; $show['images'] = true; $show['sitecontent'] = true; $show['admin'] = true; } break; case 'editlist': $show['access'] = $GLOBALS[ACA . 'type'] == 'PRO' ? true : false; if (class_exists($GLOBALS[ACA . 'classes' . $listType])) { $view = new $GLOBALS[ACA . 'classes' . $listType](); $show = array_merge($show, $view->editlist()); } else { $show['sender_info'] = true; $show['hide'] = true; $show['auto_option'] = true; $show['htmlmailing'] = true; $show['auto_subscribe'] = true; $show['email_unsubcribe'] = false; $show['unsusbcribe'] = false; } break; case 'showMailings': $show['admin'] = acajoom::checkPermissions('admin'); $show['index'] = 'index2'; $show['buttons'] = false; if ($show['admin']) { if (class_exists($GLOBALS[ACA . 'classes' . $listType])) { $view = new $GLOBALS[ACA . 'classes' . $listType](); $show = array_merge($show, $view->showMailings()); } else { $show['id'] = true; $show['dropdown'] = true; $show['select'] = true; $show['issue'] = true; $show['sentdate'] = true; $show['delay'] = false; $show['status'] = true; } } else { $show['id'] = false; $show['dropdown'] = false; $show['select'] = false; $show['issue'] = true; $show['sentdate'] = true; $show['delay'] = false; $show['status'] = false; } break; case 'showListsBack': if (acajoom::checkPermissions('admin')) { $show['id'] = true; } else { $show['id'] = false; } $show['index'] = 'index2'; $show['select'] = true; $show['published'] = true; $show['sender'] = true; $show['sender_email'] = false; $show['mailings_link'] = true; $show['mailings_sub'] = true; $show['list_type'] = true; $show['visible'] = true; $show['buttons'] = false; $show['front'] = false; break; case 'showListsFront': if (acajoom::checkPermissions('admin')) { $show['id'] = true; $show['published'] = true; $show['sender'] = true; $show['sender_email'] = false; $show['list_type'] = true; $show['visible'] = true; $show['mailings_sub'] = false; $show['mailings_link'] = true; $show['front'] = true; } else { $show['id'] = false; $show['published'] = false; $show['sender'] = false; $show['sender_email'] = false; $show['list_type'] = false; $show['visible'] = false; $show['mailings_sub'] = false; $show['mailings_link'] = false; $show['front'] = true; } $show['index'] = 'index'; $show['select'] = false; $show['buttons'] = true; break; default: $show = ''; break; } return $show; }
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; } }
function showListingLists($lists, $action, $task, $forms, $show) { global $Itemid, $mainframe, $my; $loggedin = false; if ($my->id > 0) { $loggedin = true; } if (!$mainframe->isAdmin() and !empty($GLOBALS[ACA . 'itemidAca'])) { $Itemid = $GLOBALS[ACA . 'itemidAca']; $item = '&Itemid=' . $Itemid; } else { $item = ''; } echo $forms['main']; echo '<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist"><tr>'; if ($show['id']) { echo '<th width="2%" class="title">id#</td>'; } if ($show['select']) { echo '<th width="3%" class="title"></th>'; } if ($show['published']) { echo '<th width="5%" class="title">' . _ACA_PUBLISHED . '</th>'; } echo '<th width="30%" class="title">' . _ACA_LIST_NAME . '</th>'; if ($show['sender']) { echo '<th width="20%" class="title">' . _ACA_LIST_SENDER . ' </th>'; } if ($show['sender_email']) { echo ' <th width="15%" class="title">' . _ACA_SENDER_EMAIL . '</th>'; } if ($show['mailings_link']) { echo '<th width="17%" class="title">' . _ACA_MENU_MAILING_TITLE . '</th>'; } if ($show['mailings_sub']) { echo '<th width="17%" class="title">' . _ACA_SUBSCRIBER_CONFIG . '</th>'; } if ($show['list_type']) { echo '<th width="10%" class="title">' . _ACA_LIST_TYPE . '</th>'; } if ($show['visible']) { echo '<th width="5%" class="title">' . _ACA_VISIBLE . '</th>'; } if ($show['buttons']) { if ($GLOBALS[ACA . 'allow_unregistered'] or $loggedin) { echo '<th class="title" width="90"><center>' . _ACA_SUBSCRIB . '</center></th>'; } if ($GLOBALS[ACA . 'show_archive'] == '1') { echo '<th class="title" width="90"><center>' . _ACA_VIEW_ARCHIVE . '</center></th>'; } } echo '</tr>'; $i = 0; foreach ($lists as $list) { $i++; if ($list->list_type == 1 or $list->list_type == 7) { $linkArchive = '.php?option=com_acajoom&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive' . $item; } else { $linkArchive = '#'; } if ($list->published == 1) { $img = 'publish_g.png'; $alt = 'Published'; } else { if ($list->published == 2) { $img = 'publish_y.png'; $alt = 'Scheduled'; } else { $img = 'publish_x.png'; $alt = 'Unpublished'; } } ?> <tr class="row<?php echo $i % 2; ?> "> <?php if ($show['id']) { echo '<td width="2%" class="title"><center>' . $list->id . '<center></td>'; } ?> <?php if ($show['select']) { ?> <td><input type="radio" name="listid" value="<?php echo $list->id; ?> " onClick="isChecked(this.checked);" /></td> <?php } if ($show['published']) { ?> <td align="center"><center> <img src="<?php echo $GLOBALS['mosConfig_live_site']; ?> /administrator/images/<?php echo $img; ?> " width="12" height="12" border="0" alt="<?php echo $alt; ?> " /> </center></td> <?php } if ($show['index'] == 'index') { if (acajoom::checkPermissions('admin')) { $link = '.php?option=com_acajoom&act=' . $action . '&task=' . $task . '&listid=' . $list->id . $item; } else { $link = $linkArchive; } compa::completeLink($link, false); } else { $link = '.php?option=com_acajoom&act=' . $action . '&task=' . $task . '&listid=' . $list->id; compa::completeLink($link); } ?> <td> <span class="aca_letter_names" <?php if ($link == "#" or $link == "administrator/#") { echo " onClick='return false;' "; } ?> > <?php echo compa::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, $link, 1); ?> </span> </td> <?php if ($show['sender']) { echo '<td>' . $list->sendername . '</td>'; } if ($show['sender_email']) { echo ' <td width="20%" class="title">' . $list->senderemail . '</td>'; } if ($show['mailings_link']) { if ($show['index'] == 'index') { $link = '.php?option=com_acajoom&act=mailing&task=show&listid=' . $list->id . '&listype=' . $list->list_type . $item; compa::completeLink($link, false); } else { $link = '.php?option=com_acajoom&act=mailing&task=show&listid=' . $list->id . '&listype=' . $list->list_type; compa::completeLink($link); } ?> <td><a href="<?php echo $link; ?> "> <?php echo _ACA_MALING_EDIT_VIEW; ?> </a></td> <?php } if ($show['mailings_sub']) { if ($show['index'] == 'index') { $link = '.php?option=com_acajoom&act=subscribers&listid=' . $list->id . $item; compa::completeLink($link, false); } else { $link = '.php?option=com_acajoom&act=subscribers&listid=' . $list->id; compa::completeLink($link); } ?> <td><a href="<?php echo $link; ?> "> <?php echo _ACA_SUBCRIBERS_VIEW; ?> </a></td> <?php } if ($show['list_type']) { if ($show['index'] == 'index') { $link = '.php?option=com_acajoom&act=mailing&listype=' . $list->list_type . $item; compa::completeLink($link, false); } else { $link = '.php?option=com_acajoom&act=mailing&listype=' . $list->list_type; compa::completeLink($link); } ?> <td><a href="<?php echo $link; ?> " ><?php echo @constant($GLOBALS[ACA . 'listname' . $list->list_type]); ?> </a></td> <?php } if ($show['visible']) { if ($list->hidden == 1) { $img = 'tick.png'; } else { $img = 'publish_x.png'; } ?> <td height="20"><center><img src="<?php echo $GLOBALS['mosConfig_live_site']; ?> /administrator/images/<?php echo $img; ?> " width="12" height="12" border="0" alt="" /></center></td> <?php } ?> <?php if ($show['buttons']) { if ($GLOBALS[ACA . 'allow_unregistered'] or $loggedin) { if (function_exists('sefRelToAbs') and $GLOBALS[ACA . 'use_sef']) { $link = sefRelToAbs($show['index'] . '.php?option=com_acajoom&act=subone&listid=' . $list->id . $item); } else { $link = $show['index'] . '.php?option=com_acajoom&act=subone&listid=' . $list->id . $item; } $img = 'folder_add_f2.png'; echo '<td align="center" height="24"><center>'; echo '<a href="' . $link . '" >' . "\n\r"; echo '<img src="components/com_acajoom/images/' . $img . '" width="20" height="20" border="0" alt="" /></a></center></td>' . "\n\r"; } if (($list->list_type == 1 or $list->list_type == 7) && $GLOBALS[ACA . 'show_archive'] == '1') { if (function_exists('sefRelToAbs') and $GLOBALS[ACA . 'use_sef']) { $linkArchive = sefRelToAbs($show['index'] . '.php?option=com_acajoom&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive' . $item); } else { $linkArchive = $show['index'] . '.php?option=com_acajoom&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive' . $item; } $img = 'move_f2.png'; echo '<td height="24"><center>'; echo '<a href="' . $linkArchive . '" >' . "\n\r"; echo '<img src="components/com_acajoom/images/' . $img . '" width="20" height="20" border="0" alt="' . _ACA_VIEW_ARCHIVE . '" /></a></center></td>' . "\n\r"; } elseif ($GLOBALS[ACA . 'show_archive'] == '1') { echo '<td height="24"><center>-</center></td>' . "\n\r"; } } echo ' </tr>' . "\n\r"; } echo '</table>'; }
function mailingEdit($subscriberId, $mailingId, $listId, $listType, $action) { global $my, $Itemid; if (ACA_CMSTYPE) { // joomla 15 $issue_nb = JRequest::getVar('issue_nb', '0'); $my =& JFactory::getUser(); } else { //joomla 1x $issue_nb = intval(mosGetParam($_REQUEST, 'issue_nb', 0)); global $my; } //endif $accessGrant = false; $new = 0; if (class_exists('pro')) { if ($issue_nb == 0) { $issue_nb = xmailing::countMailings($listId, ''); $issue_nb++; } if ($listId > 0) { $list = lists::getOneList($listId); $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new); $acc_level = $list->acc_level; } else { return false; } if (acajoom::checkPermissions('hello', 0, $acc_level)) { $accessGrant = true; } } else { if ($subscriberId != 0 and ($my->usertype == 'Administrator' or $my->usertype == 'Super Administrator')) { $accessGrant = true; } } if ($accessGrant) { if ($issue_nb == 0) { $issue_nb = xmailing::countMailings($listId, ''); $issue_nb++; } if (empty($mailing)) { if ($mailingId > 0) { $mailing = xmailing::getOneMailing('', $mailingId, $issue_nb, $new); } else { if ($listId > 0) { $list = lists::getOneList($listId); $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new); } else { return false; } } } $mainLink = '.php?option=com_acajoom&act=savemailing'; compa::completeLink($mainLink, false); $forms['main'] = '<form method="post" enctype="multipart/form-data" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="adminForm" >' . "\n\r"; $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; $show = lisType::showType($mailing->list_type, 'editmailing'); frontHTML::formStart(_ACA_EDIT_A . @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]), $mailing->html, 'edit_mailing'); mailingsHTML::editMailing($mailing, $new, $listId, $forms, $show); $go[] = acajoom::makeObj('act', $action); frontHTML::formEnd(_CMN_SAVE . ' ' . @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]), $go); } else { echo acajoom::printM('red', _NOT_AUTH); } return true; }
function quickiconButton($link, $image, $text, $external = false, $accessLevel = '', $frontEnd = false) { if (acajoom::checkPermissions($accessLevel)) { if ($frontEnd and $GLOBALS[ACA . 'use_sef'] and function_exists('sefRelToAbs')) { $link = sefRelToAbs($link); } ?> <div style="float:left;"> <div class="icon"> <a href="<?php echo $link; ?> " <?php if ($external) { echo 'target="_blank"'; } ?> > <?php compa::showIcon($image, $text); ?> <span><?php echo $text; ?> </span> </a> </div> </div> <?php } }
function showPanel() { global $Itemid; if (ACA_CMSTYPE) { $database =& JFactory::getDBO(); $acl =& JFactory::getACL(); $my =& JFactory::getUser(); } else { global $my, $database, $acl; } //endif if (isset($my->id) && $my->id > 0) { if (!empty($my->username)) { $greeting_message = _HI . ' ' . $my->username; } else { $greeting_message = ''; } backHTML::controlPanelBottonStart(_UCP_USER_MENU, 'cpanel.png'); $link = '.php?option=com_acajoom&act=show&Itemid=' . $Itemid; compa::completeLink($link, false); backHTML::quickiconButton($link, 'addusers.png', _UCP_USER_CONTACT, false, 'Registered', false); if (class_exists('pro')) { $aro_id = isset($my->id) && $my->id > 0 ? $acl->get_object_id('users', $my->id, 'ARO') : 1; $qacl = "SELECT `group_id` FROM `#__core_acl_groups_aro_map` WHERE `aro_id` =" . $aro_id; $database->setQuery($qacl); $usergid = $database->loadResult(); $gidAdmin = $acl->get_group_id('Administrator', 'ARO'); $ex_groups = $acl->get_group_children($gidAdmin, 'ARO', 'RECURSE'); $ex_groups[] = $gidAdmin; if (in_array($usergid, $ex_groups)) { $link = '.php?option=com_acajoom&act=list&Itemid=' . $Itemid; compa::completeLink($link, false); backHTML::quickiconButton($link, 'addedit.png', _ACA_MENU_LIST, false, 'admin', false); } else { $lists = lists::getLists(0, 0, true); $access = false; foreach ($lists as $list) { $bit = acajoom::checkPermissions('hello', 0, $list->acc_level); if ($bit) { $access = true; break; } } $link = '.php?option=com_acajoom&act=list&Itemid=' . $Itemid; compa::completeLink($link, false); if ($access) { backHTML::quickiconButton($link, 'addedit.png', _ACA_MENU_LIST, false, 'Registered', false); } } } else { $link = '.php?option=com_acajoom&act=list&Itemid=' . $Itemid; compa::completeLink($link, false); backHTML::quickiconButton($link, 'addedit.png', _ACA_MENU_LIST, false, 'admin', false); } backHTML::controlPanelBottomEnd(); if (class_exists('auto')) { auto::otherPanel(); } } }
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; }
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; }