Esempio n. 1
0
 function queue($mailid, $time, $onlyNew = false)
 {
     $mailid = intval($mailid);
     if (empty($mailid)) {
         return false;
     }
     $classLists = acymailing::get('class.listmail');
     $lists = $classLists->getReceivers($mailid, false);
     if (empty($lists)) {
         return 0;
     }
     $config = acymailing::config();
     $querySelect = 'SELECT DISTINCT a.subid,' . $mailid . ',' . $time . ',' . (int) $config->get('priority_newsletter', 3);
     $querySelect .= ' FROM ' . acymailing::table('listsub') . ' as a ';
     $querySelect .= 'LEFT JOIN ' . acymailing::table('subscriber') . ' as b ON a.subid = b.subid ';
     $querySelect .= 'WHERE b.enabled = 1 AND b.accept = 1 ';
     $querySelect .= 'AND a.listid IN (' . implode(',', array_keys($lists)) . ') AND a.status = 1 ';
     $config = acymailing::config();
     if ($config->get('require_confirmation', '0')) {
         $querySelect .= 'AND b.confirmed = 1 ';
     }
     $query = 'INSERT IGNORE INTO ' . acymailing::table('queue') . ' (subid,mailid,senddate,priority) ' . $querySelect;
     $this->database->setQuery($query);
     if (!$this->database->query()) {
         acymailing::display($this->database->ErrorMsg(), 'error');
     }
     $totalinserted = $this->database->getAffectedRows();
     if ($onlyNew) {
         $this->database->setQuery('DELETE b.* FROM `#__acymailing_userstats` as a LEFT JOIN `#__acymailing_queue` as b on a.subid = b.subid WHERE a.mailid = ' . $mailid);
         $this->database->query();
         $totalinserted = $totalinserted - $this->database->getAffectedRows();
     }
     return $totalinserted;
 }
Esempio n. 2
0
 function continuesend()
 {
     $config = acymailing::config();
     $newcrontime = time() + 120;
     if ($config->get('cron_next') < $newcrontime) {
         $newValue = null;
         $newValue->cron_next = $newcrontime;
         $config->save($newValue);
     }
     $mailid = acymailing::getCID('mailid');
     $totalSend = JRequest::getVar('totalsend', 0, '', 'int');
     $alreadySent = JRequest::getVar('alreadysent', 0, '', 'int');
     $helperQueue = acymailing::get('helper.queue');
     $helperQueue->mailid = $mailid;
     $helperQueue->report = true;
     $helperQueue->total = $totalSend;
     $helperQueue->start = $alreadySent;
     $helperQueue->pause = $config->get('queue_pause');
     $helperQueue->process();
     $alreadySent = $alreadySent + $helperQueue->nbprocess;
     if (!$helperQueue->finish) {
         $app =& JFactory::getApplication();
         $app->redirect(acymailing::completeLink('send&task=continuesend&mailid=' . $mailid . '&alreadysent=' . $alreadySent . '&totalsend=' . $totalSend, true, true));
         exit;
     }
     ob_start();
 }
Esempio n. 3
0
 function mailerHelper()
 {
     JPluginHelper::importPlugin('acymailing');
     $this->dispatcher =& JDispatcher::getInstance();
     $this->app =& JFactory::getApplication();
     $this->subscriberClass = acymailing::get('class.subscriber');
     $this->encodingHelper = acymailing::get('helper.encoding');
     $this->config =& acymailing::config();
     $this->setFrom($this->config->get('from_email'), $this->config->get('from_name'));
     $this->Sender = $this->cleanText($this->config->get('bounce_email'));
     if (empty($this->Sender)) {
         $this->Sender = '';
     }
     switch ($this->config->get('mailer_method', 'phpmail')) {
         case 'smtp':
             $this->IsSMTP();
             $this->Host = $this->config->get('smtp_host');
             $port = $this->config->get('smtp_port');
             if (empty($port) && $this->config->get('smtp_secured') == 'ssl') {
                 $port = 465;
             }
             if (!empty($port)) {
                 $this->Host .= ':' . $port;
             }
             $this->SMTPAuth = (bool) $this->config->get('smtp_auth', true);
             $this->Username = trim($this->config->get('smtp_username'));
             $this->Password = trim($this->config->get('smtp_password'));
             $this->SMTPSecure = trim((string) $this->config->get('smtp_secured'));
             if (empty($this->Sender)) {
                 $this->Sender = strpos($this->Username, '@') ? $this->Username : $this->config->get('from_email');
             }
             break;
         case 'sendmail':
             $this->IsSendmail();
             $this->SendMail = trim($this->config->get('sendmail_path'));
             if (empty($this->SendMail)) {
                 $this->SendMail = '/usr/sbin/sendmail';
             }
             break;
         case 'qmail':
             $this->IsQmail();
             break;
         default:
             $this->IsMail();
             break;
     }
     //endswitch
     $this->PluginDir = dirname(__FILE__) . DS;
     $this->CharSet = strtolower($this->config->get('charset'));
     if (empty($this->CharSet)) {
         $this->CharSet = 'utf-8';
     }
     $this->clearAll();
     $this->Encoding = $this->config->get('encoding_format');
     if (empty($this->Encoding)) {
         $this->Encoding = '8bit';
     }
     $this->Hostname = $this->config->get('hostname', '');
     $this->WordWrap = intval($this->config->get('word_wrapping', 0));
 }
