function getMailingView($mailingId, $listId = 0) { global $_MAMBOTS; global $_VERSION, $mainframe; $joomAca15 = $_VERSION->RELEASE != '1.0' && class_exists('JFactory') ? true : false; $archivemailing = ''; if ($mailingId != 0) { if ($listId > 0) { $list = lists::getOneList($listId); $archivemailing = xmailing::getOneMailing($list, $mailingId, 0, $new); } else { $archivemailing = xmailing::getOneMailing(0, $mailingId, 0, $new); } if ($new) { return ''; } else { if (!(strlen($archivemailing->textonly) > 0)) { $archivemailing->textonly = acajoom_mail::htmlToText($archivemailing->htmlcontent); } if ($joomAca15) { JPluginHelper::importPlugin('acajoom'); $bot_results = $mainframe->triggerEvent('acajoombot_transformall', array(&$archivemailing->htmlcontent, &$archivemailing->textonly)); } else { $_MAMBOTS->loadBotGroup('acajoom'); $bot_results = $_MAMBOTS->trigger('acajoombot_transformall', array(&$archivemailing->htmlcontent, &$archivemailing->textonly)); } preg_match_all('/<img([^>]*)src="([^">]+)"([^>]*)>/i', $archivemailing->htmlcontent, $images, PREG_SET_ORDER); foreach ($images as $image) { $image[2] = preg_replace('/(\\.\\.\\/)+/', '/', $image[2]); $image[2] = str_replace($GLOBALS['mosConfig_live_site'], '', $image[2]); $image[2] = preg_replace('/^\\//', '', $image[2]); if (stristr($image[2], 'http://') === false) { // remove unneeded directory information if (stristr($image[2], 'images/stories/') !== false) { $image[2] = '/' . stristr($image[2], 'images/stories/'); } // end if $replacement = '<img ' . $image[1] . 'src="' . $GLOBALS['mosConfig_live_site'] . $image[2] . '"' . $image[3] . '>'; } else { $replacement = '<img ' . $image[1] . 'src="' . $image[2] . '"' . $image[3] . '>'; } // end if $archivemailing->textonly = str_replace($image[0], $replacement, $archivemailing->htmlcontent); } } } return $archivemailing; }
function getMailingView($mailingId, $listId = 0) { $archivemailing = ''; if ($mailingId != 0) { if ($listId > 0) { $list = lists::getOneList($listId); $archivemailing = xmailing::getOneMailing($list, $mailingId, 0, $new); } else { $archivemailing = xmailing::getOneMailing(0, $mailingId, 0, $new); } if ($new) { return ''; } else { if (!(strlen($archivemailing->textonly) > 0)) { $archivemailing->textonly = acajoom_mail::htmlToText($archivemailing->htmlcontent); } if (ACA_CMSTYPE) { global $mainframe; JPluginHelper::importPlugin('acajoom'); $bot_results = $mainframe->triggerEvent('acajoombot_transformall', array(&$archivemailing->htmlcontent, &$archivemailing->textonly)); } else { global $_MAMBOTS; $_MAMBOTS->loadBotGroup('acajoom'); $bot_results = $_MAMBOTS->trigger('acajoombot_transformall', array(&$archivemailing->htmlcontent, &$archivemailing->textonly)); } preg_match_all('/<img([^>]*)src="([^">]+)"([^>]*)>/i', $archivemailing->htmlcontent, $images, PREG_SET_ORDER); foreach ($images as $image) { $image[2] = preg_replace('/(\\.\\.\\/)+/', '/', $image[2]); $image[2] = str_replace(array(ACA_JPATH_LIVE, ACA_JPATH_LIVE_NO_HTTPS), '', $image[2]); $image[2] = preg_replace('/^\\//', '', $image[2]); if (stristr($image[2], 'http://') === false) { // remove unneeded directory information if (stristr($image[2], 'images/stories/') !== false) { $image[2] = '/' . stristr($image[2], 'images/stories/'); } // end if $replacement = '<img ' . $image[1] . 'src="' . ACA_JPATH_LIVE_NO_HTTPS . $image[2] . '"' . $image[3] . '>'; } else { $replacement = '<img ' . $image[1] . 'src="' . $image[2] . '"' . $image[3] . '>'; } // end if $archivemailing->textonly = str_replace($image[0], $replacement, $archivemailing->htmlcontent); } } } return $archivemailing; }
function getContent($images, $layout, &$content, &$textonly) { global $_MAMBOTS; global $_VERSION, $mainframe, $database; $joomAca15 = $_VERSION->RELEASE != '1.0' && class_exists('JFactory') ? true : false; $replaceTag = array('href="mailto:', '@', 'href="#'); $replaceBy = array('9aca7aca5', '9aca4aca1', '9aca12aca3'); $content = str_replace($replaceTag, $replaceBy, $content); $content = str_replace('{mospagebreak}', '<br style="clear: both;" /><br />', $content); if (strlen($textonly) < 2) { $textonly = acajoom_mail::htmlToText($content); $textonly = str_replace('{mosimage}', '', $textonly); } if (!empty($images)) { foreach ($images as $image) { $image_string = '<img src="' . $GLOBALS['mosConfig_live_site'] . '/images/stories/' . $image . '" />'; $content = preg_replace('/{mosimage}/', $image_string, $content, 1); } } if ($joomAca15) { JPluginHelper::importPlugin('acajoom'); $bot_results = $mainframe->triggerEvent('acajoombot_transformall', array(&$content, &$textonly)); } else { $_MAMBOTS->loadBotGroup('acajoom'); $bot_results = $_MAMBOTS->trigger('acajoombot_transformall', array(&$content, &$textonly)); } $content = str_replace($replaceTag, $replaceBy, $content); $content = preg_replace('#src[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'src="' . $GLOBALS['mosConfig_live_site'] . '/', $content); $content = preg_replace('#href[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'href="' . $GLOBALS['mosConfig_live_site'] . '/', $content); $content = str_replace($replaceBy, $replaceTag, $content); return true; }
function getContent($images, $layout, &$content, &$textonly, $send = false) { $replaceTag = array('href="mailto:', '@', 'href="#'); $replaceBy = array('9aca7aca5', '9aca4aca1', '9aca12aca3'); $content = str_replace($replaceTag, $replaceBy, $content); $content = str_replace('{mospagebreak}', '<br style="clear: both;" /><br />', $content); if (strlen(trim($textonly)) < 2 && $send) { $textonly = acajoom_mail::htmlToText($content); $textonly = str_replace('{mosimage}', '', $textonly); } if (!empty($images)) { foreach ($images as $image) { $image_string = '<img src="' . ACA_JPATH_LIVE . '/images/stories/' . $image . '" />'; $content = preg_replace('/{mosimage}/', $image_string, $content, 1); } } if (ACA_CMSTYPE) { global $mainframe; JPluginHelper::importPlugin('acajoom'); $bot_results = $mainframe->triggerEvent('acajoombot_transformall', array(&$content, &$textonly)); } else { global $_MAMBOTS; $_MAMBOTS->loadBotGroup('acajoom'); $bot_results = $_MAMBOTS->trigger('acajoombot_transformall', array(&$content, &$textonly)); } $content = str_replace($replaceTag, $replaceBy, $content); $content = preg_replace('#src[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'src="' . ACA_JPATH_LIVE_NO_HTTPS . '/', $content); $content = preg_replace('#href[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'href="' . ACA_JPATH_LIVE_NO_HTTPS . '/', $content); $content = str_replace($replaceBy, $replaceTag, $content); return true; }
function acajoombot_jcalpro_transformall($html, $text) { $database =& JFactory::getDBO(); $Itemid = $GLOBALS[ACA . 'itemidAca']; preg_match_all('#{jcalevent:.{7,15}}#', $html . $text, $tags); $replace = array(); $replacebyHTML = array(); $replacebyText = array(); if (!empty($tags[0])) { foreach ($tags[0] as $tag) { $isolate = explode(':', $tag); if (count($isolate) != 2) { continue; } $parameters = explode('|', $isolate[1]); if (count($parameters) != 4) { continue; } if (!empty($replace[$tag])) { continue; } $replace[$tag] = $tag; $query = 'SELECT `title`, `description`, `end_date`, `start_date`, `extid` from #__jcalpro_events where `extid` = ' . intval($parameters[0]); $database->setQuery($query); if (ACA_CMSTYPE) { // joomla 15 $event = $database->loadObject(); } else { //joomla 1x $database->loadObject($event); } //endif if (empty($event->extid)) { $replacebyHTML[$tag] = ''; $replacebyText[$tag] = ''; continue; } if (get_magic_quotes_runtime()) { $event->title = stripslashes($event->title); $event->description = stripslashes($event->description); } $eventhtml = ''; if ($parameters[2]) { $eventhtml .= '<div class="eventpaneopen_nws">'; } $eventhtml .= '<span class="eventheading_nws">' . $event->title . '</span>'; $eventtext = strtoupper(acajoom_mail::htmlToText($event->title)); if ($parameters[1]) { $start_date_array = explode('-', $event->start_date); $start_time_array = explode(':', substr($event->start_date, 10, 15)); $date = strftime(JText::_('DATE_FORMAT_LC'), mktime($start_time_array[0], $start_time_array[1], 0, $start_date_array[1], $start_date_array[2], $start_date_array[0])); $eventhtml .= '<br/>' . $date; $eventtext .= "\r\n" . $date; } if ($parameters[2]) { $eventhtml .= '<br/>' . $event->description; $eventtext .= "\r\n" . acajoom_mail::htmlToText($event->description); } if ($parameters[3]) { $link = '.php?option=com_jcalpro&extmode=view&extid=' . $event->extid . '&Itemid=' . $Itemid; compa::completeLink($link, false, $GLOBALS[ACA . 'use_sef']); $eventhtml .= '<br/><a href="' . $link . '"><span class="readon_nws">' . _ACA_READMORE . '</span></a>'; $eventtext .= "\r\n" . ' * ' . _ACA_READMORE . ' ( ' . $link . ' )'; } if ($parameters[2]) { $eventhtml .= '</div>'; } $replacebyHTML[$tag] = $eventhtml; $replacebyText[$tag] = $eventtext; } } $html = str_replace($replace, $replacebyHTML, $html); $text = str_replace($replace, $replacebyText, $text); }
function acajoombot_jcalpro_transformall($html, $text) { global $database; $Itemid = $GLOBALS[ACA . 'itemidAca']; preg_match_all('#{jcalevent:.{7,15}}#', $html . $text, $tags); $replace = array(); $replacebyHTML = array(); $replacebyText = array(); if (!empty($tags[0])) { foreach ($tags[0] as $tag) { $isolate = explode(':', $tag); if (count($isolate) != 2) { continue; } $parameters = explode('|', $isolate[1]); if (count($parameters) != 4) { continue; } if (!empty($replace[$tag])) { continue; } $replace[$tag] = $tag; $query = 'SELECT `title`, `description`, `end_date`, `start_date`, `extid` from #__jcalpro_events where `extid` = ' . intval($parameters[0]); $database->setQuery($query); $database->loadObject($event); if (empty($event->extid)) { $replacebyHTML[$tag] = ''; $replacebyText[$tag] = ''; continue; } $eventhtml = ''; if ($parameters[2]) { $eventhtml .= '<div class="eventpaneopen_nws">'; } $eventhtml .= '<span class="eventheading_nws">' . $event->title . '</span>'; $eventtext = strtoupper(acajoom_mail::htmlToText($event->title)); if ($parameters[1]) { $start_date_array = explode('-', $event->start_date); $start_time_array = explode(':', substr($event->start_date, 10, 15)); $date = strftime(_DATE_FORMAT_LC, mktime($start_time_array[0], $start_time_array[1], 0, $start_date_array[1], $start_date_array[2], $start_date_array[0])); $eventhtml .= '<br/>' . $date; $eventtext .= "\r\n" . $date; } if ($parameters[2]) { $eventhtml .= '<br/>' . $event->description; $eventtext .= "\r\n" . acajoom_mail::htmlToText($event->description); } if ($parameters[3]) { if ($GLOBALS[ACA . 'use_sef'] == '1' and $GLOBALS['mosConfig_sef'] == '1' and function_exists('sefRelToAbs')) { $link = sefRelToAbs('index.php?option=com_jcalpro&extmode=view&extid=' . $event->extid . '&Itemid=' . $Itemid); } else { $link = $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_jcalpro&extmode=view&extid=' . $event->extid . '&Itemid=' . $Itemid; } $eventhtml .= '<br/><a href="' . $link . '"><span class="readon_nws">' . _READ_MORE . '</span></a>'; $eventtext .= "\r\n" . ' * ' . _READ_MORE . ' ( ' . $link . ' )'; } if ($parameters[2]) { $eventhtml .= '</div>'; } $replacebyHTML[$tag] = $eventhtml; $replacebyText[$tag] = $eventtext; } } $html = str_replace($replace, $replacebyHTML, $html); $text = str_replace($replace, $replacebyText, $text); }