Beispiel #1
0
 function deleteList($listId)
 {
     global $database;
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     $xf = new xonfig();
     $list = lists::getOneList($listId);
     $query = 'DELETE FROM `#__acajoom_lists` WHERE `id` = ' . $listId;
     $database->setQuery($query);
     $database->query();
     $erro->err = $database->getErrorMsg();
     $erro->E(__LINE__, '8317', $database);
     $query = 'DELETE FROM `#__acajoom_queue` WHERE `list_id` = ' . $listId;
     $database->setQuery($query);
     $database->query();
     $erro->err = $database->getErrorMsg();
     $erro->E(__LINE__, '8319', $database);
     $mailings = xmailing::getMailings($listId, '', -1, -1, '', $total, '', false, false);
     if (!empty($mailings)) {
         foreach ($mailings as $mailing) {
             $listingList[] = $mailing->id;
         }
         $query = "DELETE FROM `#__acajoom_stats_global` WHERE `mailing_id` IN ( " . implode(' , ', $listingList) . " ) ";
         $database->setQuery($query);
         $database->query();
         $erro->err .= $database->getErrorMsg();
         $erro->E(__LINE__, '8320', $database);
         $query = "DELETE FROM `#__acajoom_stats_details` WHERE  `mailing_id` IN ( " . implode(' , ', $listingList) . " ) ";
         $database->setQuery($query);
         $database->query();
         $erro->err .= $database->getErrorMsg();
         $erro->E(__LINE__, '8321', $database);
     }
     $query = 'DELETE FROM `#__acajoom_mailings` WHERE `list_id` = ' . $listId;
     $database->setQuery($query);
     $database->query();
     $erro->err = $database->getErrorMsg();
     $erro->E(__LINE__, '8318', $database);
     if (!$erro->result) {
         return false;
     } else {
         $xf->plus('act_totallist0', -1);
         $xf->plus('act_totalmailing' . $list->list_type, -1);
         return true;
     }
 }
