public static function getMailingView($mailingId, $listId = 0) { $archivemailing = new stdClass(); if ($mailingId != 0) { if ($listId > 0) { $list = jNews_Lists::getOneList($listId); $archivemailing = jNews_Mailing::getOneMailing($list, $mailingId, 0, $new); } else { $archivemailing = jNews_Mailing::getOneMailing(0, $mailingId, 0, $new); } $mailingtype = JRequest::getInt('listype'); if ($mailingtype == '7') { $db = JFactory::getDBO(); $query = 'SELECT `delay` FROM `#__jnews_queue` WHERE `type` = 7 AND `mailing_id` = ' . $archivemailing->id; $db->setQuery($query); $snDelay = $db->loadResult(); if (!empty($snDelay)) { $myTime = jnews::getNow(); $computedDate = jNews_Autonews::computeSmartDate($archivemailing->delay_min, $snDelay, $myTime); //We use the start date to previous the first one $computedDate->lastDate = $archivemailing->start_date; $newMailing = jNews_Autonews::loadSmartContent($archivemailing, $computedDate->lastDate, $snDelay); $archivemailing = !empty($newMailing) ? $newMailing : $archivemailing; } } if ($new) { return ''; } else { $mainframe = JFactory::getApplication(); JPluginHelper::importPlugin('jnews'); $bot_results = $mainframe->triggerEvent('jnewsbot_transformall', array(&$archivemailing->htmlcontent, &$archivemailing->textonly, &$archivemailing->subject)); $myReceiver = JFactory::getUser(); $db = JFactory::getDBO(); $query = "SELECT A.`id`, A.`receive_html` "; //we retreive the extra columns info of the user if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnews is pro if ($GLOBALS[JNEWS . 'show_column1']) { $query .= ', A.`column1`'; } if ($GLOBALS[JNEWS . 'show_column2']) { $query .= ',A.`column2`'; } if ($GLOBALS[JNEWS . 'show_column3']) { $query .= ',A.`column3`'; } if ($GLOBALS[JNEWS . 'show_column4']) { $query .= ',A.`column4`'; } if ($GLOBALS[JNEWS . 'show_column5']) { $query .= ',A.`column5`'; } } $query .= " FROM `#__jnews_subscribers` AS A WHERE A.`user_id`=" . $myReceiver->id; $db->setQuery($query); $myReceiverColumns = $db->loadObject(); if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnews is pro if ($GLOBALS[JNEWS . 'show_column1']) { $myReceiver->column1 = $myReceiverColumns->column1; } if ($GLOBALS[JNEWS . 'show_column2']) { $myReceiver->column2 = $myReceiverColumns->column2; } if ($GLOBALS[JNEWS . 'show_column3']) { $myReceiver->column3 = $myReceiverColumns->column3; } if ($GLOBALS[JNEWS . 'show_column4']) { $myReceiver->column4 = $myReceiverColumns->column4; } if ($GLOBALS[JNEWS . 'show_column5']) { $myReceiver->column5 = $myReceiverColumns->column5; } } $myReceiver->receive_html = !empty($myReceiverColumns->id) ? $myReceiverColumns->receive_html : 1; $oneQueue = new stdClass(); $oneQueue->id = $mailingId; $archivemailing->subject = jNews_ProcessMail::replaceTags($archivemailing->subject, $myReceiver, $oneQueue, false, null, false); $archivemailing->htmlcontent = jNews_ProcessMail::replaceTags($archivemailing->htmlcontent, $myReceiver, $oneQueue, true); preg_match_all('/<img([^>]*)src="([^">]+)"([^>]*)>/i', $archivemailing->htmlcontent, $images, PREG_SET_ORDER); if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $imgfolders = '/images/stories'; } else { //j16 $imgfolders = '/images/sampledata'; } foreach ($images as $image) { $image[2] = preg_replace('/(\\.\\.\\/)+/', '/', $image[2]); $image[2] = str_replace(array(JNEWS_JPATH_LIVE, JNEWS_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], $imgfolders) !== false) { $image[2] = '/' . stristr($image[2], $imgfolders); } // end if $replacement = '<img ' . $image[1] . 'src="' . JNEWS_JPATH_LIVE_NO_HTTPS . $image[2] . '"' . $image[3] . '>'; } else { $replacement = '<img ' . $image[1] . 'src="' . $image[2] . '"' . $image[3] . '>'; } // end if } } } return $archivemailing; }