Esempio n. 4
0
 function send()
 {
     JRequest::checkToken() or die('Invalid Token');
     $bodyEmail = JRequest::getString('mailbody');
     $code = JRequest::getString('code');
     JRequest::setVar('code', $code);
     if (empty($code)) {
         return;
     }
     $config = acymailing::config();
     $mailer = acymailing::get('helper.mailer');
     $mailer->Subject = '[ACYMAILING LANGUAGE FILE] ' . $code;
     $mailer->Body = 'The website ' . ACYMAILING_LIVE . ' using AcyMailing ' . $config->get('level') . $config->get('version') . ' sent a language file : ' . $code;
     $mailer->Body .= "\n" . "\n" . "\n" . $bodyEmail;
     $user = JFactory::getUser();
     $mailer->AddAddress($user->email, $user->name);
     $mailer->AddAddress('*****@*****.**', 'Acyba Translation Team');
     $mailer->report = false;
     jimport('joomla.filesystem.file');
     $path = JPath::clean(JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing.ini');
     $mailer->AddAttachment($path);
     $result = $mailer->Send();
     if ($result) {
         acymailing::display(JText::_('THANK_YOU_SHARING'), 'success');
         acymailing::display($mailer->reportMessage, 'success');
     } else {
         acymailing::display($mailer->reportMessage, 'error');
     }
 }
Esempio n. 5
0
 function checkAccessNewsletter($edit = true)
 {
     $mailid = acymailing::getCID('mailid');
     $listid = JRequest::getInt('listid');
     if (empty($mailid)) {
         return true;
     }
     $db =& JFactory::getDBO();
     $db->setQuery('SELECT * FROM `#__acymailing_mail` WHERE mailid = ' . intval($mailid));
     $mail = $db->loadObject();
     if (empty($mail->mailid)) {
         return false;
     }
     $config = acymailing::config();
     $my =& JFactory::getUser();
     if ($edit and !$config->get('frontend_modif', 1) and $my->id != $mail->userid) {
         return false;
     }
     if ($edit and !$config->get('frontend_modif_sent', 1) and !empty($mail->senddate)) {
         return false;
     }
     $db->setQuery('SELECT `mailid` FROM `#__acymailing_listmail` WHERE `mailid` = ' . intval($mailid) . ' AND `listid` = ' . intval($listid));
     $result = $db->loadResult();
     if (empty($result) && $my->id != $mail->userid) {
         return false;
     }
     return true;
 }
Esempio n. 6
0
 function editorHelper()
 {
     $config =& acymailing::config();
     $this->editor = $config->get('editor', null);
     if (empty($this->editor)) {
         $this->editor = null;
     }
     $this->myEditor =& JFactory::getEditor($this->editor);
     $this->myEditor->initialise();
 }
Esempio n. 7
0
 function bounceHelper()
 {
     $this->config = acymailing::config();
     $this->mailer = acymailing::get('helper.mailer');
     $this->mailer->report = false;
     $this->subClass = acymailing::get('class.subscriber');
     $this->listsubClass = acymailing::get('class.listsub');
     $this->listsubClass->checkAccess = false;
     $this->db =& JFactory::getDBO();
 }
Esempio n. 8
0
 function plgAcymailingTemplate(&$subject, $config)
 {
     parent::__construct($subject, $config);
     if (!isset($this->params)) {
         $plugin =& JPluginHelper::getPlugin('acymailing', 'template');
         $this->params = new JParameter($plugin->params);
     }
     $this->config = acymailing::config();
     if (version_compare(PHP_VERSION, '5.0.0', '>=') && class_exists('DOMDocument') && function_exists('mb_convert_encoding')) {
         require_once ACYMAILING_FRONT . 'inc' . DS . 'emogrifier' . DS . 'emogrifier.php';
     }
 }
Esempio n. 9
0
 function fetchButton($type = 'Pophelp', $namekey = '', $id = 'pophelp')
 {
     JHTML::_('behavior.mootools');
     $doc =& JFactory::getDocument();
     $config =& acymailing::config();
     $level = $config->get('level');
     $url = ACYMAILING_HELPURL . $namekey . '&level=' . $level;
     $iFrame = "'<iframe src=\\'{$url}\\' width=\\'100%\\' height=\\'100%\\' scrolling=\\'auto\\'></iframe>'";
     $js = "var openHelp = true; function displayDoc(){var box=\$('iframedoc'); if(openHelp){box.innerHTML = " . $iFrame . ";box.style.display = 'block';box.style.height = '0';}";
     $js .= "try{\r\n                   var fx = box.effects({duration: 1500, transition:\r\n\t\t\t\t\tFx.Transitions.Quart.easeOut});\r\n\t\t\t\t\tif(openHelp){\r\n\t\t\t\t\t\tfx.start({'height': 300});\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tfx.start({'height': 0}).chain(function() {\r\n\t\t\t\t\t\t\tbox.innerHTML='';\r\n\t\t\t\t\t\t\tbox.setStyle('display','none');\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}catch(err){\r\n\t\t\t\t\tbox.style.height = '300px';\r\n\t\t\t\t\tvar myVerticalSlide = new Fx.Slide('iframedoc');\r\n \t\t\t\t\tif(openHelp){\r\n\t\t\t\t\t\tmyVerticalSlide.slideIn();\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tmyVerticalSlide.slideOut().chain(function() {\r\n\t\t\t\t\t\tbox.innerHTML='';\r\n\t\t\t\t\t\tbox.setStyle('display','none');\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t} openHelp = !openHelp;}";
     $doc->addScriptDeclaration($js);
     return '<a href="' . $url . '" target="_blank" onclick="displayDoc();return false;" class="toolbar"><span class="icon-32-help" title="' . JText::_('ACY_HELP', true) . '"></span>' . JText::_('ACY_HELP') . '</a>';
 }
Esempio n. 10
0
 function emailactionType()
 {
     $this->values = array();
     $this->values[] = JHTML::_('select.option', 'noaction', JText::_('NO_ACTION'));
     $this->values[] = JHTML::_('select.option', 'delete', JText::_('DELETE_EMAIL'));
     $this->values[] = JHTML::_('select.option', 'forward', JText::_('FORWARD_EMAIL'));
     $js = "function updateEmailAction(num){";
     $js .= "forwardarea = window.document.getElementById('bounce_email_'+num).value;";
     $js .= "if(forwardarea == 'forward') {window.document.getElementById('config_bounce_forward_'+num).style.display = 'block';}else{window.document.getElementById('config_bounce_forward_'+num).style.display = 'none';}";
     $js .= '}';
     $doc =& JFactory::getDocument();
     $doc->addScriptDeclaration($js);
     $this->config = acymailing::config();
 }
Esempio n. 11
0
 function fetchButton($type = 'Pophelp', $namekey = '', $id = 'pophelp')
 {
     JHTML::_('behavior.mootools');
     $doc =& JFactory::getDocument();
     $config =& acymailing::config();
     $level = $config->get('level');
     $url = ACYMAILING_HELPURL . $namekey . '&level=' . $level;
     $iFrame = "'<iframe src=\\'{$url}\\' width=\\'100%\\' height=\\'100%\\' scrolling=\\'auto\\'></iframe>'";
     $js = "var openHelp = true; function displayDoc(){var box=\$('iframedoc'); if(openHelp){box.setHTML(" . $iFrame . ");box.setStyle('display','block');}";
     $js .= "var fx = box.effects({duration: 1500, transition: Fx.Transitions.Quart.easeOut});";
     $js .= "if(openHelp){fx.start({'height': 300});}else{fx.start({'height': 0}).chain(function() {box.setHTML('');box.setStyle('display','none');})}; openHelp = !openHelp;}";
     $doc->addScriptDeclaration($js);
     return '<a href="' . $url . '" target="_blank" onclick="displayDoc();return false;" class="toolbar"><span class="icon-32-help" title="' . JText::_('HELP', true) . '"></span>' . JText::_('HELP') . '</a>';
 }
Esempio n. 12
0
 function unsubscribe($subid, $listids)
 {
     $app =& JFactory::getApplication();
     if (acymailing::level(3)) {
         $campaignClass = acymailing::get('helper.campaign');
         $campaignClass->stop($subid, $listids);
     }
     $config = acymailing::config();
     static $alreadySent = false;
     if ($this->sendNotif and !$alreadySent and $config->get('notification_unsub') and !$app->isAdmin()) {
         $alreadySent = true;
         $mailer = acymailing::get('helper.mailer');
         $mailer->report = false;
         $mailer->autoAddUser = true;
         $mailer->checkConfirmField = false;
         $userClass = acymailing::get('class.subscriber');
         $subscriber = $userClass->get($subid);
         $ipClass = acymailing::get('helper.user');
         $mailer->addParam('survey', $this->survey);
         $mailer->addParamInfo();
         $subscriber->ip = $ipClass->getIP();
         foreach ($subscriber as $fieldname => $value) {
             $mailer->addParam('user:'******',', $config->get('notification_unsub'));
         foreach ($allUsers as $oneUser) {
             $mailer->sendOne('notification_unsub', $oneUser);
         }
     }
     $db =& JFactory::getDBO();
     if ($this->sendConf and !$app->isAdmin()) {
         $db->setQuery('SELECT DISTINCT `unsubmailid` FROM ' . acymailing::table('list') . ' WHERE `listid` IN (' . implode(',', $listids) . ') AND `published` = 1  AND `unsubmailid` > 0');
         $messages = $db->loadResultArray();
         if (!empty($messages)) {
             $config = acymailing::config();
             $mailHelper = acymailing::get('helper.mailer');
             $mailHelper->report = $config->get('unsub_message', true);
             $mailHelper->checkAccept = false;
             foreach ($messages as $mailid) {
                 $mailHelper->sendOne($mailid, $subid);
             }
         }
     }
     //end only frontend
     $db->setQuery('DELETE  FROM ' . acymailing::table('queue') . ' WHERE `subid` = ' . (int) $subid . ' AND `mailid` IN (SELECT `mailid` FROM ' . acymailing::table('listmail') . ' WHERE `listid` IN (' . implode(',', $listids) . '))');
     $db->query();
     JPluginHelper::importPlugin('acymailing');
     $dispatcher =& JDispatcher::getInstance();
     $resultsTrigger = $dispatcher->trigger('onAcyUnsubscribe', array($subid, $listids));
 }
Esempio n. 13
0
 function getInput()
 {
     JHTML::_('behavior.modal', 'a.modal');
     if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_acymailing' . DS . 'helpers' . DS . 'helper.php')) {
         return 'This module can not work without the AcyMailing Component';
     }
     $lang =& JFactory::getLanguage();
     $lang->load(ACYMAILING_COMPONENT, JPATH_SITE);
     $config =& acymailing::config();
     $level = $config->get('level');
     $link = ACYMAILING_HELPURL . $this->value . '&level=' . $level;
     $text = '<a class="modal" title="' . JText::_('ACY_HELP', true) . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('ACY_HELP') . '</button></a>';
     return $text;
 }
Esempio n. 14
0
 function queueHelper()
 {
     $this->config = acymailing::config();
     $this->subClass = acymailing::get('class.subscriber');
     $this->listsubClass = acymailing::get('class.listsub');
     $this->listsubClass->checkAccess = false;
     $this->send_limit = $this->config->get('queue_nbmail', 60);
     acymailing::increasePerf();
     @ini_set('default_socket_timeout', 10);
     @ignore_user_abort(true);
     $timelimit = ini_get('max_execution_time');
     if (!empty($timelimit)) {
         $this->stoptime = time() + $timelimit - 4;
     }
     $this->db =& JFactory::getDBO();
 }
Esempio n. 15
0
 function bounceactionType()
 {
     $this->values = array();
     $this->values[] = JHTML::_('select.option', 'noaction', JText::_('NO_ACTION'));
     $this->values[] = JHTML::_('select.option', 'unsub', JText::_('UNSUB_USER'));
     $this->values[] = JHTML::_('select.option', 'sub', JText::_('SUBSCRIBE_USER'));
     $this->values[] = JHTML::_('select.option', 'delete', JText::_('DELETE_USER'));
     $this->config = acymailing::config();
     $this->lists = acymailing::get('type.lists');
     array_shift($this->lists->values);
     $js = "function updateSubAction(num){";
     $js .= "myAction = window.document.getElementById('bounce_action_'+num).value;";
     $js .= "if(myAction == 'sub') {window.document.getElementById('config_bounce_action_lists_'+num).style.display = '';}else{window.document.getElementById('config_bounce_action_lists_'+num).style.display = 'none';}";
     $js .= '}';
     $doc =& JFactory::getDocument();
     $doc->addScriptDeclaration($js);
 }
Esempio n. 16
0
 function start($subid, $listids)
 {
     $listCampaignClass = acymailing::get('class.listcampaign');
     $campaignids = $listCampaignClass->getAffectedCampaigns($listids);
     if (empty($campaignids)) {
         return true;
     }
     $campaignSubscription = acymailing::get('class.listsub');
     $campaignSubscription->type = 'campaign';
     $subscription = $campaignSubscription->getSubscription($subid);
     $campaignAdded = array();
     $time = time();
     foreach ($campaignids as $id => $campaignid) {
         if (!empty($subscription[$campaignid]) and $subscription[$campaignid]->status == 1 and $subscription[$campaignid]->unsubdate > $time) {
             continue;
         }
         $campaignAdded[] = $campaignid;
     }
     if (empty($campaignAdded)) {
         return true;
     }
     $config = acymailing::config();
     $db = JFactory::getDBO();
     $query = 'SELECT a.`listid`, max(b.`senddate`) as maxsenddate FROM ' . acymailing::table('listmail') . ' as a LEFT JOIN ' . acymailing::table('mail') . ' as b on a.`mailid` = b.`mailid`';
     $query .= ' WHERE a.`listid` IN (' . implode(',', $campaignAdded) . ') AND b.`published` = 1 GROUP BY a.listid';
     $db->setQuery($query);
     $maxunsubdate = $db->loadObjectList();
     if (empty($maxunsubdate)) {
         return true;
     }
     $queryInsert = array();
     foreach ($maxunsubdate as $onecampaign) {
         $queryInsert[] = $onecampaign->listid . ',' . $subid . ',' . $time . ',' . ($time + $onecampaign->maxsenddate) . ',1';
     }
     $query = 'REPLACE INTO ' . acymailing::table('listsub') . ' (listid,subid,subdate,unsubdate,status) VALUES (' . implode('),(', $queryInsert) . ')';
     $db->setQuery($query);
     $db->query();
     $querySelect = 'SELECT ' . $subid . ',a.`mailid`,' . $time . ' + b.`senddate`,' . (int) $config->get('priority_followup', 2);
     $querySelect .= ' FROM ' . acymailing::table('listmail') . ' as a LEFT JOIN ' . acymailing::table('mail') . ' as b on a.`mailid` = b.`mailid`';
     $querySelect .= ' WHERE a.`listid` IN (' . implode(',', $campaignAdded) . ') AND b.`published` = 1';
     $query = 'INSERT IGNORE INTO ' . acymailing::table('queue') . ' (`subid`,`mailid`,`senddate`,`priority`) ' . $querySelect;
     $db->setQuery($query);
     return $db->query();
 }
Esempio n. 17
0
    function import()
    {
        $listClass = acymailing::get('class.list');
        acymailing::setTitle(JText::_('IMPORT'), 'import', 'data&task=import');
        $bar =& JToolBar::getInstance('toolbar');
        JToolBarHelper::custom('doimport', 'import', '', JText::_('IMPORT'), false);
        $bar->appendButton('Link', 'cancel', JText::_('ACY_CANCEL'), acymailing::completeLink('subscriber'));
        JToolBarHelper::divider();
        $bar->appendButton('Pophelp', 'data-import');
        $db = JFactory::getDBO();
        $importData = array();
        $importData['file'] = JText::_('ACY_FILE');
        $importData['textarea'] = JText::_('IMPORT_TEXTAREA');
        $importData['joomla'] = JText::_('IMPORT_JOOMLA');
        $importData['contact'] = 'com_contact';
        $importData['database'] = JText::_('DATABASE');
        $possibleImport = array();
        $possibleImport[$db->getPrefix() . 'acajoom_subscribers'] = array('acajoom', 'Acajoom');
        $possibleImport[$db->getPrefix() . 'ccnewsletter_subscribers'] = array('ccnewsletter', 'ccNewsletter');
        $possibleImport[$db->getPrefix() . 'letterman_subscribers'] = array('letterman', 'Letterman');
        $possibleImport[$db->getPrefix() . 'communicator_subscribers'] = array('communicator', 'Communicator');
        $possibleImport[$db->getPrefix() . 'yanc_subscribers'] = array('yanc', 'Yanc');
        $possibleImport[$db->getPrefix() . 'vemod_news_mailer_users'] = array('vemod', 'Vemod News Mailer');
        $possibleImport[$db->getPrefix() . 'jnews_subscribers'] = array('jnews', 'jNewsletter');
        $tables = $db->getTableList();
        foreach ($tables as $mytable) {
            if (isset($possibleImport[$mytable])) {
                $importData[$possibleImport[$mytable][0]] = $possibleImport[$mytable][1];
            }
        }
        $importvalues = array();
        foreach ($importData as $div => $name) {
            $importvalues[] = JHTML::_('select.option', $div, $name);
        }
        $js = 'var currentoption = \'file\';
		function updateImport(newoption){document.getElementById(currentoption).style.display = "none";document.getElementById(newoption).style.display = \'block\';currentoption = newoption;}';
        $doc =& JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        $this->assignRef('importvalues', $importvalues);
        $this->assignRef('importdata', $importData);
        $this->assignRef('lists', $listClass->getLists());
        $this->assignRef('config', acymailing::config());
    }
Esempio n. 18
0
 function __construct($config = array())
 {
     $config = acymailing::config();
     $formname = JRequest::getCmd('acyformname');
     if (empty($formname)) {
         $type = 'component';
     } else {
         $type = 'module';
     }
     $captchaClass = acymailing::get('class.acycaptcha');
     $captchaClass->background_color = $config->get('captcha_background_' . $type);
     $captchaClass->colors = explode(',', $config->get('captcha_color_' . $type));
     $captchaClass->width = $config->get('captcha_width_' . $type);
     $captchaClass->height = $config->get('captcha_height_' . $type);
     $captchaClass->nb_letters = $config->get('captcha_nbchar_' . $type);
     $captchaClass->state = 'acycaptcha' . $type . $formname;
     $captchaClass->get();
     $captchaClass->displayImage();
 }
Esempio n. 19
0
 function saveForm()
 {
     $filter = null;
     $filter->filid = acymailing::getCID('filid');
     $formData = JRequest::getVar('data', array(), '', 'array');
     foreach ($formData['filter'] as $column => $value) {
         acymailing::secureField($column);
         $filter->{$column} = strip_tags($value);
     }
     $config = acymailing::config();
     $alltriggers = array_keys((array) JRequest::getVar('trigger'));
     $filter->trigger = implode(',', $alltriggers);
     $newConfig = null;
     foreach ($alltriggers as $oneTrigger) {
         $name = 'triggerfilter_' . $oneTrigger;
         if ($config->get($name)) {
             continue;
         }
         $newConfig->{$name} = 1;
     }
     if (!empty($newConfig)) {
         $config->save($newConfig);
     }
     $data = array('action', 'filter');
     foreach ($data as $oneData) {
         $filter->{$oneData} = array();
         $formData = JRequest::getVar($oneData);
         foreach ($formData['type'] as $num => $oneType) {
             if (empty($oneType)) {
                 continue;
             }
             $filter->{$oneData}['type'][$num] = $oneType;
             $filter->{$oneData}[$num][$oneType] = $formData[$num][$oneType];
         }
         $filter->{$oneData} = serialize($filter->{$oneData});
     }
     $filid = $this->save($filter);
     if (!$filid) {
         return false;
     }
     JRequest::setVar('filid', $filid);
     return true;
 }
Esempio n. 20
0
    function _iframe($url)
    {
        $informations = null;
        $config = acymailing::config();
        $informations->version = $config->get('version');
        $informations->level = $config->get('level');
        $informations->component = 'acymailing';
        $infos = urlencode(base64_encode(serialize($informations)));
        $url .= '&infos=' . $infos;
        ?>
        <div id="acymailing_div">
            <iframe allowtransparency="true" scrolling="auto" height="450px" frameborder="0" width="100%" name="acymailing_frame" id="acymailing_frame" src="<?php 
        echo $url;
        ?>
">
            </iframe>
        </div>
<?php 
    }
Esempio n. 21
0
 function getUrl($url, $mailid, $subid)
 {
     static $allurls;
     $url = str_replace('&amp;', '&', $url);
     if (empty($allurls[$url])) {
         $currentURL = $this->get($url);
         if (empty($currentURL->urlid)) {
             $currentURL = null;
             $currentURL->url = $url;
             $currentURL->name = $url;
             $currentURL->urlid = $this->save($currentURL);
         }
         $allurls[$url] = $currentURL;
     } else {
         $currentURL = $allurls[$url];
     }
     $config = acymailing::config();
     $itemId = $config->get('itemid', 0);
     $item = empty($itemId) ? '' : '&Itemid=' . $itemId;
     return str_replace('&amp;', '&', acymailing::frontendLink('index.php?option=com_acymailing&ctrl=url&urlid=' . $currentURL->urlid . '&mailid=' . $mailid . '&subid=' . $subid . $item));
 }
Esempio n. 22
0
 function getReceivers($mailid, $total = true, $onlypublished = true)
 {
     $query = 'SELECT a.name,a.description,a.published,a.color,b.listid,b.mailid FROM ' . acymailing::table('listmail') . ' as b LEFT JOIN ' . acymailing::table('list') . ' as a on a.listid = b.listid WHERE b.mailid = ' . intval($mailid);
     if ($onlypublished) {
         $query .= ' AND a.published = 1';
     }
     $this->database->setQuery($query);
     $lists = $this->database->loadObjectList('listid');
     if (empty($lists) or !$total) {
         return $lists;
     }
     $config = acymailing::config();
     $confirmed = $config->get('require_confirmation') ? 'b.confirmed = 1 AND' : '';
     $countQuery = 'SELECT a.listid, count(b.subid) as nbsub FROM `#__acymailing_listsub` as a LEFT JOIN `#__acymailing_subscriber` as b ON a.subid = b.subid WHERE ' . $confirmed . ' b.`enabled` = 1 AND b.`accept` = 1 AND a.`status` = 1 AND a.`listid` IN (' . implode(',', array_keys($lists)) . ') GROUP BY a.`listid`';
     $this->database->setQuery($countQuery);
     $countResult = $this->database->loadObjectList('listid');
     foreach ($lists as $listid => $count) {
         $lists[$listid]->nbsub = empty($countResult[$listid]->nbsub) ? 0 : $countResult[$listid]->nbsub;
     }
     return $lists;
 }
Esempio n. 23
0
 function process()
 {
     acymailing::increasePerf();
     $config = acymailing::config();
     $bounceClass = acymailing::get('helper.bounce');
     $bounceClass->report = true;
     if (!$bounceClass->init()) {
         return;
     }
     if (!$bounceClass->connect()) {
         acymailing::display($bounceClass->getErrors(), 'error');
         return;
     }
     acymailing::display(JText::sprintf('BOUNCE_CONNECT_SUCC', $config->get('bounce_username')), 'success');
     $nbMessages = $bounceClass->getNBMessages();
     acymailing::display(JText::sprintf('NB_MAIL_MAILBOX', $nbMessages), 'info');
     if (empty($nbMessages)) {
         return;
     }
     $bounceClass->handleMessages();
     $bounceClass->close();
 }
Esempio n. 24
0
 function continuesend()
 {
     $config = acymailing::config();
     $newcrontime = time() + 120;
     if ($config->get('cron_next') < $newcrontime) {
         $newValue = null;
         $newValue->cron_next = $newcrontime;
         $config->save($newValue);
     }
     $mailid = acymailing::getCID('mailid');
     $totalSend = JRequest::getVar('totalsend', 0, '', 'int');
     $alreadySent = JRequest::getVar('alreadysent', 0, '', 'int');
     $helperQueue = acymailing::get('helper.queue');
     $helperQueue->mailid = $mailid;
     $helperQueue->report = true;
     $helperQueue->total = $totalSend;
     $helperQueue->start = $alreadySent;
     $helperQueue->pause = $config->get('queue_pause');
     //->Process will exit the current page if it needs to be continued
     $helperQueue->process();
     ob_start();
 }
Esempio n. 25
0
 function doforward()
 {
     acymailing::checkRobots();
     $config = acymailing::config();
     if (!$config->get('forward', true)) {
         return $this->view();
     }
     $email = trim(JRequest::getString('email'));
     $userClass = acymailing::get('helper.user');
     if (!$userClass->validEmail($email)) {
         echo "<script>alert('" . JText::_('VALID_EMAIL', true) . "'); window.history.go(-1);</script>";
         exit;
     }
     $mailid = JRequest::getInt('mailid');
     if (empty($mailid)) {
         return $this->view();
     }
     $receiver = null;
     $receiver->email = $email;
     $receiver->subid = 0;
     $receiver->html = 1;
     $receiver->name = trim(strip_tags(JRequest::getString('name', '')));
     $mailerHelper = acymailing::get('helper.mailer');
     $mailerHelper->checkConfirmField = false;
     $mailerHelper->checkEnabled = false;
     $mailerHelper->checkAccept = false;
     $mailtosend = $mailerHelper->load($mailid);
     $key = JRequest::getString('key');
     if (empty($key) or $mailtosend->key !== $key) {
         return $this->view();
     }
     if ($mailerHelper->sendOne($mailid, $receiver)) {
         $db =& JFactory::getDBO();
         $db->setQuery('UPDATE ' . acymailing::table('stats') . ' SET `forward` = `forward` +1 WHERE `mailid` = ' . (int) $mailid);
         $db->query();
     }
     return $this->view();
 }
Esempio n. 26
0
    function licensejs()
    {
        $informations = null;
        $config = acymailing::config();
        $informations->version = $config->get('version');
        $informations->level = $config->get('level');
        $informations->website = str_replace('~', 'tildsymb', ACYMAILING_LIVE);
        $informations->component = 'acymailing';
        $infos = urlencode(base64_encode(serialize($informations)));
        // write the license file
        $path = ACYMAILING_BACK . 'li.txt';
        JFile::write($path, $infos);
        // end of license file write
        $doc =& JFactory::getDocument();
        $doc->addScript(ACYMAILING_UPDATEURL . 'licensejs&infos=' . $infos);
        ?>

		<div id="acytext"></div>
		<form action="index.php?option=<?php 
        echo ACYMAILING_COMPONENT;
        ?>
&amp;ctrl=update" method="post" name="adminForm" autocomplete="off">
		<input type="hidden" name="option" value="<?php 
        echo ACYMAILING_COMPONENT;
        ?>
" />
		<input type="hidden" name="task" value="addli" />
		<input type="hidden" name="ctrl" value="update" />
		<input type="hidden" name="li" value="" id="acyli"/>
		<?php 
        echo JHTML::_('form.token');
        ?>

		</form>
		<?php 
    }
Esempio n. 27
0
 function saveForm()
 {
     $app =& JFactory::getApplication();
     $mail = null;
     $mail->mailid = acymailing::getCID('mailid');
     $formData = JRequest::getVar('data', array(), '', 'array');
     foreach ($formData['mail'] as $column => $value) {
         if ($app->isAdmin() or in_array($column, $this->allowedFields)) {
             acymailing::secureField($column);
             if ($column == 'params') {
                 $mail->{$column} = $value;
             } else {
                 $mail->{$column} = strip_tags($value);
             }
         }
     }
     $mail->body = JRequest::getVar('editor_body', '', '', 'string', JREQUEST_ALLOWRAW);
     $mail->attach = array();
     $attachments = JRequest::getVar('attachments', array(), 'files', 'array');
     if (!empty($attachments['name'][0]) or !empty($attachments['name'][1])) {
         jimport('joomla.filesystem.file');
         $config =& acymailing::config();
         $allowedFiles = explode(',', strtolower($config->get('allowedfiles')));
         $uploadFolder = JPath::clean(html_entity_decode($config->get('uploadfolder')));
         $uploadFolder = trim($uploadFolder, DS . ' ') . DS;
         $uploadPath = JPath::clean(ACYMAILING_ROOT . $uploadFolder);
         if (!is_dir($uploadPath)) {
             jimport('joomla.filesystem.folder');
             JFolder::create($uploadPath);
         }
         if (!is_writable($uploadPath)) {
             @chmod($uploadPath, '0755');
             if (!is_writable($uploadPath)) {
                 $app->enqueueMessage(JText::sprintf('WRITABLE_FOLDER', $uploadPath), 'notice');
             }
         }
         foreach ($attachments['name'] as $id => $filename) {
             if (empty($filename)) {
                 continue;
             }
             $attachment = null;
             $attachment->filename = strtolower(JFile::makeSafe($filename));
             $attachment->size = $attachments['size'][$id];
             $attachment->extension = strtolower(substr($attachment->filename, strrpos($attachment->filename, '.') + 1));
             if (!in_array($attachment->extension, $allowedFiles)) {
                 $app->enqueueMessage(JText::sprintf('ACCEPTED_TYPE', $attachment->extension, $config->get('allowedfiles')), 'notice');
                 continue;
             }
             if (!move_uploaded_file($attachments['tmp_name'][$id], $uploadPath . $attachment->filename)) {
                 if (!JFile::upload($attachments['tmp_name'][$id], $uploadPath . $attachment->filename)) {
                     $app->enqueueMessage(JText::sprintf('FAIL_UPLOAD', $attachments['tmp_name'][$id], $uploadPath . $attachment->filename), 'error');
                     continue;
                 }
             }
             $mail->attach[] = $attachment;
         }
     }
     $mailid = $this->save($mail);
     if (!$mailid) {
         return false;
     }
     JRequest::setVar('mailid', $mailid);
     $status = true;
     if (!empty($formData['listmail'])) {
         $receivers = array();
         $remove = array();
         foreach ($formData['listmail'] as $listid => $receiveme) {
             if (!empty($receiveme)) {
                 $receivers[] = $listid;
             } else {
                 $remove[] = $listid;
             }
         }
         $listMailClass = acymailing::get('class.listmail');
         $status = $listMailClass->save($mailid, $receivers, $remove);
     }
     return $status;
 }
Esempio n. 28
0
 function acymailing_replaceusertags(&$email, &$user)
 {
     $match = '#{(readonline|forward)}(.*){/(readonline|forward)}#Uis';
     $variables = array('body', 'altbody');
     $found = false;
     foreach ($variables as $var) {
         if (empty($email->{$var})) {
             continue;
         }
         $found = preg_match_all($match, $email->{$var}, $results[$var]) || $found;
         if (empty($results[$var][0])) {
             unset($results[$var]);
         }
     }
     if (!$found) {
         return;
     }
     $config = acymailing::config();
     $itemId = $config->get('itemid', 0);
     $item = empty($itemId) ? '' : '&Itemid=' . $itemId;
     $tags = array();
     $tmplview = '';
     $tmplforward = '';
     if (!empty($email->key) and $this->params->get('addkey', 'yes') == 'yes') {
         $tmplview .= '&key=' . $email->key;
         $tmplforward .= '&key=' . $email->key;
     }
     if (!empty($user->key) and $this->params->get('adduserkey', 'yes') == 'yes') {
         $tmplview .= '&subid=' . $user->subid . '-' . $user->key;
         $tmplforward .= '&subid=' . $user->subid . '-' . $user->key;
     }
     if ($this->params->get('viewtemplate', 'standard') == 'notemplate') {
         $tmplview .= '&tmpl=component';
     }
     if ($this->params->get('forwardtemplate', 'standard') == 'notemplate') {
         $tmplforward .= '&tmpl=component';
     }
     foreach ($results as $var => $allresults) {
         foreach ($allresults[0] as $i => $oneTag) {
             if (isset($tags[$oneTag])) {
                 continue;
             }
             if ($allresults[1][$i] == 'readonline') {
                 $link = acymailing::frontendLink('index.php?option=com_acymailing&ctrl=archive&task=view&mailid=' . $email->mailid . $tmplview . $item);
             } elseif ($allresults[1][$i] == 'forward') {
                 $link = acymailing::frontendLink('index.php?option=com_acymailing&ctrl=archive&task=forward&mailid=' . $email->mailid . $tmplforward . $item);
             }
             if (empty($allresults[2][$i])) {
                 $tags[$oneTag] = $link;
             } else {
                 $tags[$oneTag] = '<a style="text-decoration:none;" href="' . $link . '"><span class="acymailing_online">' . $allresults[2][$i] . '</span></a>';
             }
         }
     }
     $email->body = str_replace(array_keys($tags), $tags, $email->body);
     if (!empty($email->altbody)) {
         $email->altbody = str_replace(array_keys($tags), $tags, $email->altbody);
     }
 }
Esempio n. 29
0
 function onAfterStoreUser($user, $isnew, $success, $msg)
 {
     if ($success === false or empty($user['email'])) {
         return false;
     }
     if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_acymailing' . DS . 'helpers' . DS . 'helper.php')) {
         return true;
     }
     if (!isset($this->params)) {
         $plugin =& JPluginHelper::getPlugin('system', 'regacymailing');
         $this->params = new JParameter($plugin->params);
     }
     $config = acymailing::config();
     $joomUser = null;
     $joomUser->email = trim(strip_tags($user['email']));
     if (!empty($user['name'])) {
         $joomUser->name = trim(strip_tags($user['name']));
     }
     if (empty($user['block'])) {
         $joomUser->confirmed = 1;
     }
     $joomUser->enabled = 1 - (int) $user['block'];
     $joomUser->userid = $user['id'];
     $userClass = acymailing::get('class.subscriber');
     if (!$isnew and !empty($this->oldUser['email']) and $user['email'] != $this->oldUser['email']) {
         $joomUser->subid = $userClass->subid($this->oldUser['email']);
     }
     if (empty($joomUser->subid)) {
         $joomUser->subid = $userClass->subid($joomUser->userid);
     }
     $userClass->checkVisitor = false;
     $userClass->sendConf = false;
     if (isset($joomUser->email)) {
         $userHelper = acymailing::get('helper.user');
         if (!$userHelper->validEmail($joomUser->email)) {
             return true;
         }
     }
     $subid = $userClass->save($joomUser);
     if ($isnew || empty($joomUser->subid)) {
         $listsToSubscribe = $config->get('autosub', 'None');
         $currentSubscription = $userClass->getSubscriptionStatus($subid);
         $config = acymailing::config();
         $listsClass = acymailing::get('class.list');
         $allLists = $listsClass->getLists('listid');
         if (acymailing::level(1)) {
             $allLists = $listsClass->onlyCurrentLanguage($allLists);
         }
         $visiblelistschecked = JRequest::getVar('acysub', array(), '', 'array');
         $acySubHidden = JRequest::getString('acysubhidden');
         if (!empty($acySubHidden)) {
             $visiblelistschecked = array_merge($visiblelistschecked, explode(',', $acySubHidden));
         }
         if (empty($visiblelistschecked) and !empty($_SESSION['acysub'])) {
             $visiblelistschecked = $_SESSION['acysub'];
             unset($_SESSION['acysub']);
         }
         $listsArray = array();
         if (strpos($listsToSubscribe, ',') or is_numeric($listsToSubscribe)) {
             $listsArrayParam = explode(',', $listsToSubscribe);
             foreach ($allLists as $oneList) {
                 if ($oneList->published and in_array($oneList->listid, $visiblelistschecked) || in_array($oneList->listid, $listsArrayParam)) {
                     $listsArray[] = $oneList->listid;
                 }
             }
         } elseif (strtolower($listsToSubscribe) == 'all') {
             foreach ($allLists as $oneList) {
                 if ($oneList->published) {
                     $listsArray[] = $oneList->listid;
                 }
             }
         } elseif (!empty($visiblelistschecked)) {
             foreach ($allLists as $oneList) {
                 if ($oneList->published and in_array($oneList->listid, $visiblelistschecked)) {
                     $listsArray[] = $oneList->listid;
                 }
             }
         }
         $statusAdd = (empty($joomUser->enabled) or empty($joomUser->confirmed) and $config->get('require_confirmation', false)) ? 2 : 1;
         $addlists = array();
         if (!empty($listsArray)) {
             foreach ($listsArray as $idOneList) {
                 if (!isset($currentSubscription[$idOneList])) {
                     $addlists[$statusAdd][] = $idOneList;
                 }
             }
         }
         if (!empty($addlists)) {
             $listsubClass = acymailing::get('class.listsub');
             if (!empty($user['gid'])) {
                 $listsubClass->gid = $user['gid'];
             }
             if (!empty($user['groups'])) {
                 $listsubClass->gid = $user['groups'];
             }
             $listsubClass->addSubscription($subid, $addlists);
         }
     } else {
         if (!empty($this->oldUser['block']) and !empty($joomUser->confirmed)) {
             $userClass->confirmSubscription($subid);
         }
     }
     return true;
 }
Esempio n. 30
0
    function footer()
    {
        $config = acymailing::config();
        $description = $config->get('description_' . strtolower($config->get('level')), 'Joomla!<sup style="font-size:4px;">TM</sup> Mailing System');
        $text = '<!--  AcyMailing Component powered by http://www.acyba.com -->
		<!-- version ' . $config->get('level') . ' : ' . $config->get('version') . ' -->';
        if (!$config->get('show_footer', true)) {
            return $text;
        }
        $text .= '<div class="acymailing_footer" align="center" style="text-align:center"><a href="http://www.acyba.com" target="_blank" title="' . ACYMAILING_NAME . ' : ' . str_replace('TM ', ' ', strip_tags($description)) . '">' . ACYMAILING_NAME;
        $app =& JFactory::getApplication();
        if ($app->isAdmin()) {
            $text .= ' ' . $config->get('level') . ' ' . $config->get('version');
        }
        $text .= ' - ' . $description . '</a></div>';
        return $text;
    }