function test() { if (!$this->isAllowed('configuration', 'manage')) { return; } $app =& JFactory::getApplication(); $this->store(); acymailing_displayErrors(); $config = acymailing_config(); $user =& JFactory::getUser(); $mailClass = acymailing_get('helper.mailer'); $addedName = $config->get('add_names', true) ? $mailClass->cleanText($user->name) : ''; $mailClass->AddAddress($user->email, $addedName); $mailClass->Subject = 'Test e-mail from ' . ACYMAILING_LIVE; $mailClass->Body = JText::_('TEST_EMAIL'); $mailClass->SMTPDebug = 1; $result = $mailClass->send(); if (!$result) { $bounce = $config->get('bounce_email'); if ($config->get('mailer_method') == 'smtp' && $config->get('smtp_secured') == 'ssl' && !function_exists('openssl_sign')) { $app->enqueueMessage('The PHP Extension openssl is not enabled on your server, this extension is required to use an SSL connection, please enable it', 'notice'); } elseif (!empty($bounce) and !in_array($config->get('mailer_method'), array('smtp', 'smtp_com', 'elasticemail'))) { $app->enqueueMessage(JText::sprintf('ADVICE_BOUNCE', $bounce), 'notice'); } elseif ($config->get('mailer_method') == 'smtp' and !$config->get('smtp_auth') and strlen($config->get('smtp_password')) > 1) { $app->enqueueMessage(JText::_('ADVICE_SMTP_AUTH'), 'notice'); } elseif ((strpos(ACYMAILING_LIVE, 'localhost') or strpos(ACYMAILING_LIVE, '127.0.0.1')) and in_array($config->get('mailer_method'), array('sendmail', 'qmail', 'mail'))) { $app->enqueueMessage(JText::_('ADVICE_LOCALHOST'), 'notice'); } } return $this->display(); }
* @version 5.1.0 * @author acyba.com * @copyright (C) 2009-2015 ACYBA S.A.R.L. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); if (version_compare(PHP_VERSION, '5.0.0', '<')) { echo '<p style="color:red">This version of AcyMailing does not support PHP4, it is time to upgrade your server to PHP5!</p>'; exit; } if (!(include_once rtrim(JPATH_ADMINISTRATOR, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_acymailing' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'helper.php')) { echo "Could not load Acy helper file"; return; } if (defined('JDEBUG') and JDEBUG) { acymailing_displayErrors(); } $taskGroup = JRequest::getCmd('ctrl', JRequest::getCmd('gtask', 'dashboard')); if ($taskGroup == 'config') { $taskGroup = 'cpanel'; } $config =& acymailing_config(); $doc = JFactory::getDocument(); $app = JFactory::getApplication(); $doc->addStyleSheet(ACYMAILING_CSS . 'backend_default.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'backend_default.css')); $cssBackend = $config->get('css_backend'); if ($cssBackend == 'backend_custom') { $doc->addStyleSheet(ACYMAILING_CSS . 'backend_custom.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'backend_custom.css')); } $doc->addScript(ACYMAILING_JS . 'acymailing_compat.js?v=' . filemtime(ACYMAILING_MEDIA . 'js' . DS . 'acymailing_compat.js')); JHTML::_('behavior.tooltip');
function ldap_init() { $config = acymailing_config(); $newConfig = null; $newConfig->ldap_host = trim(JRequest::getString('ldap_host')); $newConfig->ldap_port = JRequest::getInt('ldap_port'); if (empty($newConfig->ldap_port)) { $newConfig->ldap_port = 389; } $newConfig->ldap_basedn = trim(JRequest::getString('ldap_basedn')); $this->ldap_basedn = $newConfig->ldap_basedn; $newConfig->ldap_username = trim(JRequest::getString('ldap_username')); $newConfig->ldap_password = trim(JRequest::getString('ldap_password')); $config->save($newConfig); if (empty($newConfig->ldap_host)) { return false; } acymailing_displayErrors(); $this->ldap_conn = ldap_connect($newConfig->ldap_host, $newConfig->ldap_port); if (!$this->ldap_conn) { acymailing_display('Could not connect to LDAP server : ' . $newConfig->ldap_host . ':' . $newConfig->ldap_port, 'warning'); return false; } ldap_set_option($this->ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($this->ldap_conn, LDAP_OPT_REFERRALS, 0); if (empty($newConfig->ldap_username)) { $bindResult = ldap_bind($this->ldap_conn); } else { $bindResult = ldap_bind($this->ldap_conn, $newConfig->ldap_username, $newConfig->ldap_password); } if (!$bindResult) { acymailing_display('Could not bind to the LDAP directory ' . $newConfig->ldap_host . ':' . $newConfig->ldap_port . ' with specified username and password<br/>' . ldap_error($this->ldap_conn), 'warning'); return false; } acymailing_display('Successfully connected to ' . $newConfig->ldap_host . ':' . $newConfig->ldap_port, 'success'); return true; }
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; }
<?php /** * @package AcyMailing for Joomla! * @version 4.9.3 * @author acyba.com * @copyright (C) 2009-2015 ACYBA S.A.R.L. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?><?php jimport('joomla.application.component.controller'); jimport( 'joomla.application.component.view'); include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acymailing'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php'); if(defined('JDEBUG') AND JDEBUG) acymailing_displayErrors(); $view = JRequest::getCmd('view'); if(!empty($view) AND !JRequest::getCmd('ctrl')){ JRequest::setVar('ctrl',$view); $layout = JRequest::getCmd('layout'); if(!empty($layout)){ JRequest::setVar('task',$layout); } } $taskGroup = JRequest::getCmd('ctrl',JRequest::getCmd('gtask','lists')); global $Itemid; if(empty($Itemid)){ $urlItemid = JRequest::getInt('Itemid'); if(!empty($urlItemid)) $Itemid = $urlItemid;