Esempio n. 1
0
 function insertMailing($mailing)
 {
     global $database;
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     $erro->ck = xmailing::insertMailingData($mailing);
     if ($erro->Eck(__LINE__, '8417')) {
         $query = 'SELECT `id` FROM `#__acajoom_mailings` WHERE ';
         $query .= ' `list_id` = ' . $mailing->list_id . ' AND `issue_nb` = \'' . $mailing->issue_nb . '\'';
         $query .= ' AND `author_id` = ' . $mailing->author_id . ' AND `list_type` = \'' . $mailing->list_type . '\'';
         $query .= ' AND `published` != -1';
         $database->setQuery($query);
         $mailingId = $database->loadResult();
         $erro->err = $database->getErrorMsg();
         if (!$erro->E(__LINE__, '8418', $database)) {
             return '';
         } else {
             return $mailingId;
         }
     } else {
         return '';
     }
 }
Esempio n. 2
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;
     }
 }
Esempio n. 3
0
 function logStatistics($mailingId, $subscriberId)
 {
     global $database;
     if ($subscriberId != 0) {
         $query = 'REPLACE INTO `#__acajoom_stats_details` ' . '( `mailing_id`, `subscriber_id`, `html`, `read`) ' . 'VALUES ( \'' . $mailingId . '\', \'' . $subscriberId . '\', \'1\', \'1\')';
         $database->setQuery($query);
         $database->query();
     }
     xmailing::updateStatsGlobal($mailingId, 0, 0, true);
     ob_end_clean();
     $filename = $GLOBALS['mosConfig_absolute_path'] . '/images/blank.png';
     $handle = fopen($filename, 'r');
     $contents = fread($handle, filesize($filename));
     fclose($handle);
     header("Content-type: image/png");
     echo $contents;
     exit;
 }
Esempio n. 4
0
 function insertMailingData($mailing)
 {
     if (ACA_CMSTYPE) {
         $database =& JFactory::getDBO();
     } else {
         global $database;
     }
     //endif
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     $xf = new xonfig();
     $query = "INSERT INTO `#__acajoom_mailings` (`list_id`, `list_type`,`send_date`, `subject`, `htmlcontent`, `textonly`," . "\n `attachments`, `images`, `published`, `html`, `visible`, `fromname`, `fromemail`, `frombounce`, " . "\n `author_id`, `delay`, `issue_nb` , `acc_level` , `createdate`) " . "\n VALUES ( {$mailing->list_id}, " . "{$mailing->list_type}, " . "'{$mailing->send_date}', " . "'" . addslashes($mailing->subject) . "', " . "'" . addslashes($mailing->htmlcontent) . "', " . "'" . addslashes($mailing->textonly) . "', " . "'{$mailing->attachments}', " . "'{$mailing->images}', " . "{$mailing->published}, " . "{$mailing->html}, " . "{$mailing->visible}, " . "'{$mailing->fromname}', " . "'{$mailing->fromemail}', " . "'{$mailing->frombounce}', " . "'{$mailing->author_id}', " . "{$mailing->delay}, " . "{$mailing->issue_nb}, " . "{$mailing->acc_level}, " . "'{$mailing->createdate}' ) ";
     $database->setQuery($query);
     $database->query();
     $erro->err = $database->getErrorMsg();
     if (empty($erro->err)) {
         $xf->plus('totalmailing0', 1);
         $xf->plus('act_totalmailing0', 1);
         $xf->plus('totalmailing' . $mailing->list_type, 1);
         $xf->plus('act_totalmailing' . $mailing->list_type, 1);
     }
     $mailingId = xmailing::getLastMailingId();
     xmailing::insertStatsGlobal($mailingId);
     return $erro->E(__LINE__, '8419', $database);
 }
