static function displaySocialShare($mailingId = 0, $social = 'facebook', $full_screen = false) { $socialShareHTML = ''; $Itemid = $GLOBALS[JNEWS . 'itemidAca']; $archivelink = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=view&mailingid=' . $mailingId, false, $GLOBALS[JNEWS . 'use_sef']); $subject = jNews_Mailing::getMailingsSubject($mailingId); if ($social == 'twitter') { $img = 'twitter.png'; $link = "http://twitter.com/home?status=" . urlencode($archivelink) . "&title=" . $subject; $title = "Share on Twitter"; } elseif ($social == 'linkedin') { $img = 'linkedin.png'; $link = "http://www.linkedin.com/shareArticle?mini=true&url=" . urlencode($archivelink) . "&title=" . $subject; $title = "Share on LinkedIn"; } else { $img = 'facebook.png'; $full_screen_text = $full_screen ? "&format=raw" : ""; $link = "http://www.facebook.com/sharer.php?u=" . urlencode($archivelink . $full_screen_text) . "&title=" . $subject; $title = "Share on Facebook"; } $imageLink = '<a target="_blank" href="' . $link . '" title="' . $title . '"><img src="' . JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/images/share/' . $img . '" width="16" height="16" border="0" alt="" /></a>'; $socialShareHTML .= '<td>' . $imageLink . '</td>'; return $socialShareHTML; }
public static function importBis() { @set_time_limit(0); $returnMessage = ''; //If memory_limit less than 128M $limit = jnews::convertToBytes(@ini_get('memory_limit')); if ($limit < jnews::convertToBytes('128M')) { @ini_set('memory_limit', '128M'); } $allAvailableListsA = JRequest::getVar('sub_list_id', ''); $list2SubcribeToA = JRequest::getVar('subscribed', ''); $filename = $_FILES['importfile']['name']; if (!empty($filename)) { //if we import a file //the flag is true coz we add subscribers in frontend through rows $saveSubsInRows = true; $path = JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'upload_url']; $path = str_replace(array('/', '\\'), DS, $path); if (!is_writable($path)) { $returnMessage .= '<br/>The file could not be imported because the folder is not writable.'; $returnMessage .= '<br/>Please make sure the path "' . JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'upload_url'] . '" is writable'; return $returnMessage; } if (!@move_uploaded_file($_FILES['importfile']['tmp_name'], $path . $filename)) { $path .= DS; if (!@move_uploaded_file($_FILES['importfile']['tmp_name'], $path . $filename)) { $returnMessage .= _JNEWS_ERROR_MOVING_UPLOAD; $returnMessage .= '<br/>Please make sure the path "' . JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'upload_url'] . '" is writable'; return $returnMessage; } } $import = file_get_contents($path . $filename); $import = str_replace(array("\r\n", "\r"), "\n", $import); $allLinesA = explode("\n", $import); } else { //if we add subscribers in frontend through rows //the flag is true coz we add subscribers in frontend through rows $saveSubsInRows = true; //we get the number of rows $rows = JRequest::getVar('count', ''); $nRows = intval($rows) - 1; if ($nRows == 0) { $nRows = intval($GLOBALS[JNEWS . 'create_newsubsrows']); } //we get the value of each element from the rows for ($count = 1; $count <= $nRows; $count++) { $allLinesA[$count] = JRequest::getVar('name' . $count, '') . ', ' . JRequest::getVar('email' . $count, '') . ', ' . JRequest::getVar('receive_html' . $count, '') . ', ' . JRequest::getVar('confirmed' . $count, '') . ', ' . JRequest::getVar('column1' . $count, '') . ', ' . JRequest::getVar('column2' . $count, '') . ', ' . JRequest::getVar('column3' . $count, '') . ', ' . JRequest::getVar('column4' . $count, '') . ', ' . JRequest::getVar('column5' . $count, ''); } } if (empty($allLinesA)) { return false; } $db = JFactory::getDBO(); $insertQuery = ''; $selectQuery = ''; $firstValue = true; $time = time(); $totalInsert = 0; $allSubscribersIDA = array(); foreach ($allLinesA as $line) { $line = trim($line); if (empty($line)) { continue; } $line = str_replace(';', ',', $line); $subscriberA = explode(',', $line); $email = trim($subscriberA[1], ' "\''); if (!jNews_Subscribers::validEmail($email)) { if (!$saveSubsInRows) { //if import of file is done echo '<br />' . jnews::printM('red', _JNEWS_EMAIL_INVALID . ': ' . $email); continue; } else { continue; } } if ($GLOBALS[JNEWS . 'level'] > 2) { $column4 = !empty($subscriberA[4]) ? mysql_escape_string(trim($subscriberA[4], '"')) : ''; $column5 = !empty($subscriberA[5]) ? mysql_escape_string(trim($subscriberA[5], '"')) : ''; $column6 = !empty($subscriberA[6]) ? mysql_escape_string(trim($subscriberA[6], '"')) : ''; $column7 = !empty($subscriberA[7]) ? mysql_escape_string(trim($subscriberA[7], '"')) : ''; $column8 = !empty($subscriberA[8]) ? mysql_escape_string(trim($subscriberA[8], '"')) : ''; $ip = !empty($subscriberA[9]) ? mysql_escape_string(trim($subscriberA[9], '"')) : ''; } $comfirmation = $GLOBALS[JNEWS . 'require_confirmation'] ? 0 : (int) trim($subscriberA[3], ' "\''); // i need to know if exist user $db = JFactory::getDBO(); $quer = "SELECT id FROM `#__jnews_subscribers` WHERE `email` = '{$email}'"; $db->setQuery($quer); $res = $db->loadResult(); if ($res) { //i need to update $isResiveHtml = (int) trim($subscriberA[2], ' "\''); $querUpdate = "UPDATE `#__jnews_subscribers` SET confirmed = '{$comfirmation}', receive_html= '{$isResiveHtml}',column1 = '{$column4}', column2 = '{$column5}', column3 = '{$column5}', column4 = '{$column7}', column5= '{$column8}',ip = '{$ip}' WHERE `email` = '{$email}'"; $db->setQuery($querUpdate); $db->query(); if (!empty($allAvailableListsA) && !empty($list2SubcribeToA)) { foreach ($list2SubcribeToA as $oneneedList => $noneed) { $listId = $allAvailableListsA[$oneneedList]; // $query = "INSERT IGNORE `#__jnews_listssubscribers` (`list_id`,`subscriber_id`,`subdate`) VALUES ({$listId}, {$res}, {$time})"; $db->setQuery($query); $db->query(); } } continue; } if (!$firstValue) { $insertQuery .= ','; } /*$insertQuery .= '(\''. htmlentities(trim($subscriberA[0],' "\'') ) . '\',\''.$email.'\','.$comfirmation.','.(int)trim($subscriberA[2],' "\'').',\''.$time.'\',\''.$column4.'\',\''.$column5.'\',\''.$column6.'' . '\',\''.$column7.'\',\''.$column8.'\',\''.$ip.'\')';*/ $insertQuery .= '(\'' . addslashes(trim($subscriberA[0], ' "\'')) . '\',\'' . $email . '\',' . $comfirmation . ',' . (int) trim($subscriberA[2], ' "\'') . ',\'' . $time . '\',\'' . $column4 . '\',\'' . $column5 . '\',\'' . $column6 . '' . '\',\'' . $column7 . '\',\'' . $column8 . '\',\'' . $ip . '\')'; if (!$firstValue) { $selectQuery .= ','; } $selectQuery .= '\'' . $email . '\''; $firstValue = false; $totalInsert++; if ($totalInsert % 50 == 0) { if (empty($insertQuery)) { continue; } $db = JFactory::getDBO(); $query = 'INSERT IGNORE `#__jnews_subscribers` (`name`,`email`,`confirmed`,`receive_html`,`subscribe_date`,`column1`,`column2`,`column3`,`column4`,`column5`,`ip`) VALUES ' . $insertQuery; $db->setQuery($query); $db->query(); $firstValue = true; $insertQuery = ''; //get the id of the subscribers $query = 'SELECT `id` FROM `#__jnews_subscribers` WHERE `email` IN (' . $selectQuery . ')'; $db->setQuery($query); $loadResultArray = $db->loadObjectList(); $resultsSubClA = jnews::convertObjectList2Array($loadResultArray); $allSubscribersIDA = array_merge($allSubscribersIDA, $resultsSubClA); $selectQuery = ''; } else { if (empty($insertQuery)) { return false; } $db = JFactory::getDBO(); $query = 'INSERT IGNORE `#__jnews_subscribers` (`name`,`email`,`confirmed`,`receive_html`,`subscribe_date`,`column1`,`column2`,`column3`,`column4`,`column5`,`ip`) VALUES ' . $insertQuery; $db->setQuery($query); $db->query(); } } //send confirmation email if required if ($GLOBALS[JNEWS . 'require_confirmation'] && !empty($list2SubcribeToA)) { $list4Message = $allAvailableListsA[key($list2SubcribeToA)]; $myList = jNews_Lists::getOneList($list4Message); $myList->subscribemessage = trim($myList->subscribemessage); if (empty($myList->subscribemessage) || substr_count($myList->subscribemessage, '{tag:confirm}') < 1) { $Sub_TAG = '{tag:confirm}'; //'[CONFIRM]'; } else { $Sub_TAG = ''; } $mailing = new stdClass(); if (!empty($myList->subscribemessage)) { $mailing->htmlcontent = $myList->subscribemessage; $mailing->textonly = $myList->subscribemessage; } else { // default message $mailing->textonly = 'Please confirm your subscription to our website by clicking on the following link.'; $mailing->htmlcontent = '<br />' . $mailing->textonly . '<br /><br />'; } $mailing->textonly .= $Sub_TAG; $mailing->htmlcontent .= $Sub_TAG; //insert the mailing in the mailing table $mailing->mailing_type = 1; $mailing->template_id = 0; $mailing->senddate = $time; $mailing->subject = _JNEWS_SUBSCRIBE_SUBJECT_MESS; $mailing->attachments = ''; $mailing->images = ''; $mailing->published = 1; $mailing->html = 1; $mailing->visible = 0; $mailing->fromname = ''; $mailing->fromemail = ''; $mailing->frombounce = ''; $mailing->author_id = 0; $mailing->delay = 0; $mailing->follow_up = 0; $mailing->cat_id = 0; $mailing->delay_min = 0; $mailing->delay_max = 0; $mailing->notify_id = 0; $mailing->next_date = 0; $mailing->start_date = $time - 2; $mailing->issue_nb = 0; $mailing->createdate = $time; $mailing->acc_level = 0; $mailingID = jNews_Mailing::insertMailingData($mailing); //enter the emails in the queue $query = 'INSERT IGNORE INTO `#__jnews_queue` (`subscriber_id`,`mailing_id`,`send_date`,`priority`) '; $query .= 'SELECT `id`,' . intval($mailingID) . ',' . $time . ',1'; $query .= ' FROM `#__jnews_subscribers` '; $query .= 'WHERE `subscribe_date`=' . $time . ' AND `confirmed`=0'; $db->setQuery($query); $db->query(); } if (!empty($selectQuery)) { //get the id of the subscribers $query = 'SELECT `id` FROM `#__jnews_subscribers` WHERE `email` IN (' . $selectQuery . ')'; $db->setQuery($query); $loadResultArray = $db->loadObjectList(); $resultsSubClA = jnews::convertObjectList2Array($loadResultArray); $allSubscribersIDA = array_merge($allSubscribersIDA, $resultsSubClA); } if (!empty($allAvailableListsA)) { //if lists in checkbox are not empty if (empty($list2SubcribeToA)) { jnews::printM('red', 'You need to select at least one list. Emails have been imported but not subscribed.'); if ($GLOBALS[JNEWS . 'require_confirmation']) { return 'The confirmation email cannot be sent because there is not list selected to subscribe the users.'; } else { return _JNEWS_IMPORT_FINISHED; } } foreach ($list2SubcribeToA as $oneselected => $vval) { $seleeected[] = $allAvailableListsA[$oneselected]; } foreach ($list2SubcribeToA as $oneneedList => $noneed) { $listId = $allAvailableListsA[$oneneedList]; // $query = 'INSERT IGNORE `#__jnews_listssubscribers` (`list_id`,`subscriber_id`,`subdate`) VALUES '; $firstTime = true; if (!empty($allSubscribersIDA)) { foreach ($allSubscribersIDA as $oneSubcriber) { if (!$firstTime) { $query .= ','; } $query .= '(' . $listId . ',' . $oneSubcriber . ',' . $time . ')'; $firstTime = false; if (jNews_Lists::getListType($listId) == 2) { //we add directly the imported subscribers to the queue if they are imported to an autoresponder type of list jNews_ListsSubs::subscribeARtoQueue($oneSubcriber, $listId); // } else { if (jNews_Lists::getListType($listId) == 1) { $arrayFollowUp = jNews_Subscribers::followInSelected($listId); if (!$arrayFollowUp) { continue; } foreach ($arrayFollowUp as $onefollow_id) { if (in_array($onefollow_id, $seleeected)) { continue; } $query .= ',(' . $onefollow_id . ',' . $oneSubcriber . ',' . $time . ')'; jNews_ListsSubs::subscribeARtoQueue($oneSubcriber, $onefollow_id); } } } } $db->setQuery($query); $db->query(); } } } else { //otherwise we get the value from dropdown box $listId = JRequest::getVar('opted_list', ''); if ($listId) { $query = 'INSERT IGNORE `#__jnews_listssubscribers` (`list_id`,`subscriber_id`,`subdate`) VALUES '; $firstTime = true; if (!empty($allSubscribersIDA)) { foreach ($allSubscribersIDA as $oneSubcriber) { if (!$firstTime) { $query .= ','; } $query .= '(' . $listId . ',' . $oneSubcriber . ',' . $time . ')'; $firstTime = false; if (jNews_Lists::getListType($listId) == 2) { //we add directly the imported subscribers to the queue if they are imported to an autoresponder type of list jNews_ListsSubs::subscribeARtoQueue($oneSubcriber, $listId); } else { if (jNews_Lists::getListType($listId) == 1) { $arrayFollowUp = jNews_Subscribers::followInSelected($listId); if (!$arrayFollowUp) { continue; } foreach ($arrayFollowUp as $onefollow_id) { if (in_array($onefollow_id, $seleeected)) { continue; } $query .= ',(' . $onefollow_id . ',' . $oneSubcriber . ',' . $time . ')'; jNews_ListsSubs::subscribeARtoQueue($oneSubcriber, $onefollow_id); } } } } $db->setQuery($query); $db->query(); } } } if ($saveSubsInRows) { //if adding subscribers in frontend through rows jnews::printM('green', count($allSubscribersIDA) . ' subscribers successfully added!'); } else { //otherwise we import subscribers jnews::printM('green', count($allSubscribersIDA) . ' subscribers successfully imported!'); } return _JNEWS_IMPORT_FINISHED; }
public static function subject($mailingEdit, $lists, $show) { ?> <fieldset class="jnewscss jnewshead"> <table class="jnewstabletable" cellspacing="1" border="0"> <tbody> <tr> <td width="110px" class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_INFO_LIST_SUBJET; $title = _JNEWS_SUBJECT; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <?php $text = str_replace('"', '"', $mailingEdit->subject); if (function_exists('htmlspecialchars_decode')) { $text = htmlspecialchars_decode($text, ENT_NOQUOTES); } elseif (function_exists('html_entity_decode')) { $text = html_entity_decode($text, ENT_NOQUOTES); } echo ' <input type="text" name="subject" class="inputbox" size="40" maxlength="110" value="' . $text . '" />'; ?> </td> </tr> <?php if (JRequest::getVar('act', '', '', 'WORD') == 'mailing' and JRequest::getInt('listype') == 2) { ?> <tr> <td class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_ARINFO_LIST_DELAY; $title = _JNEWS_AUTO_DELAY; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <?php $mailid = JRequest::getVar('mailingid'); $delay = !empty($mailid) ? $mailingEdit->delay / 1440 : jNews_Mailing::countMailings(0, 2); ?> <input type="text" name="delay" class="inputbox" size="5" maxlength="10" value="<?php echo $delay; ?> " /> </td> </tr> <?php } ?> <?php if (JRequest::getVar('act', '', '', 'WORD') == 'mailing' and JRequest::getInt('listype') == 1 and class_exists('jNews_Auto')) { ?> <tr> <td class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_INFO_LIST_DATE; $title = _JNEWS_LIST_DATE; $tip .= '<br/>(Actual server time is ' . date('Y-m-d H:i:s', jnews::getNow(0, true)) . ' )'; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <?php if (!isset($doc)) { $doc = JFactory::getDocument(); } $doc->addStyleSheet(JNEWS_URL_INCLUDES . 'calendar2/css/calendar.css'); $doc->addScript(JNEWS_URL_INCLUDES . 'calendar2/js/calendar.js'); if ($mailingEdit->send_date == 0) { $mailingEdit->send_date = date('Y-m-d H:i:s', jnews::getNow(0, true)); } elseif ($mailingEdit->id == 0) { $mailingEdit->send_date = date('Y-m-d H:i:s', jnews::getNow(0, true)); } else { $mailingEdit->send_date = date('Y-m-d H:i:s', jnews::getNow(0, true, $mailingEdit->send_date)); } ?> <input id="acaCalendar" type="text" value="<?php echo $mailingEdit->send_date; ?> " name="senddate"> <input title="<?php echo _JNEWS_DATETIME; ?> " type="button" class="calendarDash" value="" onclick="displayCalendar(document.getElementById('acaCalendar'),'yyyy-mm-dd hh:ii',this,true)"> </td> </tr> <?php } ?> <?php if ($show['published']) { ?> <tr> <td width="80" class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_INFO_LIST_PUB; $title = _JNEWS_PUBLISHED; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td><?php echo $lists['published']; ?> </td> </tr> <?php } ?> <?php if ($show['hide']) { ?> <tr> <td width="80" class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_INFO_MAILING_VISIBLE; $title = _JNEWS_VISIBLE_FRONT; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td><?php echo $lists['visible']; ?> </td> </tr> <?php } ?> <?php $javascript = "function updateEditor(htmlvalue){"; $javascript .= 'if(htmlvalue == \'0\'){window.document.getElementById("htmlfieldset").style.display = \'none\'}else{window.document.getElementById("htmlfieldset").style.display = \'block\'}'; $javascript .= '}'; $javascript .= 'window.addEvent(\'load\', function(){ updateEditor(' . $mailingEdit->html . '); });'; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($javascript); ?> <tr> <td width="185" class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_INFO_LIST_HTML; $title = _JNEWS_HTML_MAILING; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </td> <td> <?php echo $lists['html_mailings']; ?> </td> </tr> <?php //} ?> </tbody> </table> </fieldset> <?php }
public static function fwdtofriend($action, $task) { jimport('joomla.html.parameter'); $mainframe = JFactory::getApplication(); JPluginHelper::importPlugin('jnews'); $plugin = JPluginHelper::getPlugin('jnews', 'forwardtofriend'); $registry = new JRegistry(); if (!method_exists($registry, 'loadString')) { $data = trim($plugin->params); $options = array('processSections' => false); if (substr($data, 0, 1) != '{' && substr($data, -1, 1) != '}') { $ini = JRegistryFormat::getInstance('INI'); $obj = $ini->stringToObject($data, $options); } else { $obj = json_decode($data); } $registry->loadObject($obj); } else { $registry->loadString($plugin->params); } $params = $registry; if ($task == 'sendtofriend') { $new = false; $mailingID = JRequest::getInt('mailingid'); $html = JRequest::getInt('html'); $html1 = $html ? 'true' : 'false'; $mailing = new stdClass(); $mailing = jNews_Mailing::getOneMailing('', $mailingID, '', $new, $html1); //&$new $mailing->fromname = JRequest::getVar('fromName'); $mailing->fromemail = JRequest::getVar('fromEmail'); $mailing->frombounce = JRequest::getVar('fromEmail'); $mailing->id = $mailingID; $mailing->issue_nb = 0; $mailing->images = ''; $mailing->attachments = ''; $receiversNames = JRequest::getVar('toName', array(), '', 'array'); $receiversEmails = JRequest::getVar('toEmail', array(), '', 'array'); $message = new stdClass(); $message->dflt = JRequest::getVar('message'); $message->inEmail = JRequest::getVar('inEmailMessage'); //need to get it from the URL/request $list = new stdClass(); $list->id = JRequest::getInt('listid'); $list->html = $html; $botResult = $mainframe->triggerEvent('jnewsbot_sendtofriend', array($mailing, $message, $receiversNames, $receiversEmails, $list)); if (empty($plugin)) { echo '<center><span style="font-size: 1.3em;">The <strong>jNews: Forward to friend</strong> plugin is either not installed or published. Click <a target="_blank" href="administrator/index.php?option=com_plugins&client=site&filter_type=jnews">here</a> to check if it\'s installed or published.</span></center>'; } } else { $botResult = $mainframe->triggerEvent('jnewsbot_fwdtofriend', array($params)); if (empty($plugin)) { echo '<center><span style="font-size: 1.3em;">The <strong>jNews: Forward to friend</strong> plugin is either not installed or published. Click <a target="_blank" href="administrator/index.php?option=com_plugins&client=site&filter_type=jnews">here</a> to check if it\'s installed or published.</span></center>'; } } }
function mailing($action, $task, $listId, $listType, $mailingId, $message) { $showMailings = false; $db = JFactory::getDBO(); switch ($task) { case 'edit': $issue_nb = JRequest::getInt('issue_nb', 1); $mailingType = JRequest::getVar('listype'); $isEdit = JRequest::getVar('isEdit', true); $mySess = JFactory::getSession(); $mySess->set('listype', $mailingType, 'LType'); if (!empty($listId)) { $list = jNews_Lists::getOneList($listId); } else { $list = jNews_Lists::getListFirstEntry(); } $new = empty($mailingId) || $mailingId == 0 ? true : false; $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new, false, true); $mailing->mailing_type = $mailingType; // if(empty($isEdit)) $isEdit = true; // set default mailing parameters $my = JFactory::getUser(); $subscribers = jNews_Subscribers::getSubscriberInfoFromUserId($my->id); if (!isset($subscribers)) { $subscribers = new stdClass(); } $subscribers->name = isset($subscribers->name) ? $subscribers->name : ''; $subscribers->email = isset($subscribers->email) ? $subscribers->email : ''; // $mailing->fromname = ( !isset( $mailing->fromname ) || empty( $mailing->fromname ) ) ? $subscribers->name : $mailing->fromname; // $mailing->fromemail = ( !isset( $mailing->fromemail ) || empty( $mailing->fromemail ) ) ? $subscribers->email : $mailing->fromemail; // $mailing->frombounce = ( !isset( $mailing->frombounce ) || empty( $mailing->frombounce ) ) ? $GLOBALS[JNEWS.'sendmail_from'] : $mailing->frombounce; $show = jNews_ListType::showType($mailing->mailing_type, 'editmailing'); if ($mailing->published != 1 or $mailing->mailing_type != 1 or isset($show['admin']) and $show['admin']) { $forms['main'] = " <form action='index.php' method='post' enctype='multipart/form-data' name='adminForm' id=\"adminForm\">"; jNews_Mailing::_header($task, $action, $mailing->mailing_type, $message, 'edit'); jNews_MailingsHTML::editMailing($mailing, $new, $listId, $forms, $show, $isEdit); $go[] = jnews::makeObj('act', $action); backHTML::formEnd($go); } else { $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; jNews_Mailing::_header($task, $action, $mailing->mailing_type, $message); //backHTML::formStart(); jNews_MailingsHTML::viewMailing($mailing, $forms); $go[] = jnews::makeObj('act', 'mailing'); $go[] = jnews::makeObj('task', 'viewmailing'); $go[] = jnews::makeObj('mailingid', $mailing->id); backHTML::formEnd($go); } break; case 'new': case 'add': // check if atleast one list exist and published // if false then restrict entry $mailingType = JRequest::getVar('listype'); $type = $mailingType == 2 ? 2 : 1; $result = jNews_Lists::checkListNotEmpty($type); if (!$result) { if ($type == 2) { $disp = addslashes(_JNEWS_CHECKCAMPAIGNFOUND); } else { $disp = addslashes(_JNEWS_CHECKLISTFOUND); } echo "<script> alert('" . $disp . "'); window.history.go(-1);</script>\n"; break; } $mailingType = JRequest::getVar('listype'); if (empty($listId)) { $listId = JRequest::getVar('listid'); } if (!empty($listId)) { $mailingType = jNews_Lists::getListType($listId) == 2 ? 2 : 1; } JRequest::setVar('listype', $mailingType); $total = jNews_Mailing::countMailings($listId, $mailingType); $total++; jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&mailingid=0&issue_nb=' . $total . '&listype=' . $mailingType . '&listid=' . $listId . '&isEdit=0'); //mariap break; case 'saveSend': JRequest::checkToken() or die('Invalid Token'); $mySess = JFactory::getSession(); $mailingType = $mySess->get('listype', '', 'LType'); $status = checkMailingSave($mailingType); if (!$status) { return false; } jNews_Mailing::saveMailing($mailingId, $listId); case 'sendready': //we update the senddate of the newsletter jNews_Mailing::updatesenddate($mailingId); jNews_MailingsHTML::sendReady($mailingId, $listId, $listType); break; case 'generate': if (class_exists('jNews_Auto')) { $still = false; $message = jnews::printYN(jNews_Auto::processQueue(true, true, $still, true), 'Queue processed', _JNEWS_ERROR); jNews_Auto::displayStatus(); } return; break; case 'send': $queueC = new jNews_Queue(); $queueC->checkForNewsletters($mailingId); $queueCount = jNews_Queue::getQueueCount($mailingId); $totalSub = JRequest::setVar('totalsend', $queueCount); $linkURL = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=continuesend&mailingid=' . $mailingId . '&totalsend=' . $totalSub, true, false, true); jNews_Tools::redirect($linkURL); break; case 'continuesend': $queueC = new jNews_Queue(); //we update the senddate of the mailing to be now to be able to continue the sending and send it after we click continue // $queueC->updateSenddateToNow($mailingId); $totalSend = JRequest::getVar('totalsend', 0, '', 'int'); $alreadySent = JRequest::getVar('alreadysent', 0, '', 'int'); $queueC->start = $alreadySent; $queueC->total = $totalSend; $queueC->pause = $GLOBALS[JNEWS . 'pause_time']; $queueC->sendQueue(false, $mailingId, false, true); ob_start(); exit; break; case 'testspam': if (empty($message)) { $message = _JNEWS_MESSAGE_NOT; } $mailingId = $mailingId == 0 ? jNews_Mailing::getLastMailingId() : $mailingId; $my = JFactory::getUser(); if ($listId > 0) { $archivemailing = jNews_Mailing::getMailingView($mailingId, $listId); } else { $archivemailing = jNews_Mailing::getMailingView($mailingId); } $mailing = new stdClass(); $receivers = new stdClass(); $receivers->email = '*****@*****.**'; $receivers->name = $archivemailing->fromname; $receivers->receive_html = 1; $receivers->id = jNews_Subscribers::getSubscriberIdFromUserId($my->id); //if email are different we dont replace because we want to make sure the spam cehck count the fact that //sender and bounce back are different if ($archivemailing->fromemail == $archivemailing->frombounce) { $archivemailing->frombounce = $my->email; } $archivemailing->fromemail = $my->email; $mailerC = new jNews_ProcessMail(); $status = $mailerC->send($archivemailing, $receivers); $message = jnews::printYN($status, _JNEWS_SPAMTEXT_MESSAGE_SENT_SUCCESSFULLY, $message); $link = 'http://www.joobi.co/index.php?option=com_jlinks&controller=redirect&link=SpamCheck&alt=jnewsdoc_glossary'; $iFrame = '<iframe src="' . $link . '" width="100%" height="680px" scrolling="auto"></iframe>'; echo $iFrame; break; case 'savePreview': JRequest::checkToken() or die('Invalid Token'); $status = checkMailingSave($mailingType); if (!$status) { return false; } if ($mailingType == 7) { $mailing = JRequest::getVar('mailing', ''); $ContentStatus = checkTag(); if (!$ContentStatus) { return false; } } jNews_Mailing::saveMailing($mailingId, $listId); case 'preview': $emailaddress = JRequest::getVar('emailaddress', ''); $mailingId = $mailingId == 0 ? jNews_Mailing::getLastMailingId() : $mailingId; if (!empty($emailaddress)) { $status = jNews_Mailing::sendTestEmail($mailingId, $listId); if (empty($message)) { $message = _JNEWS_MESSAGE_NOT; } $message = jnews::printYN($status, _JNEWS_MESSAGE_SENT_SUCCESSFULLY, $message); } if ($listId > 0) { $archivemailing = jNews_Mailing::getMailingView($mailingId, $listId); } else { $archivemailing = jNews_Mailing::getMailingView($mailingId); } $doc = JFactory::getDocument(); $css = '.icon-48-preview{ background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/preview.png)}'; $doc->addStyleDeclaration($css, $type = 'text/css'); $title = _JNEWS_PREVIEW_TITLE . ': ' . $archivemailing->subject; backHTML::_header(_JNEWS_PREVIEW_TITLE, 'preview.png', $message, $task, $action); //new view for the preview mailing echo '<table cellpadding="0" cellspacing="2" border="0" width="100%"><tr><td width="40%">'; jNews_MailingsHTML::previewMailingHTML($mailingId, $listId, $listType, $archivemailing->html); echo '</td><td width="60%">'; $forms['main'] = ''; $list = jNews_Lists::getOneList($archivemailing->list_id); $textonly = ''; $mailerC = new jNews_ProcessMail(); $queueInfo = new stdClass(); $queueInfo->mailingid = $mailingId; $queueInfo->listid = @$listId; $mailerC->getContent($archivemailing->images, $archivemailing->html, $archivemailing->textonly, $archivemailing->subject, false, true, $queueInfo); //new $archivemailing->subject if ($archivemailing->html == 1) { if (empty($template_id)) { $template_id = $archivemailing->template_id; } if (!empty($template_id)) { jNews_Templates::includeStyles($archivemailing->htmlcontent, $template_id); } } else { $archivemailing->textonly = jNews_ProcessMail::htmlToText($archivemailing->textonly); } //new view for the preview mailing jNews_MailingsHTML::viewHeading($archivemailing); echo '</td></tr><tr><td colspan="2">'; jNews_MailingsHTML::viewMailing($archivemailing, $forms); echo '</td></tr></tbody></table>'; if ($mailingId == 0) { JRequest::setVar('mailingid', $mailingId); } break; case 'view': $mailingType = JRequest::getVar('listype'); if (!empty($mailingType)) { $mySess = JFactory::getSession(); $mySess->set('listype', $mailingType, 'LType'); } if ($mailingId != 0) { if ($listId > 0) { $archivemailing = jNews_Mailing::getMailingView($mailingId, $listId); } else { $archivemailing = jNews_Mailing::getMailingView($mailingId); } if (empty($template_id)) { $template_id = $archivemailing->template_id; } if (!empty($template_id)) { jNews_Templates::includeStyles($archivemailing->htmlcontent, $template_id); } $forms['main'] = "<form action='index.php?option=" . JNEWS_OPTION . "&act=mailing&listype=" . $listType . "&listid=" . $listId . "' method='post' name='adminForm' id=\"adminForm\">"; jNews_Mailing::_header($task, $action, $listType, $message); backHTML::formStart('show_mailing', 0, ''); jNews_MailingsHTML::viewMailing($archivemailing, $forms); $go[] = jnews::makeObj('act', 'mailing'); $go[] = jnews::makeObj('task', 'viewmailing'); $go[] = jnews::makeObj('listId', $archivemailing->list_id); //listid to listId--original backHTML::formEnd($go); } break; case 'deletequeue': //implement here what are we going to do with the delete queueu column on the mailing $mailingID = JRequest::getVar('mailingid'); $mailingType = JRequest::getVar('listype'); if (!empty($mailingID)) { $db = JFactory::getDBO(); $db->setQuery('DELETE FROM `#__jnews_queue` WHERE `mailing_id` = ' . $mailingID); $db->query(); $message = jnews::printYN(true, _JNEWS_MAILING_QUEUE_DELETED, _JNEWS_ERROR); } else { $message = jnews::printYN(false, _JNEWS_MAILING_QUEUE_DELETED, _JNEWS_ERROR); } jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType, $message); break; case 'deleteMailing': JRequest::checkToken() or die('Invalid Token'); $d['mailing'] = jNews_Mailing::getOneMailing('', $mailingId, '', $new); $message = jnews::printYN(jNews_Mailing::delete($d), @constant($GLOBALS[JNEWS . 'listname' . $d['mailing']->list_type]) . '"' . $d['mailing']->subject . '"' . _JNEWS_SUCCESS_DELETED, _JNEWS_ERROR); $showMailings = true; break; case 'cancel': $url = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&mailingid=' . $mailingId; $url .= (!empty($listId) ? '&listid=' . $listId : '') . '&listype=' . $mailingType; jNews_Tools::redirect($url); break; case 'copy': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Mailing::copyMailing($mailingId), _JNEWS_MAILING_COPY, _JNEWS_ERROR); $showMailings = true; break; case 'cancelMailing': $showMailings = true; break; case 'publishMailing': JRequest::checkToken() or die('Invalid Token'); $mailing = jNews_Mailing::getOneMailing('', $mailingId, '', $new); $message = jnews::printYN(jNews_Mailing::publishMailing($mailingId), @constant($GLOBALS[JNEWS . 'listname' . $mailing->mailing_type]) . ' ' . _JNEWS_PUBLISHED, _JNEWS_ERROR); $mailingType = jNews_Mailing::getMailingInfoz($mailingId); jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType); break; case 'unpublishMailing': JRequest::checkToken() or die('Invalid Token'); $mailing = jNews_Mailing::getOneMailing('', $mailingId, '', $new); $message = jnews::printYN(jNews_Mailing::unpublishMailing($mailingId), @constant($GLOBALS[JNEWS . 'listname' . $mailing->mailing_type]) . ' ' . _JNEWS_UNPUBLISHED, _JNEWS_ERROR); $mailingType = jNews_Mailing::getMailingInfoz($mailingId); jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId); break; case 'cpanel': backHTML::controlPanel(); break; case 'save': JRequest::checkToken() or die('Invalid Token'); $subject = JRequest::getVar('subject', ''); if (empty($subject)) { echo "<script> alert('subject needs to be not empty'); window.history.go(-1);</script>\n"; return false; } if (!isset($mailingType)) { $mySess = JFactory::getSession(); $mailingType = $mySess->get('listype', '', 'LType'); } $status = checkMailingSave($mailingType); if ($mailingType == 7) { $mailing = JRequest::getVar('mailing', ''); $ContentStatus = checkTag(); if (!$ContentStatus) { return false; } } if (!$status) { return false; } $message = jnews::printYN(jNews_Mailing::saveMailing($mailingId, $listId), _JNEWS_MAILING_SAVED, _JNEWS_ERROR); if (!empty($mailingtype)) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId); $showMailings = true; unset($GLOBALS["task"]); unset($_REQUEST["task"]); } break; case 'apply': JRequest::checkToken() or die('Invalid Token'); $mailingid = JRequest::getVar('mailingid', '0'); if (!isset($mailingType)) { $mySess = JFactory::getSession(); $mailingType = $mySess->get('listype', '', 'LType'); } $status = checkMailingSave($mailingType); if ($mailingType == 7) { $mailing = JRequest::getVar('mailing', ''); $ContentStatus = checkTag(); if (!$ContentStatus) { return false; } } if (!$status) { return false; } $message = jnews::printYN(jNews_Mailing::saveMailing($mailingId, $listId), _JNEWS_MAILING_SAVED, _JNEWS_ERROR); $mailingid = $mailingid == 0 ? jNews_Mailing::getLastMailingId() : $mailingid; if (!empty($mailingtype)) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&listype=' . $mailingType . '&mailingid=' . $mailingid . '&listid=' . $listId); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&listype=' . $mailingType . '&mailingid=' . $mailingid . '&listid=' . $listId); $showMailings = true; unset($GLOBALS["task"]); unset($_REQUEST["task"]); } break; case 'show': $id = JRequest::getVar('mailingid'); $mySess = JFactory::getSession(); $mailingType = JRequest::getVar('listype', 0); $listId = JRequest::getVar('listid', 0); $link = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId; jNews_Tools::redirect($link); $showMailings = true; break; case 'toggle': $listid = JRequest::getVar('listid'); $column = JRequest::getVar('col'); $mailingid = JRequest::getVar('mailingid'); if (!empty($mailingid) && !empty($column)) { $passObj = new stdClass(); $passObj->tableName = '#__jnews_mailings'; $passObj->columnName = $column; $passObj->whereColumn = 'id'; $passObj->whereColumnValue = $mailingid; jnews::toggle($passObj); } if ($listType == 1) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listid=' . $listid . '&listype=1'); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listid=' . $listid . '&listype=2'); } break; default: $showMailings = true; break; } if ($showMailings) { if (empty($listType)) { $listType = JRequest::getVar('listype', 0); } if (empty($listId)) { $listId = JRequest::getVar('listid', 0); } $paginationStart = JRequest::getVar('pg'); if (!empty($paginationStart)) { $limitstart = 0; $limitend = $paginationStart; } else { $app = JFactory::getApplication(); $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int'); $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int'); } $limittotal = jNews_Mailing::countMailings(0, $listType); $setLimit = new stdClass(); $setLimit->total = !empty($limittotal) ? $limittotal : 0; $setLimit->start = !empty($limitstart) ? $limitstart : 0; $setLimit->end = !empty($limitend) ? $limitend : $limittotal; if ($setLimit->total == $setLimit->end) { $setLimit->start = 0; } jNews_Mailing::showMailings($task, $action, $listId, $listType, $message, true, _JNEWS_MENU_MAILING, $setLimit); } return true; }
/** * <p>public static function to create the custom cpanel menu</p> * @return boolean */ public static function _editMailingPrev() { $mailingType = JRequest::getVar('listype'); $mailingid = JRequest::getVar('mailingid', '0'); $listId = JRequest::getVar('listid', '0'); $mailingid = $mailingid == 0 ? jNews_Mailing::getLastMailingId() : $mailingid; $html = '<a class="btn btn-small" href="index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&listype=' . $mailingType . '&mailingid=' . $mailingid . '&listid=' . $listId . '"><span style="float:left;"><img width=16 height=16 src="' . JNEWS_PATH_ADMIN_IMAGES2 . 'toolbar/editT.png"/></span><span style="float:left; margin-left:8px;">' . _JNEWS_MENU_EDIT . '</span></a>'; $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Custom', $html); return true; }
public static function replaceTags($content, $subscriber, $oneQueue, $html, $tags = null, $showSign = true) { $mailingId = $oneQueue->id; $Itemid = $GLOBALS[JNEWS . 'itemidAca']; $listId = '0'; //can be empty $subscriptionslink = 'option=' . JNEWS_OPTION . '&Itemid=' . $Itemid . '&act=change&subscriber=' . $subscriber->id . '&cle=' . md5($subscriber->email); $unsubscribelink = 'option=' . JNEWS_OPTION . '&Itemid=' . $Itemid . '&act=unsubscribe&subscriber=' . $subscriber->id . '&mailingid=' . $mailingId . '&cle=' . md5($subscriber->email); $subscriptiontext = ''; $subscriptionslink = jNews_Tools::completeLink($subscriptionslink, false, $GLOBALS[JNEWS . 'use_sef']); $unsubscribelink = jNews_Tools::completeLink($unsubscribelink, false, $GLOBALS[JNEWS . 'use_sef']); if ($html) { $subscriptionslink = '<a href="' . $subscriptionslink . '" target="_blank"><span class="aca_subscribe">' . _JNEWS_CHANGE_EMAIL_SUBSCRIPTION . '</span></a>'; $unsubscribelink = '<a href="' . $unsubscribelink . '" target="_blank"><span class="aca_unsubscribe">' . _JNEWS_SAFEUNSUBSCRIBE . '</span></a>'; $subscriptionstext = '<p>' . $subscriptionslink . '<br />' . $unsubscribelink . '</p>'; } else { $subscriptionslink = _JNEWS_CHANGE_EMAIL_SUBSCRIPTION . ' ( ' . $subscriptionslink . ' )'; $unsubscribelink = _JNEWS_SAFEUNSUBSCRIBE . ' ( ' . $unsubscribelink . ' )'; $subscriptionstext = "\r\n" . $subscriptionslink . "\r\n" . $unsubscribelink; } $subscriptionstext = ''; if ($showSign && $GLOBALS[JNEWS . 'show_signature']) { if ($html) { $signatureText = '<a href="http://www.joobi.co" target="_blank">'; $signatureText .= '<br /><center><div style="width: 99%; color:#000; font-size: 0.8em; text-align: center; ">Powered by Joobi</div></center>'; $signatureText .= '</a>'; } else { $signatureText = '<br />Powered by Joobi ( http://www.joobi.co )'; } $subscriptionstext .= "\r\n\r\n" . $signatureText; } $confirmlink = 'option=' . JNEWS_OPTION . '&act=confirm&listid=' . $listId . '&cle=' . md5($subscriber->email) . '&subscriber=' . $subscriber->id . '&Itemid=' . $Itemid; $confirmlink = jNews_Tools::completeLink($confirmlink, false, $GLOBALS[JNEWS . 'use_sef']); //for rpelacement of the {tag:title} $mailSubject = ''; // $mailingid = empty($oneQueue->mailing_id) OR !isset($oneQueue->mailing_id) ? jNews_Queue::getQueueMailingId($oneQueue->id) : $oneQueue->mailing_id; $mailSubject = jNews_Mailing::getMailingsSubject($oneQueue->id); if ($html) { $confirmlink = '<a href="' . $confirmlink . '" target="_blank">' . _JNEWS_CONFIRM_LINK . '</a>'; } else { $confirmlink = _JNEWS_CONFIRM_LINK . "\n" . $confirmlink; } $tname = explode(" ", $subscriber->name); $firstname = $tname[0]; $username = empty($subscriber->username) ? $firstname : $subscriber->username; $archiveLink = 'option=' . JNEWS_OPTION . '&act=mailing&task=view&mailingid=' . $mailingId . '&Itemid=' . $Itemid; $archiveLink = jNews_Tools::completeLink($archiveLink, false, $GLOBALS[JNEWS . 'use_sef']); $archiveAll = '<a href="' . $archiveLink . '">' . _JNEWS_VIEWARCHIVE . '</a>'; // $replaceWhat = array('[CONFIRM]','[NAME]','[FIRSTNAME]','[EMAIL]','[DATE]','[USERNAME]','[LINK]','[ARCHIVE]', '[SUBSCRIPTIONS]', '[UNSUBSCRIBE]'); // $replaceWhat = array('{tag:confirm}','{tag:name}','{tag:firstname}','{tag:email}','{tag:date}','{tag:username}','{tag:link}','{tag:archive}', '{tag:subscriptions}', '{tag:unsubscribe}', '{tag:title}'); $replaceTagsA = array(); $replaceTagsA['{tag:confirm}'] = $confirmlink; $replaceTagsA['{tag:name}'] = $subscriber->name; $replaceTagsA['{tag:firstname}'] = $firstname; $replaceTagsA['{tag:email}'] = $subscriber->email; if (version_compare(JVERSION, '3.0.0', '<')) { $replaceTagsA['{tag:date}'] = JHTML::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC1')); // , JNEWS_TIME_OFFSET } else { $replaceTagsA['{tag:date}'] = JHtml::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC1')); // , JNEWS_TIME_OFFSET } $replaceTagsA['{tag:username}'] = $username; $replaceTagsA['{tag:link}'] = $archiveLink; $replaceTagsA['{tag:archive}'] = $archiveAll; $mainframe = JFactory::getApplication(); if (!$mainframe->isAdmin() && JRequest::getVar('act', '', '', 'WORD') == 'mailing' && JRequest::getVar('task') == 'view') { $replaceTagsA['{tag:subscriptions}'] = ''; $replaceTagsA['{tag:unsubscribe}'] = ''; } else { $replaceTagsA['{tag:subscriptions}'] = $subscriptionslink; $replaceTagsA['{tag:unsubscribe}'] = $unsubscribelink; } $replaceTagsA['{tag:title}'] = $mailSubject; if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnews is pro $replaceTagsA['{tag:profile nb=1}'] = empty($subscriber->column1) ? '' : $subscriber->column1; $replaceTagsA['{tag:profile nb=2}'] = empty($subscriber->column2) ? '' : $subscriber->column2; $replaceTagsA['{tag:profile nb=3}'] = empty($subscriber->column3) ? '' : $subscriber->column3; $replaceTagsA['{tag:profile nb=4}'] = empty($subscriber->column4) ? '' : $subscriber->column4; $replaceTagsA['{tag:profile nb=5}'] = empty($subscriber->column5) ? '' : $subscriber->column5; } $replaceTagsKeysA = array_keys($replaceTagsA); $content = str_replace($replaceTagsKeysA, $replaceTagsA, $content); if (class_exists('jNews_Auto')) { jNews_Auto::tags($content, $tags); } $content = stristr($content, 'Powered by Joobi') !== false ? $content : $content . $subscriptionstext; if (class_exists('jNews_Tags')) { jNews_Tags::replace($content, $tags); } $mainframe = JFactory::getApplication(); JPluginHelper::importPlugin('jnews'); $plugin = JPluginHelper::getPlugin('jnews', 'forwardtofriend'); if (!empty($plugin)) { jimport('joomla.html.parameter'); $fwdObj = new stdClass(); $fwdObj->subscriber = $subscriber; $fwdObj->mailingid = $mailingId; $fwdObj->listid = $listId; $bot_results = $mainframe->triggerEvent('jnewsbot_fwdtofriendTransform', array(&$content, $fwdObj)); } if (!defined('JOOBI_SECURE')) { define('JOOBI_SECURE', true); } //check if we have Joobi install if so check for tags $joobiEntryPoint = ''; if (defined('JPATH_ROOT')) { $path = JPATH_ROOT; } elseif (isset($mosConfig_absolute_path)) { $path = $mosConfig_absolute_path; } $status = @(include_once $path . DIRECTORY_SEPARATOR . 'joobi' . DIRECTORY_SEPARATOR . 'entry.php'); if ($status) { //process joobi tag $tagProcessC = WClass::get('output.process', null, 'class', false); if (!empty($tagProcessC)) { $tagProcessC->replaceTags($content); } } if (!empty($mailingId) and $GLOBALS[JNEWS . 'enable_statistics'] == 1) { if ($GLOBALS[JNEWS . 'statistics_per_subscriber'] == 1) { if ($html) { $content .= '<img src="' . JNEWS_JPATH_LIVE_NO_HTTPS . '/index.php?option=' . JNEWS_OPTION . '&Itemid=' . $Itemid . '&act=log' . '&mailingid=' . $mailingId . '&subscriber=' . $subscriber->id . '" border="0" width="1" height="1" />'; } } else { if ($html) { $content .= '<img src="' . JNEWS_JPATH_LIVE_NO_HTTPS . '/index.php?option=' . JNEWS_OPTION . '&Itemid=' . $Itemid . '&act=log' . '&mailingid=' . $mailingId . '" border="0" width="1" height="1" />'; } } } // replace for images // put the good mailto tag back (replaced before the content mambot) $replaceTag = array('href="mailto:', '@', 'href="#'); $replaceBy = array('9aca7aca5', '9aca4aca1', '9aca12aca3'); $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); $content = preg_replace('#\\.(jpg|gif|jpeg|png)(?:(?!").)?"#', '.\\1"', $content); if (!$html) { $content = str_replace('&', '&', $content); } return $content; }
public static function upgrade_News3() { $my = JFactory::getUser(); $db = JFactory::getDBO(); $xf = new jNews_Config(); $newLists = array(); $idImportedList = array(); $i = 0; $db->setQuery("SELECT * FROM #__yanc_letters"); $newsletters = $db->loadObjectList(); $error = $db->getErrorMsg(); $newSubscriber = null; $list = null; $mailings = null; $subscriberId = 0; $total = 0; if (!empty($error)) { echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error getting newsletters. Database error: <br />' . $error . '</p>'; return false; } else { foreach ($newsletters as $newsletter) { $list->list_name = $newsletter->list_name; $list->list_desc = $newsletter->list_desc; $list->sendername = $newsletter->sendername; $list->senderemail = $newsletter->senderemail; $list->bounceadres = $newsletter->bounceadres; $list->layout = $newsletter->layout; $list->template = 0; $list->subscribemessage = $newsletter->subscribemessage; $list->unsubscribemessage = $newsletter->unsubscribemessage; $list->notifyadminmsg = $newsletter->notifyadminmsg; $list->html = $newsletter->html; $list->hidden = !$newsletter->hidden; $list->unsubscribesend = 1; $list->unsubscribenotifyadmin = 1; $list->list_type = '1'; $list->auto_add = 0; $list->user_choose = 0; $list->cat_id = '0:0'; $list->delay_min = 0; $list->delay_max = 0; $list->follow_up = 0; $list->owner = $my->id; $list->acc_level = $newsletter->aid; $list->acc_id = 29; $list->published = 1; $list->createdate = time(); $list->footer = 1; $list->notify_id = 0; $list->notification = 0; $query = 'INSERT INTO `#__jnews_lists` (`list_name`) VALUES (\'' . $list->list_name . '\' )'; $db->setQuery($query); $db->query(); $error = $db->getErrorMsg(); if (!empty($error)) { echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error adding list to database. Database error: <br />' . $error . '</p><br /><br />Are you trying to insert a list name which is already in use? The list name has to be different for each list! <br /><br />'; } else { $query = 'SELECT * FROM `#__jnews_lists` WHERE `list_name`= \'' . $list->list_name . '\''; $db->setQuery($query); $mynewlist = $db->loadObject(); $error = $db->getErrorMsg(); $xf->plus('totallist0', 1); $xf->plus('act_totallist0', 1); $xf->plus('totallist1', 1); $xf->plus('act_totallist1', 1); if (!empty($error)) { echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting listname. Database error: <br />' . $error . '</p>'; return false; } else { $idImportedList[$newsletter->id] = $mynewlist->list_id; $newLists[$i] = $mynewlist->list_id; $i++; $list->id = $mynewlist->list_id; $error = jNews_Lists::updateListData($list); if (!$error) { echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting list. Database error: <br />' . $error . '</p>'; } else { echo '<br /><b>' . @constant($GLOBALS[JNEWS . 'listnames1']) . ': </b>' . $list->list_name . ': ' . jnews::printM('green', _JNEWS_IMPORT_SUCCESS); $db->setQuery("SELECT * FROM #__yanc_letters WHERE `list_id`=" . $newsletter->id); $mailingsImports = $db->loadObjectList(); $error = $db->getErrorMsg(); if (!empty($error)) { echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting mailings. Database error: <br />' . $error . '</p>'; return false; } else { $issue_nb = 1; foreach ($mailingsImports as $mailingsImport) { $mailings->list_id = $mynewlist->list_id; $mailings->list_type = '1'; $mailings->send_date = $mailingsImport->send_date; $mailings->subject = $mailingsImport->subject; $mailings->htmlcontent = $mailingsImport->htmlcontent; $mailings->textonly = $mailingsImport->textonly; $mailings->attachments = $mailingsImport->attachments; $mailings->images = $mailingsImport->images; $mailings->published = $mailingsImport->published; $mailings->visible = $mailingsImport->visible; $mailings->html = $mynewlist->html; $mailings->fromname = $list->sendername; $mailings->fromemail = $list->senderemail; $mailings->frombounce = $list->bounceadres; $mailings->author_id = $my->id; $mailings->delay = 0; $mailings->issue_nb = $issue_nb; $mailings->acc_level = 25; $mailings->createdate = $list->createdate; $issue_nb++; $error = jNews_Mailing::insertMailingData($mailings); if (!$error) { echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error inserting mailing. Database error: <br />' . $error . '</p>'; } else { echo '<br /><b>' . _JNEWS_MENU_MAILING_TITLE . ': </b>' . $mailingsImport->subject . ': ' . jnews::printM('green', _JNEWS_IMPORT_SUCCESS); } } } } } } } $db->setQuery("SELECT * FROM #__yanc_subscribers"); $subscribers = $db->loadObjectList(); $error = $db->getErrorMsg(); if (!empty($error)) { echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting subscribers. Database error: <br />' . $error . '</p>'; return false; } else { foreach ($subscribers as $subscriber) { $newSubs = true; $jnewssubscribers = jNews_Subscribers::getSubscribers(-1, -1, '', $total, 0, '', '', '', '', ''); //added one parameter for mailid foreach ($jnewssubscribers as $jnewssubscriber) { if ($subscriber->subscriber_email == $jnewssubscriber->email) { $newSubs = false; $subId[0] = $jnewssubscriber->id; } } if ($newSubs) { $newSubscriber->user_id = $subscriber->userid; $newSubscriber->name = $subscriber->subscriber_name; $newSubscriber->email = $subscriber->subscriber_email; $newSubscriber->ip = $subscriber->ip; $newSubscriber->receive_html = $subscriber->receive_html; $newSubscriber->confirmed = $subscriber->confirmed; $newSubscriber->subscribe_date = $subscriber->subscribe_date; $newSubscriber->blacklist = 0; $newSubscriber->timezone = '00:00:00'; $newSubscriber->language_iso = 'eng'; $newSubscriber->params = ''; if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnews is pro $newSubscriber->column1 = $newSubscriber->column1; $newSubscriber->column2 = $newSubscriber->column2; $newSubscriber->column3 = $newSubscriber->column3; $newSubscriber->column4 = $newSubscriber->column4; $newSubscriber->column5 = $newSubscriber->column5; } //end if for check version pro $error = jNews_Subscribers::saveSubscriber($newSubscriber, $subscriberId, true); if (!empty($error)) { if ($subscriberId < 1) { echo ' Error inserting subscriber:' . $newSubscriber->name; } $error = ''; $subId[0] = $subscriberId; } else { echo '<br /><b>' . _JNEWS_MENU_SUBSCRIBERS . ': </b>' . $newSubscriber->name . ': ' . jnews::printM('green', _JNEWS_IMPORT_SUCCESS); $d['email'] = $subscriber->email; jNews_Subscribers::getSubscriberIdFromEmail($d); $subId[0] = $d['subscriberId']; } } else { echo '<br /><b>' . _JNEWS_MENU_SUBSCRIBERS . ': </b>' . $subscriber->subscriber_name . ': ' . jnews::printM('red', _JNEWS_IMPORT_EXIST); } $j = 0; $queue = jNews_ListsSubs::getListSubscriberInfo($subId[0], $idImportedList[$subscriber->list_id]); if (empty($queue)) { $error = jNews_Queue::insertQueuesForNews($subId, $idImportedList[$subscriber->list_id], 29); if (!$error) { echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting queue. Database error: <br />' . $error . '</p>'; } } } } } return true; }
public static function controlPanel() { unset($GLOBALS["task"]); unset($_REQUEST["task"]); $doc = JFactory::getDocument(); $doc->addStyleSheet(JNEWS_URL_ADMIN . 'cssadmin/jnews.css'); ?> <div align="center" class="centermain"> <div id="jnews"> <table class=""> <tr> <td width="58%" valign="top"> <?php echo backHTML::iconsPanel(); ?> </td> <td width="42%" valign="top"> <div style="width=100%;"> <script type="text/javascript"> function checkcid(myField) { myField.checked = true; isChecked(true); } </script> <form action="index.php" method="post" name="adminForm" id="adminForm"> <input type="hidden" name="option" value="<?php echo JNEWS_OPTION; ?> " /> <input type="hidden" name="act" value="jnews" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="userid" value="" /> <input type="hidden" name="boxchecked" value="0" /> <?php $tabs = new MosTabsjNews(1); $tabs->startPane('acaControlPanel'); $tabs->startTab(_JNEWS_MENU_TAB_SUM, "acaControlPanel.Summary"); ?> <table class="<?php echo jnews::myTheme(); ?> "> <tbody> <thead> <tr> <th class="title" style="text-align: center;"><?php echo '#'; ?> </th> <th class="title" style="text-align: center;"><?php echo _JNEWS_MENU_TAB_LIST; ?> </th> <th class="title" style="text-align: center;"><?php echo _JNEWS_MENU_MAILING_TITLE; ?> </th> </tr> </thead> <?php $html = ''; $totalist = 0; $totalmail = 0; $totalsub = $GLOBALS[JNEWS . 'act_totalsubcribers0']; $totalsent = 0; $nb = explode(',', $GLOBALS[JNEWS . 'activelist']); $size = sizeof($nb); $countOfLists[1] = jNews_Lists::countLists(1); $countOfLists[2] = jNews_Lists::countLists(2); $countOfLists[7] = jNews_Mailing::countMails(7, true); $countOfMailings[1] = jNews_Mailing::countMails(1); $countOfMailings[2] = jNews_Mailing::countMails(2); $countOfMailings[7] = jNews_Mailing::countMails(7); for ($i = 0; $i < $size; $i++) { $index = $nb[$i]; if ($GLOBALS[JNEWS . 'listshow' . $index] > 0 and $GLOBALS[JNEWS . 'listype' . $index] == 1) { $row = ($i + 1) % 2; $html .= '<tr class="row' . $row . '">'; $html .= '<td><b>' . @constant($GLOBALS[JNEWS . 'listnames' . $index]) . '</b></td>'; // $html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'act_totallist'.$index].'1 </td>'; $html .= '<td style="text-align: center; ">' . $countOfLists[$index] . ' </td>'; //if the value to be is less than 0 we will display 0 if ($GLOBALS[JNEWS . 'act_totalmailing' . $index] > 0) { // $html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'act_totalmailing'.$index].' </td>'; $html .= '<td style="text-align: center; ">' . $countOfMailings[$index] . ' </td>'; } else { $html .= '<td style="text-align: center; ">0</td>'; } // $html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'totalmailingsent'.$index].' </td>'; $html .= '</tr>'; // $totalist = $totalist + $GLOBALS[JNEWS.'act_totallist'.$index]; $totalist = array_sum($countOfLists); // $totalmail = $totalmail + $GLOBALS[JNEWS.'act_totalmailing'.$index]; $totalmail = array_sum($countOfMailings); $totalsent = $totalsent + $GLOBALS[JNEWS . 'totalmailingsent' . $index]; if ($GLOBALS[JNEWS . 'act_totalsubcribers' . $index] > $totalsub) { $totalsub = $GLOBALS[JNEWS . 'act_totalsubcribers' . $index]; } } } $html .= '<tr>'; $html .= '<td style="background-color: #CCFFFF;"><b>' . _JNEWS_CP_TOTAL . '</b></td>'; $html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' . $totalist . ' </td>'; $html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' . $totalmail . ' </td>'; // $html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' .$totalsent.' </td>'; //$html .= '<td style="text-align: center; ">' .$totalsub.' </td>'; $html .= '</tr>'; echo $html; ?> </tbody></table> <br /> <?php if (class_exists('jNews_Auto')) { echo jNews_Auto::showQueue(); } $tabs->endTab(); $tabs->startTab(_JNEWS_MENU_SUBSCRIBERS, "acaControlPanel.Subscribers"); $emailsearch = ''; $listId = 0; $limittotal = jNews_Subscribers::getSubscribersCount($listId); $setLimitSubs = jnews::setLimitPagination($limittotal); ?> <input type="hidden" name="listid" value="<?php echo $listId; ?> " /> <input type="hidden" name="start" value="<?php echo $setLimitSubs->start; ?> " /> <input type="hidden" name="limit" value="<?php echo $setLimitSubs->end; ?> " /> <input type="hidden" name="listsearch" value="<?php echo $emailsearch; ?> " /> <div style="margin-top: 10px;"><?php echo jnews::setTop('', '', $setLimitSubs); ?> </div> <table class="<?php echo jnews::myTheme(); ?> "> <thead> <tr> <th class="title">#</th> <th class="title" style="text-align: left;"><?php echo _JNEWS_INPUT_NAME; ?> </th> <th class="title" style="text-align: left;"><?php echo _JNEWS_INPUT_EMAIL; ?> </th> <th class="title" style="text-align: center;"><?php echo _JNEWS_SIGNUP_DATE; ?> </th> </tr> </thead> <?php $subscribers = jNews_Subscribers::getSubscribers($setLimitSubs->start, $setLimitSubs->end, $emailsearch, $setLimitSubs->total, $listId, '', 0, 0, 'sub_dateD', 0, 0, null, 0); $i = 0; foreach ($subscribers as $subscriber) { $i++; if (!jNews_Subscribers::validEmail($subscriber->email)) { continue; } ?> <tr class="row<?php echo ($i + 2) % 2; ?> "> <td><center><?php echo $i + $setLimitSubs->start; ?> </center></td> <td style="text-align: left;"> <a href="index.php?option=<?php echo JNEWS_OPTION; ?> &act=subscribers&task=show&userid=<?php echo $subscriber->id; ?> " > <?php echo $subscriber->name; ?> </a></td> <td style="text-align: left;"><?php echo $subscriber->email; ?> </td> <td style="text-align: center;"> <?php echo date('l, jS F Y h:i:s A', jnews::getNow(0, true, $subscriber->subscribe_date)); ?> </td> </tr> <?php } ?> </table> <?php $tabs->endTab(); $tabs->startTab(_JNEWS_MENU_TAB_LIST, "acaControlPanel.Lists"); $listsearch = ''; $lists = jNews_Lists::getLists(0, 0, 1, '', false, false, false); $limittotal = count($lists); $setLimitLists = jnews::setLimitPagination($limittotal); ?> <input type="hidden" name="listid" value="<?php echo $listId; ?> " /> <input type="hidden" name="start" value="<?php echo $setLimitLists->start; ?> " /> <input type="hidden" name="limit" value="<?php echo $setLimitLists->end; ?> " /> <input type="hidden" name="listsearch" value="<?php echo $listsearch; ?> " /> <div style="margin-top: 10px;"><?php echo jnews::setTop('', '', $setLimitLists); ?> </div> <table class="<?php echo jnews::myTheme(); ?> "> <thead> <tr> <th class="title">#</th> <th class="title" width="65%" style="text-align: left;"><?php echo _JNEWS_LIST_NAME; ?> </th> <th class="title" width="25%" style="text-align: left;"><?php echo _JNEWS_LIST_TYPE; ?> </th> <th class="title" style="text-align: center;">ID</th> </tr> </thead> <?php $lists = jNews_Lists::getLists(0, 0, 1, 'listtypeA', false, false, false, false, false, $listsearch, $setLimitLists, 0, 0); $i = 0; foreach ($lists as $list) { $i++; $link = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&task=show&listid=' . $list->id; ?> <tr class="row<?php echo ($i + 2) % 2; ?> "> <td><?php echo $i + $setLimitLists->start; ?> </td> <td style="text-align: left;"> <a href="<?php echo $link; ?> "> <?php echo $list->list_name; ?> </a> </td> <td style="text-align: left;"><?php if ($list->list_type == 1) { echo _JNEWS_LIST; } else { echo _JNEWS_AR; } ?> </td> <td style="text-align: center;"><?php echo $list->id; ?> </td> </tr> <?php } ?> <tr> <th colspan="4"> </th> </tr> </table> <?php $tabs->endTab(); ?> <?php $tabs->endPane(); ?> </form> </div> <div style="clear:both; float:left; margin-top: 10px;"> <?php echo jnews::printM('ok', _JNEWS_SERVER_LOCAL_TIME . ' : ' . date('l, j F Y H:i:s', jnews::getNow(0, true))); // - date('Z') ?> </div> <td> </tr> </table> </div> </div> <?php }
/** we call this public static function to get the content of the articles via ajax * we directly insert the article in the newsletter without the tags * */ public static function getContent($artId = 0, $contentType = 0, $task = '', $template_id = '') { $mainframe = JFactory::getApplication(); ob_clean(); //j15 if (version_compare(JVERSION, '1.6.0', '<')) { $Itemid = $mainframe->getItemId($artId); } if (empty($Itemid)) { $Itemid = $GLOBALS[JNEWS . 'itemidAca']; } if ($task == 'articleContent') { $content = jNews_Mailing::getContentDetail($artId); } elseif ($task == 'blogContent') { $content = jNews_Mailing::getBlogDetail($artId); } if ($GLOBALS[JNEWS . 'show_author'] == 1) { $author = '<br />' . $content->created_by_alias; } else { $author = ''; } //we get the details of the article //if show only the title if ($contentType == 2) { $link = 'option=com_content&view=article&id=' . $artId . '&Itemid=' . $Itemid; $link = jNews_Tools::completeLink($link, false, $GLOBALS[JNEWS . 'use_sef']); $contentD = '<a href="' . $link . '"><span class="aca_title">' . $content->title . '</span></a>'; } elseif ($contentType == 0) { //to show the full article $contentD = '<div class="aca_content"><span class="aca_title">' . $content->title . '</span>' . "\r\n" . $author . '<br />' . $content->introtext . '<br />' . "\r\n" . $content->fulltext . "\r\n" . '</div>'; //TO DO: images } else { //title, intro and readmore if ($task == 'articleContent') { $link = 'option=com_content&view=article&id=' . $artId . '&Itemid=' . $Itemid; } elseif ($task == 'blogContent') { $link = 'option=com_lyftenbloggie&view=lyftenbloggie&view=entry&id=' . $artId . '&Itemid=' . $Itemid; } $link = jNews_Tools::completeLink($link, false, $GLOBALS[JNEWS . 'use_sef']); $wordwrap = $GLOBALS[JNEWS . 'word_wrap']; if (empty($content->fulltext) and !empty($wordwrap)) { //Limit the number of words if (strlen($content->introtext) > $wordwrap) { //$fulltext = $content->introtext; $fulltext = strip_tags($content->introtext, '<br><img>'); if (strlen($fulltext) > $wordwrap) { //We make sure we won't cut any html tag : $open = 0; $limitText = strlen($fulltext) - 1; for ($i = 0; $i < strlen($fulltext); $i++) { if ($content->introtext[$i] == '<') { $open++; } continue; if ($content->introtext[$i] == '>') { $open--; } continue; if ($content->introtext[$i] == " " and $i > $wordwrap and $open == 0) { $limitText = $i - 1; break; } } $content->introtext = substr($fulltext, 0, $limitText) . '...'; } } if (empty($content->fulltext) and !empty($GLOBALS[JNEWS . 'word_wrap'])) { if (strlen($content->introtext) > $GLOBALS[JNEWS . 'word_wrap']) { //$content->introtext = substr(strip_tags($content->introtext),0,$GLOBALS[JNEWS.'word_wrap']).'...'; $content->introtext = substr($content->introtext, 0, $GLOBALS[JNEWS . 'word_wrap']) . '...'; } } } $images = jNews_Mailing::getimage($content->images); foreach ($images as $image) { $image_string = '<img src="' . JNEWS_JPATH_LIVE_NO_HTTPS . '/images/stories/' . $image['image'] . '" align="' . $image['align'] . '" alt="' . $image['alttext'] . '" border="' . $image['border'] . '" />'; $contentD = preg_replace('/{mosimage}/', $image_string, $contentD, 1); } $contentD = str_replace('{mosimage}', '', $contentD); $contentD = '<div class="aca_content"><span class="aca_title">' . $content->title . '</span>' . "\r\n" . $author . '<br />' . $content->introtext . '<br />' . "\r\n" . '<a href="' . $link . '"><span class="aca_readmore">' . _JNEWS_READMORE . '</span></a>' . "\r\n" . '</div>'; //$contentD = '<div class="aca_content"><span class="aca_title" style="display:block; text-indent:5px; font-weight: bold; width: 100%; font-size: 1.2em; text-decoration: none; color: rgb(255, 255, 255); border: 1px solid rgb(50, 154, 167); background-color: rgb(2, 91, 135);">' . $content->title . '</span>' . "\r\n" . $author . '<br />' . $content->introtext . '<br />' . "\r\n" . '<a href="' . $link . '"><span class="aca_readmore" style="font-weight:bold; color:#ffffff; font-size:11px; float: right; border: 1px solid rgb(50, 154, 167); background-color: rgb(2, 91, 135); padding: 2px 8px;">' . _JNEWS_READMORE . '</span></a>' . "\r\n".'</div>'; //} } //insert the styles of this template if (!empty($template_id)) { jNews_Templates::includeStyles($contentD, $template_id); } if ($task == 'articleContent') { echo "<div id=artcontent_{$artId}>{$contentD}</div>"; } elseif ($task == 'blogContent') { echo "<div id=blogcontent_{$artId}>{$contentD}</div>"; } return true; }
static function _deleteSubsQueuePriv($subscriber_id, $mailing_ids, $listID) { static $alreadyProssed = array(); $key = $subscriber_id . '.' . $mailing_ids . '.' . $listID; if (isset($alreadyProssed[$key])) { return true; } $alreadyProssed[$key] = true; $db = JFactory::getDBO(); $status = true; $listIds = jNews_Mailing::getMailingList($mailing_ids); $key = array_search($listID, $listIds); unset($listIds[$key]); if (!empty($listIds)) { if (is_array($listIds)) { foreach ($listIds as $listId) { if (!empty($listssubscribers)) { if (!$listssubscribers->unsubscribe) { $status = false; } } } } else { $status = !empty($listssubscribers) ? true : false; } } //end if if ($status) { if ($subscriber_id > 0) { static $myResultA = array(); $myKey = $subscriber_id . '.' . $mailing_ids; if (isset($myResultA[$myKey])) { return true; } $myResultA[$myKey] = true; $query = 'DELETE FROM `#__jnews_queue` WHERE `subscriber_id` = ' . $subscriber_id; $query .= ' AND `mailing_id` = ' . $mailing_ids; $db->setQuery($query); $db->query(); return true; } } }
public static function flagAR($subscriberID, $subscribeARA) { $db = JFactory::getDBO(); foreach ($subscribeARA as $subscribeAR) { //get the id of the ar with the max delay in subscribeARA $maxDelayAR = jNews_Mailing::maxDelayAR($subscribeAR); if (empty($maxDelayAR)) { return true; } //we insert an entry in the queue that will flag that the last mail in the ar has been already sent to the user //here insert in the delay column the listid of the AR so that we will no longer get the listid of the mailing through another query $time = time(); $senddate = $time + $maxDelayAR->delay * 60; $query = 'INSERT IGNORE INTO `#__jnews_queue`(subscriber_id, type, mailing_id, delay, send_date,suspend)'; $query .= 'VALUES(' . $subscriberID . ',8,' . $maxDelayAR->id . ',' . $subscribeAR . ',' . $senddate . ',1)'; $db->setQuery($query); $db->query(); } return false; }
/** * public static function that will upload template */ public static function uploadTemplate() { jimport('joomla.filesystem.archive'); $name = $_FILES['tempupload']['name']; $tempPath = JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'templates' . DS; // check and set permission of the template folder if (!empty($name)) { $mediacomjNewsdir = jNews_Templates::_checkpermission(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION); $mediacomjNewsTemplatesdir = jNews_Templates::_checkpermission(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'templates'); $mediacomjNewsTemplatesThumbnaildir = jNews_Templates::_checkpermission(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'templates' . DS . 'thumbnail'); if (!$mediacomjNewsdir or !$mediacomjNewsTemplatesdir or !$mediacomjNewsTemplatesThumbnaildir) { echo jnews::printM('notice', 'The following directory is not writable: ' . JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION); return false; } } else { //failed echo jnews::printM('notice', 'Did not found a file to upload.'); return false; } // upload template $status = true; $path = JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'templates'; $folderName = substr($name, 0, -4); $result = jNews_Mailing::uploadFiles($path); $nameRealFolder = jNews_Templates::openZip($tempPath . $name); jNews_Templates::$nameNewFolder = ""; if ($folderName !== $nameRealFolder) { jNews_Templates::$nameNewFolder = $nameRealFolder; } if (jNews_Templates::$nameNewFolder === "") { if (!is_dir($tempPath . $folderName)) { $status = mkdir($tempPath . $folderName, 0755); } } if (!$status) { echo jnews::printM('notice', 'The following directory is not writable: ' . $tempPath); return false; } if ($status && !empty($result)) { $resultArchive = JArchive::extract($tempPath . $name, $path); if ($resultArchive) { // delete zip afterwards if (fopen($tempPath . $name, 'w')) { @unlink($tempPath . $name); } //we prompt a message that the upload was successful echo jnews::printM('green', 'Successfully uploaded the template'); if (is_dir($tempPath . $folderName)) { chmod($tempPath . $folderName, 0755); } if (jNews_Templates::$nameNewFolder === "") { return file_exists($tempPath . $folderName . DS . 'index.html') ? true : false; } else { return file_exists($tempPath . $nameRealFolder . DS . 'index.html') ? true : false; } } else { echo 'Joomla is unable to extract the file :' . $tempPath . $name; } } else { return false; } }
/** * <p>public static function to create the custom cpanel menu</p> * @return boolean */ public static function _editMailingPrev() { $mailingType = JRequest::getVar('listype'); $mailingid = JRequest::getVar('mailingid', '0'); $listId = JRequest::getVar('listid', '0'); $mailingid = $mailingid == 0 ? jNews_Mailing::getLastMailingId() : $mailingid; $html = '<a href="index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&listype=' . $mailingType . '&mailingid=' . $mailingid . '&listid=' . $listId . '"> <img src="' . JNEWS_PATH_ADMIN_IMAGES2 . 'toolbar/editT.png"/> <br/><center>' . _JNEWS_MENU_EDIT . '</center> </a>'; $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Custom', $html); return true; }
public static function _displayQueue($mailingq, $i) { if (empty($mailingq)) { return true; } if (version_compare(JVERSION, '3.0.0', '<')) { $onClickFct = ''; } else { $onClickFct = 'Joomla.'; } foreach ($mailingq as $mailingQ) { ?> <tr class="row<?php echo ($i + 1) % 2; ?> "> <td><center><?php echo $i + 1; ?> </center></td> <td><center><input type="checkbox" id="cid[<?php echo $i; ?> ]" name="cid[<?php echo $i; ?> ]" value="<?php echo $mailingQ->qid; ?> " onclick="<?php echo $onClickFct; ?> isChecked(this.checked);"></center></td> <td><?php $subject = jNews_Mailing::getMailingsSubject($mailingQ->mailing_id); echo $subject; ?> </td> <td><?php $email = jNews_ListsSubs::getSubscriberMail($mailingQ->subscriber_id); echo $email; ?> </td> <td ><div align="center"><?php if ($mailingQ->send_date == 0) { echo '0000-00-00 00:00:00'; } else { echo date('D, d M Y H:i:s', jnews::getNow(0, true, $mailingQ->send_date)); } ?> </div></td> <td><center><?php echo $mailingQ->priority; ?> </center></td> <td><center><?php echo $mailingQ->attempt; ?> </center></td> <td><center><?php echo $mailingQ->suspend; ?> </center></td> <td><center><?php if ($mailingQ->block) { $img = '16/block.png'; ?> <img src="<?php echo JNEWS_PATH_ADMIN_IMAGES2 . $img; ?> " border="0" alt="" /> <?php jnews::getLegend('block.png', _JNEWS_QUEUE_BLOCK); } else { $img = '16/unblock.png'; ?> <img src="<?php echo JNEWS_PATH_ADMIN_IMAGES2 . $img; ?> " border="0" alt="" /> <?php jnews::getLegend('unblock.png', _JNEWS_QUEUE_UNBLOCK); } ?> </center></td> <td><center><?php echo $mailingQ->qid; ?> </center></td> </tr> <?php $i = $i + 1; } }