function insertStatsGlobal($mailingId) { global $database; $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); $query = 'SELECT COUNT(mailing_id) FROM `#__acajoom_stats_global` WHERE `mailing_id` = \'' . $mailingId . '\''; $database->setQuery($query); $nb = $database->loadResult(); $erro->err = $database->getErrorMsg(); $erro->E(__LINE__, '8430', $database); if ($nb < 1) { $query = 'INSERT INTO `#__acajoom_stats_global` ( `mailing_id`, `sentdate`, `html_sent`, `text_sent` ) VALUES (' . $mailingId . ', \'' . acajoom::getNow() . '\', ' . ' 0 , ' . ' 0 )'; $database->setQuery($query); $database->query(); $erro->err = $database->getErrorMsg(); } return $erro->E(__LINE__, '8422', $database); }
function sendReport($from_email, $time, $html_sent, $text_sent) { global $version, $database; $safemode = ini_get("safe_mode") == 0 ? 'off' : 'on'; $numberSubscribers = $text_sent + $html_sent; $time = class_exists('acajoom') ? acajoom::getNow() : date('Y-m-d H:i:s', time()); $content = 'Acajoom send mailing report of ' . $time . "\n\n"; $content .= "-----------------------------------\n"; $content .= "Server: \n"; $content .= "-----------------------------------\n\n"; //$content .= "Joomla Version: " . $version . "\n"; $content .= "Software: " . $_SERVER['SERVER_SOFTWARE'] . "\n"; $content .= "Database Version: " . $database->getVersion() . "\n"; $content .= "PHP Version: " . phpversion() . "\n"; $content .= "Zend Version: " . zend_version() . "\n"; $content .= "Magic_quotes_gpc: " . ini_get("magic_quotes_gpc") . "\n"; $content .= "Disable_functions: " . ini_get("disable_functions") . "\n"; $content .= "Max_execution_time: " . ini_get("max_execution_time") . "\n"; $content .= "Safe_mode: " . $safemode . "\n"; $content .= "Memory_limit: " . ini_get("memory_limit") . "\n"; $content .= "\n\n"; $content .= "-----------------------------------\n"; $content .= "Acajoom configuration: \n"; $content .= "-----------------------------------\n\n"; $content .= "Send method: " . $GLOBALS[ACA . 'emailmethod'] . "\n"; if ($GLOBALS[ACA . 'emailmethod'] == 'smtp') { $auth = $GLOBALS[ACA . 'smtp_auth_required'] == 1 ? 'yes' : 'no'; $content .= "Authentication required: " . $auth . "\n"; } $content .= $time . " \n"; $content .= "\n\n"; $content .= "-----------------------------------\n"; $content .= "Mailing options: \n"; $content .= "-----------------------------------\n\n"; $content .= "Time to send: " . $time . "\n"; $content .= "Number of subscribers: " . $numberSubscribers . "\n"; $content .= "HTML format: " . $html_sent . "\n"; $content .= "Text format: " . $text_sent . "\n"; echo '<img src="' . $GLOBALS[ACA . 'report_site'] . '/index.php?option=' . $GLOBALS[ACA . 'option'] . '&act=perflog' . '×end=' . $time . '&text=' . $text_sent . '&html=' . $html_sent . '&lists=' . $GLOBALS[ACA . 'totallist0'] . '&mailings=' . $GLOBALS[ACA . 'totalmailing0'] . '&subs=' . $GLOBALS[ACA . 'totalsubcribers0'] . '&msent=' . $GLOBALS[ACA . 'totalmailingsent0'] . '&maxexe=' . ini_get("max_execution_time") . '&memory=' . ini_get("memory_limit") . '&method=' . $GLOBALS[ACA . 'emailmethod'] . '&version=' . $GLOBALS[ACA . 'version'] . '&php=' . phpversion() . '&zend=' . zend_version() . '&soft=' . $_SERVER['SERVER_SOFTWARE'] . '&magic=' . ini_get("magic_quotes_gpc") . '&mode=' . $safemode . '&disable=' . ini_get("disable_functions") . '" border="0" width="1" height="1" />'; }
function subject($mailingEdit, $lists, $show) { ?> <fieldset class="acajoomcss"> <legend><?php echo _ACA_LIST_T_GENERAL; ?> </legend> <table class="acajoomtable" cellspacing="1"> <tbody> <tr> <td width="110px" class="key"> <span class="editlinktip"> <?php $tip = _ACA_INFO_LIST_SUBJET; $title = _ACA_SUBJECT; echo compa::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <?php $text = str_replace('"', '"', $mailingEdit->subject); if (function_exists('htmlspecialchars_decode')) { $text = htmlspecialchars_decode($text, ENT_NOQUOTES); } elseif (function_exists('html_entity_decode')) { $text = html_entity_decode($text, ENT_NOQUOTES); } echo ' <input type="text" name="subject" class="inputbox" size="50" maxlength="64" value="' . $text . '" />'; ?> </td> </tr> <?php if ($show['issuenb']) { ?> <tr> <td class="key"> <span class="editlinktip"> <?php $tip = _ACA_ISSUE_NB_TIPS; $title = @constant($GLOBALS[ACA . 'listname' . $mailingEdit->list_type]) . ' #'; echo compa::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <?php echo $mailingEdit->issue_nb; ?> </td> </tr> <?php } else { echo ' <input type="hidden" name="issue_nb" value="' . $mailingEdit->issue_nb . '" />'; } ?> <?php if ($show['delay']) { ?> <tr> <td class="key"> <span class="editlinktip"> <?php $tip = _ACA_INFO_LIST_DELAY; $title = _ACA_AUTO_DELAY; echo compa::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <?php $delay = $mailingEdit->delay / 1440; ?> <input type="text" name="delay" class="inputbox" size="5" maxlength="10" value="<?php echo $delay; ?> " /> </td> </tr> <?php } ?> <?php if ($show['pub_date'] and $GLOBALS[ACA . 'listype2'] == '1' and class_exists('auto')) { ?> <tr> <td class="key"> <span class="editlinktip"> <?php $tip = _ACA_INFO_LIST_DATE; $title = _ACA_LIST_DATE; $tip .= '<br/>(Actual server time is ' . acajoom::getNow() . ' )'; echo compa::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <input type="text" name="senddate" class="inputbox" size="25" maxlength="25" value="<?php echo $mailingEdit->send_date; ?> " /> </td> </tr> <?php } ?> <tr> <td class="key"> <span class="editlinktip"> <?php $tip = ''; $title = _ACA_LIST_NAME; echo compa::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <?php $name = lists::getLists($mailingEdit->list_id, 0, null, '', false, false, true); echo $name[0]->list_name; ?> </td> </tr> </tbody> </table> </fieldset> <?php }
/** * @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 lists($action, $task, $listId, $listType) { global $database, $my; $message = ''; $xf = new xonfig(); $erro = new xerr(__FILE__, __FUNCTION__); $erro->show(); $showLists = true; switch ($task) { case 'new': if ($listType < 1) { $listType = 1; } $filename = $GLOBALS['mosConfig_absolute_path'] . '/components/com_acajoom/templates/default/default.html'; $handle = fopen($filename, "rb"); $template = fread($handle, filesize($filename)); fclose($handle); $template = str_replace('src="', 'src="' . $GLOBALS['mosConfig_live_site'] . '/', $template); $subscriber = subscribers::getSubscriberInfoFromUserId($my->id); $showLists = false; $newList->id = ''; $newList->html = 1; $newList->new_letter = 1; $newList->list_name = ''; $newList->list_desc = ''; $newList->sendername = $subscriber->name; $newList->senderemail = $subscriber->email; $newList->bounceadres = $subscriber->email; $newList->layout = $template; $newList->template = 0; $newList->hidden = 1; $newList->auto_add = 0; $newList->list_type = $listType; $newList->delay_min = 1; $newList->delay_max = 7; $newList->user_choose = 0; $newList->cat_id = 0; $newList->follow_up = ''; $newList->notify_id = 0; $newList->owner = $my->id; $newList->acc_level = 25; $newList->acc_id = 29; $newList->published = 0; $newList->start_date = date('Y-m-d', time()); $newList->next_date = time(); $newList->subscribemessage = _ACA_DEFAULT_SUBSCRIBE_MESS; $newList->unsubscribemessage = _ACA_DEFAULT_UNSUBSCRIBE_MESS; $newList->unsubscribesend = 1; $newList->footer = 1; $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n "; $show = lisType::showType($newList->list_type, 'editlist'); backHTML::_header(_ACA_NEW . ' ' . _ACA_LIST, $GLOBALS[ACA . 'listlogo0'], $message, $task, $action); backHTML::formStart('listedit', $newList->html, ''); listsHTML::editList($newList, $forms, $show); $go[] = acajoom::makeObj('act', $action); $go[] = acajoom::makeObj('listid', $newList->id); backHTML::formEnd($go); break; case 'doNew': $listname = mosGetParam($_REQUEST, 'list_name', ''); $listType = mosGetParam($_REQUEST, 'list_type', 0); $now = acajoom::getNow(); $query = "SELECT `id` FROM `#__acajoom_lists` WHERE `list_name`= '{$listname}' "; $database->setQuery($query); $lId = $database->loadResult(); $erro->err = $database->getErrorMsg(); $erro->E(__LINE__, '1091', $database); if ($lId > 0) { echo "<script> alert(' This list already exist, please choose another name. '); window.history.go(-1);</script>\n"; return false; } else { $query = "INSERT INTO `#__acajoom_lists` (`list_name`,`createdate`) VALUES ( '" . addslashes($listname) . "' , '{$now}' )"; $database->setQuery($query); $database->query(); $erro->err = $database->getErrorMsg(); } if ($erro->E(__LINE__, '1001', $database)) { $query = "SELECT * FROM `#__acajoom_lists` WHERE `list_name`= '{$listname}' "; $database->setQuery($query); $database->loadObject($mynewlist); $mynewlist->list_name = stripslashes($mynewlist->list_name); $mynewlist->list_desc = stripslashes($mynewlist->list_desc); $mynewlist->layout = stripslashes($mynewlist->layout); $mynewlist->subscribemessage = stripslashes($mynewlist->subscribemessage); $mynewlist->unsubscribemessage = stripslashes($mynewlist->unsubscribemessage); $erro->err = $database->getErrorMsg(); $erro->E(__LINE__, '1005'); $listId = $mynewlist->id; $message = acajoom::printYN(lists::updateListFromEdit($listId, '', true), _ACA_LIST_ADDED, _ACA_ERROR); $xf->plus('totallist0', 1); $xf->plus('act_totallist0', 1); $xf->plus('totallist' . $listType, 1); $xf->plus('act_totallist' . $listType, 1); } break; case 'edit': if ($listId == 0) { echo "<script> alert('" . addslashes(_ACA_SELECT_LIST) . "'); window.history.go(-1);</script>\n"; return false; } else { $showLists = false; $query = 'SELECT * FROM `#__acajoom_lists` WHERE `id` = ' . intval($listId); $database->setQuery($query); $database->loadObject($listEdit); $erro->err = $database->getErrorMsg(); if (!$erro->E(__LINE__, '1002')) { return false; } else { $listEdit->list_name = stripslashes($listEdit->list_name); $listEdit->list_desc = stripslashes($listEdit->list_desc); $listEdit->layout = stripslashes($listEdit->layout); $listEdit->subscribemessage = stripslashes($listEdit->subscribemessage); $listEdit->unsubscribemessage = stripslashes($listEdit->unsubscribemessage); $listEdit->new_letter = 0; $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n "; $show = lisType::showType($listEdit->list_type, 'editlist'); backHTML::_header(_ACA_EDIT_A . @constant($GLOBALS[ACA . 'listname' . $listEdit->list_type]) . ' ' . _ACA_LIST, $GLOBALS[ACA . 'listlogo0'], $message, $task, $action); backHTML::formStart('listedit', $listEdit->html, ''); listsHTML::editList($listEdit, $forms, $show); $go[] = acajoom::makeObj('act', $action); $go[] = acajoom::makeObj('listid', $listEdit->id); backHTML::formEnd($go); } } break; case 'update': $message = acajoom::printYN(lists::updateListFromEdit($listId, '', false), _ACA_LIST_UPDATED, _ACA_ERROR); break; case 'delete': $message = acajoom::printYN(lists::deleteList($listId), _ACA_LIST . _ACA_SUCCESS_DELETED, _ACA_ERROR); break; case 'copy': $message = acajoom::printYN(lists::copyList($listId), _ACA_LIST_COPY, _ACA_ERROR); break; case 'publish': $message = acajoom::printYN(lists::updateListFromList($listId, true, false), _ACA_PUBLISHED, _ACA_ERROR); break; case 'unpublish': $message = acajoom::printYN(lists::updateListFromList($listId, false, false), _ACA_UNPUBLISHED, _ACA_ERROR); break; case 'forms': case 'make': if (class_exists('createForm')) { createForm::taskOptions($task); $showLists = false; } else { $showLists = true; } break; case 'cpanel': backHTML::controlPanel(); return true; break; } if ($showLists) { backHTML::_header(_ACA_MENU_LIST, $GLOBALS[ACA . 'listlogo0'], $message, $task, $action); $show = lisType::showType(0, 'showListsBack'); $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n"; backHTML::formStart('show_mailing', '', ''); $listing = lists::getLists(0, 0, 1, '', false, false, false); if ($show['list_type']) { $show['list_type'] = lisType::checkOthers(); } listsHTML::showListingLists($listing, $action, 'edit', $forms, $show); $go[] = acajoom::makeObj('act', $action); backHTML::formEnd($go); return true; } }
function checkNewVersion() { static $available = false; $xf = new xonfig(); $canUpdate = false; if ($this->canUpdate()) { foreach ($this->compsList as $compList) { if ($compList[0] == $this->local['component'] and $compList[1] == $this->local['type'] and $this->checkVersion($this->local['version'], $compList[2])) { $joomlaVer = new joomlaVersion(); $joomla = $joomlaVer->getShortVersion(); $value = $compList[3] . '_' . $compList[2]; if (empty($this->local[$value . '_requirement']) or $this->requiredVersion($joomla, $this->local[$value . '_requirement'])) { $xf->update('update_avail', '1'); $available = true; if (isset($this->local[$value . '_message']) and defined('_ACA_UPDATE_MESS' . $this->local[$value . '_message'])) { $xf->update('update_message', @constant('_ACA_UPDATE_MESS' . $this->local[$value . '_message'])); } else { $xf->update('update_message', ''); } } else { $xf->update('update_avail', '0'); } } else { $xf->update('update_avail', '0'); } } } $xf->update('date_update', acajoom::getNow()); return $available; }
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 subscriptions($subscriberId, $listId, $action) { global $Itemid; if (!empty($subscriberId)) { $qid[0] = $subscriberId; $subscriber = subscribers::getSubscribersFromId($qid, false); $queues = queue::getSubscriberLists($subscriberId); } else { $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'; $newSubscriber->params = ''; $subscriber->subscribe_date = acajoom::getNow(); $queues = ''; } if ($subscriber->user_id > 0) { $access = acajoom::checkPermissions('admin', $subscriber->user_id); } else { $access = false; } $lists = lists::getLists($listId, 0, $subscriberId, '', false, true, false); $doShowSubscribers = false; $mainLink = '.php?option=com_acajoom'; $selectLink = '.php?option=com_acajoom&act=' . $action; 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">'; $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; $forms['select'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; frontHTML::formStart(_ACA_SUBSCRIPTIONS, 0, 'name_email'); echo subscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, $access, true, false); $go[] = acajoom::makeObj('act', $action); $go[] = acajoom::makeObj('subscriber_id', $subscriber->id); $go[] = acajoom::makeObj('user_id', $subscriber->user_id); frontHTML::formEnd(_ACA_SAVE, $go); return true; }
function setupMaiOptions($acajoomConfigFile) { $xf = new xonfig(); $return = '<br />' . _ACA_INSTALL_CONFIG . ' : '; $config = array(); $exist = acajoom::checkExisting(); if ($exist['news1'] == 0) { $config['news1'] = '0'; } if ($exist['news2'] == 0) { $config['news2'] = '0'; } if ($exist['news3'] == 0) { $config['news3'] = '0'; } if (ACA_CMSTYPE) { // joomla 15 $conf =& JFactory::getConfig(); $config['emailmethod'] = $conf->getValue('config.mailer'); $config['sendmail_path'] = $conf->getValue('config.sendmail'); $config['sendmail_from'] = $conf->getValue('config.mailfrom'); $config['sendmail_name'] = $conf->getValue('config.fromname'); $config['smtp_host'] = $conf->getValue('config.smtphost'); $config['smtp_auth_required'] = $conf->getValue('config.smtpauth'); $config['smtp_username'] = $conf->getValue('config.smtpuser'); $config['smtp_password'] = $conf->getValue('config.smtppass'); $config['confirm_fromname'] = $conf->getValue('config.fromname'); $config['confirm_fromemail'] = $conf->getValue('config.mailfrom'); $config['confirm_return'] = $conf->getValue('config.mailfrom'); } else { //joomla 1x $config['emailmethod'] = $GLOBALS['mosConfig_mailer']; $config['sendmail_path'] = $GLOBALS['mosConfig_sendmail']; $config['sendmail_from'] = $GLOBALS['mosConfig_mailfrom']; $config['sendmail_name'] = $GLOBALS['mosConfig_fromname']; $config['smtp_host'] = $GLOBALS['mosConfig_smtphost']; $config['smtp_auth_required'] = $GLOBALS['mosConfig_smtpauth']; $config['smtp_username'] = $GLOBALS['mosConfig_smtpuser']; $config['smtp_password'] = $GLOBALS['mosConfig_smtppass']; $config['confirm_fromname'] = $GLOBALS['mosConfig_fromname']; $config['confirm_fromemail'] = $GLOBALS['mosConfig_mailfrom']; $config['confirm_return'] = $GLOBALS['mosConfig_mailfrom']; } //endif $config['date_update'] = acajoom::getNow(); for ($index = 0; $index < $acajoomConfigFile['nblist']; $index++) { $xf->insert('listname' . $index, '', 0); $xf->insert('listnames' . $index, '', 0); $xf->insert('listype' . $index, '', 0); $xf->insert('listshow' . $index, '', 0); $xf->insert('classes' . $index, '', 0); $xf->insert('listlogo' . $index, '', 0); $xf->insert('totallist' . $index, '', 0); $xf->insert('act_totallist' . $index, '', 0); $xf->insert('totalmailing' . $index, '', 0); $xf->insert('totalmailingsent' . $index, '', 0); $xf->insert('act_totalmailing' . $index, '', 0); $xf->insert('totalsubcribers' . $index, '', 0); $xf->insert('act_totalsubcribers' . $index, '', 0); } $activeList = '1'; $config['classes1'] = 'newsletter'; $config['classes2'] = 'autoresponder'; $config['classes7'] = 'autonews'; $xf->insert('activelist', $activeList, 0, true); $xf->insert('option', 'com_sdonkey', 0, true); $config['listype0'] = '1'; $config['listname0'] = ''; $config['listnames0'] = _ACA_MAILING_ALL; $config['listshow0'] = '1'; $config['listlogo0'] = 'addedit.png'; $config['classes0'] = ''; $config['listype1'] = '1'; $config['listname1'] = '_ACA_NEWSLETTER'; $config['listnames1'] = '_ACA_MENU_NEWSLETTERS'; $config['listshow1'] = '1'; $config['listlogo1'] = 'inbox.png'; $nb = explode(',', $activeList); $size = sizeof($nb); for ($k = 0; $k < $size; $k++) { $index = $nb[$k]; if (class_exists($config['classes' . $index])) { $classConfig = new $config['classes' . $index](); $config = array_merge($config, $classConfig->getActive()); } } wupdate::queue2(); if ($xf->saveConfig($config)) { $return .= acajoom::printM('green', _ACA_INSTALL_SUCCESS) . '<br />'; } else { $return .= 'Configuration file not updated.<br />'; } return $return; }
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; }
function controlPanel() { //hack for JOomla 13 ADRIEN unset($GLOBALS["task"]); unset($_REQUEST["task"]); ?> <link rel="stylesheet" href="components/com_acajoom/cssadmin/acajoom.css" type="text/css" > <div align="center" class="centermain"> <div id="acajoom"> <table class="acajoomcss"> <tr> <td width="58%" valign="top"> <?php echo backHTML::iconsPanel(); ?> </td> <td width="42%" valign="top"> <div style="width=100%;"> <form action="index2.php" method="post" name="adminForm"> <?php $tabs = new mosTabs(1); $tabs->startPane('acaControlPanel'); $tabs->startTab(_ACA_MENU_TAB_SUM, "acaControlPanel.Summary"); ?> <table class="acajoom_stats" style="text-align: left; width: 100%; " cellpadding="2" cellspacing="0"> <tbody> <tr> <th style="text-align: center;"><?php echo '#'; ?> </th> <th style="text-align: center;"><?php echo _ACA_MENU_TAB_LIST; ?> </th> <th style="text-align: center;"><?php echo _ACA_MENU_MAILING_TITLE; ?> </th> <th style="text-align: center;"><?php echo _ACA_SENT_MAILING; ?> </th> <th style="text-align: center;"><?php echo _ACA_DESC_SUBSCRIBERS; ?> </th> </tr> <?php $html = ''; $totalist = 0; $totalmail = 0; $totalsub = 0; $totalsent = 0; $nb = explode(',', $GLOBALS[ACA . 'activelist']); $size = sizeof($nb); for ($i = 0; $i < $size; $i++) { $index = $nb[$i]; if ($GLOBALS[ACA . 'listshow' . $index] > 0 and $GLOBALS[ACA . 'listype' . $index] == 1) { $html .= '<tr>'; $html .= '<td><b>' . @constant($GLOBALS[ACA . 'listnames' . $index]) . '</b></td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'act_totallist' . $index] . ' </td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'act_totalmailing' . $index] . ' </td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'totalmailingsent' . $index] . ' </td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'act_totalsubcribers' . $index] . ' </td>'; $html .= '</tr>'; $totalist = $totalist + $GLOBALS[ACA . 'act_totallist' . $index]; $totalmail = $totalmail + $GLOBALS[ACA . 'act_totalmailing' . $index]; $totalsent = $totalsent + $GLOBALS[ACA . 'totalmailingsent' . $index]; if ($GLOBALS[ACA . 'act_totalsubcribers' . $index] < $totalsub) { $totalsub = $GLOBALS[ACA . 'act_totalsubcribers' . $index]; } } } $html .= '<tr>'; $html .= '<td><b>' . _ACA_CP_TOTAL . '</b></td>'; $html .= '<td style="text-align: center; ">' . $totalist . ' </td>'; $html .= '<td style="text-align: center; ">' . $totalmail . ' </td>'; $html .= '<td style="text-align: center; ">' . $totalsent . ' </td>'; $html .= '<td style="text-align: center; ">' . $totalsub . ' </td>'; $html .= '</tr>'; echo $html; ?> </tbody></table> <br /> <?php if (class_exists('auto')) { echo auto::showQueue(); } $tabs->endTab(); $tabs->startTab(_ACA_MENU_SUBSCRIBERS, "acaControlPanel.Subscribers"); $emailsearch = ''; $listId = 0; $start = mosGetParam($_REQUEST, 'start', 0); $limit = mosGetParam($_REQUEST, 'limit', 15); $order = mosGetParam($_REQUEST, 'order', 'date'); $total = 0; $subscribers = subscribers::getSubscribers($start, $limit, $emailsearch, $total, $listId, '', 1, 1, 'sub_dateD'); mosCommonHTML::loadOverlib(); ?> <script type="text/javascript"> function checkcid(myField) { myField.checked = true; isChecked(true); } </script> <!-- <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> --> <form action="index2.php" method="post" name="adminForm"> <input type="hidden" name="option" value="com_acajoom" /> <input type="hidden" name="act" value="acajoom" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="userid" value="" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="listid" value="<?php echo $listId; ?> " /> <input type="hidden" name="start" value="<?php echo $start; ?> " /> <input type="hidden" name="limit" value="<?php echo $limit; ?> " /> <input type="hidden" name="emailsearch" value="<?php echo $emailsearch; ?> " /> <table width="100%" border="0" cellspacing="0" cellpadding="4" class="adminlist"> <tr> <th class="title">#</th> <th class="title" style="text-align: left;"><?php echo _ACA_INPUT_NAME; ?> </th> <th class="title" style="text-align: left;"><?php echo _ACA_INPUT_EMAIL; ?> </th> <th class="title" style="text-align: center;"><?php echo _ACA_SIGNUP_DATE; ?> </th> </tr> <?php $i = 0; foreach ($subscribers as $subscriber) { ?> <tr class="row<?php echo $i++ % 2; ?> "> <td><?php echo $i + $start; ?> </td> <td style="text-align: left;"> <a href="index2.php?option=com_acajoom&act=subscribers&task=show&userid=<?php echo $subscriber->id; ?> " > <?php echo $subscriber->name; ?> </a></td> <td style="text-align: left;"><?php echo $subscriber->email; ?> </td> <td style="text-align: center;"><?php echo mosFormatDate($subscriber->subscribe_date, '%x'); ?> </td> </tr> <?php } ?> </table> </form> <?php backHTML::footerCounts($start, $limit, $emailsearch, $total, 4, '', $listId, ''); $tabs->endTab(); $tabs->startTab(_ACA_MENU_TAB_LIST, "acaControlPanel.Lists"); $lists = lists::getLists(0, 0, 1, '', false, false, false); ?> <table class="adminlist"> <tr> <th class="title">#</th> <th class="title" width="65%" style="text-align: left;"><?php echo _ACA_LIST_NAME; ?> </th> <th class="title" width="25%" style="text-align: left;"><?php echo _ACA_LIST_TYPE; ?> </th> <th class="title" style="text-align: center;">#id</th> </tr> <?php $i = 0; foreach ($lists as $list) { $i++; $link = 'index2.php?option=com_acajoom&act=mailing&task=show&listid=' . $list->id; ?> <tr> <td><?php echo $i; ?> </td> <td style="text-align: left;"> <a href="<?php echo $link; ?> "> <?php echo $list->list_name; ?> </a> </td> <td style="text-align: left;"><a href='index2.php?option=com_acajoom&act=mailing&listype=<?php echo $list->list_type; ?> '><?php echo @constant($GLOBALS[ACA . 'listname' . $list->list_type]); ?> </a></td> <td style="text-align: center;"><?php echo $list->id; ?> </td> </tr> <?php } ?> <tr> <th colspan="4"> </th> </tr> </table> <?php $tabs->endTab(); $tabs->endPane(); ?> </form> </div> <div style="clear:both; float:left;"> <?php echo acajoom::printM('blue', _ACA_SERVER_LOCAL_TIME . ' :' . mosFormatDate(acajoom::getNow(), '%A, %d %B %Y %H:%M', 0)); ?> </div> <td> </tr> </table> </div> </div> <?php }
function updateSuscription($suscription) { $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); //$i = 0; //do { //$i++; foreach ($suscription->sub_list_id as $i => $value) { $queues = queue::suscriptionExist($suscription->user_id, $suscription->sub_list_id[$i]); if (!empty($queues)) { if (isset($suscription->subscribed[$i])) { if ($suscription->subscribed[$i] == 0) { $erro->ck = queue::deleteSubsQueue($suscription->user_id, $suscription->sub_list_id[$i]); $erro->Eck(__LINE__, '8520'); } else { $updatedQueue = $queues; $updatedQueue->acc_level = $suscription->acc_level[$i]; if ($queues->mailing_id < 1) { $mailingId = xmailing::getFirstMailingId($queues->list_id); if (!empty($mailingId)) { $list = lists::getOneList($queues->list_id); $mailing = queue::getValidMailing($list, $mailingId); if (!empty($mailing)) { $updatedQueue->type = $mailing->list_type; $updatedQueue->list_id = $list->id; $updatedQueue->mailing_id = $mailing->id; $updatedQueue->published = $list->published; $updatedQueue->send_date = acajoom::getNow(); if ($mailing->list_type == 1 or $mailing->list_type == 7) { $updatedQueue->issue_nb = 0; $updatedQueue->send_date = '0000-00-00 00:00:00'; $updatedQueue->delay = 0; } else { $updatedQueue->issue_nb = $mailing->issue_nb; $updatedQueue->send_date = acajoom::getNow(); $updatedQueue->delay = $mailing->delay; } } } $qid = ''; $qid[0] = $updatedQueue->qid; $erro->ck = queue::updateQueueData($qid, '', $updatedQueue->type, $updatedQueue->list_id, $updatedQueue->mailing_id, $updatedQueue->issue_nb, $updatedQueue->send_date, $updatedQueue->delay, $updatedQueue->acc_level, $updatedQueue->published); $erro->Eck(__LINE__, '8521'); } else { queue::updateAccessLevel($updatedQueue); } } } } else { if (isset($suscription->subscribed[$i])) { if ($suscription->subscribed[$i] == 1) { $subId = array(); $subId[0] = $suscription->user_id; $subList = isset($suscription->sub_list_id[$i]) ? $suscription->sub_list_id[$i] : 0; $subLevel = isset($suscription->acc_level[$i]) ? $suscription->acc_level[$i] : 29; $erro->ck = queue::updateQueues($subId, '', $subList, $subLevel, true); $erro->Eck(__LINE__, '8522'); } } } } //while (count($suscription->sub_list_id ) > $i ); return $erro->R(); }
function import($listId) { $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); @set_time_limit(0); $queue = ''; $queue->sub_list_id = mosGetParam($_REQUEST, 'sub_list_id', ''); $queue->subscribed = mosGetParam($_REQUEST, 'subscribed', ''); $queue->acc_level = mosGetParam($_REQUEST, 'acc_level', 29); $path = $GLOBALS['mosConfig_absolute_path'] . $GLOBALS[ACA . 'upload_url']; $filename = $_FILES['importfile']['name']; if (is_writable($path)) { if (!@move_uploaded_file($_FILES['importfile']['tmp_name'], $path . $filename)) { echo _ACA_ERROR_MOVING_UPLOAD; } $import = file_get_contents($path . $filename); $import = str_replace(array("\r", "\r\n"), "\n", $import); $array = explode("\n", $import); if (sizeof($array) > 0) { foreach ($array as $row) { $row = trim($row); if (empty($row)) { continue; } $values = explode(',', $row); if (count($values) != 4) { echo '<br />' . acajoom::printM('red', $row . ' : Acajoom needs 4 arguments for each user'); continue; } $values[0] = trim($values[0]); $values[1] = trim($values[1]); if (isset($values[1])) { $valid = subscribers::validEmail($values[1]); if (!$valid) { echo '<br />' . acajoom::printM('red', $values[1] . ': ' . _ACA_EMAIL_INVALID); continue; } else { $subscriber = null; $subscriber->name = addslashes($values[0]); $subscriber->email = $values[1]; $subscriber->receive_html = empty($values[2]) ? '0' : '1'; $subscriber->confirmed = empty($values[3]) ? '0' : '1'; $subscriber->subscribe_date = acajoom::getNow(); $subscriber->language_iso = 'eng'; $subscriber->timezone = '00:00:00'; $subscriber->blacklist = '0'; $subscriber->params = ''; $d['email'] = $subscriber->email; $erro->ck = subscribers::getSubscriberIdFromEmail($d); $erro->Eck(__LINE__, '8679'); $subscriberId = $d['subscriberId']; if ($subscriberId < 1) { $erro->ck = subscribers::insertSubscriber($subscriber, $subscriberId); $erro->Eck(__LINE__, '8650'); } if (!$erro->ck) { echo '<br />' . acajoom::printM('red', $values[0] . ': ' . _ACA_SUBCRIBER_EXIT); } else { if (!empty($queue->subscribed) and $subscriberId > 0) { $queue->user_id = $subscriberId; $erro->ck = queue::updateSuscription($queue); $erro->Eck(__LINE__, '8651'); if ($GLOBALS[ACA . 'require_confirmation'] == '1' and $values[3] == '0') { $listIds = array(); $size = sizeof($queue->sub_list_id); for ($index = 0; $index < $size; $index++) { if (isset($queue->subscribed[$index])) { if ($queue->subscribed[$index] > 0) { $listIds[] = $queue->sub_list_id[$index]; } } } $erro->ck = acajoom_mail::processConfirmationEmail($subscriberId, $listIds); $erro->Eck(__LINE__, '8652'); } if ($erro->ck) { echo '<br />' . acajoom::printM('green', $values[0] . ': ' . _ACA_IMPORT_SUCCESS); } else { echo '<br />' . acajoom::printM('blue', $values[0] . ': ' . _ACA_PB_QUEUE); } } } } } } return true; } $erro->ck = unlink($path . $filename); $erro->Eck(__LINE__, '8655'); if (!$erro->ck) { echo _ACA_DELETION_OFFILE . ' ' . $path . $filename . ' ' . _ACA_MANUALLY_DELETE . '.</p>'; } } else { echo _ACA_CANNOT_WRITE_DIR . ' ' . $path . '</p>'; return false; } }
function email() { global $version, $database; $acaVers = class_exists('acajoom') ? acajoom::version() : 'test'; $acaNow = class_exists('acajoom') ? acajoom::getNow() : time(); $safemode = ini_get("safe_mode") == 0 ? 'off' : 'on'; $content = "-----------------------------------\n"; $content .= $GLOBALS[ACA . 'component'] . " Configuration: \n"; $content .= "-----------------------------------\n\n"; $content .= "Component : " . $acaVers . " \n"; $content .= "Language : " . $GLOBALS['mosConfig_lang'] . "\n"; $content .= ' Time of report : ' . $acaNow . "\n\n"; $content .= "Send method: " . $GLOBALS[ACA . 'emailmethod'] . "\n"; if ($GLOBALS[ACA . 'emailmethod'] == 'smtp') { $auth = $GLOBALS[ACA . 'smtp_auth_required'] == 1 ? 'yes' : 'no'; $content .= "Authentication required: " . $auth . "\n"; } $content .= "-----------------------------------\n"; $content .= " Server configuration: \n"; $content .= "-----------------------------------\n\n"; $content .= "Joomla Version : " . $version . "\n"; $content .= "Database Version : " . $database->getVersion() . "\n"; $content .= "PHP Version : " . phpversion() . "\n"; $content .= "Zend Version : " . zend_version() . "\n"; $content .= "Magic_quotes_gpc : " . ini_get("magic_quotes_gpc") . "\n"; $content .= "Disable_functions : " . ini_get("disable_functions") . "\n"; $content .= "Max_execution_time : " . ini_get("max_execution_time") . "\n"; $content .= "Safe_mode : " . $safemode . "\n"; $content .= "Memory_limit : " . ini_get("memory_limit") . "\n"; $content .= "Software : " . $_SERVER['SERVER_SOFTWARE'] . "\n"; $content .= "-----------------------------------\n"; $content .= " Traces: \n"; $content .= "-----------------------------------\n\n"; $content .= "Error # :" . _ACA_ERR_NB . $this->errNb . "\n\n\n"; $content .= "Line : " . $this->line . "\n"; $content .= "Class : " . $this->classes . "\n"; $content .= "Function : " . $this->fct . "\n"; $content .= "File : " . $this->file_name . "\n"; $content .= "\n\n"; if ($this->err) { $content .= "Error raised: " . $this->varDump($this->err) . "\n"; } if ($this->data) { $content .= "Data : " . $this->varDump($this->data) . "\n"; } $content .= "\n\n"; $content .= "\n\n"; }
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; }