Esempio n. 5
0
/**
* @copyright Copyright (C) 2009 Joobi Limited All rights reserved.
* @license This file is released under the GPL license (http://www.gnu.org/licenses )
* @link http://www.ijoobi.com
*/
function mailing($action, $task, $listId, $listType, $mailingId, $message)
{
    $showMailings = false;
    switch ($task) {
        case 'edit':
            if (ACA_CMSTYPE) {
                // joomla 15
                $issue_nb = intval(JRequest::getVar('issue_nb', 1));
            } else {
                //joomla 1x
                $issue_nb = intval(mosGetParam($_REQUEST, 'issue_nb', 1));
            }
            //endif
            $list = lists::getOneList($listId);
            $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new);
            $show = lisType::showType($mailing->list_type, 'editmailing');
            if ($mailing->published != 1 or $mailing->list_type != 1 or isset($show['admin']) and $show['admin']) {
                $forms['main'] = " <form action='index2.php' method='post' enctype='multipart/form-data' name='adminForm'> \n ";
                xmailing::_header($task, $action, $mailing->list_type, $message, 'edit');
                mailingsHTML::editMailing($mailing, $new, $listId, $forms, $show);
                $go[] = acajoom::makeObj('act', $action);
                backHTML::formEnd($go);
            } else {
                $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
                xmailing::_header($task, $action, $mailing->list_type, $message);
                //backHTML::formStart();
                mailingsHTML::viewMailing($mailing, $forms);
                $go[] = acajoom::makeObj('act', 'mailing');
                $go[] = acajoom::makeObj('task', 'viewmailing');
                $go[] = acajoom::makeObj('listid', $mailing->list_id);
                backHTML::formEnd($go);
            }
            break;
        case 'new':
        case 'add':
            if ($listId == 0) {
                echo "<script> alert('" . addslashes(_ACA_SELCT_MAILING) . "'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $total = xmailing::countMailings($listId, '');
                $total++;
                compa::redirect('index2.php?option=com_acajoom&act=mailing&task=edit&mailingid=0&issue_nb=' . $total . '&listid=' . $listId);
            }
            break;
        case 'saveSend':
            xmailing::saveMailing($mailingId, $listId);
        case 'sendNewsletter':
            if ($listId < 1 or $listType < 0) {
                $mailing = xmailing::getOneMailing('', $mailingId, '', $new, true);
                $listId = $mailing->list_id;
                $listType = $mailing->list_type;
            }
            if (lisType::sendType($listType)) {
                $checkStatus = lists::checkStatus($listId);
                if ($checkStatus == false) {
                    $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NOT_PUBLISHED);
                    $showMailings = true;
                } else {
                    $receivers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, 'sub_emailA');
                    if (empty($receivers)) {
                        $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NO_SUSCRIBERS);
                        $showMailings = true;
                    } else {
                        $status = queue::sendNewsletter(true, $mailingId, $listId, $receivers, $message);
                        $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message);
                        $showMailings = true;
                        flush();
                        sleep(5);
                        compa::redirect('index2.php?option=com_acajoom&act=mailing&listype=' . $listType, $message);
                    }
                }
            } else {
                if (class_exists('auto')) {
                    $message = acajoom::printYN(auto::processQueue(true), _ACA_QUEUE_SENT_SUCCESS, _ACA_ERROR);
                }
                $showMailings = true;
            }
            break;
        case 'savePreview':
            xmailing::saveMailing($mailingId, $listId);
        case 'preview':
            if (ACA_CMSTYPE) {
                // joomla 15
                $emailaddress = JRequest::getVar('emailaddress', '');
            } else {
                //joomla 1x
                $emailaddress = mosGetParam($_REQUEST, 'emailaddress', '');
            }
            //endif
            if (!empty($emailaddress)) {
                $status = xmailing::preview($mailingId, $listId, $message);
                $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message);
            }
            backHTML::_header(_ACA_PREVIEW_TITLE, 'preview_f2.png', $message, $task, $action);
            mailingsHTML::previewMailingHTML($mailingId, $listId, $listType);
            if ($listId > 0) {
                $archivemailing = xmailing::getMailingView($mailingId, $listId);
            } else {
                $archivemailing = xmailing::getMailingView($mailingId);
            }
            $forms['main'] = '';
            $list = lists::getOneList($archivemailing->list_id);
            $textonly = '';
            acajoom_mail::getContent($archivemailing->images, $list->layout, $archivemailing->htmlcontent, $textonly);
            acajoom_mail::replaceClass($archivemailing->htmlcontent, $textonly);
            mailingsHTML::viewMailing($archivemailing, $forms);
            break;
        case 'view':
            if ($mailingId != 0) {
                if ($listId > 0) {
                    $archivemailing = xmailing::getMailingView($mailingId, $listId);
                } else {
                    $archivemailing = xmailing::getMailingView($mailingId);
                }
                $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
                xmailing::_header($task, $action, $listType, $message);
                backHTML::formStart('', 0, '');
                mailingsHTML::viewMailing($archivemailing, $forms);
                $go[] = acajoom::makeObj('act', 'mailing');
                $go[] = acajoom::makeObj('task', 'viewmailing');
                $go[] = acajoom::makeObj('listid', $archivemailing->list_id);
                backHTML::formEnd($go);
            }
            break;
        case 'deleteMailing':
            $d['mailing'] = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::delete($d), @constant($GLOBALS[ACA . 'listname' . $d['mailing']->list_type]) . _ACA_SUCCESS_DELETED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cancel':
            compa::redirect('index2.php?option=com_acajoom');
            break;
        case 'copy':
            $message = acajoom::printYN(xmailing::copyMailing($mailingId), _ACA_MAILING_COPY, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cancelMailing':
            $showMailings = true;
            break;
        case 'publishMailing':
            $mailing = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::publishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_PUBLISHED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'unpublishMailing':
            $mailing = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::unpublishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_UNPUBLISHED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cpanel':
            backHTML::controlPanel();
            break;
        case 'save':
            $message = acajoom::printYN(xmailing::saveMailing($mailingId, $listId), _ACA_MAILING_SAVED, _ACA_ERROR);
            $showMailings = true;
            unset($GLOBALS["task"]);
            unset($_REQUEST["task"]);
            break;
        case 'show':
        default:
            $showMailings = true;
            break;
    }
    if ($showMailings) {
        xmailing::showMailings($task, $action, $listId, $listType, $message, true, _ACA_MENU_MAILING);
    }
    return true;
}
Esempio n. 6
0
 function logStatistics($mailingId, $subscriberId)
 {
     if (ACA_CMSTYPE) {
         $database =& JFactory::getDBO();
     } else {
         global $database;
     }
     //endif
     if ($subscriberId != 0) {
         $query = 'REPLACE INTO `#__acajoom_stats_details` ' . '( `mailing_id`, `subscriber_id`, `html`, `read`) ' . 'VALUES ( \'' . $mailingId . '\', \'' . $subscriberId . '\', \'1\', \'1\')';
         $database->setQuery($query);
         $database->query();
     }
     xmailing::updateStatsGlobal($mailingId, 0, 0, true);
     ob_end_clean();
     $filename = ACA_JPATH_ROOT . '/images/blank.png';
     $handle = fopen($filename, 'r');
     $contents = fread($handle, filesize($filename));
     fclose($handle);
     header("Content-type: image/png");
     echo $contents;
     exit;
 }