Beispiel #2
0
 function sendSchedule($d, $showHTML, $receivers, $list, &$message, &$max, $tags = null)
 {
     static $countEmails = 0;
     $mailing = $d['mailing'];
     $h = '';
     $xf = new xonfig();
     if (empty($mailing)) {
         $message = _ACA_NO_MAILING_ENTERED;
         return false;
     } elseif (empty($receivers)) {
         $message = _ACA_NO_ADDRESS_ENTERED;
         return false;
     } elseif (empty($list)) {
         $message = _ACA_NO_LIST_ENTERED;
         return false;
     } else {
         $message = '';
     }
     $mailingId = $mailing->id;
     $issue_nb = $mailing->issue_nb;
     $subject = $mailing->subject;
     $content = $mailing->htmlcontent;
     $textonly = $mailing->textonly;
     $fromname = $mailing->fromname;
     $fromemail = $mailing->fromemail;
     $images = $mailing->images;
     $listId = $list->id;
     $html = $list->html;
     $layout = $list->layout;
     $totalsofar = number_format(0, 4, ',', '');
     $nbPause = 0;
     $tags['issuenb'] = $issue_nb;
     if (ini_get('safe_mode')) {
     } else {
         @set_time_limit(60 * $GLOBALS[ACA . 'script_timeout']);
     }
     ignore_user_abort(true);
     ### create the mail
     $mail = acajoom_mail::getMailer($mailing);
     ### create content
     acajoom_mail::getContent($images, $layout, $content, $textonly);
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $starttime = $mtime;
     $html_sent = 0;
     $text_sent = 0;
     $size = sizeof($receivers);
     $log_detailed = "\r\n" . "\r\n" . '*** ' . strftime(_DATE_FORMAT_LC) . ' ***' . "\r\n";
     foreach ($receivers as $receiver) {
         $tags['user_id'] = $receiver->user_id;
         if ($html && intval($receiver->receive_html) == 1) {
             $mail->IsHTML(true);
             $ashtml = 1;
             $Altbody = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, 0, $tags);
             $mail->AltBody = acajoom_mail::safe_utf8_encode($Altbody, $mail->CharSet);
             $html_sent++;
             $mail->Body = acajoom_mail::replaceTags($content, $receiver, $list, $mailingId, $ashtml, $tags);
         } else {
             $mail->IsHTML(false);
             $mail->AltBody = '';
             $ashtml = 0;
             $text_sent++;
             $mail->Body = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, $ashtml, $tags);
             // if we are in TEXT Mode, Why do we add embedded images???
             if (!empty($images)) {
                 foreach ($images as $image) {
                     $img = explode('|', $image);
                     $attrib = explode("/", $img[0]);
                     $path = $GLOBALS['mosConfig_absolute_path'] . '/images/stories/';
                     if (count($img) == 1) {
                         $imageName = $img[0];
                     } else {
                         $imageName = $attrib[count($attrib) - 1];
                         for ($index = 0; $index < sizeof($attrib) - 1; $index++) {
                             $path .= $attrib[$index] . '/';
                         }
                     }
                     $mail->AddAttachment($path . $imageName);
                 }
             }
         }
         $tname = explode(" ", $receiver->name);
         $firstname = $tname[0];
         $mail->AddAddress($receiver->email, $receiver->name);
         $sujetReplaced = str_replace('[NAME]', $receiver->name, $subject);
         $sujetReplaced = str_replace('[FIRSTNAME]', $firstname, $sujetReplaced);
         if (class_exists('auto')) {
             auto::tags($sujetReplaced, $tags);
         }
         $mail->Subject = $sujetReplaced;
         $mailssend = $mail->Send();
         $countEmails++;
         if ($countEmails >= $GLOBALS[ACA . 'cron_max_emails']) {
             $max = true;
         }
         if ($mail->error_count > 0) {
             static $info = false;
             if (!$info and acajoom::checkPermissions('admin')) {
                 echo '<br/>Mailer Error : ' . $mail->ErrorInfo;
                 $info = true;
             }
             $log_detailed .= '[' . $mailingId . '] ' . $subject . ' : ' . $receiver->email . ' -> ' . _ACA_MESSAGE_NOT . "\r\n" . _ACA_MAILER_ERROR . ': ' . $mail->ErrorInfo . "\r\n";
             if ($html && intval($receiver->receive_html) == 1) {
                 $html_sent--;
             } else {
                 $text_sent--;
             }
         } else {
             $log_detailed .= '[' . $mailingId . '] ' . $subject . ' : ' . $receiver->email . ' -> ' . _ACA_MESSAGE_SENT_SUCCESSFULLY . "\r\n";
             if ($GLOBALS[ACA . 'enable_statistics'] == 1 and $GLOBALS[ACA . 'statistics_per_subscriber'] == 1) {
                 xmailing::insertStats($mailingId, $receiver->id, $ashtml);
             }
             $d['qids'] = array();
             $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
             if ($d['listype'] == '2') {
                 $d['qids'][0] = queue::whatQID($mailingId, $receiver->id, $d['listype']);
                 $erro->ck = auto::updateAutoresponderSent($d);
                 $erro->Eck(__LINE__, '8137', $d);
             } elseif ($d['listype'] == '1' || $d['listype'] == '7') {
                 $d['qids'][0] = queue::whatQID($mailingId, $receiver->id, $d['listype']);
                 $erro->ck = queue::deleteQueues($d['qids']);
                 $erro->Eck(__LINE__, '8127', $d);
             }
         }
         $mail->ClearAddresses();
     }
     if ($GLOBALS[ACA . 'enable_statistics'] == 1) {
         xmailing::updateStatsGlobal($mailingId, $html_sent, $text_sent, false);
     }
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $endtime = $mtime;
     if ($totalsofar > 0) {
         $totaltime = $totalsofar;
         $totalstr = strval($totaltime);
     } else {
         $totaltime = number_format($endtime - $starttime - $nbPause * $GLOBALS[ACA . 'pause_time'], 4, ',', '');
         $totalstr = strval($totaltime);
     }
     if ($GLOBALS[ACA . 'send_data'] == 1) {
         acajoom_mail::sendReport($fromemail, $totalstr, $html_sent, $text_sent);
     }
     $xf->plus('totalmailingsent' . $list->list_type, $html_sent + $text_sent);
     $xf->plus('totalmailingsent0', $html_sent + $text_sent);
     $log_simple = 'Time to send: ' . $totalstr . ' ' . _ACA_SECONDS . "\r\n" . 'Number of subscribers: ' . ($text_sent + $html_sent) . "\r\n" . 'HTML format: ' . $html_sent . "\r\n" . 'Text format: ' . $text_sent . "\r\n";
     $log_detailed = $log_simple . 'Details: ' . "\r\n" . $log_detailed . "\r\n";
     if (class_exists('lisType')) {
         acajoom_mail::writeLogs($list, $log_simple, $log_detailed);
     }
     if ($d['listype'] == '2') {
         echo '<br/>' . _ACA_QUEUE_AUTO_PROCESSED;
     } elseif ($d['listype'] == '1') {
         echo '<br/>' . _ACA_QUEUE_NEWS_PROCESSED;
     }
     if ($html_sent + $text_sent > 0) {
         return true;
     } else {
         $message = xmailing::M('no', _ACA_NO_MAILING_SENT);
         return false;
     }
 }
 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);
 }
