function formatString(&$replaceme, $mytag) { if (!empty($mytag->part)) { $parts = explode(' ', $replaceme); if ($mytag->part == 'last') { $replaceme = count($parts) > 1 ? end($parts) : ''; } else { $replaceme = reset($parts); } } if (!empty($mytag->type)) { if (empty($mytag->format)) { $mytag->format = JText::_('DATE_FORMAT_LC3'); } if ($mytag->type == 'date') { $replaceme = acymailing_getDate(acymailing_getTime($replaceme), $mytag->format); } elseif ($mytag->type == 'time') { $replaceme = acymailing_getDate($replaceme, $mytag->format); } } if (!empty($mytag->lower)) { $replaceme = strtolower($replaceme); } if (!empty($mytag->upper)) { $replaceme = strtoupper($replaceme); } if (!empty($mytag->ucwords)) { $replaceme = ucwords($replaceme); } if (!empty($mytag->ucfirst)) { $replaceme = ucfirst($replaceme); } if (!empty($mytag->urlencode)) { $replaceme = urlencode($replaceme); } if (!empty($mytag->maxheight) || !empty($mytag->maxwidth)) { $pictureHelper = acymailing_get('helper.acypict'); $pictureHelper->maxHeight = empty($mytag->maxheight) ? 999 : $mytag->maxheight; $pictureHelper->maxWidth = empty($mytag->maxwidth) ? 999 : $mytag->maxwidth; $replaceme = $pictureHelper->resizePictures($replaceme); } }
function scheduleone() { if (!$this->isAllowed('newsletters', 'schedule')) { return; } $mailid = JRequest::getInt('mailid'); $subid = JRequest::getInt('subid'); $senddate = JRequest::getString('senddate', ''); $sendhours = JRequest::getString('sendhours', ''); $sendminutes = JRequest::getString('sendminutes', ''); $senddateComplete = $senddate . ' ' . $sendhours . ':' . $sendminutes; $app = JFactory::getApplication(); JRequest::checkToken() && !empty($mailid) && !empty($subid) or die('Invalid Token'); $realSendDate = acymailing_getTime($senddateComplete); if ($realSendDate < time()) { acymailing_display(JText::_('DATE_FUTURE'), 'warning'); if ($app->isAdmin()) { return $this->addqueue(); } else { $frontSubController = acymailing_get('controller.frontsubscriber'); return $frontSubController->addqueue(); } } $mailClass = acymailing_get('class.mail'); $myNewsletter = $mailClass->get($mailid); $queueEntry = new stdClass(); $queueEntry->mailid = $myNewsletter->mailid; $queueEntry->subid = $subid; $queueEntry->senddate = $realSendDate; $queueEntry->priority = 1; $db = JFactory::getDBO(); $status = $db->insertObject('#__acymailing_queue', $queueEntry); if ($status) { acymailing_display(JText::sprintf('AUTOSEND_DATE', '<b><i>' . $myNewsletter->subject . '</i></b>', acymailing_getDate($realSendDate)), 'success'); } else { acymailing_display(array(JText::_('ERROR_SAVING'), $db->getErrorMsg()), 'error'); if ($app->isAdmin()) { return $this->addqueue(); } else { $frontSubController = acymailing_get('controller.frontsubscriber'); return $frontSubController->addqueue(); } } }
?> </a></span> <?php } } ?> </td> <td> <?php $subjectLine = acymailing_dispSearch($row->subject, $this->pageInfo->search); echo acymailing_tooltip('<b>' . JText::_('JOOMEXT_ALIAS') . ' : </b>' . acymailing_dispSearch($row->alias, $this->pageInfo->search), ' ', '', $subjectLine, acymailing_completeLink(($this->app->isAdmin() ? '' : 'front') . 'newsletter&task=edit&mailid=' . $row->mailid)); ?> </td> <td align="center" style="text-align:center"> <?php echo acymailing_getDate($row->senddate); if (!empty($row->countqueued) && acymailing_isAllowed($this->config->get('acl_queue_delete', 'all'))) { ?> <br/> <button class="acymailing_button" onclick="if(confirm('<?php echo str_replace("'", "\\'", JText::sprintf('ACY_VALID_DELETE_FROM_QUEUE', $row->countqueued)); ?> ')){ window.location.href = '<?php echo JURI::base(); ?> index.php?option=com_acymailing&ctrl=<?php if (!JFactory::getApplication()->isAdmin()) { echo 'front'; } ?>
echo acymailing_getDate(@$this->mail->created); ?> </td> </tr> <?php if (!empty($this->mail->senddate)) { ?> <tr> <td class="key" id="senddatekey"> <?php echo JText::_('SEND_DATE'); ?> </td> <td id="senddateinput"> <?php echo acymailing_getDate(@$this->mail->senddate); ?> </td> <td class="key" id="sentbykey"> <?php if (!empty($this->mail->sentby)) { echo JText::_('SENT_BY'); } ?> </td> <td id="sentbyinput"> <?php echo @$this->sentbyname; ?> </td> </tr>
function doexport() { if (!$this->isAllowed('subscriber', 'export')) { return; } JRequest::checkToken() or die('Invalid Token'); acymailing_increasePerf(); $filtersExport = JRequest::getVar('exportfilter'); $listsToExport = JRequest::getVar('exportlists'); $fieldsToExport = JRequest::getVar('exportdata'); $inseparator = JRequest::getString('exportseparator'); $inseparator = str_replace(array('semicolon', 'colon', 'comma'), array(';', ',', ','), $inseparator); $exportFormat = JRequest::getString('exportformat'); if (!in_array($inseparator, array(',', ';'))) { $inseparator = ';'; } $exportLists = array(); if (!empty($filtersExport['subscribed'])) { foreach ($listsToExport as $listid => $checked) { if (!empty($checked)) { $exportLists[] = (int) $listid; } } } $exportFields = array(); foreach ($fieldsToExport as $fieldName => $checked) { if (!empty($checked)) { $exportFields[] = acymailing_secureField($fieldName); } } $config = acymailing_config(); $newConfig = new stdClass(); $newConfig->export_fields = implode(',', $exportFields); $newConfig->export_lists = implode(',', $exportLists); $newConfig->export_separator = JRequest::getString('exportseparator'); $newConfig->export_format = $exportFormat; $config->save($newConfig); $where = array(); if (empty($exportLists)) { $querySelect = 'SELECT s.`' . implode('`,s.`', $exportFields) . '` FROM ' . acymailing_table('subscriber') . ' as s'; } else { $querySelect = 'SELECT DISTINCT s.`' . implode('`,s.`', $exportFields) . '` FROM ' . acymailing_table('listsub') . ' as a JOIN ' . acymailing_table('subscriber') . ' as s on a.subid = s.subid'; $where[] = 'a.listid IN (' . implode(',', $exportLists) . ')'; $where[] = 'a.status = 1'; } if (!empty($filtersExport['confirmed'])) { $where[] = 's.confirmed = 1'; } if (!empty($filtersExport['registered'])) { $where[] = 's.userid > 0'; } if (!empty($filtersExport['enabled'])) { $where[] = 's.enabled = 1'; } if (JRequest::getInt('sessionvalues') and !empty($_SESSION['acymailing']['exportusers'])) { $where[] = 's.subid IN (' . implode(',', $_SESSION['acymailing']['exportusers']) . ')'; } if (JRequest::getInt('sessionquery')) { $currentSession = JFactory::getSession(); $exportQuery = $currentSession->get('acyexportquery'); if (!empty($exportQuery)) { $where[] = 's.subid IN (' . $exportQuery . ')'; } } $query = $querySelect; if (!empty($where)) { $query .= ' WHERE (' . implode(') AND (', $where) . ')'; } $db = JFactory::getDBO(); $db->setQuery($query); $allData = $db->loadAssocList(); $encodingClass = acymailing_get('helper.encoding'); $exportHelper = acymailing_get('helper.export'); $exportHelper->addHeaders('acymailingexport'); $eol = "\r\n"; $before = '"'; $separator = '"' . $inseparator . '"'; $after = '"'; echo $before . implode($separator, $exportFields) . $after . $eol; for ($i = 0, $a = count($allData); $i < $a; $i++) { if (!empty($allData[$i]['created'])) { $allData[$i]['created'] = acymailing_getDate($allData[$i]['created'], '%Y-%m-%d %H:%M:%S'); } echo $before . $encodingClass->change(implode($separator, $allData[$i]), 'UTF-8', $exportFormat) . $after . $eol; } exit; }
function form() { $db = JFactory::getDBO(); $config = acymailing_config(); if (JRequest::getVar('task') == 'filterDisplayUsers') { $action = array(); $action['type'] = array('displayUsers'); $action[] = array('displayUsers' => array()); $filterClass = acymailing_get('class.filter'); $filterClass->subid = JRequest::getString('subid'); $filterClass->execute(JRequest::getVar('filter'), $action); if (!empty($filterClass->report)) { $this->assignRef('filteredUsers', $filterClass->report[0]); } } $filid = acymailing_getCID('filid'); $filterClass = acymailing_get('class.filter'); $testFilter = JRequest::getVar('filter'); if (!empty($filid) && empty($testFilter)) { $filter = $filterClass->get($filid); } else { $filter = new stdClass(); $filter->action = JRequest::getVar('action'); $filter->filter = JRequest::getVar('filter'); $filter->published = 1; } JPluginHelper::importPlugin('acymailing'); $this->dispatcher = JDispatcher::getInstance(); $typesFilters = array(); $typesActions = array(); $outputFilters = implode('', $this->dispatcher->trigger('onAcyDisplayFilters', array(&$typesFilters, 'massactions'))); $outputActions = implode('', $this->dispatcher->trigger('onAcyDisplayActions', array(&$typesActions))); $typevaluesFilters = array(); $typevaluesActions = array(); $typevaluesFilters[] = JHTML::_('select.option', '', JText::_('FILTER_SELECT')); $typevaluesActions[] = JHTML::_('select.option', '', JText::_('ACTION_SELECT')); $doc = JFactory::getDocument(); foreach ($typesFilters as $oneType => $oneName) { $typevaluesFilters[] = JHTML::_('select.option', $oneType, $oneName); } foreach ($typesActions as $oneType => $oneName) { $typevaluesActions[] = JHTML::_('select.option', $oneType, $oneName); } $js = "function updateAction(actionNum){\r\n\t\t\t\tvar actiontype = window.document.getElementById('actiontype'+actionNum);\r\n\t\t\t\tif(actiontype == 'undefined' || actiontype == null) return;\r\n\t\t\t\tcurrentActionType = actiontype.value;\r\n\t\t\t\tif(!currentActionType){\r\n\t\t\t\t\twindow.document.getElementById('actionarea_'+actionNum).innerHTML = '';\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tactionArea = 'action__num__'+currentActionType;\r\n\t\t\t\twindow.document.getElementById('actionarea_'+actionNum).innerHTML = window.document.getElementById(actionArea).innerHTML.replace(/__num__/g,actionNum);\r\n\t\t\t\tif(typeof(window['onAcyDisplayAction_'+currentActionType]) == 'function') {\r\n\t\t\t\t\ttry{ window['onAcyDisplayAction_'+currentActionType](actionNum); }catch(e){alert('Error in the onAcyDisplayAction_'+currentActionType+' function : '+e); }\r\n\t\t\t\t}\r\n\r\n\t\t\t}"; $js .= "var numActions = 0;\r\n\t\t\t\tfunction addAction(){\r\n\t\t\t\t\tvar newdiv = document.createElement('div');\r\n\t\t\t\t\tnewdiv.id = 'action'+numActions;\r\n\t\t\t\t\tnewdiv.className = 'plugarea';\r\n\t\t\t\t\tnewdiv.innerHTML = document.getElementById('actions_original').innerHTML.replace(/__num__/g, numActions);\r\n\t\t\t\t\tvar allactions = document.getElementById('allactions');\r\n\t\t\t\t\tif(allactions != 'undefined' && allactions != null) allactions.appendChild(newdiv); updateAction(numActions); numActions++;\r\n\t\t\t\t}"; $js .= "window.addEvent('domready', function(){ addAcyFilter(); addAction(); });"; if (!ACYMAILING_J16) { $js .= 'function submitbutton(pressbutton){ if (pressbutton != \'save\') { submitform( pressbutton ); return; }'; } else { $js .= 'Joomla.submitbutton = function(pressbutton) { if (pressbutton != \'save\') { Joomla.submitform(pressbutton,document.adminForm); return; }'; } if (ACYMAILING_J30) { $js .= "if(window.document.getElementById('filterinfo').style.display == 'none'){\r\n\t\t\t\t\t\twindow.document.getElementById('filterinfo').style.display = 'block';\r\n\t\t\t\t\t\treturn false;}\r\n\t\t\t\t\tif(window.document.getElementById('title').value.length < 2){alert('" . JText::_('ENTER_TITLE', true) . "'); return false;}"; } else { $js .= "if(window.document.getElementById('filterinfo').style.display == 'none'){\r\n\t\t\t\t\t\twindow.document.getElementById('filterinfo').style.display = 'block';\r\n\t\t\t\t\t\treturn false;}\r\n\t\t\t\t\tif(window.document.getElementById('title').value.length < 2){alert('" . JText::_('ENTER_TITLE', true) . "'); return false;}"; } if (!ACYMAILING_J16) { $js .= "submitform( pressbutton );} "; } else { $js .= "Joomla.submitform(pressbutton,document.adminForm);}; "; } $doc->addScriptDeclaration($js); $filterClass->addJSFilterFunctions(); $js = ''; $data = array('addAction' => 'action', 'addAcyFilter' => 'filter'); foreach ($data as $jsFunction => $datatype) { if (empty($filter->{$datatype})) { continue; } foreach ($filter->{$datatype}['type'] as $num => $oneType) { if (empty($oneType)) { continue; } $js .= "while(!document.getElementById('" . $datatype . "type{$num}')){" . $jsFunction . "();}\r\n\t\t\t\t\t\tdocument.getElementById('" . $datatype . "type{$num}').value= '{$oneType}';\r\n\t\t\t\t\t\tupdate" . ucfirst($datatype) . "({$num});"; if (empty($filter->{$datatype}[$num][$oneType])) { continue; } foreach ($filter->{$datatype}[$num][$oneType] as $key => $value) { if (is_array($value)) { $js .= "try{"; foreach ($value as $subkey => $subval) { $js .= "document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}][{$subkey}]'].value = '" . addslashes(str_replace(array("\n", "\r"), ' ', $subval)) . "';"; $js .= "if(document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}][{$subkey}]'].type && document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}][{$subkey}]'].type == 'checkbox'){ document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}][{$subkey}]'].checked = 'checked'; }"; } $js .= "}catch(e){}"; } $myVal = is_array($value) ? implode(',', $value) : $value; $js .= "try{"; $js .= "document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].value = '" . addslashes(str_replace(array("\n", "\r"), ' ', $myVal)) . "';"; $js .= "if(document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].type && document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].type == 'checkbox'){ document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].checked = 'checked'; }"; $js .= "}catch(e){}"; } $js .= "\n" . " if(typeof(onAcyDisplay" . ucfirst($datatype) . "_" . $oneType . ") == 'function'){\r\n\t\t\t\t\ttry{ onAcyDisplay" . ucfirst($datatype) . "_" . $oneType . "({$num}); }catch(e){alert('Error in the onAcyDisplay" . ucfirst($datatype) . "_" . $oneType . " function : '+e); }\r\n\t\t\t\t}"; if ($datatype == 'filter') { $js .= " countresults({$num});"; } } } $listid = JRequest::getInt('listid'); if (!empty($listid)) { $js .= "document.getElementById('actiontype0').value = 'list'; updateAction(0); document.adminForm.elements['action[0][list][selectedlist]'].value = '" . $listid . "';"; } $doc->addScriptDeclaration("window.addEvent('domready', function(){ {$js} });"); $triggers = array(); $triggers['daycron'] = JText::_('AUTO_CRON_FILTER'); $nextDate = $config->get('cron_plugins_next'); $listHours = array(); $listMinutess = array(); for ($i = 0; $i < 24; $i++) { $listHours[] = JHTML::_('select.option', $i, $i < 10 ? '0' . $i : $i); } $hours = JHTML::_('select.genericlist', $listHours, 'triggerhours', 'class="inputbox" size="1" style="width:60px;"', 'value', 'text', acymailing_getDate($nextDate, 'H')); for ($i = 0; $i < 60; $i += 5) { $listMinutess[] = JHTML::_('select.option', $i, $i < 10 ? '0' . $i : $i); } $defaultMin = floor(acymailing_getDate($nextDate, 'i') / 5) * 5; $minutes = JHTML::_('select.genericlist', $listMinutess, 'triggerminutes', 'class="inputbox" size="1" style="width:60px;"', 'value', 'text', $defaultMin); $this->assign('hours', $hours); $this->assign('minutes', $minutes); $this->assign('nextDate', !empty($nextDate) ? ' (' . JText::_('NEXT_RUN') . ' : ' . acymailing_getDate($nextDate, '%d %B %Y %H:%M') . ')' : ''); $triggers['allcron'] = JText::_('ACY_EACH_TIME'); $triggers['subcreate'] = JText::_('ON_USER_CREATE'); $triggers['subchange'] = JText::_('ON_USER_CHANGE'); $this->dispatcher->trigger('onAcyDisplayTriggers', array(&$triggers)); $name = empty($filter->name) ? '' : ' : ' . $filter->name; if (JRequest::getCmd('tmpl', '') != 'component') { $acyToolbar = acymailing::get('helper.toolbar'); $acyToolbar->custom('filterDisplayUsers', JText::_('FILTER_VIEW_USERS'), 'user', false, ''); $acyToolbar->custom('process', JText::_('PROCESS'), 'process', false, ''); $acyToolbar->divider(); if (acymailing_level(3)) { $acyToolbar->save(); if (!empty($filter->filid)) { $acyToolbar->link(acymailing_completeLink('filter&task=edit&filid=0'), JText::_('ACY_NEW'), 'new'); } } $acyToolbar->link(acymailing_completeLink('dashboard'), JText::_('ACY_CLOSE'), 'cancel'); $acyToolbar->divider(); $acyToolbar->help('filter'); $acyToolbar->setTitle(JText::_('ACY_MASS_ACTIONS') . $name, 'filter&task=edit&filid=' . $filid); $acyToolbar->display(); } else { acymailing_setPageTitle(JText::_('ACY_MASS_ACTIONS') . $name); } $subid = JRequest::getString('subid'); if (!empty($subid)) { $subArray = explode(',', trim($subid, ',')); JArrayHelper::toInteger($subArray); $db->setQuery('SELECT `name`,`email` FROM `#__acymailing_subscriber` WHERE `subid` IN (' . implode(',', $subArray) . ')'); $users = $db->loadObjectList(); if (!empty($users)) { $this->assignRef('users', $users); $this->assignRef('subid', $subid); } } $this->assignRef('typevaluesFilters', $typevaluesFilters); $this->assignRef('typevaluesActions', $typevaluesActions); $this->assignRef('outputFilters', $outputFilters); $this->assignRef('outputActions', $outputActions); $this->assignRef('filter', $filter); $this->assignRef('triggers', $triggers); if (JRequest::getCmd('tmpl') == 'component') { $doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'frontendedition.css')); } if (acymailing_level(3) and JRequest::getCmd('tmpl') != 'component') { $db->setQuery('SELECT * FROM #__acymailing_filter ORDER BY `published` DESC, `filid` DESC'); $filters = $db->loadObjectList(); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('filters', $filters); } }
?> </legend> <table class="adminlist table table-striped" cellspacing="1" align="center"> <tbody> <?php $k = 0; foreach ($this->nextqueue as $mailid => $row) { ?> <tr class="<?php echo "row{$k}"; ?> "> <td> <?php echo JText::sprintf('EMAIL_READY', $row->mailid, $row->subject, $row->nbsub); echo '<br />' . JText::sprintf('QUEUE_NEXT_SCHEDULE', acymailing_getDate($row->senddate)); ?> </td> </tr> <?php $k = 1 - $k; } ?> </tbody> </table> </fieldset> <?php } ?> </div> <div class="clr"></div>
?> </td> <td align="center" style="text-align:center" > <?php echo $row->html ? JText::_('HTML') : JText::_('JOOMEXT_TEXT'); ?> </td> <td align="center" style="text-align:center" > <?php echo $row->open; ?> </td> <td align="center" style="text-align:center" > <?php if (!empty($row->opendate)) { echo acymailing_getDate($row->opendate); } ?> </td> <?php if (acymailing_level(3)) { ?> <td align="center" style="text-align:center" > <?php if ($row->bounce == 0) { echo $row->bounce; } else { $text = empty($row->bouncerule) ? JText::_('NO_RULE_SAVED') : $row->bouncerule; echo acymailing_tooltip($text, JText::_('ACY_RULE'), '', $row->bounce); } ?>
function saveReport(){ $config = acymailing_config(); $saveReport = $config->get('cron_savereport'); if(empty($saveReport)) return; $reportPath = JPath::clean(ACYMAILING_ROOT.trim(html_entity_decode($config->get('cron_savepath')))); acymailing_createDir(dirname($reportPath),true,true); file_put_contents($reportPath, "\r\n"."\r\n".str_repeat('*',150)."\r\n".str_repeat('*',20).str_repeat(' ',5).acymailing_getDate(time()).str_repeat(' ',5).str_repeat('*',20)."\r\n".implode("\r\n",$this->messages), FILE_APPEND); if($saveReport == 2 AND !empty($this->detailMessages)){ @file_put_contents($reportPath, "\r\n"."---- Details ----"."\r\n".implode("\r\n",$this->detailMessages), FILE_APPEND); } }
</td> <td> <?php echo $this->emaildrop; ?> </td> </tr> <tr> <td class="acykey"> <?php echo JText::_('SEND_DATE'); ?> </td> <td> <?php echo JHTML::_('calendar', acymailing_getDate(time(), '%Y-%m-%d'), 'senddate', 'senddate', '%Y-%m-%d', array('style' => 'width:80px')); echo ' @ ' . $this->hours . ' : ' . $this->minutes; ?> </td> </tr> <tr> <td> </td> <td> <button class="btn btn-primary" type="submit"><?php echo JText::_('SCHEDULE'); ?> </button> </td> </tr> </table>
function doexport() { if (!$this->isAllowed('subscriber', 'export')) { return; } JRequest::checkToken() or die('Invalid Token'); acymailing_increasePerf(); $filtersExport = JRequest::getVar('exportfilter', array(), '', 'array'); $listsToExport = JRequest::getVar('exportlists'); $fieldsToExport = JRequest::getVar('exportdata'); $fieldsToExportList = JRequest::getVar('exportdatalist'); $fieldsToExportOthers = JRequest::getVar('exportdataother'); $fieldsToExportGeoloc = JRequest::getVar('exportdatageoloc'); $inseparator = JRequest::getString('exportseparator'); $inseparator = str_replace(array('semicolon', 'colon', 'comma'), array(';', ',', ','), $inseparator); $exportFormat = JRequest::getString('exportformat'); if (!in_array($inseparator, array(',', ';'))) { $inseparator = ';'; } $exportUnsubLists = array(); $exportWaitLists = array(); $exportLists = array(); if (!empty($filtersExport['subscribed'])) { foreach ($listsToExport as $listid => $status) { if ($status == -1) { $exportUnsubLists[] = (int) $listid; } elseif ($status == 2) { $exportWaitLists[] = (int) $listid; } elseif (!empty($status)) { $exportLists[] = (int) $listid; } } } $app = JFactory::getApplication(); if (!$app->isAdmin() && (empty($filtersExport['subscribed']) || empty($exportLists) && empty($exportUnsubLists) && empty($exportWaitLists))) { $listClass = acymailing_get('class.list'); $frontLists = $listClass->getFrontendLists(); foreach ($frontLists as $frontList) { $exportLists[] = (int) $frontList->listid; } } $exportFields = array(); $exportFieldsList = array(); $exportFieldsOthers = array(); $exportFieldsGeoloc = array(); foreach ($fieldsToExport as $fieldName => $checked) { if (!empty($checked)) { $exportFields[] = acymailing_secureField($fieldName); } } foreach ($fieldsToExportList as $fieldName => $checked) { if (!empty($checked)) { $exportFieldsList[] = acymailing_secureField($fieldName); } } if (!empty($fieldsToExportOthers)) { foreach ($fieldsToExportOthers as $fieldName => $checked) { if (!empty($checked)) { $exportFieldsOthers[] = acymailing_secureField($fieldName); } } } if (!empty($fieldsToExportGeoloc)) { foreach ($fieldsToExportGeoloc as $fieldName => $checked) { if (!empty($checked)) { $exportFieldsGeoloc[] = acymailing_secureField($fieldName); } } } $selectFields = 's.`' . implode('`, s.`', $exportFields) . '`'; $config = acymailing_config(); $newConfig = new stdClass(); $newConfig->export_fields = implode(',', array_merge($exportFields, $exportFieldsOthers, $exportFieldsList, $exportFieldsGeoloc)); $newConfig->export_lists = implode(',', $exportLists); $newConfig->export_separator = JRequest::getString('exportseparator'); $newConfig->export_format = $exportFormat; $filterActive = array(); foreach ($filtersExport as $filterKey => $value) { if ($value == 1) { $filterActive[] = $filterKey; } } $newConfig->export_filters = implode(',', $filterActive); $config->save($newConfig); $where = array(); if (empty($exportLists) && empty($exportUnsubLists) && empty($exportWaitLists)) { $querySelect = 'SELECT s.`subid`, ' . $selectFields . ' FROM ' . acymailing_table('subscriber') . ' as s'; } else { $querySelect = 'SELECT DISTINCT s.`subid`, ' . $selectFields . ' FROM ' . acymailing_table('listsub') . ' as a JOIN ' . acymailing_table('subscriber') . ' as s on a.subid = s.subid'; if (!empty($exportLists)) { $conditions[] = 'a.status = 1 AND a.listid IN (' . implode(',', $exportLists) . ')'; } if (!empty($exportUnsubLists)) { $conditions[] = 'a.status = -1 AND a.listid IN (' . implode(',', $exportUnsubLists) . ')'; } if (!empty($exportWaitLists)) { $conditions[] = 'a.status = 2 AND a.listid IN (' . implode(',', $exportWaitLists) . ')'; } if (count($conditions) == 1) { $where[] = $conditions[0]; } else { $where[] = '(' . implode(') OR (', $conditions) . ')'; } } if (!empty($filtersExport['confirmed'])) { $where[] = 's.confirmed = 1'; } if (!empty($filtersExport['registered'])) { $where[] = 's.userid > 0'; } if (!empty($filtersExport['enabled'])) { $where[] = 's.enabled = 1'; } if (JRequest::getInt('sessionvalues') and !empty($_SESSION['acymailing']['exportusers'])) { $where[] = 's.subid IN (' . implode(',', $_SESSION['acymailing']['exportusers']) . ')'; } if (JRequest::getInt('fieldfilters')) { foreach ($_SESSION['acymailing']['fieldfilter'] as $field => $value) { $where[] = 's.' . acymailing_secureField($field) . ' LIKE "%' . acymailing_getEscaped($value, true) . '%"'; } } $query = $querySelect; if (!empty($where)) { $query .= ' WHERE (' . implode(') AND (', $where) . ')'; } if (JRequest::getInt('sessionquery')) { $currentSession = JFactory::getSession(); $selectOthers = ''; if (!empty($exportFieldsOthers)) { foreach ($exportFieldsOthers as $oneField) { $selectOthers .= ' , ' . $oneField . ' AS ' . str_replace('.', '_', $oneField); } } $query = 'SELECT DISTINCT s.`subid`, ' . $selectFields . $selectOthers . ' ' . $currentSession->get('acyexportquery'); } $query .= ' ORDER BY s.subid'; $db = JFactory::getDBO(); $encodingClass = acymailing_get('helper.encoding'); $exportHelper = acymailing_get('helper.export'); $fileName = 'export_' . date('Y-m-d'); if (!empty($exportLists)) { $fileName = ''; $db->setQuery('SELECT name FROM #__acymailing_list WHERE listid IN (' . implode(',', $exportLists) . ')'); $allExportedLists = $db->loadObjectList(); foreach ($allExportedLists as $oneList) { $fileName .= '__' . $oneList->name; } $fileName = trim($fileName, '__'); } $exportHelper->addHeaders($fileName); acymailing_displayErrors(); $eol = "\r\n"; $before = '"'; $separator = '"' . $inseparator . '"'; $after = '"'; $allFields = array_merge($exportFields, $exportFieldsOthers); if (!empty($exportFieldsList)) { $allFields = array_merge($allFields, $exportFieldsList); $selectFields = 'l.`' . implode('`, l.`', $exportFieldsList) . '`'; $selectFields = str_replace('listname', 'name', $selectFields); } if (!empty($exportFieldsGeoloc)) { $allFields = array_merge($allFields, $exportFieldsGeoloc); } $titleLine = $before . implode($separator, $allFields) . $after . $eol; $titleLine = str_replace('listid', 'listids', $titleLine); echo $titleLine; if (acymailing_bytes(ini_get('memory_limit')) > 150000000) { $nbExport = 50000; } elseif (acymailing_bytes(ini_get('memory_limit')) > 80000000) { $nbExport = 15000; } else { $nbExport = 5000; } if (!empty($exportFieldsList)) { $nbExport = 500; } $valDep = 0; $dateFields = array('created', 'confirmed_date', 'lastopen_date', 'lastclick_date', 'lastsent_date', 'userstats_opendate', 'userstats_senddate', 'urlclick_date', 'hist_date'); do { $db->setQuery($query . ' LIMIT ' . $valDep . ', ' . $nbExport); $valDep += $nbExport; $allData = $db->loadAssocList('subid'); if ($allData === false) { echo $eol . $eol . 'Error : ' . $db->getErrorMsg(); } if (empty($allData)) { break; } foreach ($allData as $subid => &$oneUser) { if (!in_array('subid', $exportFields)) { unset($allData[$subid]['subid']); } foreach ($dateFields as &$fieldName) { if (isset($allData[$subid][$fieldName])) { $allData[$subid][$fieldName] = acymailing_getDate($allData[$subid][$fieldName], '%Y-%m-%d %H:%M:%S'); } } } if (!empty($exportFieldsList) && !empty($allData)) { $queryList = 'SELECT ' . $selectFields . ', ls.subid FROM #__acymailing_listsub as ls JOIN #__acymailing_list as l ON ls.listid=l.listid JOIN #__acymailing_subscriber as s on ls.subid = s.subid WHERE (ls.status = 1) and ls.subid IN (' . implode(',', array_keys($allData)) . ')'; if (!empty($exportLists)) { $queryList .= ' AND ls.listid IN (' . implode(',', $exportLists) . ')'; } $db->setQuery($queryList); $resList = $db->loadObjectList(); foreach ($resList as &$listsub) { if (in_array('listid', $exportFieldsList)) { $allData[$listsub->subid]['listid'] = empty($allData[$listsub->subid]['listid']) ? $listsub->listid : $allData[$listsub->subid]['listid'] . ' - ' . $listsub->listid; } if (in_array('listname', $exportFieldsList)) { $allData[$listsub->subid]['listname'] = empty($allData[$listsub->subid]['listname']) ? $listsub->name : $allData[$listsub->subid]['listname'] . ' - ' . $listsub->name; } } unset($resList); } if (!empty($exportFieldsGeoloc) && !empty($allData)) { $orderGeoloc = JRequest::getCmd('exportgeolocorder'); if (strtolower($orderGeoloc) !== 'desc') { $orderGeoloc = 'asc'; } $db->setQuery('SELECT geolocation_subid,' . implode(', ', $exportFieldsGeoloc) . ' FROM (SELECT * FROM #__acymailing_geolocation WHERE geolocation_subid IN (' . implode(',', array_keys($allData)) . ') ORDER BY geolocation_id ' . $orderGeoloc . ') as geoloc GROUP BY geolocation_subid'); $resGeol = $db->loadObjectList(); foreach ($resGeol as $geolData) { foreach ($exportFieldsGeoloc as $geolField) { $allData[$geolData->geolocation_subid][$geolField] = $geolField == 'geolocation_created' ? acymailing_getDate($geolData->{$geolField}, '%Y-%m-%d %H:%M:%S') : $geolData->{$geolField}; } } unset($resGeol); } foreach ($allData as $subid => &$oneUser) { $dataexport = implode($separator, $oneUser); echo $before . $encodingClass->change($dataexport, 'UTF-8', $exportFormat) . $after . $eol; } unset($allData); } while (true); exit; }
function exportglobal() { $nlCondition = ''; $cids = JRequest::getVar('cid'); JArrayHelper::toInteger($cids); if (!empty($cids)) { $nlCondition = ' WHERE a.mailid IN (' . implode(', ', $cids) . ') '; } $db = JFactory::getDBO(); $query = 'SELECT b.subject, a.senddate, a.* , a.bouncedetails FROM #__acymailing_stats as a JOIN #__acymailing_mail as b on a.mailid = b.mailid ' . $nlCondition . ' ORDER BY a.senddate desc'; $db->setQuery($query); $mydata = $db->loadObjectList(); $exportHelper = acymailing_get('helper.export'); $config = acymailing_config(); $encodingClass = acymailing_get('helper.encoding'); $exportHelper->addHeaders('globalStatistics_' . date('m_d_y')); $eol = "\r\n"; $before = '"'; $separator = '"' . str_replace(array('semicolon', 'comma'), array(';', ','), $config->get('export_separator', ';')) . '"'; $exportFormat = $config->get('export_format', 'UTF-8'); $after = '"'; $forwardEnabled = $config->get('forward', 0); $titles = array(JText::_('JOOMEXT_SUBJECT'), JText::_('SEND_DATE'), JText::_('OPEN_UNIQUE'), JText::_('OPEN_TOTAL'), JText::_('OPEN') . ' (%)'); if (acymailing_level(1)) { array_push($titles, JTEXT::_('UNIQUE_HITS'), JTEXT::_('TOTAL_HITS'), JText::_('CLICKED_LINK') . ' (%)'); } array_push($titles, JText::_('UNSUBSCRIBE'), JText::_('UNSUBSCRIBE') . ' (%)'); if (acymailing_level(1) && $forwardEnabled == 1) { array_push($titles, JText::_('FORWARDED')); } array_push($titles, JText::_('SENT_HTML'), JText::_('SENT_TEXT')); if (acymailing_level(3)) { array_push($titles, JText::_('BOUNCES'), JText::_('BOUNCES') . ' (%)'); } array_push($titles, JText::_('FAILED'), JText::_('ACY_ID')); $titleLine = $before . implode($separator, $titles) . $after . $eol; echo $titleLine; foreach ($mydata as $nl) { $line = $nl->subject . $separator; $line .= acymailing_getDate($nl->senddate) . $separator; $line .= $nl->openunique . $separator; $line .= $nl->opentotal . $separator; $cleanSent = $nl->senthtml + $nl->senttext; if (acymailing_level(3)) { $cleanSent = $cleanSent - $nl->bounceunique; } $prct = !empty($cleanSent) ? round($nl->openunique / $cleanSent * 100, 2) : '-'; $line .= $prct . '%' . $separator; if (acymailing_level(1)) { $line .= $nl->clickunique . $separator; $line .= $nl->clicktotal . $separator; $prct = !empty($cleanSent) ? round($nl->clickunique / $cleanSent * 100, 2) : '-'; $line .= $prct . '%' . $separator; } $line .= $nl->unsub . $separator; $prct = !empty($cleanSent) ? round($nl->unsub / $cleanSent * 100, 2) : '-'; $line .= $prct . '%' . $separator; if (acymailing_level(1) && $forwardEnabled == 1) { $line .= $nl->forward . $separator; } $line .= $nl->senthtml . $separator; $line .= $nl->senttext . $separator; if (acymailing_level(3)) { $line .= $nl->bounceunique . $separator; $prct = !empty($nl->senthtml) ? round($nl->bounceunique / ($nl->senthtml + $nl->senttext) * 100, 2) : '-'; $line .= $prct . '%' . $separator; } $line .= $nl->fail . $separator; $line .= $nl->mailid; $line = $before . $encodingClass->change($line, 'UTF-8', $exportFormat) . $after . $eol; echo $line; } exit; }
google.setOnLoadCallback(drawClic); google.setOnLoadCallback(drawUnsub); google.setOnLoadCallback(drawForward); function showData(typeGraph){ if(document.getElementById('exporteddata_' + typeGraph).style.display == 'none'){ document.getElementById('exporteddata_' + typeGraph).style.display = ''; }else{ document.getElementById('exporteddata_' + typeGraph).style.display = 'none'; } } </script> <div id="iframedoc"></div> <?php echo JText::_('SEND_DATE') . ' : <span class="statnumber">' . acymailing_getDate($this->mailing->senddate); ?> </span><br/> <div class="acychart mailingListChart" width="350px" height="350px"> <div id="chartMailSent"></div> <img style="position:relative;cursor:pointer;margin-top:-30px;" onclick="showData('sent');" class="donotprint" src="<?php echo ACYMAILING_IMAGES . 'smallexport.png'; ?> " alt="<?php echo JText::_('VIEW_DETAILS', true); ?> " title="<?php echo JText::_('VIEW_DETAILS', true); ?> " width="30px"/>
<script language="JavaScript" type="text/javascript"> function statsusers(){ var dataTable = new google.visualization.DataTable(); dataTable.addRows(<?php echo count($this->statsusers); ?> ); dataTable.addColumn('string'); dataTable.addColumn('number','<?php echo JText::_('USERS', true); ?> '); <?php $i = count($this->statsusers) - 1; foreach ($this->statsusers as $oneResult) { echo "dataTable.setValue({$i}, 0, '" . addslashes(acymailing_getDate(acymailing_getTime($oneResult->subday), JText::_('DATE_FORMAT_LC3'))) . "'); "; echo "dataTable.setValue({$i}, 1, " . intval(@$oneResult->total) . "); "; if ($i-- == 0) { break; } } ?> var vis = new google.visualization.ColumnChart(document.getElementById('statsusers')); var options = { width:document.documentElement.clientWidth/2, height: 300, legend:'none' }; vis.draw(dataTable, options); } google.load("visualization", "1", {packages:["corechart"]});
echo JText::_('STATISTICS', true); ?> " /></a></span> <?php } ?> <?php } ?> </td> <?php if ($this->values->show_senddate) { ?> <td align="center" nowrap="nowrap"> <?php echo acymailing_getDate($row->senddate, JText::_('DATE_FORMAT_LC3')); ?> </td> <?php } ?> <?php if ($this->values->show_receiveemail) { ?> <td align="center" nowrap="nowrap" class="receiveviaemail"> <input onclick="changeReceiveEmail(this.checked)" type="checkbox" name="receivemail[]" value="<?php echo $row->mailid; ?> " id="receive_<?php echo $row->mailid; ?>
static function getDate($time = 0, $format = '%d %B %Y %H:%M') { return acymailing_getDate($time, $format); }
if(!empty($row->thumb)) echo '<img class="archiveItemPict" src="'.$row->thumb.'"/>'; echo '<span class="acyarchivetitle"><a '.($this->config->get('open_popup',1) ? 'class="modal" rel="{handler: \'iframe\', size: {x: '.intval($this->config->get('popup_width',750)).', y: '.intval($this->config->get('popup_height',550)).'}}"' : '').'href="'.acymailing_completeLink('archive&task=view&listid='.$this->list->listid.'-'.$this->list->alias.'&mailid='.$row->mailid.'-'.strip_tags($row->alias).$this->item,(bool)$this->config->get('open_popup',1)).'">'; echo acymailing_dispSearch($row->subject,$this->pageInfo->search).'</a>'; if($this->access->frontEndManagement){ if(($this->config->get('frontend_modif',1) || ($row->userid == $this->my->id)) && ($this->config->get('frontend_modif_sent',1) || empty($row->senddate))){ ?> <span class="acyeditbutton"><a href="<?php echo acymailing_completeLink('frontnewsletter&task=edit&mailid='.$row->mailid.'&listid='.$this->list->listid); ?>" title="<?php echo JText::_('ACY_EDIT',true) ?>" ><img class="icon16" src="<?php echo ACYMAILING_IMAGES ?>icons/icon-16-edit.png" alt="<?php echo JText::_('ACY_EDIT',true) ?>" /></a></span> <?php } if(!empty($row->senddate) && acymailing_isAllowed($this->config->get('acl_statistics_manage','all'))){ ?> <span class="acystatsbutton"><a class="modal" rel="{handler: 'iframe', size: {x: 800, y: 590}}" href="<?php echo acymailing_completeLink('frontnewsletter&task=stats&mailid='.$row->mailid.'&listid='.$this->list->listid,true); ?>"><img src="<?php echo ACYMAILING_IMAGES; ?>icons/icon-16-stats.png" alt="<?php echo JText::_('STATISTICS',true) ?>" /></a></span> <?php } ?> <?php } echo '</span>'; if($this->values->show_senddate && !empty($row->senddate)) { echo '<span class="sentondate">'.JText::sprintf('ACY_SENT_ON', acymailing_getDate($row->senddate,JText::_('DATE_FORMAT_LC3'))).'</span>'; } if($this->values->show_receiveemail){ ?> <span class="receiveviaemail"> <input onclick="changeReceiveEmail(this.checked)" type="checkbox" name="receivemail[]" value="<?php echo $row->mailid; ?>" id="receive_<?php echo $row->mailid; ?>" /> <label for="receive_<?php echo $row->mailid; ?>"><?php echo JText::_('RECEIVE_VIA_EMAIL'); ?></label> </span> <?php if(!empty($row->summary)) echo '<br/>'; } if(!empty($row->summary)) echo '<span class="archiveItemDesc">'.nl2br($row->summary).'</span>'; echo '</div>'; $k = 3-$k; } ?> <div class="archivePagination"> <div class="sectiontablefooter<?php echo $this->values->suffix; ?> pagination"><?php echo $this->pagination->getPagesLinks(); ?></div>
$extra['tooltip'] .= '<br/><b>' . JText::_('SUBSCRIPTION_DATE') . ' : </b>' . acymailing_getDate($row->subscription->{$listid}->subdate); } else { $extra['tooltip'] .= '<b>' . JText::_('STATUS') . ' : </b>' . JText::_('UNSUBSCRIBED') . '<br/>'; $extra['tooltip'] .= '<b>' . JText::_('UNSUBSCRIPTION_DATE') . ' : </b>' . acymailing_getDate($row->subscription->{$listid}->unsubdate); } echo $this->toggleClass->toggle($statuslistid, $row->subscription->{$listid}->status, 'listsub', $extra); echo '</div>'; } ?> </td> <?php } ?> <td align="center"> <?php echo acymailing_getDate($row->created); ?> </td> <?php if ($app->isAdmin()) { if (!empty($this->displayFields['html'])) { ?> <td align="center"> <span id="<?php echo $htmlid; ?> " class="loading"><?php echo $this->toggleClass->toggle($htmlid, $row->html, 'subscriber'); ?> </span>
private function _publishfollowup(&$mail) { $listmailClass = acymailing_get('class.listmail'); $mycampaign = $listmailClass->getCampaign($mail->mailid); if (empty($mycampaign->listid)) { return; } $db = JFactory::getDBO(); $toggleHelper = acymailing_get('helper.toggle'); $startdate = time() - $mail->senddate; $db->setQuery('SELECT COUNT(subid) as total FROM `#__acymailing_listsub` as b WHERE b.`status` = 1 AND b.`listid` = ' . intval($mycampaign->listid) . ' AND b.`subdate` > ' . intval($startdate)); $total = $db->loadResult(); $db->setQuery('SELECT COUNT(subid) as total FROM `#__acymailing_listsub` as b WHERE b.`status` = 1 AND b.`listid` = ' . intval($mycampaign->listid)); $totalall = $db->loadResult(); if (empty($total) && empty($totalall)) { return; } $text = JText::_('FOLLOWUP_PUBLISHED_INFORMED'); $text .= '<ul>'; if (!empty($total)) { $text .= '<li>' . $toggleHelper->toggleText('add', $mail->mailid, 'followup', JText::sprintf('FOLLOWUP_ADDQUEUE_USERS', acymailing_getDate($startdate)) . ' ( ' . JText::sprintf('SELECTED_USERS', $total) . ' )') . '</li>'; } if (!empty($totalall)) { $text .= '<li>' . $toggleHelper->toggleText('addall', $mail->mailid, 'followup', JText::_('FOLLOWUP_ADDQUEUE_ALLUSERS') . ' ( ' . JText::sprintf('SELECTED_USERS', $totalall) . ' )') . '</li>'; } acymailing_enqueueMessage($text, 'notice'); }
function formatString(&$replaceme, $mytag) { if (!empty($mytag->part)) { $parts = explode(' ', $replaceme); if ($mytag->part == 'last') { $replaceme = count($parts) > 1 ? end($parts) : ''; } else { $replaceme = reset($parts); } } if (!empty($mytag->type)) { if (empty($mytag->format)) { $mytag->format = JText::_('DATE_FORMAT_LC3'); } if ($mytag->type == 'date') { $replaceme = acymailing_getDate(acymailing_getTime($replaceme), $mytag->format); } elseif ($mytag->type == 'time') { $replaceme = acymailing_getDate($replaceme, $mytag->format); } elseif ($mytag->type == 'diff') { try { $date = $replaceme; if (is_numeric($date)) { $date = acymailing_getDate($replaceme, '%Y-%m-%d %H:%M:%S'); } $dateObj = new DateTime($date); $nowObj = new DateTime(); $diff = $dateObj->diff($nowObj); $replaceme = $diff->format($mytag->format); } catch (Exception $e) { $replaceme = 'Error using the "diff" parameter in your tag. Please make sure the DateTime() and diff() functions are available on your server.'; } } } if (!empty($mytag->lower) || !empty($mytag->lowercase)) { $replaceme = function_exists('mb_strtolower') ? mb_strtolower($replaceme, 'UTF-8') : strtolower($replaceme); } if (!empty($mytag->upper) || !empty($mytag->uppercase)) { $replaceme = function_exists('mb_strtoupper') ? mb_strtoupper($replaceme, 'UTF-8') : strtoupper($replaceme); } if (!empty($mytag->ucwords)) { $replaceme = ucwords($replaceme); } if (!empty($mytag->ucfirst)) { $replaceme = ucfirst($replaceme); } if (isset($mytag->rtrim)) { $replaceme = empty($mytag->rtrim) ? rtrim($replaceme) : rtrim($replaceme, $mytag->rtrim); } if (!empty($mytag->urlencode)) { $replaceme = urlencode($replaceme); } if (!empty($mytag->substr)) { $args = explode(',', $mytag->substr); if (isset($args[1])) { $replaceme = substr($replaceme, intval($args[0]), intval($args[1])); } else { $replaceme = substr($replaceme, intval($args[0])); } } if (!empty($mytag->maxheight) || !empty($mytag->maxwidth)) { $pictureHelper = acymailing_get('helper.acypict'); $pictureHelper->maxHeight = empty($mytag->maxheight) ? 999 : $mytag->maxheight; $pictureHelper->maxWidth = empty($mytag->maxwidth) ? 999 : $mytag->maxwidth; $replaceme = $pictureHelper->resizePictures($replaceme); } }
?> </th> </tr> </thead> <tbody> <?php $k = 0; foreach ($this->geoloc as $action) { ?> <tr class="<?php echo "row{$k}"; ?> " > <td align="center" style="text-align:center" valign="top"> <?php echo acymailing_getDate($action->geolocation_created); ?> </td> <td valign="top"> <?php echo $this->escape($action->geolocation_type); ?> </td> <td valign="top"> <?php echo $this->escape($action->geolocation_country); ?> </td> <td valign="top"> <?php echo $this->escape($action->geolocation_state);
public function acymailing_generateautonews(&$email) { $acypluginsHelper = acymailing_get('helper.acyplugins'); $return = new stdClass(); $return->status = true; $return->message = ''; $time = time(); $match = '#{autocontent:(.*)}#Ui'; $variables = array('subject', '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 $return; } $this->tags = array(); $db = JFactory::getDBO(); foreach ($results as $var => $allresults) { foreach ($allresults[0] as $i => $oneTag) { if (isset($this->tags[$oneTag])) { continue; } $parameter = $acypluginsHelper->extractTag($allresults[1][$i]); $allcats = explode('-', $parameter->id); $selectedArea = array(); foreach ($allcats as $oneCat) { if (!ACYMAILING_J16) { $sectype = substr($oneCat, 0, 3); $num = substr($oneCat, 3); if (empty($num)) { continue; } if ($sectype == 'cat') { $selectedArea[] = 'catid = ' . (int) $num; } elseif ($sectype == 'sec') { $selectedArea[] = 'sectionid = ' . (int) $num; } } else { if (empty($oneCat)) { continue; } $selectedArea[] = (int) $oneCat; } } $query = 'SELECT a.id FROM `#__content` as a '; $where = array(); if (!empty($parameter->featured)) { if (ACYMAILING_J16) { $where[] = 'a.featured = 1'; } else { $query .= 'JOIN `#__content_frontpage` as b ON a.id = b.content_id '; $where[] = 'b.content_id IS NOT NULL'; } } if (!empty($parameter->nofeatured)) { if (ACYMAILING_J16) { $where[] = 'a.featured = 0'; } else { $query .= 'LEFT JOIN `#__content_frontpage` as b ON a.id = b.content_id '; $where[] = 'b.content_id IS NULL'; } } if (ACYMAILING_J16 && !empty($parameter->subcats) && !empty($selectedArea)) { $db->setQuery('SELECT lft,rgt FROM #__categories WHERE id IN (' . implode(',', $selectedArea) . ')'); $catinfos = $db->loadObjectList(); if (!empty($catinfos)) { $whereCats = array(); foreach ($catinfos as $onecat) { $whereCats[] = 'lft > ' . $onecat->lft . ' AND rgt < ' . $onecat->rgt; } $db->setQuery('SELECT id FROM #__categories WHERE (' . implode(') OR (', $whereCats) . ')'); $othercats = acymailing_loadResultArray($db); $selectedArea = array_merge($selectedArea, $othercats); } } if (!empty($selectedArea)) { if (!ACYMAILING_J16) { $where[] = implode(' OR ', $selectedArea); } else { $where[] = '`catid` IN (' . implode(',', $selectedArea) . ')'; } } if (!empty($parameter->excludedcats)) { $excludedCats = explode('-', $parameter->excludedcats); JArrayHelper::toInteger($excludedCats); $where[] = '`catid` NOT IN ("' . implode('","', $excludedCats) . '")'; } if (!empty($parameter->filter) and !empty($email->params['lastgenerateddate'])) { $condition = '`publish_up` >\'' . date('Y-m-d H:i:s', $email->params['lastgenerateddate'] - date('Z')) . '\''; $condition .= ' OR `created` >\'' . date('Y-m-d H:i:s', $email->params['lastgenerateddate'] - date('Z')) . '\''; if ($parameter->filter == 'modify') { $condition .= ' OR ('; $condition .= ' `modified` > \'' . date('Y-m-d H:i:s', $email->params['lastgenerateddate'] - date('Z')) . '\''; if (!empty($parameter->maxpublished)) { $condition .= ' AND `publish_up` > \'' . date('Y-m-d H:i:s', time() - date('Z') - (int) $parameter->maxpublished * 60 * 60 * 24) . '\''; } $condition .= ')'; } $where[] = $condition; } if (!empty($parameter->maxcreated)) { $date = strtotime($parameter->maxcreated); if (empty($date)) { acymailing_display('Wrong date format (' . $parameter->maxcreated . ' in ' . $oneTag . '), please use YYYY-MM-DD', 'warning'); } $where[] = '`created` < ' . $db->Quote(date('Y-m-d H:i:s', $date)); } if (!empty($parameter->mincreated)) { $date = strtotime($parameter->mincreated); if (empty($date)) { acymailing_display('Wrong date format (' . $parameter->mincreated . ' in ' . $oneTag . '), please use YYYY-MM-DD', 'warning'); } $where[] = '`created` > ' . $db->Quote(date('Y-m-d H:i:s', $date)); } if (!empty($parameter->meta)) { $allMetaTags = explode(',', $parameter->meta); $metaWhere = array(); foreach ($allMetaTags as $oneMeta) { if (empty($oneMeta)) { continue; } $metaWhere[] = "`metakey` LIKE '%" . acymailing_getEscaped($oneMeta, true) . "%'"; } if (!empty($metaWhere)) { $where[] = implode(' OR ', $metaWhere); } } $where[] = '`publish_up` < \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\''; $where[] = '`publish_down` > \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\' OR `publish_down` = 0'; $where[] = 'state = 1'; if (!ACYMAILING_J16) { if (isset($parameter->access)) { $where[] = 'access <= ' . intval($parameter->access); } else { if ($this->params->get('contentaccess', 'registered') == 'registered') { $where[] = 'access <= 1'; } elseif ($this->params->get('contentaccess', 'registered') == 'public') { $where[] = 'access = 0'; } } } elseif (isset($parameter->access)) { $where[] = 'access = ' . intval($parameter->access); } if (!empty($parameter->language)) { $allLanguages = explode(',', $parameter->language); $langWhere = 'language IN ('; foreach ($allLanguages as $oneLanguage) { $langWhere .= $db->Quote(trim($oneLanguage)) . ','; } $where[] = trim($langWhere, ',') . ')'; } $query .= ' WHERE (' . implode(') AND (', $where) . ')'; if (!empty($parameter->order)) { if ($parameter->order == 'rand') { $query .= ' ORDER BY rand()'; } else { $ordering = explode(',', $parameter->order); $query .= ' ORDER BY `' . acymailing_secureField($ordering[0]) . '` ' . acymailing_secureField($ordering[1]) . ' , a.`id` DESC'; } } $start = ''; if (!empty($parameter->start)) { $start = intval($parameter->start) . ','; } if (empty($parameter->max)) { $parameter->max = 100; } $query .= ' LIMIT ' . $start . (int) $parameter->max; $db->setQuery($query); $allArticles = acymailing_loadResultArray($db); if (!empty($parameter->min) and count($allArticles) < $parameter->min) { $return->status = false; $return->message = 'Not enough articles for the tag ' . $oneTag . ' : ' . count($allArticles) . ' / ' . $parameter->min . ' between ' . acymailing_getDate($email->params['lastgenerateddate']) . ' and ' . acymailing_getDate($time); } $stringTag = empty($parameter->noentrytext) ? '' : $parameter->noentrytext; if (!empty($allArticles)) { if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'autocontent.php')) { ob_start(); require ACYMAILING_MEDIA . 'plugins' . DS . 'autocontent.php'; $stringTag = ob_get_clean(); } else { $arrayElements = array(); $numArticle = 1; foreach ($allArticles as $oneArticleId) { $args = array(); $args[] = 'joomlacontent:' . $oneArticleId; $args[] = 'num:' . $numArticle++; if (!empty($parameter->type)) { $args[] = 'type:' . $parameter->type; } if (!empty($parameter->link)) { $args[] = 'link'; } if (!empty($parameter->author)) { $args[] = 'author'; } if (!empty($parameter->autologin)) { $args[] = 'autologin'; } if (!empty($parameter->cattitle)) { $args[] = 'cattitle'; } if (!empty($parameter->lang)) { $args[] = 'lang:' . $parameter->lang; } if (!empty($parameter->theme)) { $args[] = 'theme'; } if (!empty($parameter->clean)) { $args[] = 'clean'; } if (!empty($parameter->notitle)) { $args[] = 'notitle'; } if (!empty($parameter->created)) { $args[] = 'created'; } if (!empty($parameter->noattach)) { $args[] = 'noattach'; } if (!empty($parameter->itemid)) { $args[] = 'itemid:' . $parameter->itemid; } if (!empty($parameter->noreadmore)) { $args[] = 'noreadmore'; } if (isset($parameter->pict)) { $args[] = 'pict:' . $parameter->pict; } if (!empty($parameter->wrap)) { $args[] = 'wrap:' . $parameter->wrap; } if (!empty($parameter->maxwidth)) { $args[] = 'maxwidth:' . $parameter->maxwidth; } if (!empty($parameter->maxheight)) { $args[] = 'maxheight:' . $parameter->maxheight; } if (!empty($parameter->readmore)) { $args[] = 'readmore:' . $parameter->readmore; } if (!empty($parameter->dateformat)) { $args[] = 'dateformat:' . $parameter->dateformat; } if (!empty($parameter->textafter)) { $args[] = 'textafter:' . $parameter->textafter; } if (!empty($parameter->maxchar)) { $args[] = 'maxchar:' . $parameter->maxchar; } if (!empty($parameter->share)) { $args[] = 'share:' . $parameter->share; } if (!empty($parameter->sharetxt)) { $args[] = 'sharetxt:' . $parameter->sharetxt; } $arrayElements[] = '{' . implode('|', $args) . '}'; } $stringTag = $acypluginsHelper->getFormattedResult($arrayElements, $parameter); } } $this->tags[$oneTag] = $stringTag; } } return $return; }
echo ACYMAILING_IMAGES; ?> icons/icon-16-stats.png" /><?php } ?> <?php echo '<span class="acy_stat_subject">' . acymailing_tooltip('<b>' . JText::_('JOOMEXT_ALIAS') . ' : </b>' . $row->alias, ' ', '', $row->subject) . '</span>'; ?> <?php if (acymailing_level(2)) { ?> </a><?php } ?> <?php echo '<br /><span class="acy_stat_date"><b>' . JText::_('SEND_DATE') . ' : </b>' . acymailing_getDate($row->senddate) . '</span>'; ?> </td> <td align="center" style="text-align:center" > <?php if (!empty($row->senthtml)) { $text = '<b>' . JText::_('OPEN_UNIQUE') . ' : </b>' . $row->openunique . ' / ' . $cleanSent; $text .= '<br /><b>' . JText::_('OPEN_TOTAL') . ' : </b>' . $row->opentotal; $pourcent = $cleanSent == 0 ? '0%' : substr($row->openunique / $cleanSent * 100, 0, 5) . '%'; $title = JText::sprintf('PERCENT_OPEN', $pourcent); echo acymailing_tooltip($text, $title, '', $pourcent, acymailing_completeLink('stats&task=detaillisting&filter_status=open&filter_mail=' . $row->mailid)); } ?> </td> <?php if (acymailing_level(1)) {
function acymailing_replacetags(&$email, $send = true) { $match = '#{date:?([^:].*)?}#Ui'; $variables = array('subject', 'body', 'altbody'); foreach ($variables as $var) { $email->{$var} = str_replace(array('{mailid}', '%7Bmailid%7D', '{emailsubject}'), array($email->mailid, $email->mailid, $email->subject), $email->{$var}); } $email->body = str_replace('{textversion}', nl2br($email->altbody), $email->body); $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; } $tags = array(); foreach ($results as $var => $allresults) { foreach ($allresults[0] as $i => $oneTag) { if (isset($tags[$oneTag])) { continue; } $arguments = explode('|', strip_tags($allresults[1][$i])); $parameter = new stdClass(); $parameter->format = $arguments[0]; for ($i = 1; $i < count($arguments); $i++) { $args = explode(':', $arguments[$i]); $arg0 = trim($args[0]); if (isset($args[1])) { $parameter->{$arg0} = $args[1]; } else { $parameter->{$arg0} = true; } } $time = time(); if (!empty($parameter->senddate) && !empty($email->senddate)) { $time = $email->senddate; } if (!empty($parameter->add)) { $time += intval($parameter->add); } if (!empty($parameter->remove)) { $time -= intval($parameter->remove); } if (empty($parameter->format) or is_numeric($parameter->format)) { $tags[$oneTag] = acymailing_getDate($time, JText::_('DATE_FORMAT_LC' . $parameter->format)); } else { $tags[$oneTag] = acymailing_getDate($time, $parameter->format); } } } foreach (array_keys($results) as $var) { $email->{$var} = str_replace(array_keys($tags), $tags, $email->{$var}); } }
function doexport() { if (!$this->isAllowed('subscriber', 'export')) { return; } JRequest::checkToken() or die('Invalid Token'); acymailing_increasePerf(); $filtersExport = JRequest::getVar('exportfilter'); $listsToExport = JRequest::getVar('exportlists'); $fieldsToExport = JRequest::getVar('exportdata'); $fieldsToExportList = JRequest::getVar('exportdatalist'); $fieldsToExportOthers = JRequest::getVar('exportdataother'); $inseparator = JRequest::getString('exportseparator'); $inseparator = str_replace(array('semicolon', 'colon', 'comma'), array(';', ',', ','), $inseparator); $exportFormat = JRequest::getString('exportformat'); if (!in_array($inseparator, array(',', ';'))) { $inseparator = ';'; } $exportLists = array(); if (!empty($filtersExport['subscribed'])) { foreach ($listsToExport as $listid => $checked) { if (!empty($checked)) { $exportLists[] = (int) $listid; } } } $exportFields = array(); $exportFieldsList = array(); $exportFieldsOthers = array(); $selectOthers = ''; foreach ($fieldsToExport as $fieldName => $checked) { if (!empty($checked)) { $exportFields[] = acymailing_secureField($fieldName); } } foreach ($fieldsToExportList as $fieldName => $checked) { if (!empty($checked)) { $exportFieldsList[] = acymailing_secureField($fieldName); } } if (!empty($fieldsToExportOthers)) { foreach ($fieldsToExportOthers as $fieldName => $checked) { if (!empty($checked)) { $exportFieldsOthers[] = acymailing_secureField($fieldName); } } } $selectFields = 's.`' . implode('`, s.`', $exportFields) . '`'; $config = acymailing_config(); $newConfig = new stdClass(); $newConfig->export_fields = implode(',', array_merge($exportFields, $exportFieldsOthers, $exportFieldsList)); $newConfig->export_lists = implode(',', $exportLists); $newConfig->export_separator = JRequest::getString('exportseparator'); $newConfig->export_format = $exportFormat; $filterActive = array(); foreach ($filtersExport as $filterKey => $value) { if ($value == 1) { $filterActive[] = $filterKey; } } $newConfig->export_filters = implode(',', $filterActive); $config->save($newConfig); $where = array(); if (empty($exportLists)) { $querySelect = 'SELECT s.`subid`, ' . $selectFields . ' FROM ' . acymailing_table('subscriber') . ' as s'; } else { $querySelect = 'SELECT DISTINCT s.`subid`, ' . $selectFields . ' FROM ' . acymailing_table('listsub') . ' as a JOIN ' . acymailing_table('subscriber') . ' as s on a.subid = s.subid'; $where[] = 'a.listid IN (' . implode(',', $exportLists) . ')'; $where[] = 'a.status = 1'; } if (!empty($filtersExport['confirmed'])) { $where[] = 's.confirmed = 1'; } if (!empty($filtersExport['registered'])) { $where[] = 's.userid > 0'; } if (!empty($filtersExport['enabled'])) { $where[] = 's.enabled = 1'; } if (JRequest::getInt('sessionvalues') and !empty($_SESSION['acymailing']['exportusers'])) { $where[] = 's.subid IN (' . implode(',', $_SESSION['acymailing']['exportusers']) . ')'; } $query = $querySelect; if (!empty($where)) { $query .= ' WHERE (' . implode(') AND (', $where) . ')'; } if (JRequest::getInt('sessionquery')) { $currentSession = JFactory::getSession(); $selectOthers = ''; if (!empty($exportFieldsOthers)) { foreach ($exportFieldsOthers as $oneField) { $selectOthers .= ' , ' . $oneField . ' AS ' . str_replace('.', '_', $oneField); } } $query = 'SELECT DISTINCT s.`subid`, ' . $selectFields . $selectOthers . ' ' . $currentSession->get('acyexportquery'); } $query .= ' ORDER BY s.subid'; $db = JFactory::getDBO(); $encodingClass = acymailing_get('helper.encoding'); $exportHelper = acymailing_get('helper.export'); $fileName = 'export_' . date('Y-m-d'); if (!empty($exportLists)) { $fileName = ''; $db->setQuery('SELECT name FROM #__acymailing_list WHERE listid IN (' . implode(',', $exportLists) . ')'); $allExportedLists = $db->loadObjectList(); foreach ($allExportedLists as $oneList) { $fileName .= '__' . $oneList->name; } $fileName = trim($fileName, '__'); } $exportHelper->addHeaders($fileName); $eol = "\r\n"; $before = '"'; $separator = '"' . $inseparator . '"'; $after = '"'; $allFields = array_merge($exportFields, $exportFieldsOthers); if (!empty($exportFieldsList)) { $allFields = array_merge($allFields, $exportFieldsList); $selectFields = 'l.`' . implode('`, l.`', $exportFieldsList) . '`'; $selectFields = str_replace('listname', 'name', $selectFields); } echo $before . implode($separator, $allFields) . $after . $eol; if (acymailing_bytes(ini_get('memory_limit')) > 150000000) { $nbExport = 50000; } elseif (acymailing_bytes(ini_get('memory_limit')) > 80000000) { $nbExport = 15000; } else { $nbExport = 5000; } if (!empty($exportFieldsList)) { $nbExport = 500; } $valDep = 0; $dateFields = array('created', 'confirmed_date', 'lastopen_date', 'lastclick_date', 'lastsent_date', 'userstats_opendate', 'userstats_senddate', 'urlclick_date', 'hist_date'); do { $db->setQuery($query . ' LIMIT ' . $valDep . ', ' . $nbExport); $valDep += $nbExport; $allData = $db->loadAssocList(); if (empty($allData)) { break; } $dataUser = array(); $subids = array(); for ($i = 0, $a = count($allData); $i < $a; $i++) { $subids[] = (int) $allData[$i]['subid']; if (!in_array('subid', $exportFields)) { array_shift($allData[$i]); } foreach ($allData[$i] as $fieldName => $oneUser) { if (!in_array($fieldName, $dateFields)) { $dataUser[$subids[$i]][$fieldName] = $oneUser; } else { $dataUser[$subids[$i]][$fieldName] = acymailing_getDate($oneUser, '%Y-%m-%d %H:%M:%S'); } } } if (!empty($exportFieldsList) && !empty($subids)) { $queryList = 'SELECT ' . $selectFields . ', ls.subid FROM #__acymailing_listsub as ls JOIN #__acymailing_list as l ON ls.listid=l.listid JOIN #__acymailing_subscriber as s on ls.subid = s.subid WHERE (ls.status = 1) and ls.subid IN (' . implode(',', $subids) . ')'; if (!empty($exportLists)) { $queryList .= ' AND ls.listid IN (' . implode(',', $exportLists) . ')'; } $db->setQuery($queryList); $resList = $db->loadObjectList(); $userListid = array(); $userListname = array(); foreach ($resList as $listsub) { if (in_array('listid', $exportFieldsList)) { $userListid[$listsub->subid] = empty($userListid[$listsub->subid]) ? $listsub->listid : $userListid[$listsub->subid] . ' - ' . $listsub->listid; } if (in_array('listname', $exportFieldsList)) { $userListname[$listsub->subid] = empty($userListname[$listsub->subid]) ? $listsub->name : $userListname[$listsub->subid] . ' - ' . $listsub->name; } } } foreach ($subids as $subid) { if (!empty($exportFieldsList)) { $listDetail = array(); if (in_array('listid', $exportFieldsList)) { $listDetail[] = !empty($userListid[$subid]) ? $userListid[$subid] : ''; } if (in_array('listname', $exportFieldsList)) { $listDetail[] = !empty($userListname[$subid]) ? $userListname[$subid] : ''; } $dataexport = implode($separator, $dataUser[$subid]) . $separator . implode($separator, $listDetail); } else { $dataexport = implode($separator, $dataUser[$subid]); } echo $before . $encodingClass->change($dataexport, 'UTF-8', $exportFormat) . $after . $eol; } } while (!empty($allData)); exit; }
function getSubscriptionString($subid, $dates = false) { $usersubscription = $this->getSubscription($subid); $subscriptionString = ''; if (!empty($usersubscription)) { $subscriptionString = '<ul>'; foreach ($usersubscription as $onesub) { $status = $onesub->status == 1 ? JText::_('SUBSCRIBED') : ($onesub->status == -1 ? JText::_('UNSUBSCRIBED') : JText::_('PENDING_SUBSCRIPTION')); $subscriptionString .= '<li>[' . $onesub->listid . '] ' . $onesub->name . ' : ' . $status; if ($dates) { $subscriptionString .= ' - ' . acymailing_getDate($onesub->status == -1 ? $onesub->unsubdate : $onesub->subdate, JText::_('DATE_FORMAT_LC')); } $subscriptionString .= '</li>'; } $subscriptionString .= '</ul>'; } return $subscriptionString; }
public function myacymailingarea() { $this->_addAjaxScript(); $config = acymailing_config(); $menu = '<div id="myacymailing_level">' . ACYMAILING_NAME . ' ' . $config->get('level') . ' : ' . $config->get('version') . '</div><div id="myacymailing_version">'; $currentVersion = $config->get('version', ''); $latestVersion = $config->get('latestversion', ''); if ($currentVersion >= $latestVersion) { $menu .= '<div class="acyversion_uptodate myacymailingbuttons">' . JText::_('ACY_LATEST_VERSION_OK') . '</div>'; } elseif (!empty($latestVersion)) { $menu .= '<div class="acyversion_needtoupdate myacymailingbuttons"><a class="acy_updateversion" href="' . ACYMAILING_REDIRECT . 'update-acymailing-' . $config->get('level') . '" target="_blank"><i class="acyicon-import"></i>' . JText::sprintf('ACY_UPDATE_NOW', $latestVersion) . '</a></div>'; } $menu .= '</div>'; if (acymailing_level(1)) { $expirationDate = $config->get('expirationdate', ''); if (empty($expirationDate) || $expirationDate == -1) { $menu .= '<div id="myacymailing_expiration"></div>'; } elseif ($expirationDate == -2) { $menu .= '<div id="myacymailing_expiration"><div class="acylicence_expired"><span style="color:#c2d5f3; line-height: 16px;">' . JText::_('ACY_ATTACH_LICENCE') . ' :</span><div><a class="acy_attachlicence myacymailingbuttons" href="' . ACYMAILING_REDIRECT . 'acymailing-assign" target="_blank"><i class="acyicon-attach"></i>' . JText::_('ACY_ATTACH_LICENCE_BUTTON') . '</a></div></div></div>'; } elseif ($expirationDate < time()) { $menu .= '<div id="myacymailing_expiration"><div class="acylicence_expired"><span class="acylicenceinfo">' . JText::_('ACY_SUBSCRIPTION_EXPIRED') . '</span><a class="acy_subscriptionexpired myacymailingbuttons" href="' . ACYMAILING_REDIRECT . 'renew-acymailing-' . $config->get('level') . '" target="_blank"><i class="acyicon-renew"></i>' . JText::_('ACY_SUBSCRIPTION_EXPIRED_LINK') . '</a></div></div>'; } else { $menu .= '<div id="myacymailing_expiration"><div class="acylicence_valid myacymailingbuttons"><span class="acy_subscriptionok">' . JText::_('ACY_VALID_UNTIL') . ' : ' . acymailing_getDate($expirationDate, 'DATE_FORMAT_LC4') . '</span></div></div>'; } } $menu .= '<div class="myacymailingbuttons"><button onclick="checkForNewVersion()"><i class="acyicon-search"></i>' . JText::_('ACY_CHECK_MY_VERSION') . '</button></div>'; return $menu; }
function display($tpl = null) { global $Itemid; $db = JFactory::getDBO(); $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $feedEmail = @$app->getCfg('feed_email') ? $app->getCfg('feed_email') : 'author'; $siteEmail = $app->getCfg('mailfrom'); $jsite = JFactory::getApplication('site'); $menus = $jsite->getMenu(); $menu = $menus->getActive(); $listed = array(); if (empty($menu) and !empty($Itemid)) { $menus->setActive($Itemid); $menu = $menus->getItem($Itemid); } $myItem = empty($Itemid) ? '' : '&Itemid=' . $Itemid; $selectedLists = 'all'; if (is_object($menu)) { jimport('joomla.html.parameter'); $menuparams = new acyParameter($menu->params); $selectedLists = $menuparams->get('lists', 'all'); } $listsClass = acymailing_get('class.list'); $allLists = $listsClass->getLists('listid', $selectedLists); foreach ($allLists as $oneList) { if ($oneList->published && $oneList->visible && acymailing_isAllowed($oneList->access_sub)) { $listed[] = $oneList->listid; } } $config = acymailing_config(); $filters = array(); $filters[] = 'a.type = \'news\''; $filters[] = 'a.published = 1'; $filters[] = 'a.visible = 1'; $filters[] = 'c.listid IN (' . implode(',', $listed) . ')'; $query = 'SELECT a.*,c.listid'; $query .= ' FROM ' . acymailing_table('listmail') . ' as c'; $query .= ' LEFT JOIN ' . acymailing_table('mail') . ' as a on a.mailid = c.mailid '; $query .= ' WHERE (' . implode(') AND (', $filters) . ')'; $query .= ' GROUP BY a.mailid ORDER BY a.' . $config->get('acyrss_order', 'senddate') . ' ' . ($config->get('acyrss_order', 'senddate') == 'subject' ? 'ASC' : 'DESC'); $query .= ' LIMIT ' . $config->get('acyrss_element', '20'); $db->setQuery($query); $rows = $db->loadObjectList(); $doc->title = $config->get('acyrss_name', ''); $doc->description = $config->get('acyrss_description', ''); $receiver = new stdClass(); $receiver->name = JText::_('VISITOR'); $receiver->subid = 0; $mailClass = acymailing_get('helper.mailer'); $mailClass->loadedToSend = false; foreach ($rows as $row) { $oneMail = $mailClass->load($row->mailid); $oneMail->sendHTML = true; $mailClass->dispatcher->trigger('acymailing_replaceusertags', array(&$oneMail, &$receiver, false)); $title = $this->escape($oneMail->subject); $title = html_entity_decode($title); $oneList = $allLists[$row->listid]; $link = JRoute::_('index.php?option=com_acymailing&ctrl=archive&task=view&listid=' . $oneList->listid . '-' . $oneList->alias . '&mailid=' . $row->mailid . '-' . $row->alias); $description = $oneMail->body; $author = $oneMail->userid; $item = new JFeedItem(); $item->title = $title; $item->link = $link; $item->description = $description; $item->date = acymailing_getDate($oneMail->senddate, '%Y-%m-%d %H:%M:%S'); $item->category = JText::_('NEWSLETTER'); $doc->addItem($item); } }
$k = 0; $i = 0; foreach ($this->rows as $row) { ?> <tr class="<?php echo "row{$k}"; ?> " > <td align="center" valign="top"> <?php echo $i + 1; ?> </td> <td align="center" valign="top"> <?php echo acymailing_getDate($row->date); ?> </td> <td align="center" style="text-align:center" > <?php $text = '<b>' . JText::_('ACY_NAME') . ' : </b>' . $row->name; $text .= '<br /><b>' . JText::_('ACY_ID') . ' : </b>' . $row->subid; echo acymailing_tooltip($text, $row->email, '', $row->email); ?> </td> <td valign="top"> <?php $data = explode("\n", $row->data); foreach ($data as $value) { if (!strpos($value, '::')) { echo $value;
public function acymailing_generateautonews(&$email) { $time = time(); $tags = $this->acypluginsHelper->extractTags($email, 'autocontent'); $return = new stdClass(); $return->status = true; $return->message = ''; $this->tags = array(); if (empty($tags)) { return $return; } foreach ($tags as $oneTag => $parameter) { if (isset($this->tags[$oneTag])) { continue; } $allcats = explode('-', $parameter->id); $selectedArea = array(); foreach ($allcats as $oneCat) { if (!ACYMAILING_J16) { $sectype = substr($oneCat, 0, 3); $num = substr($oneCat, 3); if (empty($num)) { continue; } if ($sectype == 'cat') { $selectedArea[] = 'catid = ' . (int) $num; } elseif ($sectype == 'sec') { $selectedArea[] = 'sectionid = ' . (int) $num; } } else { if (empty($oneCat)) { continue; } $selectedArea[] = intval($oneCat); } } $query = 'SELECT a.id FROM `#__content` as a '; $where = array(); if (!empty($parameter->tags) && version_compare(JVERSION, '3.1.0', '>=')) { $tagsArray = explode(',', $parameter->tags); JArrayHelper::toInteger($tagsArray); if (!empty($tagsArray)) { foreach ($tagsArray as $oneTagId) { $query .= 'JOIN #__contentitem_tag_map AS tagsmap' . $oneTagId . ' ON (a.id = tagsmap' . $oneTagId . '.content_item_id AND tagsmap' . $oneTagId . '.type_alias LIKE "com_content.article" AND tagsmap' . $oneTagId . '.tag_id = ' . $oneTagId . ') '; } } } if (!empty($parameter->featured)) { if (ACYMAILING_J16) { $where[] = 'a.featured = 1'; } else { $query .= 'JOIN `#__content_frontpage` as b ON a.id = b.content_id '; $where[] = 'b.content_id IS NOT NULL'; } } if (!empty($parameter->nofeatured)) { if (ACYMAILING_J16) { $where[] = 'a.featured = 0'; } else { $query .= 'LEFT JOIN `#__content_frontpage` as b ON a.id = b.content_id '; $where[] = 'b.content_id IS NULL'; } } if (ACYMAILING_J16 && !empty($parameter->subcats) && !empty($selectedArea)) { $this->db->setQuery('SELECT lft,rgt FROM #__categories WHERE id IN (' . implode(',', $selectedArea) . ')'); $catinfos = $this->db->loadObjectList(); if (!empty($catinfos)) { $whereCats = array(); foreach ($catinfos as $onecat) { $whereCats[] = 'lft > ' . $onecat->lft . ' AND rgt < ' . $onecat->rgt; } $this->db->setQuery('SELECT id FROM #__categories WHERE (' . implode(') OR (', $whereCats) . ')'); $othercats = acymailing_loadResultArray($this->db); $selectedArea = array_merge($selectedArea, $othercats); } } if (!empty($selectedArea)) { if (!ACYMAILING_J16) { $where[] = implode(' OR ', $selectedArea); } else { $filter_cat = '`catid` IN (' . implode(',', $selectedArea) . ')'; if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_multicats')) { $filter_cat = '`catid` REGEXP "^([0-9]+,)*' . implode('(,[0-9]+)*$" OR `catid` REGEXP "^([0-9]+,)*', $selectedArea) . '(,[0-9]+)*$"'; } $where[] = $filter_cat; } } if (!empty($parameter->excludedcats)) { $excludedCats = explode('-', $parameter->excludedcats); JArrayHelper::toInteger($excludedCats); $filter_cat = '`catid` NOT IN ("' . implode('","', $excludedCats) . '")'; if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_multicats')) { $filter_cat = '`catid` NOT REGEXP "^([0-9]+,)*' . implode('(,[0-9]+)*$" AND `catid` NOT REGEXP "^([0-9]+,)*', $excludedCats) . '(,[0-9]+)*$"'; } $where[] = $filter_cat; } if (!empty($parameter->filter) && !empty($email->params['lastgenerateddate'])) { $condition = '(`publish_up` > \'' . date('Y-m-d H:i:s', $email->params['lastgenerateddate'] - date('Z')) . '\' AND `publish_up` < \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\')'; $condition .= ' OR (`created` > \'' . date('Y-m-d H:i:s', $email->params['lastgenerateddate'] - date('Z')) . '\' AND `created` < \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\')'; if ($parameter->filter == 'modify') { $modify = '(`modified` > \'' . date('Y-m-d H:i:s', $email->params['lastgenerateddate'] - date('Z')) . '\' AND `modified` < \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\')'; if (!empty($parameter->maxpublished)) { $modify = '(' . $modify . ' AND `publish_up` > \'' . date('Y-m-d H:i:s', time() - date('Z') - (int) $parameter->maxpublished * 60 * 60 * 24) . '\')'; } $condition .= ' OR ' . $modify; } $where[] = $condition; } if (!empty($parameter->maxcreated)) { $date = $parameter->maxcreated; if (strpos($parameter->maxcreated, '[time]') !== false) { $date = acymailing_replaceDate(str_replace('[time]', '{time}', $parameter->maxcreated)); } if (!is_numeric($date)) { $date = strtotime($parameter->maxcreated); } if (empty($date)) { acymailing_display('Wrong date format (' . $parameter->maxcreated . ' in ' . $oneTag . '), please use YYYY-MM-DD', 'warning'); } $where[] = '`created` < ' . $this->db->Quote(date('Y-m-d H:i:s', $date)) . ' OR `publish_up` < ' . $this->db->Quote(date('Y-m-d H:i:s', $date)); } else { $where[] = '`publish_up` < \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\''; } if (!empty($parameter->mincreated)) { $date = $parameter->mincreated; if (strpos($parameter->mincreated, '[time]') !== false) { $date = acymailing_replaceDate(str_replace('[time]', '{time}', $parameter->mincreated)); } if (!is_numeric($date)) { $date = strtotime($parameter->mincreated); } if (empty($date)) { acymailing_display('Wrong date format (' . $parameter->mincreated . ' in ' . $oneTag . '), please use YYYY-MM-DD', 'warning'); } $where[] = '`created` > ' . $this->db->Quote(date('Y-m-d H:i:s', $date)) . ' OR `publish_up` > ' . $this->db->Quote(date('Y-m-d H:i:s', $date)); } if (!empty($parameter->meta)) { $allMetaTags = explode(',', $parameter->meta); $metaWhere = array(); foreach ($allMetaTags as $oneMeta) { if (empty($oneMeta)) { continue; } $metaWhere[] = "`metakey` LIKE '%" . acymailing_getEscaped($oneMeta, true) . "%'"; } if (!empty($metaWhere)) { $where[] = implode(' OR ', $metaWhere); } } $where[] = '`publish_down` > \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\' OR `publish_down` = 0'; if (empty($parameter->unpublished)) { $where[] = 'state = 1'; } else { $where[] = 'state = 0'; } if (!ACYMAILING_J16) { if (isset($parameter->access)) { $where[] = 'access <= ' . intval($parameter->access); } else { if ($this->params->get('contentaccess', 'registered') == 'registered') { $where[] = 'access <= 1'; } elseif ($this->params->get('contentaccess', 'registered') == 'public') { $where[] = 'access = 0'; } } } elseif (isset($parameter->access)) { if (strpos($parameter->access, ',')) { $allAccess = explode(',', $parameter->access); JArrayHelper::toInteger($allAccess); $where[] = 'access IN (' . implode(',', $allAccess) . ')'; } else { $where[] = 'access = ' . intval($parameter->access); } } if (ACYMAILING_J16 && !empty($parameter->language)) { $allLanguages = explode(',', $parameter->language); $langWhere = 'language IN ('; foreach ($allLanguages as $oneLanguage) { $langWhere .= $this->db->Quote(trim($oneLanguage)) . ','; } $where[] = trim($langWhere, ',') . ')'; } $query .= ' WHERE (' . implode(') AND (', $where) . ')'; if (!empty($parameter->order)) { $ordering = explode(',', $parameter->order); if ($ordering[0] == 'rand') { $query .= ' ORDER BY rand()'; } else { $query .= ' ORDER BY `' . acymailing_secureField($ordering[0]) . '` ' . acymailing_secureField($ordering[1]) . ' , a.`id` DESC'; } } $start = ''; if (!empty($parameter->start)) { $start = intval($parameter->start) . ','; } if (empty($parameter->max)) { $parameter->max = 100; } $query .= ' LIMIT ' . $start . (int) $parameter->max; $this->db->setQuery($query); $allArticles = acymailing_loadResultArray($this->db); if (!empty($parameter->min) && count($allArticles) < $parameter->min) { $return->status = false; $return->message = 'Not enough articles for the tag ' . $oneTag . ' : ' . count($allArticles) . ' / ' . $parameter->min . ' between ' . acymailing_getDate($email->params['lastgenerateddate']) . ' and ' . acymailing_getDate($time); } $stringTag = empty($parameter->noentrytext) ? '' : $parameter->noentrytext; if (!empty($allArticles)) { if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'autocontent.php')) { ob_start(); require ACYMAILING_MEDIA . 'plugins' . DS . 'autocontent.php'; $stringTag = ob_get_clean(); } else { $arrayElements = array(); $numArticle = 1; foreach ($allArticles as $oneArticleId) { $args = array(); $args[] = 'joomlacontent:' . $oneArticleId; $args[] = 'num:' . $numArticle++; if (!empty($parameter->invert) && $numArticle % 2 == 1) { $args[] = 'invert'; } if (!empty($parameter->type)) { $args[] = 'type:' . $parameter->type; } if (!empty($parameter->format)) { $args[] = 'format:' . $parameter->format; } if (!empty($parameter->template)) { $args[] = 'template:' . $parameter->template; } if (!empty($parameter->jtags)) { $args[] = 'jtags'; } if (!empty($parameter->link)) { $args[] = 'link'; } if (!empty($parameter->author)) { $args[] = 'author'; } if (!empty($parameter->autologin)) { $args[] = 'autologin'; } if (!empty($parameter->cattitle)) { $args[] = 'cattitle'; } if (!empty($parameter->cattitlelink)) { $args[] = 'cattitlelink'; } if (!empty($parameter->lang)) { $args[] = 'lang:' . $parameter->lang; } if (!empty($parameter->theme)) { $args[] = 'theme'; } if (!empty($parameter->clean)) { $args[] = 'clean'; } if (!empty($parameter->notitle)) { $args[] = 'notitle'; } if (!empty($parameter->nopictstyle)) { $args[] = 'nopictstyle'; } if (!empty($parameter->nopictlink)) { $args[] = 'nopictlink'; } if (!empty($parameter->created)) { $args[] = 'created'; } if (!empty($parameter->noattach)) { $args[] = 'noattach'; } if (!empty($parameter->itemid)) { $args[] = 'itemid:' . $parameter->itemid; } if (!empty($parameter->noreadmore)) { $args[] = 'noreadmore'; } if (isset($parameter->pict)) { $args[] = 'pict:' . $parameter->pict; } if (!empty($parameter->wrap)) { $args[] = 'wrap:' . $parameter->wrap; } if (!empty($parameter->maxwidth)) { $args[] = 'maxwidth:' . $parameter->maxwidth; } if (!empty($parameter->maxheight)) { $args[] = 'maxheight:' . $parameter->maxheight; } if (!empty($parameter->readmore)) { $args[] = 'readmore:' . $parameter->readmore; } if (!empty($parameter->dateformat)) { $args[] = 'dateformat:' . $parameter->dateformat; } if (!empty($parameter->textafter)) { $args[] = 'textafter:' . $parameter->textafter; } if (!empty($parameter->maxchar)) { $args[] = 'maxchar:' . $parameter->maxchar; } if (!empty($parameter->share)) { $args[] = 'share:' . $parameter->share; } if (!empty($parameter->sharetxt)) { $args[] = 'sharetxt:' . $parameter->sharetxt; } if (!empty($parameter->catpict)) { $args[] = 'catpict'; } if (!empty($parameter->catmaxwidth)) { $args[] = 'catmaxwidth:' . $parameter->catmaxwidth; } if (!empty($parameter->catmaxheight)) { $args[] = 'catmaxheight:' . $parameter->catmaxheight; } $arrayElements[] = '{' . implode('|', $args) . '}'; } $stringTag = $this->acypluginsHelper->getFormattedResult($arrayElements, $parameter); } } $this->tags[$oneTag] = $stringTag; } return $return; }