Esempio n. 7
0
 function mailingEdit($subscriberId, $mailingId, $listId, $listType, $action)
 {
     global $my, $Itemid;
     if (ACA_CMSTYPE) {
         // joomla 15
         $issue_nb = JRequest::getVar('issue_nb', '0');
         $my =& JFactory::getUser();
     } else {
         //joomla 1x
         $issue_nb = intval(mosGetParam($_REQUEST, 'issue_nb', 0));
         global $my;
     }
     //endif
     $accessGrant = false;
     $new = 0;
     if (class_exists('pro')) {
         if ($issue_nb == 0) {
             $issue_nb = xmailing::countMailings($listId, '');
             $issue_nb++;
         }
         if ($listId > 0) {
             $list = lists::getOneList($listId);
             $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new);
             $acc_level = $list->acc_level;
         } else {
             return false;
         }
         if (acajoom::checkPermissions('hello', 0, $acc_level)) {
             $accessGrant = true;
         }
     } else {
         if ($subscriberId != 0 and ($my->usertype == 'Administrator' or $my->usertype == 'Super Administrator')) {
             $accessGrant = true;
         }
     }
     if ($accessGrant) {
         if ($issue_nb == 0) {
             $issue_nb = xmailing::countMailings($listId, '');
             $issue_nb++;
         }
         if (empty($mailing)) {
             if ($mailingId > 0) {
                 $mailing = xmailing::getOneMailing('', $mailingId, $issue_nb, $new);
             } else {
                 if ($listId > 0) {
                     $list = lists::getOneList($listId);
                     $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new);
                 } else {
                     return false;
                 }
             }
         }
         $mainLink = '.php?option=com_acajoom&act=savemailing';
         compa::completeLink($mainLink, false);
         $forms['main'] = '<form method="post" enctype="multipart/form-data" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="adminForm" >' . "\n\r";
         $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
         $show = lisType::showType($mailing->list_type, 'editmailing');
         frontHTML::formStart(_ACA_EDIT_A . @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]), $mailing->html, 'edit_mailing');
         mailingsHTML::editMailing($mailing, $new, $listId, $forms, $show);
         $go[] = acajoom::makeObj('act', $action);
         frontHTML::formEnd(_CMN_SAVE . ' ' . @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]), $go);
     } else {
         echo acajoom::printM('red', _NOT_AUTH);
     }
     return true;
 }