Beispiel #4
0
 function filetoDatabase($acajoomConfigFile)
 {
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     $erro->show();
     $configKeys = array_keys($acajoomConfigFile);
     $size = sizeof($configKeys);
     for ($index = 0; $index < $size; $index++) {
         $erro->err .= $this->insert($configKeys[$index], $acajoomConfigFile[$configKeys[$index]], 0);
     }
     return $erro->E(__LINE__, '9012');
 }
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 updateFile($file, $addFile, $version = '')
 {
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     if (ini_get('allow_url_fopen') == false) {
         if (in_array('curl', get_loaded_extensions())) {
             $globalFile = $this->getFileCurl($this->path . $file, $version);
         } else {
             $erro->W(__LINE__, '8013', _ACA_WARNG_REMOTE_FILE);
             $message = acajoom::printM('warning', _ACA_WARNG_REMOTE_FILE);
             return false;
         }
     } else {
         $globalFile = file_get_contents($GLOBALS[ACA . 'update_url'] . preg_replace('/\\.php$/', '.inc', $this->path . $file));
     }
     if (empty($globalFile)) {
         $erro->W(__LINE__, '8014', _ACA_ERROR_FETCH);
         $message = acajoom::printM('warning', _ACA_ERROR_FETCH);
         return false;
     } else {
         $status = false;
         if (file_exists($GLOBALS['mosConfig_absolute_path'] . DS . $file)) {
             if (@copy($GLOBALS['mosConfig_absolute_path'] . DS . $file, WPATH_ADMIN . 'backup/' . acajoom::version(true) . DS . $file)) {
                 $status = file_put_contents($GLOBALS['mosConfig_absolute_path'] . DS . $file, $globalFile);
             } else {
                 echo acajoom::printM('red', _ACA_BACKUP_FAILED) . '<br />';
             }
         } else {
             if ($addFile) {
                 $status = file_put_contents($GLOBALS['mosConfig_absolute_path'] . DS . $file, $globalFile);
             }
         }
         return $status;
     }
 }
