public static function viewMailing($mailing, $forms) { echo $forms['main']; if ($mailing->html) { ?> <fieldset class="adminform" width="100%" id="htmlfieldset"> <legend><?php echo _JNEWS_HTML_VERSION; ?> </legend> <div class="newsletter_content" ><?php echo $mailing->htmlcontent; ?> </div> </fieldset> <?php } else { ?> <fieldset class="adminform" > <legend><?php echo _JNEWS_NONHTML; ?> </legend> <textarea style="width:100%" rows="20" readonly><?php echo jNews_ProcessMail::htmlToText($mailing->textonly); ?> </textarea> </fieldset> <?php } echo '<div class="clr"></div>'; $act = JRequest::getVar('act', '', '', 'WORD'); $task = JRequest::getVar('task'); if ($act != 'mailing' && $task != 'view') { ?> <fieldset class="adminform" > <legend><?php echo _JNEWS_NONHTML; ?> </legend> <textarea style="width:100%" rows="20" readonly><?php echo jNews_ProcessMail::htmlToText($mailing->textonly); ?> </textarea> </fieldset> <div class="clr"></div> <?php } if (!empty($mailing->attachments)) { ?> <table width="100%" cellpadding="4" cellspacing="0" border="0" align="left" class="adminlist"> <tr> <th align="left" valign="top"> <strong><?php echo _JNEWS_ATTACHED_FILES; ?> :</strong> </th> <td align="left"> <?php foreach ($mailing->attachments as $file) { echo '<a href="' . JNEWS_JPATH_LIVE . $GLOBALS[JNEWS . 'upload_url'] . DS . basename($file) . '" target="_blank">' . basename($file) . '</a><br />'; } ?> </td> </tr> </table> <?php } }
function jnewsbot_k2_transformall(&$html, &$text, &$subject, $queueInfo = null) { $mainframe = JFactory::getApplication(); $livesite = $mainframe->getCfg("live_site"); $sef = $mainframe->getCfg("sef"); $k2_items = array(); $k2_items_new = array(); $k2_items_old = array(); preg_match_all('/\\{k2item:(.{1,8})\\|(.{1})}/', $html, $k2_items_old, PREG_SET_ORDER); preg_match_all('/\\{k2item:(.{1,8})\\|(.{1})\\|(.{1})}/', $html, $k2_items_new, PREG_SET_ORDER); $k2_items = jnewsbot_class_transform_mergeArray($k2_items_new, $k2_items_old); foreach ($k2_items as $k2_item) { //j15 if (version_compare(JVERSION, '1.6.0', '<')) { $Itemid = $mainframe->getItemId($k2_item[1]); } if (empty($Itemid)) { $Itemid = $GLOBALS[JNEWS . 'itemidAca']; } $replacement = jnewsbot_k2_getitem($k2_item[1]); if ($GLOBALS[JNEWS . 'show_author'] == 1) { $author = '<br />' . $replacement->created_by_alias; } else { $author = ''; } $replacement->introtext = str_replace('{mospagebreak}', '<div style="clear: both;" ><div />', $replacement->introtext); $replacement->fulltext = str_replace('{mospagebreak}', '<div style="clear: both;" ><div />', $replacement->fulltext); // [0] => {k2item:3|1|1} // [1] => 3 // [2] => 1 // [3] => 1 if (isset($k2_item[3])) { if ($k2_item[3] == 1 && $k2_item[2] != 2) { $replacement->title = ""; } } if ($k2_item[2] == 0) { $html = str_replace($k2_item[0], '<div class="aca_content"><span class="aca_title">' . $replacement->title . '</span>' . "\r\n" . $author . '<br />' . $replacement->introtext . '<br />' . "\r\n" . $replacement->fulltext . "\r\n" . '</div>', $html); } else { if ($GLOBALS[JNEWS . 'use_sef'] == '1' and $sef == '1' and function_exists('sefRelToAbs')) { $link = sefRelToAbs('index.php?option=com_k2&view=item&id=' . $k2_item[1] . '&Itemid=' . $Itemid); } else { $link = $livesite . '/index.php?option=com_k2&view=item&id=' . $k2_item[1] . '&Itemid=' . $Itemid; } if ($k2_item[2] == 1) { $html = str_replace($k2_item[0], '<div class="aca_content"><span class="aca_title">' . $replacement->title . '</span>' . "\r\n" . $author . '<br />' . $replacement->introtext . '<br />' . "\r\n" . '<a href="' . $link . '"><span class="aca_readmore">' . _JNEWS_READMORE . '</span></a>' . "\r\n" . '</div>', $html); } else { $html = str_replace($k2_item[0], '<a href="' . $link . '"><span class="aca_title">' . $replacement->title . '</span></a>', $html); } } $image = jnewsbot_k2_getimage($replacement->image); if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $imgfolders = '/images/stories'; } else { //j16 $imgfolders = '/images/sampledata'; } foreach ($image as $image) { $image_string = '<img src="' . $livesite . $imgfolders . $image['image'] . '" align="' . $image['align'] . '" alt="' . $image['alttext'] . '" border="' . $image['border'] . '" />'; $html = preg_replace('/{mosimage}/', $image_string, $html, 1); } } $k2_items = array(); $k2_items_new = array(); $k2_items_old = array(); preg_match_all('/\\{k2item:(.{1,5})\\|(.{1})}/', $text, $k2_items_old, PREG_SET_ORDER); preg_match_all('/\\{k2item:(.{1,5})\\|(.{1})\\|(.{1})}/', $text, $k2_items_new, PREG_SET_ORDER); $k2_items = jnewsbot_class_transform_mergeArray($k2_items_new, $k2_items_old); foreach ($k2_items as $k2_item) { //j15 if (version_compare(JVERSION, '1.6.0', '<')) { $Itemid = $mainframe->getItemId($k2_item[1]); } if (empty($Itemid)) { $Itemid = $GLOBALS[JNEWS . 'itemidAca']; } $replacement = jnewsbot_k2_getitem($k2_item[1]); if ($GLOBALS[JNEWS . 'show_author'] == 1) { $author = "\r\n" . $replacement->created_by_alias; } else { $author = ''; } $replacement->title = strtoupper(jNews_ProcessMail::htmlToText($replacement->title)); $replacement->introtext = jNews_ProcessMail::htmlToText($replacement->introtext); $replacement->fulltext = jNews_ProcessMail::htmlToText($replacement->fulltext); if (isset($k2_item[3])) { if ($k2_item[3] == 1 && $k2_item[2] != 2) { $replacement->title = ""; } } if ($k2_item[2] == 0) { $text = str_replace($k2_item[0], $replacement->title . $author . "\r\n" . $replacement->introtext . "\r\n" . $replacement->fulltext . "\r\n", $text); } else { if ($GLOBALS[JNEWS . 'use_sef'] == '1' and $sef == '1' and function_exists('sefRelToAbs')) { $link = sefRelToAbs('index.php?option=com_k2&view=item&id=' . $k2_item[1] . '&Itemid=' . $Itemid); } else { $link = $livesite . '/index.php?option=com_k2&view=item&id=' . $k2_item[1] . '&Itemid=' . $Itemid; } if ($k2_item[2] == 1) { $text = str_replace($k2_item[0], $replacement->title . $author . "\r\n" . $replacement->introtext . "\r\n" . '* ' . _JNEWS_READMORE . ' ( ' . $link . ' )' . "\r\n", $text); } else { $text = str_replace($k2_item[0], $replacement->title . ' ( ' . $link . ' )', $text); } } $text = str_replace('{mosimage}', '', $text); } $html = str_replace('{mospagebreak}', '<div style="clear: both;" ><div />', $html); $text = str_replace('{mospagebreak}', "\r\n \r\n", $text); }
function checkTag() { if ($GLOBALS[JNEWS . 'sntag_norequired']) { return true; } $content = JRequest::getVar('jnewsContent', '', 'request', 'string', JREQUEST_ALLOWRAW); $alt_content = JRequest::getVar('textcontent_', '', JREQUEST_ALLOWRAW); if (empty($alt_content)) { $alt_content = jNews_ProcessMail::htmlToText($content); } $inHTML = strpos($alt_content, '[SMARTNEWSLETTER]'); $inText = strpos($content, '[SMARTNEWSLETTER]'); $inHTMLK2 = strpos($alt_content, '[SMARTK2]'); $inTextK2 = strpos($content, '[SMARTK2]'); $inHTMLflex = strpos($alt_content, '[SMARTFLEXI]'); $inTexflex = strpos($content, '[SMARTFLEXI]'); if ($inHTML === false and $inText === false and $inHTMLflex === false and $inTexflex === false and $inHTMLK2 === false and $inTextK2 === false) { $text = _JNEWS_NOSMARTTAG; echo "<script> alert('" . addslashes($text) . "'); window.history.go(-1);</script>\n"; return false; } return true; }
function jnewsbot_jcalpro_transformall(&$html, &$text, &$subject, $queueInfo = null) { $db = JFactory::getDBO(); $Itemid = $GLOBALS[JNEWS . '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 #__jcalpro2_events where `extid` = ' . intval($parameters[0]); $db->setQuery($query); $event = $db->loadObject(); $db->loadObject($event); 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="aca_jcalcontent">'; } $eventhtml .= '<span class="aca_jcaltitle">' . $event->title . '</span>'; $eventtext = strtoupper(jNews_ProcessMail::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" . jNews_ProcessMail::htmlToText($event->description); } if ($parameters[3]) { $link = 'option=com_jcalpro&extmode=view&extid=' . $event->extid . '&Itemid=' . $Itemid; $link = jNews_Tools::completeLink($link, false, $GLOBALS[JNEWS . 'use_sef']); $eventhtml .= '<br/><a href="' . $link . '"><span class="aca_readmore">' . _JNEWS_READMORE . '</span></a>'; $eventtext .= "\r\n" . ' * ' . _JNEWS_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 getContent($images, &$content, &$textonly, &$subject, $send = false, $isEdit = false, $queueInfo = null) { $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 = jNews_ProcessMail::htmlToText($content); $textonly = str_replace('{mosimage}', '', $textonly); } if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $imgfolders = '/images/stories'; } else { //j16 $imgfolders = '/images/sampledata'; } if (!empty($images)) { foreach ($images as $image) { $image_string = '<img src="' . JNEWS_JPATH_LIVE . $imgfolders . $image . '" />'; $content = preg_replace('/{mosimage}/', $image_string, $content, 1); } } if (!$isEdit) { $mainframe = JFactory::getApplication(); JPluginHelper::importPlugin('jnews'); $bot_results = $mainframe->triggerEvent('jnewsbot_transformall', array(&$content, &$textonly, &$subject, $queueInfo)); if (empty($queueInfo->mailingid)) { $queueInfo->mailingid = 0; } if (empty($queueInfo->listid)) { $queueInfo->listid = 0; } //we replace the empty p tags with br tag $content = str_replace('<p> </p>', '<br />', $content); $content = str_replace('<p></p>', '<br />', $content); $content = str_replace('<p> </p>', '<br />', $content); $fwdObj = new stdClass(); $fwdObj->mailingid = !empty($queueInfo->id) ? $queueInfo->id : 0; $fwdObj->listid = !empty($queueInfo->list_id) ? $queueInfo->list_id : 0; $jomsocial = $mainframe->triggerEvent('jnewsbot_jomsocial_members', array(&$content, &$textonly, '')); //to replace jomsocial tags } $content = jNews_Mailing::replaceOldTagsToNew($content); if (empty($subject)) { //we have no subject probably because one of the bot define that we should not send the newsletter //we cancel this mail $this->cancelMailing = true; return false; } $content = str_replace($replaceTag, $replaceBy, $content); $content = preg_replace('#src[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'src="' . JNEWS_JPATH_LIVE_NO_HTTPS . '/', $content); $content = preg_replace('#href[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'href="' . JNEWS_JPATH_LIVE_NO_HTTPS . '/', $content); $content = str_replace($replaceBy, $replaceTag, $content); return true; }
/** public static function that will save mailing * @param int $mailingId - mailing id * @param int $listId - list id */ public static function saveMailing(&$mailingId, $listId) { $total = 0; $list = jNews_Lists::getOneList($listId); // $allow_html = jNews_Tools::allow_html(); $xf = new jNews_Config(); $db = JFactory::getDBO(); // check list type $mailingtype = JRequest::getVar('listype', 0); if (empty($mailingtype)) { $mySess = JFactory::getSession(); $listType = $mySess->set('listype', '', 'LType'); } else { $listType = $mailingtype; } $senddate = JRequest::getVar('senddate', 0); $task = JRequest::getVar('task', ''); if ($task == 'saveSend') { $senddate = time(); } $subject = JRequest::getVar('subject', '', 'request', 'string'); // $content = JRequest::getVar('content', '', 'request','string', JREQUEST_ALLOWRAW); $content = JRequest::getVar('jnewsContent', '', 'request', 'string', JREQUEST_ALLOWRAW); $alt_content = JRequest::getVar('altbody', '', JREQUEST_ALLOWRAW); $published = JRequest::getVar('published', 0); $visible = JRequest::getVar('visible', 1); $html = JRequest::getVar('html_mailings', 1); $new_list = JRequest::getVar('new_list', 0); $fromname = JRequest::getVar('fromname', ''); $fromemail = JRequest::getVar('fromemail', ''); $frombounce = JRequest::getVar('frombounce', ''); $userid = JRequest::getVar('userid', 0); $delay = JRequest::getVar('delay', 0); $acc_level = JRequest::getVar('acc_level', $list->acc_id); $issue_nb = JRequest::getVar('issue_nb', 1); if ($mailingtype == 7) { $issue_nb = 1; } $attachments = JRequest::getVar('attachments', ''); $follow_up = JRequest::getVar('follow_up', 0); $cat_id = JRequest::getVar('cat_id', ''); $delay_max = JRequest::getVar('delay_max', 7); $delay_min = JRequest::getVar('delay_min', 0); $notify_id = JRequest::getVar('notify_id', 0); $next_date = JRequest::getVar('next_date', 0); $start_date = JRequest::getVar('start_date', 0); $smart_date = JRequest::getVar('smart_date', 0); $listIdA = JRequest::getVar('aca_mailing_addto', array()); //clean up $cat_id if (!empty($cat_id)) { $cat_idA = explode(',', $cat_id); if (count($cat_idA) > 1) { //remove the all category $newcat_idA = array(); foreach ($cat_idA as $oneCat_id) { if ($oneCat_id != '0:0') { $newcat_idA[] = $oneCat_id; } } $cat_id = trim(implode(',', $newcat_idA), ','); } } $createdate = time(); //get the default template $template = jNews_Templates::loadOneTemplate('*', '', 'template_id', 'DESC', true); $template_id = JRequest::getVar('template_id', $template->template_id); // change start_date type from string to int if (!empty($senddate) and $task != 'saveSend') { $senddate = strtotime($senddate); $senddate = $senddate - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z'); if ($senddate <= time()) { $senddate = 0; } } elseif (!empty($senddate) && $task == 'saveSend') { //not used any more $senddate = $senddate; } else { $senddate = 0; } if (!empty($start_date)) { $start_date = strtotime($start_date); $start_date = $start_date - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z'); } if (!empty($next_date)) { $next_date = strtotime($next_date); $next_date = $next_date - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z'); } if (!empty($create_date)) { $create_date = strtotime($create_date); $create_date = $create_date - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z'); } $delay = $delay * 24 * 60; $attach = ''; if (!empty($attachments)) { foreach ($attachments as $attachment) { $attach .= $attachment . "\n"; } } if (!empty($_FILES['file_0']['name'])) { $otherAttachs = jNews_Mailing::uploadFiles(); if (!empty($otherAttachs)) { foreach ($otherAttachs as $otherAttach) { $attach .= '/' . $otherAttach . "\n"; } } } $images = JRequest::getVar('images', ''); if (empty($alt_content)) { $alt_content = jNews_ProcessMail::htmlToText($content); } else { $alt_content = "<pre>" . $alt_content . "</pre>"; } if ($listType == 2) { // auto-repsonders $senddate = time() + $delay * 60; } else { if ($senddate > time()) { $published = 2; } } if ($GLOBALS[JNEWS . 'show_subscriptionlink']) { if (substr_count($content, '{tag:subscriptions}') < 1) { $content .= "<br/> {tag:subscriptions} <br/>"; } if (strlen($alt_content) > 10 and substr_count($alt_content, '{tag:subscriptions}') < 1) { $alt_content .= "\r\n {tag:subscriptions} \r\n"; } } if ($GLOBALS[JNEWS . 'show_unsubscribelink']) { if (substr_count($content, '{tag:unsubscribe}') < 1) { $content .= "<br/> {tag:unsubscribe} <br/>"; } if (strlen($alt_content) > 10 and substr_count($alt_content, '{tag:unsubscribe}') < 1) { $alt_content .= "\r\n {tag:unsubscribe}\r\n"; } } // save to cross table if (!empty($listIdA) && !empty($listIdA)) { $myLIst2Add = array(); foreach ($listIdA as $listid => $values) { if ($values == 1) { $myLIst2Add[$listid] = true; } } } else { // we dont have any list selected return false; } //in saving in case there are still old tag format we will replace with new //we replce the oldtags to new tags $mailing = new stdClass(); $mailing->htmlcontent = jNews_Mailing::replaceOldTagsToNew($content); $mailing->textonly = jNews_Mailing::replaceOldTagsToNew($alt_content); if ($new_list != 0) { //NEW MAILING //information to be inserted $mailing->list_id = $listId; $mailing->mailing_type = $mailingtype; $mailing->senddate = $senddate; $mailing->subject = $subject; $mailing->htmlcontent = $content; $mailing->textonly = $alt_content; $mailing->attachments = $attach; $mailing->images = $images; $mailing->published = $published; $mailing->visible = $visible; $mailing->fromname = $fromname; $mailing->fromemail = $fromemail; $mailing->frombounce = $frombounce; $mailing->html = $html; $mailing->delay = $delay; $mailing->issue_nb = $issue_nb; $mailing->acc_level = $acc_level; $mailing->createdate = $createdate; $mailing->follow_up = $follow_up; if (empty($mailing->follow_up)) { $mailing->follow_up = 0; } $mailing->cat_id = $cat_id; $mailing->delay_max = $delay_max; $mailing->delay_min = $delay_min; $mailing->notify_id = $notify_id; $mailing->next_date = $next_date; $mailing->start_date = $start_date; $mailing->smart_date = $smart_date; $mailing->mailing_type = $mailingtype; $mailing->list_id = $listId; $mailing->author_id = $userid; $mailing->template_id = $template_id; //insert the mailing data $mailingId = jNews_Mailing::insertMailingData($mailing); $db->setQuery('SELECT LAST_INSERT_ID()'); $mailingId = $db->loadResult(); $xf->plus('totalmailing0', 1); $xf->plus('act_totalmailing0', 1); $xf->plus('totalmailing' . $listType, 1); $xf->plus('act_totalmailing' . $listType, 1); if ($listType == 7) { jNews_Queue::addSNinQueue($mailingId, $delay_min, $start_date, $mailing->next_date); } //modified for smartnewsletter added next_date jNews_Mailing::saveMailingList($mailingId, array_keys($myLIst2Add), $senddate, $listType, $published, (bool) $new_list); //if we have an auto-responder we need to make sure the new auto-responders get added to all current subscribed users if ($published && $mailingtype == 2) { //add the this auto-responders to all users //select all user subscribe to this autoresponder $query = "SELECT L.`subscriber_id`, L.`subdate`+" . $delay . ", " . $mailingId . ", 2, 1 FROM `#__jnews_listssubscribers` AS L "; $query .= " WHERE L.`list_id` =" . $listId; $query2 = "INSERT IGNORE `#__jnews_queue` ( `subscriber_id`, `send_date`, `mailing_id`, `type`, `priority` ) " . $query; $db->setQuery($query2); $db->query(); } } else { //update mailing $query = 'SELECT `send_date`,`published`,`delay` FROM `#__jnews_mailings` WHERE `id` =' . $mailingId; $db->setQuery($query); $mailingInfoO = $db->loadObject(); $queueSendDateUpdate = $mailingInfoO->send_date != $senddate ? true : false; $queuePublishUpdate = $mailingInfoO->published != $published ? true : false; $queueDelayUpdate = $mailingInfoO->delay != $delay ? $delay - $mailingInfoO->delay : 0; $query = "UPDATE `#__jnews_mailings` SET " . " `subject` = '" . addslashes($subject) . "', " . " `htmlcontent` = '" . addslashes($content) . "', " . " `textonly` = '" . addslashes($alt_content) . "', " . " `attachments` = '" . $attach . "', " . " `images` = '" . $images . "', " . " `published` = '" . $published . "', " . " `html` = " . $html . " , " . " `visible` = " . $visible . " , " . " `fromname` = '" . $fromname . "', " . " `fromemail` = '" . $fromemail . "', " . " `frombounce` = '" . $frombounce . "', " . " `author_id` = '" . $userid . "' , " . " `delay` = " . $delay . ", " . " `acc_level` = '" . $acc_level . "', " . " `send_date` = '" . $senddate . "', " . " `follow_up` = " . $follow_up . ", " . " `cat_id` = '" . $cat_id . "', " . " `delay_max` = " . (int) $delay_max . ", " . " `delay_min` = " . (int) $delay_min . ", " . " `notify_id` = " . (int) $notify_id . ", " . " `next_date` = " . (int) $next_date . ", " . " `template_id` = " . (int) $template_id . ", " . " `start_date` = " . (int) $start_date . ", " . " `smart_date` = " . (int) $smart_date . " " . " WHERE `id` =" . $mailingId; $db->setQuery($query); $db->query(); jNews_Mailing::saveMailingList($mailingId, array_keys($myLIst2Add), $senddate, $listType, $published, (bool) $new_list, $queueSendDateUpdate, $queuePublishUpdate, $queueDelayUpdate); if ($published && $mailingtype == 2) { $query_check = "SELECT `qid` FROM `#__jnews_queue` WHERE `type` = '8' AND `mailing_id` = '{$mailingId}'"; $db->setQuery($query_check); $additionInfo = $db->loadObjectList(); if (is_array($additionInfo) && !empty($additionInfo)) { $query_update = "UPDATE `#__jnews_queue` SET `type` = '2' WHERE mailing_id = {$mailingId}"; $db->setQuery($query_update); $db->query(); } } } return true; }
function _convertAndLayoutText($articleA, $layout) { global $mainframe; if (empty($layout)) { $layout = 1; } foreach ($articleA as $oneArticle) { if (version_compare(JVERSION, '1.6.0', '<')) { $Itemid = $mainframe->getItemId($oneArticle->id); } if (empty($Itemid)) { $Itemid = $GLOBALS[JNEWS . 'itemidAca']; } if ($GLOBALS[JNEWS . 'show_author'] == 1) { $author = "\r\n" . $oneArticle->created_by_alias; } else { $author = ''; } $oneArticle->title = "<b>" . strtoupper(jNews_ProcessMail::htmlToText($oneArticle->title)) . "</b>"; $oneArticle->introtext = jNews_ProcessMail::htmlToText($oneArticle->introtext); $oneArticle->fulltext = jNews_ProcessMail::htmlToText($oneArticle->fulltext); if ($layout == 0) { $text = $oneArticle->title . $author . "\r\n" . $oneArticle->introtext . "\r\n" . $oneArticle->fulltext . "\r\n" . $text; } else { $link = 'option=com_content&view=article&id=' . $oneArticle->id . '&Itemid=' . $Itemid; $link = jNews_Tools::completeLink($link, false, $GLOBALS[JNEWS . 'use_sef']); if ($layout == 1) { if (empty($oneArticle->fulltext) and !empty($GLOBALS[JNEWS . 'word_wrap'])) { if (strlen($oneArticle->introtext) > $GLOBALS[JNEWS . 'word_wrap']) { $oneArticle->introtext = substr(strip_tags($oneArticle->introtext), 0, $GLOBALS[JNEWS . 'word_wrap']) . '...'; } } $text = $oneArticle->title . $author . "\r\n" . $oneArticle->introtext . "\r\n" . '* ' . _JNEWS_READMORE . ' ( ' . $link . ' )' . "\r\n"; } else { $text = $oneArticle->title . ' ( ' . $link . ' )'; } } $text = str_replace('{mosimage}', '', $text); } $text = str_replace('{mospagebreak}', "\r\n \r\n", $text); }