Esempio n. 8
0
switch ($action) {
    case 'confirm':
        $message = acajoom::printYN(frontend::confirmRegistration($d), _ACA_ACCOUNT_CONFIRMED, _ACA_VERIFY_INFO);
        $showPanel = true;
        if (!empty($GLOBALS[ACA . 'redirectconfirm'])) {
            compa::redirect($GLOBALS[ACA . 'redirectconfirm'], $message);
        }
        break;
    case 'sublist':
        frontEnd::showSubscriberLists($subscriberId, 'subscribeAll');
        break;
    case 'mailing':
        frontEnd::mailingOptions($action, $task, $listId, $mailingId, $subscriberId, $lisType);
        break;
    case 'savemailing':
        $message = acajoom::printYN(xmailing::saveMailing($mailingId, $listId), _ACA_MAILING_SAVED, _ACA_ERROR);
        $showPanel = true;
        break;
    case 'show':
        if (!$validated) {
            $subscriberId = 0;
        }
        frontEnd::subscriptions($subscriberId, 0, 'save');
        break;
    case 'subone':
        frontEnd::subscriptions($subscriberId, $listId, 'subscribe');
        break;
    case 'change':
        frontEnd::changeSubscriptions($subscriberId, $cle, $listId, 'save');
        break;
    case 'unsubscribe':
Esempio n. 9
0
 function upgrade_News3()
 {
     global $my, $database;
     $xf = new xonfig();
     $newLists = array();
     $idImportedList = array();
     $i = 0;
     $database->setQuery("SELECT * FROM #__newsletter_letters");
     $newsletters = $database->loadObjectList();
     $error = $database->getErrorMsg();
     if (!empty($error)) {
         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error getting newsletters. Database error: <br />' . $error . '</p>';
         return false;
     } else {
         foreach ($newsletters as $newsletter) {
             $list->list_name = $newsletter->list_name;
             $list->list_desc = $newsletter->list_desc;
             $list->sendername = $newsletter->sendername;
             $list->senderemail = $newsletter->senderemail;
             $list->bounceadres = $newsletter->bounceadres;
             $list->layout = $newsletter->layout;
             $list->template = 0;
             $list->subscribemessage = $newsletter->subscribemessage;
             $list->unsubscribemessage = $newsletter->unsubscribemessage;
             $list->html = $newsletter->html;
             $list->hidden = !$newsletter->hidden;
             $list->unsubscribesend = 1;
             $list->list_type = '1';
             $list->auto_add = 0;
             $list->user_choose = 0;
             $list->cat_id = 0;
             $list->delay_min = 0;
             $list->delay_max = 0;
             $list->follow_up = 0;
             $list->owner = $my->id;
             $list->auto_add = 0;
             $list->acc_level = $newsletter->aid;
             $list->acc_id = 29;
             $list->published = 1;
             $list->createdate = acajoom::getNow();
             $list->footer = 1;
             $list->notify_id = 0;
             $list->notification = 0;
             $query = 'INSERT INTO `#__acajoom_lists` (`list_name`) VALUES (\'' . $list->list_name . '\'  )';
             $database->setQuery($query);
             $database->query();
             $error = $database->getErrorMsg();
             if (!empty($error)) {
                 echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error adding list to database. Database error: <br />' . $error . '</p><br /><br />Are you trying to insert a list name which is already in use?    The list name has to be different for each list! <br /><br />';
             } else {
                 $query = 'SELECT * FROM `#__acajoom_lists` WHERE `list_name`= \'' . $list->list_name . '\'';
                 $database->setQuery($query);
                 $database->loadObject($mynewlist);
                 $error = $database->getErrorMsg();
                 $xf->plus('totallist0', 1);
                 $xf->plus('act_totallist0', 1);
                 $xf->plus('totallist1', 1);
                 $xf->plus('act_totallist1', 1);
                 if (!empty($error)) {
                     echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting listname. Database error: <br />' . $error . '</p>';
                     return false;
                 } else {
                     $idImportedList[$newsletter->id] = $mynewlist->id;
                     $newLists[$i] = $mynewlist->id;
                     $i++;
                     $list->id = $mynewlist->id;
                     $error = lists::updateListData($list);
                     if (!$error) {
                         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting list. Database error: <br />' . $error . '</p>';
                     } else {
                         echo '<br /><b>' . @constant($GLOBALS[ACA . 'listnames1']) . ': </b>' . $list->list_name . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS);
                         $database->setQuery("SELECT * FROM #__newsletter_mailing WHERE `list_id`=" . $newsletter->id);
                         $mailingsImports = $database->loadObjectList();
                         $error = $database->getErrorMsg();
                         if (!empty($error)) {
                             echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting mailings. Database error: <br />' . $error . '</p>';
                             return false;
                         } else {
                             $issue_nb = 1;
                             foreach ($mailingsImports as $mailingsImport) {
                                 $mailings->list_id = $mynewlist->id;
                                 $mailings->list_type = '1';
                                 $mailings->send_date = $mailingsImport->send_date;
                                 $mailings->subject = $mailingsImport->subject;
                                 $mailings->htmlcontent = $mailingsImport->htmlcontent;
                                 $mailings->textonly = $mailingsImport->textonly;
                                 $mailings->attachments = $mailingsImport->attachments;
                                 $mailings->images = $mailingsImport->images;
                                 $mailings->published = $mailingsImport->published;
                                 $mailings->visible = $mailingsImport->visible;
                                 $mailings->html = $mynewlist->html;
                                 $mailings->fromname = $list->sendername;
                                 $mailings->fromemail = $list->senderemail;
                                 $mailings->frombounce = $list->bounceadres;
                                 $mailings->author_id = $my->id;
                                 $mailings->delay = 0;
                                 $mailings->issue_nb = $issue_nb;
                                 $mailings->acc_level = 25;
                                 $mailings->createdate = $list->createdate;
                                 $issue_nb++;
                                 $error = xmailing::insertMailingData($mailings);
                                 if (!$error) {
                                     echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error inserting mailing. Database error: <br />' . $error . '</p>';
                                 } else {
                                     echo '<br /><b>' . _ACA_MENU_MAILING_TITLE . ': </b>' . $mailingsImport->subject . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS);
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $database->setQuery("SELECT * FROM #__newsletter_subscribers");
         $subscribers = $database->loadObjectList();
         $error = $database->getErrorMsg();
         if (!empty($error)) {
             echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting subscribers. Database error: <br />' . $error . '</p>';
             return false;
         } else {
             foreach ($subscribers as $subscriber) {
                 $newSubs = true;
                 $acajoomsubscribers = subscribers::getSubscribers(-1, -1, '', $total, 0, '', '', '', '');
                 foreach ($acajoomsubscribers as $acajoomsubscriber) {
                     if ($subscriber->subscriber_email == $acajoomsubscriber->email) {
                         $newSubs = false;
                         $subId[0] = $acajoomsubscriber->id;
                     }
                 }
                 if ($newSubs) {
                     $newSubscriber->user_id = $subscriber->userid;
                     $newSubscriber->name = $subscriber->subscriber_name;
                     $newSubscriber->email = $subscriber->subscriber_email;
                     $newSubscriber->receive_html = $subscriber->receive_html;
                     $newSubscriber->confirmed = $subscriber->confirmed;
                     $newSubscriber->subscribe_date = $subscriber->subscribe_date;
                     $newSubscriber->blacklist = 0;
                     $newSubscriber->timezone = '00:00:00';
                     $newSubscriber->language_iso = 'eng';
                     $newSubscriber->params = '';
                     $error = subscribers::insertSubscriber($newSubscriber, $subscriberId);
                     if (!empty($error)) {
                         if ($subscriberId < 1) {
                             echo ' Error inserting subscriber:' . $newSubscriber->name;
                         }
                         $error = '';
                         $subId[0] = $subscriberId;
                     } else {
                         echo '<br /><b>' . _ACA_MENU_SUBSCRIBERS . ': </b>' . $newSubscriber->name . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS);
                         $d['email'] = $subscriber->email;
                         $erro->ck = subscribers::getSubscriberIdFromEmail($d);
                         $erro->Eck(__LINE__, '8304');
                         $subId[0] = $d['subscriberId'];
                     }
                 } else {
                     echo '<br /><b>' . _ACA_MENU_SUBSCRIBERS . ': </b>' . $subscriber->subscriber_name . ': ' . acajoom::printM('red', _ACA_IMPORT_EXIST);
                 }
                 $j = 0;
                 $queue = queue::suscriptionExist($subId[0], $idImportedList[$subscriber->list_id]);
                 if (empty($queue)) {
                     $error = queue::insertQueuesForNews($subId, $idImportedList[$subscriber->list_id], 29);
                     if (!$error) {
                         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting queue. Database error: <br />' . $error . '</p>';
                     }
                 }
             }
         }
     }
     return true;
 }
Esempio n. 10
0
 function insert($queue)
 {
     if (ACA_CMSTYPE) {
         $database =& JFactory::getDBO();
     } else {
         global $database;
     }
     //endif
     if ($queue->list_id < 1) {
         $mailing = xmailing::getOneMailing('', $queue->mailing_id, 0, $new);
         if (empty($mailing->list_id)) {
             return false;
         }
         $queue->list_id = $mailing->list_id;
     }
     if ($queue->subscriber_id < 0) {
         return false;
     }
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     $query = 'INSERT IGNORE INTO `#__acajoom_queue` (`type` , `subscriber_id` , `list_id` , `mailing_id`, `issue_nb`,' . ' `send_date`, `suspend` , `delay`, `acc_level`, `published` , `params`	) VALUES (' . intval($queue->type) . ', ' . intval($queue->subscriber_id) . ' , ' . intval($queue->list_id) . ', ' . intval($queue->mailing_id) . ', ' . intval($queue->issue_nb) . ', \'' . $queue->send_date . '\', ' . $queue->suspend . ' , ' . $queue->delay . ' , ' . $queue->acc_level . ' , ' . $queue->published . " ,  '{$queue->params}'  ) ";
     $database->setQuery($query);
     $database->query();
     $erro->err = $database->getErrorMsg();
     return $erro->E(__LINE__, '8534', $database);
 }
Esempio n. 11
0
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);
    }
}