本文整理汇总了PHP中acymailing_enqueueMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP acymailing_enqueueMessage函数的具体用法?PHP acymailing_enqueueMessage怎么用?PHP acymailing_enqueueMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acymailing_enqueueMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listing
function listing()
{
$app = JFactory::getApplication();
global $Itemid;
$config = acymailing_config();
$jsite = JFactory::getApplication('site');
$menus = $jsite->getMenu();
$menu = $menus->getActive();
if (empty($menu) and !empty($Itemid)) {
$menus->setActive($Itemid);
$menu = $menus->getItem($Itemid);
}
if (empty($menu)) {
acymailing_enqueueMessage(JText::_('ACY_NOTALLOWED'));
$app->redirect('index.php');
}
$selectedLists = 'all';
if (is_object($menu)) {
jimport('joomla.html.parameter');
$menuparams = new acyParameter($menu->params);
$this->assign('listsintrotext', $menuparams->get('listsintrotext'));
$this->assign('listsfinaltext', $menuparams->get('listsfinaltext'));
$selectedLists = $menuparams->get('lists', 'all');
$document = JFactory::getDocument();
if ($menuparams->get('menu-meta_description')) {
$document->setDescription($menuparams->get('menu-meta_description'));
}
if ($menuparams->get('menu-meta_keywords')) {
$document->setMetadata('keywords', $menuparams->get('menu-meta_keywords'));
}
if ($menuparams->get('robots')) {
$document->setMetadata('robots', $menuparams->get('robots'));
}
if ($menuparams->get('page_title')) {
acymailing_setPageTitle($menuparams->get('page_title'));
}
}
if (empty($menuparams)) {
$pathway = $app->getPathway();
$pathway->addItem(JText::_('MAILING_LISTS'));
}
$document = JFactory::getDocument();
$link = '&format=feed&limitstart=';
if ($config->get('acyrss_format') == 'rss' || $config->get('acyrss_format') == 'both') {
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
}
if ($config->get('acyrss_format') == 'atom' || $config->get('acyrss_format') == 'both') {
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
}
$listsClass = acymailing_get('class.list');
$allLists = $listsClass->getLists('', $selectedLists);
if (acymailing_level(1)) {
$allLists = $listsClass->onlyCurrentLanguage($allLists);
}
$myItem = empty($Itemid) ? '' : '&Itemid=' . $Itemid;
$this->assignRef('rows', $allLists);
$this->assignRef('item', $myItem);
}
示例2: change
function change($data, $input, $output)
{
$input = strtoupper(trim($input));
$output = strtoupper(trim($output));
$supportedEncodings = array("BIG5", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "ISO-2022-JP", "US-ASCII", "UTF-7", "UTF-8", "UTF-16", "Windows-1251", "Windows-1252", "ARMSCII-8", "ISO-8859-16");
if (!in_array($input, $supportedEncodings)) {
acymailing_enqueueMessage('Encoding not supported: ' . $input, 'error');
} elseif (!in_array($output, $supportedEncodings)) {
acymailing_enqueueMessage('Encoding not supported: ' . $output, 'error');
}
if ($input == $output) {
return $data;
}
if ($input == 'UTF-8' && $output == 'ISO-8859-1') {
$data = str_replace(array('€', '„', '“'), array('EUR', '"', '"'), $data);
}
if (function_exists('iconv')) {
set_error_handler('acymailing_error_handler_encoding');
$encodedData = iconv($input, $output . "//IGNORE", $data);
restore_error_handler();
if (!empty($encodedData) && !acymailing_error_handler_encoding('result')) {
return $encodedData;
}
}
if (function_exists('mb_convert_encoding')) {
return mb_convert_encoding($data, $output, $input);
}
if ($input == 'UTF-8' && $output == 'ISO-8859-1') {
return utf8_decode($data);
}
if ($input == 'ISO-8859-1' && $output == 'UTF-8') {
return utf8_encode($data);
}
return $data;
}
示例3: doimport
function doimport()
{
if (!$this->isAllowed('subscriber', 'import')) {
return;
}
JRequest::checkToken() or die('Invalid Token');
$function = JRequest::getCmd('importfrom');
$importHelper = acymailing_get('helper.import');
if (!$importHelper->{$function}()) {
return $this->import();
}
$app = JFactory::getApplication();
if ($function == 'textarea' || $function == 'file') {
if (file_exists(ACYMAILING_MEDIA . 'import' . DS . JRequest::getCmd('filename'))) {
$importContent = file_get_contents(ACYMAILING_MEDIA . 'import' . DS . JRequest::getCmd('filename'));
}
if (empty($importContent)) {
acymailing_enqueueMessage(JText::_('ACY_IMPORT_NO_CONTENT'), 'error');
$this->setRedirect(acymailing_completeLink(($app->isSite() ? 'front' : '') . 'data&task=import', false, true));
} else {
JRequest::setVar('hidemainmenu', 1);
JRequest::setVar('layout', 'genericimport');
return parent::display();
}
} else {
$this->setRedirect(acymailing_completeLink($app->isAdmin() ? 'subscriber' : 'frontsubscriber', false, true));
}
}
示例4: remove
function remove()
{
if (!$this->isAllowed('statistics', 'delete')) {
return;
}
JRequest::checkToken() or die('Invalid Token');
$cids = JRequest::getVar('cid', array(), '', 'array');
$class = acymailing_get('class.stats');
$num = $class->delete($cids);
acymailing_enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $num), 'message');
return $this->listing();
}
示例5: remove
function remove()
{
if (!$this->isAllowed($this->aclCat, 'delete')) {
return;
}
JRequest::checkToken() or die('Invalid Token');
$listIds = JRequest::getVar('cid', array(), '', 'array');
$subscriberObject = acymailing_get('class.list');
$num = $subscriberObject->delete($listIds);
acymailing_enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $num), 'message');
JRequest::setVar('layout', 'listing');
return parent::display();
}
示例6: cancelNewsletter
function cancelNewsletter()
{
if (!$this->isAllowed($this->aclCat, 'delete')) {
return;
}
JRequest::checkToken() || JRequest::checkToken('get') || die('Invalid token');
$mailid = JRequest::getInt('mailid', 0);
if (empty($mailid)) {
acymailing_enqueueMessage('Mail id not found', 'error');
return;
}
$queueClass = acymailing_get('class.queue');
acymailing_enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $queueClass->delete(array('a.mailid = ' . $mailid))), 'info');
}
示例7: store
function store()
{
JRequest::checkToken() or die('Invalid Token');
$oldMailid = acymailing_getCID('mailid');
$mailClass = acymailing_get('class.mail');
if ($mailClass->saveForm()) {
$data = JRequest::getVar('data');
$type = @$data['mail']['type'];
if (!empty($type) and in_array($type, array('unsub', 'welcome'))) {
$subject = addslashes($data['mail']['subject']);
$mailid = JRequest::getInt('mailid');
if ($type == 'unsub') {
$js = "var mydrop = window.top.document.getElementById('datalistunsubmailid'); ";
$js .= "var type = 'unsub';";
} else {
//type=welcome
$js = "var mydrop = window.top.document.getElementById('datalistwelmailid'); ";
$js .= "var type = 'welcome';";
}
if (empty($oldMailid)) {
$js .= 'var optn = document.createElement("OPTION");';
$js .= "optn.text = '[{$mailid}] {$subject}'; optn.value = '{$mailid}';";
$js .= 'mydrop.options.add(optn);';
$js .= 'lastid = 0; while(mydrop.options[lastid+1]){lastid = lastid+1;} mydrop.selectedIndex = lastid;';
$js .= 'window.top.changeMessage(type,' . $mailid . ');';
} else {
$js .= "lastid = 0; notfound = true; while(notfound && mydrop.options[lastid]){if(mydrop.options[lastid].value == {$mailid}){mydrop.options[lastid].text = '[{$mailid}] {$subject}';notfound = false;} lastid = lastid+1;}";
}
if (ACYMAILING_J30) {
$js .= 'window.top.jQuery("#datalist' . ($type == 'unsub' ? 'unsub' : 'wel') . 'mailid").trigger("liszt:updated");';
}
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
}
acymailing_enqueueMessage(JText::_('JOOMEXT_SUCC_SAVED'), 'success');
} else {
acymailing_enqueueMessage(JText::_('ERROR_SAVING'), 'error');
}
}
示例8: listing
function listing()
{
$app = JFactory::getApplication();
$config = acymailing_config();
if (!class_exists('plgSystemAcymailingClassMail')) {
$warning_msg = JText::_('ACY_WARNINGOVERRIDE_DISABLED_1') . ' <a href="index.php?option=com_acymailing&ctrl=cpanel">' . JText::sprintf('ACY_WARNINGOVERRIDE_DISABLED_2', ' acymailingclassmail (Override Joomla mailing system plugin)') . '</a>';
acymailing_enqueueMessage($warning_msg, 'notice');
}
$pageInfo = new stdClass();
$pageInfo->filter = new stdClass();
$pageInfo->filter->order = new stdClass();
$paramBase = ACYMAILING_COMPONENT . '.' . $this->getName();
$pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'mailid', 'cmd');
$pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
if (strtolower($pageInfo->filter->order->dir) !== 'desc') {
$pageInfo->filter->order->dir = 'asc';
}
$db = JFactory::getDBO();
$query = 'SELECT mailid, subject, alias, fromname, published, fromname, fromemail, replyname, replyemail FROM #__acymailing_mail WHERE `type` = ' . $db->Quote($this->type);
if (!empty($pageInfo->filter->order->value)) {
$query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
}
$db->setQuery($query);
$rows = $db->loadObjectList();
$acyToolbar = acymailing::get('helper.toolbar');
$acyToolbar->custom('preview', JText::_('ACY_PREVIEW'), 'search', true);
$acyToolbar->edit();
$acyToolbar->delete();
$acyToolbar->divider();
$acyToolbar->help($this->doc);
$acyToolbar->setTitle(JText::_($this->nameListing), $this->ctrl);
$acyToolbar->display();
$toggleClass = acymailing_get('helper.toggle');
$this->assignRef('toggleClass', $toggleClass);
$this->assignRef('pageInfo', $pageInfo);
$this->assign('config', $config);
$this->assign('rows', $rows);
}
示例9: installExtensions
//.........这里部分代码省略.........
$destinationFolder = ACYMAILING_ROOT . 'plugins' . DS . $newPlugin->folder . DS . $newPlugin->element;
if (!acymailing_createDir($destinationFolder)) {
continue;
}
}
if (!$this->copyFolder($path . DS . $oneDir, $destinationFolder)) {
continue;
}
if (in_array($newPlugin->folder . $newPlugin->element, $existingExtensions)) {
continue;
}
$plugins[] = $newPlugin;
} elseif ($arguments[0] == 'mod') {
$newModule = new stdClass();
if (!empty($additionalInfo)) {
$newModule->additionalInfo = json_encode($additionalInfo);
}
$newModule->name = $oneDir;
if (isset($extensioninfo[$oneDir][0])) {
$newModule->name = $extensioninfo[$oneDir][0];
}
$newModule->type = 'module';
$newModule->folder = '';
$newModule->element = $oneDir;
$newModule->enabled = 1;
$newModule->params = '{}';
$newModule->ordering = 0;
if (isset($extensioninfo[$oneDir][1])) {
$newModule->ordering = $extensioninfo[$oneDir][1];
}
$destinationFolder = ACYMAILING_ROOT . 'modules' . DS . $oneDir;
if (!acymailing_createDir($destinationFolder)) {
continue;
}
if (!$this->copyFolder($path . DS . $oneDir, $destinationFolder)) {
continue;
}
if (in_array($newModule->element, $existingExtensions)) {
continue;
}
$modules[] = $newModule;
} else {
acymailing_enqueueMessage('Could not handle : ' . $oneDir, 'error');
}
}
if (!empty($this->errors)) {
acymailing_enqueueMessage($this->errors, 'error');
}
if (!ACYMAILING_J16) {
$extensions = $plugins;
} else {
$extensions = array_merge($plugins, $modules);
}
$success = array();
if (!empty($extensions)) {
if (!ACYMAILING_J16) {
$queryExtensions = 'INSERT INTO `#__plugins` (`name`,`element`,`folder`,`published`,`ordering`) VALUES ';
} else {
$queryExtensions = 'INSERT INTO `#__extensions` (`name`,`element`,`folder`,`enabled`,`ordering`,`type`,`access`,`manifest_cache`) VALUES ';
}
foreach ($extensions as $oneExt) {
$queryExtensions .= '(' . $this->db->Quote($oneExt->name) . ',' . $this->db->Quote($oneExt->element) . ',' . $this->db->Quote($oneExt->folder) . ',' . $oneExt->enabled . ',' . $oneExt->ordering;
if (ACYMAILING_J16) {
$queryExtensions .= ',' . $this->db->Quote($oneExt->type) . ',1,' . $this->db->Quote(!empty($oneExt->additionalInfo) ? $oneExt->additionalInfo : '');
}
$queryExtensions .= '),';
if ($oneExt->type != 'module') {
$success[] = JText::sprintf('PLUG_INSTALLED', $oneExt->name);
}
}
$queryExtensions = trim($queryExtensions, ',');
$this->db->setQuery($queryExtensions);
$this->db->query();
}
if (!empty($modules)) {
foreach ($modules as $oneModule) {
if (!ACYMAILING_J16) {
$queryModule = 'INSERT INTO `#__modules` (`title`,`position`,`published`,`module`) VALUES ';
$queryModule .= '(' . $this->db->Quote($oneModule->name) . ",'left',0," . $this->db->Quote($oneModule->element) . ")";
} else {
$queryModule = 'INSERT INTO `#__modules` (`title`,`position`,`published`,`module`,`access`,`language`) VALUES ';
$queryModule .= '(' . $this->db->Quote($oneModule->name) . ",'position-7',0," . $this->db->Quote($oneModule->element) . ",1,'*')";
}
$this->db->setQuery($queryModule);
$this->db->query();
$moduleId = $this->db->insertid();
$this->db->setQuery('INSERT IGNORE INTO `#__modules_menu` (`moduleid`,`menuid`) VALUES (' . $moduleId . ',0)');
$this->db->query();
$success[] = JText::sprintf('MODULE_INSTALLED', $oneModule->name);
}
}
if (ACYMAILING_J16) {
$this->db->setQuery("UPDATE `#__extensions` SET `access` = 1 WHERE ( `folder` = 'acymailing' OR `element` LIKE '%acymailing%' ) AND `type` = 'plugin'");
$this->db->query();
}
$this->cleanPluginCache();
if (!empty($success)) {
acymailing_enqueueMessage($success, 'success');
}
}
示例10: managePicts
function managePicts($tag, $result)
{
if (!isset($tag->pict)) {
return $result;
}
$pictureHelper = acymailing_get('helper.acypict');
if ($tag->pict === 'resized') {
$app = JFactory::getApplication();
$pictureHelper->maxHeight = empty($tag->maxheight) ? 150 : $tag->maxheight;
$pictureHelper->maxWidth = empty($tag->maxwidth) ? 150 : $tag->maxwidth;
if ($pictureHelper->available()) {
$result = $pictureHelper->resizePictures($result);
} elseif ($app->isAdmin()) {
acymailing_enqueueMessage($pictureHelper->error, 'notice');
}
} elseif ($tag->pict == '0') {
$result = $pictureHelper->removePictures($result);
}
return $result;
}
示例11: _savelanguage
function _savelanguage()
{
if (!$this->isAllowed('configuration', 'manage')) {
return;
}
JRequest::checkToken() or die('Invalid Token');
jimport('joomla.filesystem.file');
$code = JRequest::getCmd('code');
JRequest::setVar('code', $code);
$content = JRequest::getVar('content', '', '', 'string', JREQUEST_ALLOWHTML);
if (empty($code) or empty($content)) {
return;
}
$path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing.ini';
$result = JFile::write($path, $content);
if ($result) {
acymailing_enqueueMessage(JText::_('JOOMEXT_SUCC_SAVED'), 'success');
$js = "window.top.document.getElementById('image{$code}').className = 'acyicon-edit'";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
$updateHelper = acymailing_get('helper.update');
$updateHelper->installMenu($code);
} else {
acymailing_enqueueMessage(JText::sprintf('FAIL_SAVE', $path), 'error');
}
$customcontent = JRequest::getVar('customcontent', '', '', 'string', JREQUEST_ALLOWHTML);
$custompath = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing_custom.ini';
$customresult = JFile::write($custompath, $customcontent);
if (!$customresult) {
acymailing_enqueueMessage(JText::sprintf('FAIL_SAVE', $custompath), 'error');
}
return $result;
}
示例12: updateQuery
function updateQuery($query)
{
try {
$this->db->setQuery($query);
$res = $this->db->query();
} catch (Exception $e) {
$res = null;
}
if ($res === null) {
acymailing_enqueueMessage(isset($e) ? $e->getMessage() : substr(strip_tags($this->db->getErrorMsg()), 0, 200) . '...', 'error');
}
}
示例13: abtest
function abtest()
{
$nbTotalReceivers = JRequest::getInt('nbTotalReceivers');
$mailids = JRequest::getString('mailid');
$mailsArray = explode(',', $mailids);
JArrayHelper::toInteger($mailsArray);
$db = JFactory::getDBO();
$abTesting_prct = JRequest::getInt('abTesting_prct');
$abTesting_delay = JRequest::getInt('abTesting_delay');
$abTesting_action = JRequest::getString('abTesting_action');
if (empty($abTesting_prct)) {
acymailing_display(JText::_('ABTESTING_NEEDVALUE'), 'warning');
$this->abtesting();
return;
}
$newAbTestDetail = array();
$newAbTestDetail['mailids'] = implode(',', $mailsArray);
$newAbTestDetail['prct'] = !empty($abTesting_prct) ? $abTesting_prct : '';
$newAbTestDetail['delay'] = isset($abTesting_delay) && strlen($abTesting_delay) > 0 ? $abTesting_delay : '2';
$newAbTestDetail['action'] = !empty($abTesting_action) ? $abTesting_action : 'manual';
$newAbTestDetail['time'] = time();
$newAbTestDetail['status'] = 'inProgress';
$mailClass = acymailing_get('class.mail');
$nbReceiversTest = $mailClass->ab_test($newAbTestDetail, $mailsArray, $nbTotalReceivers);
acymailing_enqueueMessage(JText::sprintf('ABTESTING_SUCCESSADD', $nbReceiversTest), 'info');
JRequest::setVar('validationStatus', 'abTestAdd');
$this->abtesting();
}
示例14: abtesting
function abtesting()
{
$app = JFactory::getApplication();
$mailids = JRequest::getString('mailid');
$validationStatus = JRequest::getString('validationStatus');
$noMsg = false;
$noBtn = false;
if (!empty($mailids) && strpos($mailids, ',') !== false) {
$db = JFactory::getDBO();
$warningMsg = array();
$mailsArray = explode(',', $mailids);
JArrayHelper::toInteger($mailsArray);
$mailids = implode(',', $mailsArray);
$this->assign('mailid', $mailids);
$query = 'SELECT abtesting FROM #__acymailing_mail WHERE mailid IN (' . implode(',', $mailsArray) . ') AND abtesting IS NOT NULL';
$db->setQuery($query);
$resDetail = acymailing_loadResultArray($db);
if (!empty($resDetail) && count($resDetail) != count($mailsArray)) {
$titlePage = JText::_('ABTESTING');
acymailing_display(JText::_('ABTESTING_MISSINGEMAIL'), 'warning');
$this->assign('missingMail', true);
} else {
$abTestDetail = array();
if (empty($resDetail)) {
$abTestDetail['mailids'] = $mailids;
$abTestDetail['prct'] = 10;
$abTestDetail['delay'] = 2;
$abTestDetail['action'] = 'manual';
} else {
$abTestDetail = unserialize($resDetail[0]);
$savedIds = explode(',', $abTestDetail['mailids']);
sort($savedIds);
sort($mailsArray);
if (!empty($abTestDetail['status']) && in_array($abTestDetail['status'], array('inProgress', 'testSendOver', 'abTestFinalSend')) && $savedIds != $mailsArray) {
$warningMsg[] = JText::_('ABTESTING_TESTEXIST');
$mailsArray = $savedIds;
$mailids = implode(',', $mailsArray);
}
$this->assign('savedValues', true);
if ($abTestDetail['status'] == 'inProgress') {
$warningMsg[] = JText::_('ABTESTING_INPROGRESS');
}
}
if ($validationStatus == 'abTestAdd') {
$noMsg = true;
}
if (!empty($abTestDetail['status']) && $abTestDetail['status'] == 'abTestFinalSend' && !empty($abTestDetail['newMail'])) {
$mailInQueueErrorMsg = JText::_('ABTESTING_FINALMAILINQUEUE');
$mailTocheck = '=' . $abTestDetail['newMail'];
} else {
$mailInQueueErrorMsg = JText::_('ABTESTING_TESTMAILINQUEUE');
$mailTocheck = ' IN (' . implode(',', $mailsArray) . ')';
}
$query = "SELECT COUNT(*) FROM #__acymailing_queue WHERE mailid" . $mailTocheck;
$db->setQuery($query);
$queueCheck = $db->loadResult();
if (!empty($queueCheck) && $validationStatus != 'abTestAdd') {
acymailing_enqueueMessage($mailInQueueErrorMsg, 'error');
$noMsg = true;
}
if (!empty($resDetail) && empty($queueCheck) && in_array($abTestDetail['status'], array('inProgress', 'abTestFinalSend'))) {
if ($abTestDetail['status'] == 'inProgress') {
$abTestDetail['status'] = 'testSendOver';
} else {
$abTestDetail['status'] = 'completed';
}
$query = "UPDATE #__acymailing_mail SET abtesting=" . $db->quote(serialize($abTestDetail)) . " WHERE mailid IN (" . implode(',', $mailsArray) . ")";
$db->setQuery($query);
$db->query();
}
if (!empty($abTestDetail['status']) && $abTestDetail['status'] == 'testSendOver') {
acymailing_enqueueMessage(JText::_('ABTESTING_READYTOSEND'), 'info');
}
if (!empty($abTestDetail['status']) && $abTestDetail['status'] == 'completed') {
acymailing_enqueueMessage(JText::_('ABTESTING_COMPLETE'), 'info');
}
$this->assign('abTestDetail', $abTestDetail);
$nbMails = count($mailsArray);
$titleStr = "A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z";
$titlePage = JText::sprintf('ABTESTING_TITLE', substr($titleStr, 0, min($nbMails, 26) * 2 - 1));
$mailClass = acymailing_get('class.mail');
$mailsDetails = array();
foreach ($mailsArray as $mailid) {
$mailsDetails[] = $mailClass->get($mailid);
}
$this->assign('mailsdetails', $mailsDetails);
$mailerHelper = acymailing_get('helper.mailer');
$mailerHelper->loadedToSend = false;
$mailReceiver = $mailerHelper->load($mailsArray[0]);
$listmailClass = acymailing_get('class.listmail');
$lists = $listmailClass->getReceivers($mailReceiver->mailid, true, false);
$this->assign('lists', $lists);
$this->assign('mailReceiver', $mailReceiver);
$filterClass = acymailing_get('class.filter');
$this->assign('filterClass', $filterClass);
$listids = array();
foreach ($lists as $oneList) {
$listids[] = $oneList->listid;
}
$nbTotalReceivers = $filterClass->countReceivers($listids, $this->mailReceiver->filter, $this->mailReceiver->mailid);
//.........这里部分代码省略.........
示例15: export
function export($tempid)
{
if (!extension_loaded('zlib')) {
JError::raiseWarning('SOME_ERROR_CODE', JText::_('WARNINSTALLZLIB'));
return false;
}
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.archive');
$template = $this->get($tempid);
$fileDeb = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
if (!empty($template->description)) {
$fileDeb .= '
<meta name="description" content="' . str_replace('"', "'", $template->description) . '" />';
}
if (!empty($template->fromname)) {
$fileDeb .= '
<meta name="fromname" content="' . $template->fromname . '" />';
}
if (!empty($template->fromemail)) {
$fileDeb .= '
<meta name="fromemail" content="' . $template->fromemail . '" />';
}
if (!empty($template->replyname)) {
$fileDeb .= '
<meta name="replyname" content="' . $template->replyname . '" />';
}
if (!empty($template->replyemail)) {
$fileDeb .= '
<meta name="replyemail" content="' . $template->replyemail . '" />';
}
$fileDeb .= '
<title>' . $template->name . '</title>';
$css = '
<style type="text/css">
';
$css .= file_get_contents(ACYMAILING_TEMPLATE . DS . 'css' . DS . 'template_' . $tempid . '.css');
$css .= '
</style>';
$indexFile = $fileDeb . $css . '
</head>
<body>
' . $template->body . '
</body>
</html>';
$tmpdir = preg_replace('#[^a-z0-9]#i', '_', strtolower($template->name));
$jpathURL = ACYMAILING_LIVE . 'media/' . ACYMAILING_COMPONENT . '/tmp';
$tmp_url_dest = $jpathURL . DS . $tmpdir;
$jpath = ACYMAILING_MEDIA . 'tmp';
$tmp_dest = JPath::clean($jpath . DS . $tmpdir);
if (!JFolder::exists($jpath)) {
if (!JFolder::create($jpath)) {
acymailing_enqueueMessage('Error creating temp folder in directory: ' . $jpath, 'error');
return false;
}
}
if (!JFolder::create($tmp_dest)) {
acymailing_enqueueMessage('Error creating folder in temp directory: ' . $tmp_dest, 'error');
return false;
}
if (!empty($template->thumb)) {
$thumbPath = JPath::clean(ACYMAILING_ROOT . DS . $template->thumb);
$thumbExt = JFile::getExt($thumbPath);
$resCopyThumb = JFile::copy($thumbPath, $tmp_dest . DS . 'thumbnail.' . $thumbExt);
if (!$resCopyThumb) {
acymailing_enqueueMessage('Error copying the thumb picture', 'warning');
}
}
$resHandleImages = $this->handlepict($indexFile, $tmp_dest);
if (!$resHandleImages) {
JFolder::delete($tmp_dest);
return false;
}
$resCopyIndex = JFile::write($tmp_dest . DS . 'index.html', $indexFile);
if (!$resCopyIndex) {
acymailing_enqueueMessage('Error copying the file index.html to temp directory ' . $tmp_dest, 'error');
return false;
}
$zipFilesArray = array();
$dirs = JFolder::folders($tmp_dest, '.', true, true);
array_push($dirs, $tmp_dest);
foreach ($dirs as $dir) {
$files = JFolder::files($dir, '.', false, true);
foreach ($files as $file) {
$posSlash = strrpos($file, '/');
$posASlash = strrpos($file, '\\');
$pos = $posSlash < $posASlash ? $posASlash : $posSlash;
if (!empty($pos)) {
$file = substr_replace($file, DS, $pos, 1);
}
$data = JFile::read($file);
$zipFilesArray[] = array('name' => str_replace($tmp_dest . DS, '', $file), 'data' => $data);
}
}
$zip = JArchive::getAdapter('zip');
$zip->create($tmp_dest . '.zip', $zipFilesArray);
JFolder::delete($tmp_dest);
//.........这里部分代码省略.........