Beispiel #7
0
 function sendSchedule($d, $showHTML, $receivers, $list, &$message, &$max, $tags = null)
 {
     static $countEmails = 0;
     $mailing = $d['mailing'];
     $h = '';
     $xf = new xonfig();
     if (empty($mailing)) {
         $message = _ACA_NO_MAILING_ENTERED;
         return false;
     } elseif (empty($receivers)) {
         $message = _ACA_NO_ADDRESS_ENTERED;
         return false;
     } elseif (empty($list)) {
         $message = _ACA_NO_LIST_ENTERED;
         return false;
     } else {
         $message = '';
     }
     $mailingId = $mailing->id;
     $issue_nb = $mailing->issue_nb;
     $subject = $mailing->subject;
     $content = $mailing->htmlcontent;
     $textonly = $mailing->textonly;
     $fromname = $mailing->fromname;
     $fromemail = $mailing->fromemail;
     $images = $mailing->images;
     $listId = $list->id;
     $html = $list->html;
     $layout = $list->layout;
     $totalsofar = number_format(0, 4, ',', '');
     $nbPause = 0;
     $tags['issuenb'] = $issue_nb;
     //Just in case of...
     @ini_set('max_execution_time', 0);
     @ini_set('memory_limit', '128M');
     ignore_user_abort(true);
     ### create the mail
     $mail = acajoom_mail::getMailer($mailing);
     ### create content
     acajoom_mail::getContent($images, $layout, $content, $textonly, true);
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $starttime = $mtime;
     $html_sent = 0;
     $text_sent = 0;
     $size = sizeof($receivers);
     $format = defined('_DATE_FORMAT_LC') ? _DATE_FORMAT_LC : JText::_('DATE_FORMAT_LC');
     $log_detailed = "\r\n" . "\r\n" . '*** ' . strftime($format) . ' ***' . "\r\n";
     //variables used in integration of jLinks
     $mailCatID = null;
     $convertedLinks = null;
     foreach ($receivers as $receiver) {
         $tags['user_id'] = $receiver->user_id;
         if ($html && intval($receiver->receive_html) == 1) {
             $mail->IsHTML(true);
             $ashtml = 1;
             $Altbody = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, 0, $tags);
             $mail->AltBody = acajoom_mail::safe_utf8_encode($Altbody, $mail->CharSet);
             $html_sent++;
             $mail->Body = acajoom_mail::replaceTags($content, $receiver, $list, $mailingId, $ashtml, $tags);
             acajoom_mail::replaceClass($mail->Body, $mail->AltBody, $receiver);
         } else {
             $mail->IsHTML(false);
             $mail->AltBody = '';
             $ashtml = 0;
             $text_sent++;
             $mail->Body = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, $ashtml, $tags);
             $simpleText = '';
             acajoom_mail::replaceClass($mail->Body, $simpleText, $receiver);
         }
         $tname = explode(" ", $receiver->name);
         $firstname = $tname[0];
         $toUser = $GLOBALS[ACA . 'minisendmail'] ? '' : $receiver->name;
         $mail->AddAddress($receiver->email, $toUser);
         if (!empty($receiver->id)) {
             $mail->addCustomHeader("X-SubscriberID: {$receiver->id}");
         }
         $username = empty($receiver->username) ? $firstname : $receiver->username;
         $date = ACA_CMSTYPE ? JHTML::_('date', acajoom::getNow(), JText::_('DATE_FORMAT_LC1'), 0) : mosFormatDate(acajoom::getNow(), '', 0);
         $replaceWhat = array('[NAME]', '[FIRSTNAME]', '[USERNAME]', '[DATE]');
         $replaceBy = array($receiver->name, $firstname, $username, $date);
         $sujetReplaced = str_replace($replaceWhat, $replaceBy, $subject);
         if (class_exists('auto')) {
             auto::tags($sujetReplaced, $tags);
         }
         $mail->Subject = $sujetReplaced;
         if ($GLOBALS[ACA . 'embed_images']) {
             acajoom_mail::embedImages($mail);
         }
         $mailssend = $mail->Send();
         $countEmails++;
         if ($countEmails >= $GLOBALS[ACA . 'cron_max_emails']) {
             $max = true;
         }
         if (!$mailssend || $mail->error_count > 0) {
             static $info = false;
             if (!$info and acajoom::checkPermissions('admin')) {
                 echo '<br/>Mailer Error : ' . $mail->ErrorInfo;
                 echo " : Newsletter '{$sujetReplaced}' to {$receiver->email}";
                 $info = true;
             }
             $log_detailed .= '[' . $mailingId . '] ' . $subject . ' : ' . $receiver->email . ' -> ' . _ACA_MESSAGE_NOT . "\r\n" . _ACA_MAILER_ERROR . ': ' . $mail->ErrorInfo . "\r\n";
             if ($html && intval($receiver->receive_html) == 1) {
                 $html_sent--;
             } else {
                 $text_sent--;
             }
             if (!subscribers::validEmail($receiver->email, true)) {
                 $deleteQueue = array();
                 $deleteQueue[0] = queue::whatQID($mailingId, $receiver->id, $d['listype']);
                 queue::deleteQueues($deleteQueue);
             }
         } else {
             $log_detailed .= '[' . $mailingId . '] ' . $subject . ' : ' . $receiver->email . ' -> ' . _ACA_MESSAGE_SENT_SUCCESSFULLY . "\r\n";
             if ($GLOBALS[ACA . 'enable_statistics'] == 1 and $GLOBALS[ACA . 'statistics_per_subscriber'] == 1) {
                 xmailing::insertStats($mailingId, $receiver->id, $ashtml);
             }
             $d['qids'] = array();
             $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
             if ($d['listype'] == '2') {
                 $d['qids'][0] = queue::whatQID($mailingId, $receiver->id, $d['listype']);
                 $erro->ck = auto::updateAutoresponderSent($d);
                 $erro->Eck(__LINE__, '8137', $d);
             } elseif ($d['listype'] == '1' || $d['listype'] == '7') {
                 $d['qids'][0] = queue::whatQID($mailingId, $receiver->id, $d['listype']);
                 $erro->ck = queue::deleteQueues($d['qids']);
                 $erro->Eck(__LINE__, '8127', $d);
             }
         }
         $mail->ClearAddresses();
     }
     if ($GLOBALS[ACA . 'enable_statistics'] == 1) {
         xmailing::updateStatsGlobal($mailingId, $html_sent, $text_sent, false);
     }
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $endtime = $mtime;
     if ($totalsofar > 0) {
         $totaltime = $totalsofar;
         $totalstr = strval($totaltime);
     } else {
         $totaltime = number_format($endtime - $starttime - $nbPause * $GLOBALS[ACA . 'pause_time'], 4, ',', '');
         $totalstr = strval($totaltime);
     }
     $xf->plus('totalmailingsent' . $list->list_type, $html_sent + $text_sent);
     $xf->plus('totalmailingsent0', $html_sent + $text_sent);
     $log_simple = 'Time to send: ' . $totalstr . ' ' . _ACA_SECONDS . "\r\n" . 'Number of subscribers: ' . ($text_sent + $html_sent) . "\r\n" . 'HTML format: ' . $html_sent . "\r\n" . 'Text format: ' . $text_sent . "\r\n";
     $log_detailed = $log_simple . 'Details: ' . "\r\n" . $log_detailed . "\r\n";
     if (class_exists('lisType')) {
         acajoom_mail::writeLogs($list, $log_simple, $log_detailed);
     }
     if ($d['listype'] == '2') {
         echo '<br/>' . _ACA_QUEUE_AUTO_PROCESSED;
     } elseif ($d['listype'] == '1') {
         echo '<br/>' . _ACA_QUEUE_NEWS_PROCESSED;
     }
     if ($html_sent + $text_sent > 0) {
         return true;
     } else {
         $message = xmailing::M('no', _ACA_NO_MAILING_SENT);
         return false;
     }
 }
Beispiel #8
0
function acajoombot_content_getitem($id)
{
    if (ACA_CMSTYPE) {
        $database =& JFactory::getDBO();
    } else {
        global $database;
    }
    //endif
    $erro = new xerr(__FILE__, __FUNCTION__);
    $query = "SELECT a.title as title, a.sectionid as sectionid, a.catid as catid, a.introtext as introtext, b.name as name, a.created_by_alias as created_by_alias, a.fulltext as `fulltext`, a.images as images FROM #__content as a LEFT JOIN #__users as b ON a.created_by = b.id WHERE a.id = {$id}";
    $database->setQuery($query);
    if (ACA_CMSTYPE) {
        // joomla 15
        $content_item = $database->loadObject();
    } else {
        //joomla 1x
        $database->loadObject($content_item);
    }
    //endif
    $erro->err = $database->getErrorMsg();
    $erro->show();
    if ($content_item->created_by_alias == '') {
        $content_item->created_by_alias = $content_item->name;
    }
    if (!$erro->E(__LINE__, '8011')) {
        return false;
    } else {
        if (get_magic_quotes_runtime()) {
            $content_item->title = stripslashes($content_item->title);
            $content_item->introtext = stripslashes($content_item->introtext);
            $content_item->fulltext = stripslashes($content_item->fulltext);
            $content_item->images = stripslashes($content_item->images);
            $content_item->created_by_alias = stripslashes($content_item->created_by_alias);
        }
        return $content_item;
    }
}
Beispiel #9
0
 function remove($subscriberId, $cle = '', $listId)
 {
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     if (!empty($subscriberId) and !empty($cle) and $listId > 0) {
         $qid[0] = $subscriberId;
         $subscriber = subscribers::getSubscribersFromId($qid, false);
         if (md5($subscriber->email) == $cle) {
             $suscription = new stdClass();
             $suscription->user_id = $subscriberId;
             $suscription->sub_list_id[1] = $listId;
             $suscription->subscribed[1] = 0;
             $suscription->acc_level[1] = 0;
             $erro->ck = queue::updateSuscription($suscription);
             $erro->Eck(__LINE__, '8277');
             $list = lists::getOneList($listId);
             if ($list->unsubscribesend == 1) {
                 $erro->err = acajoom_mail::sendUnsubcribeEmail($subscriberId, $list);
                 $erro->E(__LINE__, '8278');
             }
         }
     }
     return $erro->R();
 }
Beispiel #10
0
 function suscriptionExist($subscriber_id, $listId)
 {
     if (ACA_CMSTYPE) {
         $database =& JFactory::getDBO();
     } else {
         global $database;
     }
     //endif
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     if ($subscriber_id > 0 and $listId > 0) {
         if (is_array($subscriber_id)) {
             $subscriber_id = implode(',', $subscriber_id);
         }
         $query = 'SELECT * FROM `#__acajoom_queue` WHERE `subscriber_id` IN ( ' . $subscriber_id . ') AND `list_id` =' . $listId;
         $database->setQuery($query);
         if (ACA_CMSTYPE) {
             // joomla 15
             $queue = $database->loadObject();
         } else {
             //joomla 1x
             $database->loadObject($queue);
         }
         //endif
         $erro->err = $database->getErrorMsg();
         return $erro->Ertrn(__LINE__, '8541', $database, $queue);
     }
     return '';
 }
function statistics($listId, $listType, $mailingId, $message, $task, $action)
{
    global $database;
    $erro = new xerr(__FILE__, __FUNCTION__);
    switch ($task) {
        case 'edit':
        case 'view':
            $mailing = xmailing::getOneMailing(0, $mailingId, '', $new);
            $list = lists::getOneList($mailing->list_id);
            $listId = $list->id;
            $listType = $list->list_type;
            if ($mailingId != 0) {
                $query = 'SELECT * FROM `#__acajoom_stats_global` WHERE `mailing_id` = \'' . $mailingId . '\'';
                $database->setQuery($query);
                $database->loadObject($globalStats);
                $erro->err = $database->getErrorMsg();
                if (empty($globalStats)) {
                    $globalStats->html_sent = '';
                    $globalStats->html_read = 0;
                    $globalStats->text_sent = '';
                }
                $query = 'SELECT U.name, U.email, D.html, D.read FROM `#__acajoom_stats_details` as D ' . 'LEFT JOIN `#__acajoom_subscribers` as U ON D.subscriber_id=U.id WHERE  D.mailing_id = \'' . $mailingId . '\'';
                $database->setQuery($query);
                $detailedStats = $database->loadObjectList();
                $erro->err .= $database->getErrorMsg();
                $erro->show();
                if (!$erro->E(__LINE__, '8009')) {
                    return false;
                } else {
                    $html_read = array();
                    $html_unread = array();
                    $text = array();
                    foreach ($detailedStats as $detailedStat) {
                        if ($detailedStat->html == 1) {
                            if ($detailedStat->read == 1) {
                                $html_read[] = $detailedStat;
                            } else {
                                $html_unread[] = $detailedStat;
                            }
                        } else {
                            $text[] = $detailedStat;
                        }
                    }
                    backHTML::_header(_ACA_MENU_STATS, 'query.png', $message, $task, $action);
                    backHTML::showStatistics($list, $mailing, $globalStats, $html_read, $html_unread, $text, $listId);
                }
            } else {
                echo '<p> Please select a mailings id.</p>';
                return false;
            }
            break;
        case 'cancel':
            compa::redirect('index2.php?option=com_acajoom&act=statistics&listid=' . $listId);
            break;
        case 'cpanel':
            backHTML::controlPanel();
            break;
        default:
            backHTML::_header(_ACA_MENU_STATS, 'query.png', $message, $task, $action);
            xmailing::showMailings($task, $action, $listId, $listType, '', false, _ACA_MENU_STATS_FOR);
    }
}
 function updateUserstoAcajoom($force = false)
 {
     global $database;
     $time = isset($GLOBALS[ACA . 'last_sub_update']) && $GLOBALS[ACA . 'last_sub_update'] > 0 ? $GLOBALS[ACA . 'last_sub_update'] : 10000;
     $newTask = mktime(date("H") - 1, date("i"), date("s"), date("m"), date("d") - 1, date("Y"));
     if ($force or $newTask > $GLOBALS[ACA . 'last_sub_update']) {
         $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
         $xf = new xonfig();
         $newtime = mktime(date("H", $time) - 1, date("i", $time), date("s", $time), date("m", $time), date("d", $time), date("Y", $time));
         $oneDay = date('Y-m-d H:i:s', $newtime);
         $query = 'SELECT M.* FROM `#__users` AS M ' . ' LEFT JOIN `#__acajoom_subscribers` AS N ON M.id = N.user_id OR M.email = N.email ';
         $query .= ' WHERE M.registerDate > \'' . $oneDay . '\'';
         $query .= ' AND  N.id IS NULL AND M.block=0 ';
         $database->setQuery($query);
         $rows = $database->loadObjectList();
         $erro->err = $database->getErrorMsg();
         $erro->E(__LINE__, '8638', $database);
         if ($erro->result and !empty($rows)) {
             foreach ($rows as $row) {
                 $query = "INSERT INTO `#__acajoom_subscribers` (`user_id`,`subscribe_date`, `name`,`email`,`confirmed`)";
                 $query .= " VALUES ( {$row->id} , '{$row->registerDate}', '{$row->name}', '{$row->email}' , 1 ) ";
                 $database->setQuery($query);
                 $database->query();
                 $erro->err = $database->getErrorMsg();
                 $xf->plus('totalsubcribers0', 1);
                 $xf->plus('act_totalsubcribers0', 1);
                 $lists = lists::getLists(0, 0, null, '', true, false, false);
                 if (!empty($lists)) {
                     foreach ($lists as $list) {
                         $qid[0] = subscribers::getSubscriberId($row->registerDate);
                         $subscriber = subscribers::getSubscribersFromId($qid, false);
                         $subId = array();
                         $subId[0] = $subscriber->id;
                         $erro->ck = queue::updateQueues($subId, '', $list->id, @$list->acc_id, true);
                         $erro->Eck(__LINE__, '8640');
                     }
                 }
             }
         }
     }
 }
Beispiel #13
0
 function userDeleted($user, $success)
 {
     require_once ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php';
     $erro = new xerr(__FILE__, __FUNCTION__);
     if (!empty($user->user_id)) {
         $subscriberId = subscribers::getSubscriberIdFromUserId($user->user_id);
         if (!empty($subscriberId)) {
             subscribers::deleteOneSubscriber($subscriberId);
         }
     }
     $erro->ck = subscribers::updateSubscribers();
     $erro->Eck(__LINE__, '7009');
     return true;
 }
Beispiel #14
0
 function userDeleted($user, $success)
 {
     require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/components/com_acajoom/classes/class.acajoom.php';
     $erro = new xerr(__FILE__, __FUNCTION__);
     $erro->ck = subscribers::updateSubscribers();
     $erro->Eck(__LINE__, '7009');
     return true;
 }