public function Process() { // Newsletter component disabled or not found. Aborting. if (!$this->enabled) { return true; } $config = new jNews_Config(); // Build subscriber object $subscriber = new stdClass(); // Lists $cumulative = $this->JInput->post->get("jnews_subscribe_cumulative", NULL, "int"); $checkboxes = $this->JInput->post->get("jnews_subscribe", array(), "array"); $subscriber->list_id = $cumulative ? $checkboxes : array(); // No lists selected. Skip here to avoid annoying the user with email confirmation. It is useless to confirm a subscription to no lists. if (empty($subscriber->list_id)) { return true; } // Name field may be absent. JNews will assign an empty name to the user. $subscriber->name = isset($this->FieldsBuilder->Fields['sender0']) ? $this->FieldsBuilder->Fields['sender0']['Value'] : ""; $subscriber->email = empty($this->FieldsBuilder->Fields['sender1']['Value']) ? NULL : JMailHelper::cleanAddress($this->FieldsBuilder->Fields['sender1']['Value']); // JNews saves users with empty email address, so we have to check it if (empty($subscriber->email)) { $this->logger->Write(get_class($this) . " Process(): Email address empty. User save aborted."); return true; } // It seems that $subscriber->confirmed defaults to unconfirmed if unset, so we need to read and pass the actual value from the configuration $subscriber->confirmed = !(bool) $config->get('require_confirmation'); $subscriber->receive_html = 1; // Avoid Notice: Undefined property while JNews libraries access undefined properties $subscriber->ip = jNews_Subscribers::getIP(); $subscriber->subscribe_date = jnews::getNow(); $subscriber->language_iso = "eng"; $subscriber->timezone = "00:00:00"; $subscriber->blacklist = 0; $subscriber->user_id = JFactory::getUser()->id; // Subscription $sub_id = null; jNews_Subscribers::saveSubscriber($subscriber, $sub_id, true); if (empty($sub_id)) { // User save failed. Probably email address is empty or invalid $this->logger->Write(get_class($this) . " Process(): User save failed"); return true; } // Subscribe $subscriber to $subscriber->list_id //$subscriber->id = $sub_id; // jNews_ListsSubs::saveToListSubscribers() doesn't work well. When only one list is passed to, it reads the value $listids[0], // but the element 0 is not always the first element of the array. In our case is $listids[1] //jNews_ListsSubs::saveToListSubscribers($subscriber); $this->SaveSubscription($subscriber); // Log $this->logger->Write(get_class($this) . " Process(): subscribed " . $this->FieldsBuilder->Fields['sender0']['Value'] . " (" . $this->FieldsBuilder->Fields['sender1']['Value'] . ") to lists " . implode(",", $subscriber->list_id)); return true; }
function statistics($listId, $listType, $mailingId, $message, $task, $action) { //From Specified fieldset $sDate = JRequest::getVar('startdate'); $eDate = JRequest::getVar('enddate'); if ($task == 'cpanel') { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); } //Predefined fieldset $currentInterval = JRequest::getVar('rptinterval'); $currentRange = JRequest::getVar('rptrange'); if (empty($currentRange)) { $currentRange = 'this-month'; } if (empty($currentInterval)) { $currentInterval = 'weekly'; } if ($sDate == '0000-00-00' && $eDate == '0000-00-00') { $sDate = 0; $eDate = 0; } if (!empty($sDate) && !empty($eDate)) { if ($sDate != '0000-00-00' && $eDate != '0000-00-00') { $sDate = strtotime($sDate); $sDate = $sDate - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z'); $eDate = strtotime($eDate); $eDate = $eDate - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z'); } elseif ($sDate != '0000-00-00' && $eDate == '0000-00-00') { $sDate = strtotime($sDate); $sDate = $sDate - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z'); $eDate = time(); // - JNEWS_TIME_OFFSET * 3600 ; } elseif ($sDate == '0000-00-00' && $eDate != '0000-00-00') { echo jnews::printM('warning', _JNEWS_REPORT_WARN_MESSAGE); $sDate = 0; $eDate = 0; } } else { //Set the correct startDateTime and endDateTime //Set also the correct intervals appropriate for each range //current datetime base on the website setting configuration $currDate = $eDate = time(); // - JNEWS_TIME_OFFSET * 3600 ; switch ($currentRange) { case 'today': //today $sDate = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $eDate = mktime(23, 59, 59, date('m'), date('d'), date('Y')); $currentInterval = 'daily'; break; case 'yesterday': //yesterday $sDate = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); $eDate = mktime(23, 59, 59, date('m'), date('d') - 1, date('Y')); $currentInterval = 'daily'; break; case 'this-week': //this week $sDate = mktime(0, 0, 0, date('n'), date('j'), date('Y')) - (date('N') - 1) * 3600 * 24; //if selected intervals is monthly or yearly if ($currentInterval == 'monthly' || $currentInterval == 'yearly') { $currentInterval = 'weekly'; } break; case 'last-week': //last week..start of the week is Monday at 00:00:00 and will end on Sunday at 23:59:59: $sDate = mktime(0, 0, 0, date('n'), date('j') - 6, date('Y')) - date('N') * 3600 * 24; $eDate = mktime(23, 59, 59, date('n'), date('j'), date('Y')) - date('N') * 3600 * 24; //if selected intervals is monthly or yearly if ($currentInterval == 'monthly' || $currentInterval == 'yearly') { $currentInterval = 'weekly'; } break; case 'last-2-weeks': //last 2 weeks $sDate = mktime(0, 0, 0, date('n'), date('j') - 13, date('Y')) - date('N') * 3600 * 24; $eDate = mktime(23, 59, 59, date('n'), date('j'), date('Y')) - date('N') * 3600 * 24; //if selected intervals is monthly or yearly if ($currentInterval == 'monthly' || $currentInterval == 'yearly') { $currentInterval = 'weekly'; } break; case 'last-month': //last month..starts at the first day to the last day $sDate = strtotime(date('m') - 1 . '/01/' . date('Y'), $currDate); $eDate = $sDate + 30 * 24 * 3600; //mktime(23, 59, 59, date('m')); if ($currentInterval == 'yearly') { $currentInterval = 'weekly'; } break; case 'this-year': //this year..starts $sDate = strtotime('01/01/' . date('Y'), $currDate); break; case 'last-year': //last year...starts jan 1 and ends dec 31 $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 1); $eDate = mktime(23, 59, 59, 12, 31, date('Y') - 1); break; case '2-years-ago': //2 Years ago if ($currentInterval == 'yearly') { //if the interval is yearly $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 2); //starts jan 1 } else { $eDate = mktime(23, 59, 59, 12, 31, date('Y') - 2); //ends dec 31 $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 2); //starts jan 1 } break; case '3-years-ago': //3 Years ago if ($currentInterval == 'yearly') { //if the interval is yearly $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 3); //starts jan 1 } else { $eDate = mktime(23, 59, 59, 12, 31, date('Y') - 3); //ends dec 31 $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 3); //starts jan 1 } break; case 'this-month': //this month //this month default: $sDate = strtotime(date('m') . '/01/' . date('Y'), $currDate); if ($currentInterval == 'yearly') { $currentInterval = 'weekly'; } break; } } //Still need to double check if there's really values on the start and end date if (!empty($sDate) && !empty($eDate)) { //Title header $doc = JFactory::getDocument(); $css = '.icon-48-statistics_header { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/statistics.png)}'; $doc->addStyleDeclaration($css, $type = 'text/css'); $img = 'statistics_header.png'; $message = ''; $start = date('F j, Y', jnews::getNow(0, true, $sDate)); $end = date('F j, Y', jnews::getNow(0, true, $eDate)); if ($currentRange == 'today' || $currentRange == 'yesterday') { $title = _JNEWS_REPORT_HEADER . ': ' . $start; $fileNameExport = $start; } else { $title = _JNEWS_REPORT_HEADER . ': ' . $start . ' ' . _JNEWS_REPORT_HEADER_TO . ' ' . $end; $fileNameExport = $start . ' ' . _JNEWS_REPORT_HEADER_TO . ' ' . $end; } backHTML::_header($title, $img, $message, $task, $action); } $dateFormat = 'FROM_UNIXTIME('; switch ($currentInterval) { case 'yearly': //yearly $specialFormat = ',\'%Y\''; $dateFormat4DateNumber = 'FROM_UNIXTIME('; //.$columnModif.', \'' .substr($special, 10).'\'))'; $specialNo = ',\'%Y\')'; break; case 'weekly': //weekly $specialFormat = ',\'%M %d, %Y\''; $dateFormat4DateNumber = 'WEEK(' . $dateFormat; $dateFormat4DateNumber = 'WEEK(FROM_UNIXTIME('; //'dtfrmtweek%Y-%m-%d'; // WEEK(DATE_FORMAT(cdate, '%Y-%m-%d')) $specialNo = ',\'%Y-%m-%d\'))'; break; case 'daily': //daily $specialFormat = ',\'%M %d, %Y\''; $dateFormat4DateNumber = 'FROM_UNIXTIME('; //'dateformat%Y%m%d'; $specialNo = ',\'%Y%m%d\')'; break; case 'monthly': //monthly //monthly default: $specialFormat = ',\'%M, %Y\''; $dateFormat4DateNumber = 'FROM_UNIXTIME('; //'dateformat%Y%m%d'; $specialNo = ',\'%Y%m\')'; break; } $queryfilters = array(); $queryfilters['enddate'] = '\'' . $eDate . '\''; $queryfilters['startdate'] = '\'' . $sDate . '\''; $queryfilters['dateFormat'] = $dateFormat; $queryfilters['specialFormat'] = $specialFormat; $queryfilters['dateFormat4DateNumber'] = $dateFormat4DateNumber; $queryfilters['specialNo'] = $specialNo; $queryfilters['mailingId'] = $mailingId; $queryfilters['task'] = $task; //go to class.stats to display the view of stats require_once JNEWSPATH_CLASS . 'class.statistics.php'; outputReportGraph::initIncludes(); echo '<form action="index.php" method="post" name="adminForm" id="adminForm">'; if ($task == 'graph') { $results = array(); $results['subject'] = JRequest::getVar('subject', ''); $results['html_sent'] = JRequest::getVar('html_sent', '0'); $results['text_sent'] = JRequest::getVar('text_sent', '0'); $results['html_views'] = JRequest::getVar('html_views', '0'); $results['html_unread'] = JRequest::getVar('html_unread', '0'); $results['pending'] = JRequest::getVar('pending', '0'); // $results['failed'] = JRequest::getVar( 'failed', '0' ); // $results['bounces'] = JRequest::getVar( 'bounces', '0' ); $results['sent'] = JRequest::getVar('sent', '0'); // $results['sent'] = intval( $results['html_sent'] + $results['text_sent'] ); //fixed $results['id'] = JRequest::getVar('id'); $queryfilters['startdate'] = '\'' . JRequest::getInt('startdate') . '\''; $queryfilters['enddate'] = '\'' . JRequest::getVar('enddate') . '\''; outputReportGraph::mailingSpecificGraph($results, $queryfilters); } else { outputReportGraph::headerFilter($currentInterval); if (empty($fileNameExport)) { $fileNameExport = null; } outputReportGraph::tabReports($queryfilters, $task, $fileNameExport); } echo '</form>'; return true; }
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 showLists($subscriberId, $listId, $lisType, $action, $task) { $Itemid = JRequest::getInt('Itemid'); if (empty($Itemid)) { $Itemid = $GLOBALS[JNEWS . 'itemidAca']; } // we initialize the listType with one if (empty($lisType)) { $lisType = 1; } $mainframe = JFactory::getApplication(); $my = JFactory::getUser(); $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0; if (version_compare(JVERSION, '1.6.0', '<')) { $listsAddEdit = jNews_Lists::getIDswithacclevel($my->gid); } else { $groups = JAccess::getGroupsByUser($my->id); $listsAddEdit = jNews_Lists::getIDswithacclevel($groups); } if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); //UPDATE321 $lists = jNews_Lists::getLists(0, 0, true); $access = false; foreach ($lists as $list) { $bit = jnews::checkPermissions($list->acc_level); if ($bit) { $access = true; break; } } if (!$access && empty($listsAddEdit) && empty($ownedlists) && !jnews::checkPermissions('admin') && !jnews::checkPermissions($gid)) { frontHTML::showPanel(); return true; } } //for popup window JHTML::_('behavior.modal'); switch ($task) { case 'new': case 'add': $access = 'admin'; $id = 0; if ($GLOBALS[JNEWS . 'enable_jsub']) { if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (!empty($ownedlists)) { $access = strtolower($my->usertype); } $id = $my->id; } if (jnews::checkPermissions($access) || jnews::checkPermissions($gid)) { //traces $task = 'save'; $subscriber = jNews_Subscribers::getSubscriberInfoFromUserId($my->id); if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $acl = JFactory::getACL(); $groups = $acl->get_group_children_tree(null, 'USERS', false); } else { //j16 $db = JFactory::getDBO(); $db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC'); $groups = $db->loadObjectList(); } $allGroupIds = array(); foreach ($groups as $oneGroup) { $allGroupIds[] = $oneGroup->value; } $newList = new stdClass(); $newList->id = ''; $newList->html = 1; $newList->new_letter = 1; $newList->list_name = ''; $newList->list_desc = ''; if (empty($subscriber)) { $newList->sendername = ''; $newList->senderemail = ''; $newList->bounceadres = ''; //$GLOBALS[JNEWS.'sendmail_from']; } else { $newList->sendername = $subscriber->name; $newList->senderemail = $subscriber->email; $newList->bounceadres = $subscriber->email; } $newList->hidden = 1; $newList->auto_add = 0; $newList->list_type = $lisType; $newList->delay_min = 1; $newList->delay_max = 7; $newList->user_choose = 0; $newList->cat_id = '0:0'; $newList->follow_up = ''; $newList->notify_id = 0; $newList->owner = $my->id; $newList->acc_level = '24,25,7,8'; $newList->acc_id = implode(',', $allGroupIds); $newList->published = 1; $newList->start_date = date('Y-m-d', jnews::getNow(0, true)); $newList->next_date = jnews::getNow(0, true); $newList->subscribemessage = _JNEWS_DEFAULT_SUBSCRIBE_MESS; $newList->unsubscribemessage = _JNEWS_DEFAULT_UNSUBSCRIBE_MESS; $newList->notifyadminmsg = _JNEWS_UNSUBSCRIBE_ADMIN_NOTIFICATION; $newList->subnotifymsg = _JNEWS_SUBSDEFAULT_NOTIFYMSG; $newList->subnotifysend = 1; $newList->unsubscribesend = 1; $newList->unsubscribenotifyadmin = 1; $newList->footer = 1; $linkForm = 'option=' . JNEWS_OPTION; $linkForm = jNews_Tools::completeLink($linkForm, false, false); $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION); $forms['main'] = "<form action='{$mainLink}' method='post' name='adminForm' enctype='multipart/form-data' onsubmit='submitbutton();return false;' id=\"adminForm\">"; $show = jNews_ListType::showType($lisType, 'editlist'); // menus for list edit // menu save $linkForm = jNews_Tools::completeLink($linkForm, true); $linkForm = '#'; $menuSave = new stdClass(); $menuSave->popup = new stdClass(); $menuSave->popup->isPop = false; $menuSave->link = $linkForm; $menuSave->action = 'save'; $menuSave->onclick = new stdClass(); $menuSave->onclick->custom = false; $menuSave->onclick->js = ''; $menuSave->title = _JNEWS_SAVE; // menu cancel $menuCancel = new stdClass(); $menuCancel->popup = new stdClass(); $menuCancel->popup->isPop = false; $menuCancel->link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=list&Itemid=' . $Itemid, false); $menuCancel->action = 'cancel'; $menuCancel->onclick = new stdClass(); $menuCancel->onclick->custom = true; $menuCancel->onclick->js = ''; $menuCancel->title = _JNEWS_CANCEL; $link = 'option=' . JNEWS_OPTION; $link = jNews_Tools::completeLink($link, false); $menuCpanel = new stdClass(); $menuCpanel->popup = new stdClass(); $menuCpanel->popup->isPop = false; $menuCpanel->popup->isPop = false; $menuCpanel->link = $link; $menuCpanel->action = 'cpanel'; $menuCpanel->onclick = new stdClass(); $menuCpanel->onclick->custom = false; $menuCpanel->onclick->js = ''; $menuCpanel->title = _JNEWS_MENU_CPANEL; $menuA = array(); $menuA['save'] = $menuSave; $menuA['cancel'] = $menuCancel; $menuA['cpanel'] = $menuCpanel; frontHTML::formStart(_JNEWS_EDIT_A . @constant($GLOBALS[JNEWS . 'listname' . $lisType]) . ' ' . _JNEWS_LIST, $newList->html, 'listedit', $menuA); jNews_ListsHTML::editList($newList, $forms, $show, $lisType); $go[] = jnews::makeObj('list_id', $newList->id); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('task', ''); $go[] = jnews::makeObj('listype', JRequest::getInt('listype')); frontHTML::formEndFN(null, $go); } break; case 'edit': $access = 'admin'; $id = 0; if ($GLOBALS[JNEWS . 'enable_jsub']) { if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (!empty($ownedlists)) { $access = strtolower($my->usertype); } $id = $my->id; } if (jnews::checkPermissions($access) || jnews::checkPermissions($gid)) { //traces $task = 'update'; $list = jNews_Lists::getLists($listId, $lisType, $subscriberId, '', false, false, false); $listEdit = $list[0]; $listEdit->new_letter = 0; if (!empty($listEdit)) { $linkForm = 'option=' . JNEWS_OPTION; $linkForm = jNews_Tools::completeLink($linkForm, false, false); $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION); $forms['main'] = "<form action='{$mainLink}' method='post' name='adminForm' enctype='multipart/form-data' onsubmit='submitbutton();return false;' id=\"adminForm\">"; $show = jNews_ListType::showType($listEdit->list_type, 'editlist'); // menus for list edit // menu save $linkForm = 'option=' . JNEWS_OPTION . '&act=list&listid=' . $listId . '&listype=' . $lisType . '&siteend=1&Itemid=' . $Itemid; $linkForm = jNews_Tools::completeLink($linkForm, false); $menuSave = new stdClass(); $menuSave->popup = new stdClass(); $menuSave->popup->isPop = false; $menuSave->link = $linkForm; $menuSave->action = 'save'; $menuSave->onclick = new stdClass(); $menuSave->onclick->custom = false; $menuSave->onclick->js = ''; $menuSave->title = _JNEWS_SAVE; // menu cancel $menuCancel = new stdClass(); $menuCancel->popup = new stdClass(); $menuCancel->popup->isPop = false; $menuCancel->link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=list&Itemid=' . $Itemid, false); $menuCancel->action = 'cancel'; $menuCancel->onclick = new stdClass(); $menuCancel->onclick->custom = true; $menuCancel->onclick->js = ''; $menuCancel->title = _JNEWS_CANCEL; $link = 'option=' . JNEWS_OPTION; $link = jNews_Tools::completeLink($link, false); $menuCpanel = new stdClass(); $menuCpanel->popup = new stdClass(); $menuCpanel->popup->isPop = false; $menuCpanel->popup->isPop = false; $menuCpanel->link = $link; $menuCpanel->action = 'cpanel'; $menuCpanel->onclick = new stdClass(); $menuCpanel->onclick->custom = false; $menuCpanel->onclick->js = ''; $menuCpanel->title = _JNEWS_MENU_CPANEL; $menuA = array(); if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) { if (class_exists('jNews_Social')) { $menuA['save'] = $menuSave; $menuA['cancel'] = $menuCancel; } } $menuA['cpanel'] = $menuCpanel; frontHTML::formStart(_JNEWS_EDIT_A . @constant($GLOBALS[JNEWS . 'listname' . $lisType]) . ' ' . _JNEWS_LIST, $listEdit->html, 'listedit', $menuA); jNews_ListsHTML::editList($listEdit, $forms, $show, $lisType); $go[] = jnews::makeObj('list_id', $listEdit->id); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('task', 'update'); frontHTML::formEndFN(null, $go); } } break; case 'save': JRequest::checkToken() or die('Invalid Token'); if (empty($listId)) { if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) { if (class_exists('jNews_Social')) { $status = jNews_Social::createFrontendList($action, $task, $lisType); } } $msgtype = $status ? 'ok' : 'no'; $message = jnews::printYN($msgtype, _JNEWS_LIST_ADDED, _JNEWS_ERROR); if ($mainframe->isAdmin()) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $lisType . '&siteend=1'); } else { $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $lisType . '&siteend=1'); jNews_Tools::redirect($mainLink); } echo $message; } else { $lisType = jNews_Lists::getListType($listId); $message = jnews::printYN(jNews_Lists::updateListFromEdit($listId, '', false, $lisType), _JNEWS_LIST_UPDATED, _JNEWS_ERROR); // jNews_Tools::redirect('index.php?option='.JNEWS_OPTION.'&act=list&listype='.$lisType.'&siteend=1'); if ($mainframe->isAdmin()) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $lisType . '&siteend=1'); } else { $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $lisType . '&siteend=1'); jNews_Tools::redirect($mainLink); } echo $message; $listId = 0; } break; case 'ownerslists': $ownerid = JRequest::getVar('ownerid', 0); $item = JRequest::getInt('Itemid'); $ownerslists = jNews_Lists::getSpecifiedLists(0, '', $ownerid); $module = new jnews_module(); $module->lists = $ownerslists; $module->showListName = true; $module->defaultchecked = true; $module->dropdown = false; $module->shownamefield = true; $HTML = $module->create(); echo $HTML; break; case 'make': case 'forms': if (class_exists('jNews_CreateForm')) { jNews_CreateForm::taskOptions($task); $showLists = false; } else { $showLists = true; } break; case 'cpanel': jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); break; default: $my = JFactory::getUser(); $show = jNews_ListType::showType($lisType, 'showListsFront'); $msgtype = JRequest::getVar('msg', ''); if (!empty($msgtype)) { if ($msgtype == 'no') { echo jnews::printM($msgtype, _JNEWS_ERROR); } else { echo jnews::printM($msgtype, _JNEWS_LIST_ADDED); } } $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION); $forms['main'] = '<form method="post" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="mosForm" >' . "\n\r"; //$link $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; $order = 'listnameA'; $id = 0; if ($GLOBALS[JNEWS . 'enable_jsub']) { if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (!empty($ownedlists)) { $id = $my->id; } } if (jnews::checkPermissions('admin') || jnews::checkPermissions($gid) || !empty($listsAddEdit)) { if ($mainframe->isAdmin()) { $lists = jNews_Lists::getLists($listId, $lisType, $subscriberId, $order, false, false, false); } else { $lists = jNews_Lists::getLists($listId, $lisType, $subscriberId, $order, false, true, false, false, true); } } else { if ($mainframe->isAdmin()) { if ($lisType == 0) { $lists1 = jNews_Lists::getLists($listId, 1, $subscriberId, $order, false, true, false); $lists2 = jNews_Lists::getLists($listId, 2, $subscriberId, $order, false, true, false); $lists7 = jNews_Lists::getLists($listId, 7, $subscriberId, $order, false, true, false); $lists = array_merge($lists1, $lists2, $lists7); } elseif ($lisType == 1 or $lisType == 2 or $lisType == 7) { $lists = jNews_Lists::getLists($listId, $lisType, $subscriberId, $order, false, true, false); } else { $lists = ''; } } else { if ($lisType == 0) { //get the owned list of the logged user $ownedlists = 0; if ($GLOBALS[JNEWS . 'enable_jsub']) { $my = JFactory::getUser(); if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (!empty($ownedlists)) { $access = true; } } $lists1 = jNews_Lists::getLists($listId, 1, $subscriberId, $order, false, true, false, false, true, '', '', $ownedlists, $my->id); $lists2 = jNews_Lists::getLists($listId, 2, $subscriberId, $order, false, true, false, false, true); $lists7 = jNews_Lists::getLists($listId, 7, $subscriberId, $order, false, true, false, false, true); $lists = array_merge($lists1, $lists2, $lists7); } elseif ($lisType == 1 or $lisType == 2 or $lisType == 7) { $lists = jNews_Lists::getLists($listId, $lisType, $subscriberId, $order, false, true, false, false, true); } else { $lists = ''; } } } if (!empty($lists) || jnews::checkPermissions($gid)) { $menuA = null; if ($my->id > 0) { $link = 'option=' . JNEWS_OPTION; $link = jNews_Tools::completeLink($link, false); $menuCpanel = new stdClass(); $menuCpanel->popup = new stdClass(); $menuCpanel->popup->isPop = false; $menuCpanel->popup->isPop = false; $menuCpanel->link = $link; $menuCpanel->action = 'cpanel'; $menuCpanel->onclick = new stdClass(); $menuCpanel->onclick->custom = false; $menuCpanel->onclick->js = ''; $menuCpanel->title = _JNEWS_MENU_CPANEL; $menuShare = new stdClass(); $menuForms = new stdClass(); $menuNew = new stdClass(); $itemId = $GLOBALS[JNEWS . 'itemidAca']; if ($GLOBALS[JNEWS . 'enable_jsub'] && !empty($ownedlists) || jnews::checkPermissions('admin') || jnews::checkPermissions($gid)) { $linkShare = 'option=' . JNEWS_OPTION . '&act=list&task=ownerslists&ownerid=' . $my->id . '&Itemid=' . $itemId; $linkShare = jNews_Tools::completeLink($linkShare, false); $menuShare = new stdClass(); $menuShare->popup = new stdClass(); $menuShare->popup->isPop = false; $menuShare->link = $linkShare; $menuShare->action = 'share'; $menuShare->onclick = new stdClass(); $menuShare->onclick->custom = false; $menuShare->onclick->js = ''; $menuShare->title = 'Share'; $menuBack = new stdClass(); $menuBack->popup = new stdClass(); $menuBack->popup = new stdClass(); $menuBack->popup->isPop = false; $menuBack->link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=list&Itemid=' . $Itemid, false); $menuBack->action = 'back'; $menuBack->onclick = new stdClass(); $menuBack->onclick->custom = true; $menuBack->onclick->js = ''; $menuBack->title = _JNEWS_MENU_BACK; $menuDelete = new stdClass(); $menuDelete->popup = new stdClass(); $menuDelete->popup->isPop = false; $menuDelete->link = '#'; $menuDelete->action = 'delete'; $menuDelete->onclick = new stdClass(); $menuDelete->onclick->custom = false; $menuDelete->onclick->js = ''; $menuDelete->title = _JNEWS_DELETE; $menuForms = new stdClass(); $menuNew = new stdClass(); if ($GLOBALS[JNEWS . 'enable_jsub'] && !empty($ownedlists)) { $linkForm = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=list&task=make', false, false, true); $menuForms->link = $linkForm; $menuForms->popup = new stdClass(); $menuForms->popup->isPop = true; $menuForms->popup->rel = true; $menuForms->popup->x = 750; $menuForms->popup->y = 500; $menuForms->action = 'form'; $menuForms->title = 'Create Form'; $linknew = 'option=com_jsubscription&view=jsubscription&task=listing&Itemid=' . $itemId; $menuNew = new stdClass(); $menuNew->popup = new stdClass(); $menuNew->popup->isPop = false; $menuNew->action = 'new'; $menuNew->onclick = new stdClass(); $menuNew->onclick->custom = true; $menuNew->onclick->js = ''; $menuNew->title = 'New'; $menuNew->link = $linknew; } else { if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) { if (class_exists('jNews_Social')) { // if($lisType == 1){ $linkForm = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=list&task=make', true, false, true); $menuForms->link = $linkForm; $menuForms->popup = new stdClass(); $menuForms->popup->isPop = true; $menuForms->popup->rel = true; $menuForms->popup->x = 750; $menuForms->popup->y = 500; $menuForms->action = 'form'; $menuForms->title = 'Create Form'; // $linknew = 'option='.JNEWS_OPTION.'&act=list&task=new&listype='.$lisType.'&siteend=1&Itemid='.$itemId; $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION); $menuNew = new stdClass(); $menuNew->popup = new stdClass(); $menuNew->popup->isPop = false; // $linknew = jNews_Tools::completeLink($linknew,false); $linknew = '#'; // # $menuNew->action = 'new'; $menuNew->onclick = new stdClass(); $menuNew->onclick->custom = true; $menuNew->onclick->js = "javascript: submitbutton('new')"; $menuNew->title = 'New'; $menuNew->link = $linknew; } // } } } $menuUnpub = new stdClass(); $menuUnpub->popup = new stdClass(); $menuUnpub->popup->isPop = false; $menuUnpub->link = '#'; $menuUnpub->action = 'unpublished'; $menuUnpub->onclick = new stdClass(); $menuUnpub->onclick->custom = true; $menuUnpub->onclick->js = 'javascript:history.go(-1)'; $menuUnpub->title = 'Unpublished'; $menuPub = new stdClass(); $menuPub->popup = new stdClass(); $menuPub->popup->isPop = false; $menuPub->link = '#'; $menuPub->action = 'published'; $menuPub->onclick = new stdClass(); $menuPub->onclick->custom = true; $menuPub->onclick->js = 'javascript:history.go(-1)'; $menuPub->title = 'Published'; $menuCopy = new stdClass(); $menuCopy->popup = new stdClass(); $menuCopy->popup->isPop = false; $menuCopy->link = '#'; $menuCopy->action = 'copy'; $menuCopy->onclick = new stdClass(); $menuCopy->onclick->custom = true; $menuCopy->onclick->js = 'javascript:history.go(-1)'; $menuCopy->title = 'Copy'; $menuDivider = new stdClass(); $menuDivider->divider = true; } $menuA = array(); if ($lisType == '2') { $menuA['new'] = $menuNew; $menuA['cpanel'] = $menuCpanel; } else { if ($GLOBALS[JNEWS . 'enable_jsub']) { $menuA['share'] = $menuShare; } $menuA['form'] = $menuForms; $menuA['new'] = $menuNew; $menuA['cpanel'] = $menuCpanel; } } if ($lisType == 1) { $title = _JNEWS_EMAIL_LISTS; } else { $title = 'Auto-responders'; } if (empty($my->id)) { $title = _JNEWS_SUBSCRIBE_LIST2; } if (empty($ownedlists) && !empty($my->id)) { $title = _JNEWS_SUBSCRIBE_LIST2; } $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0; frontHTML::formStart($title, 0, '', $menuA); frontHTML::FEmenu(); if ($show['list_type']) { $show['list_type'] = jNews_ListType::checkOthers(); } $setSort = new stdClass(); $setSort->orderDir = ''; $setSort->orderValue = ''; if (class_exists('jNews_Pro')) { $id = 0; if ($GLOBALS[JNEWS . 'enable_jsub']) { if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (!empty($ownedlists)) { $id = $my->id; } } $access = false; foreach ($lists as $list) { $bit = jnews::checkPermissions($list->acc_level); if ($bit) { $access = true; break; } } $my = JFactory::getUser(); //owner of the list to access the list if ($GLOBALS[JNEWS . 'enable_jsub']) { if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (!empty($ownedlists)) { $access = true; $usertype = strtolower($my->usertype); } } if ($access) { jNews_Pro::showListingLists($lists, $action, 'edit', $forms, $show, $my->id); $go[] = jnews::makeObj('listype', JRequest::getInt('listype')); } else { jNews_ListsHTML::showListingLists($lists, $action, 'edit', $forms, $show, '', 0, null, null, $setSort); $go[] = jnews::makeObj('listype', JRequest::getInt('listype')); } } else { jNews_ListsHTML::showListingLists($lists, $action, 'edit', $forms, $show, '', 0, null, null, $setSort); } $go[] = jnews::makeObj('act', $action); frontHTML::formEnd('', $go); } else { frontHTML::FEmenu(); } break; } }
/** * <p>Function to insert a date tag<p> */ function tagdatetime() { $js = 'function insertjnewstag(tag){ '; if (version_compare(JVERSION, '1.6.0', '<')) { //1.5 $js .= ' if(window.top.insertTag(tag)){window.top.document.getElementById(\'sbox-window\').close();}'; } else { if (version_compare(JVERSION, '3.0.0', '<')) { $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}'; } else { $js .= ' if(window.top.insertTag(tag)) { var need_click = jQuery(window.top.document).find("div.modal-backdrop"); if(need_click.length == 0) window.parent.SqueezeBox.close(); else jQuery(window.top.document).find("div.modal-backdrop").click();}'; } } $js .= '}'; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); echo '<style type="text/css">table.' . jnews::myTheme() . 'tr:hover {cursor: pointer;}</style>'; ?> <div id="element-box"> <div class="t"> <div class="t"> <div class="t"></div> </div> </div> <div class="m"> <table class="<?php echo jnews::myTheme(); ?> "> <tbody> <thead> <tr> <th class="title"><center><?php echo _JNEWS_MAILING_TAG; ?> </center></th> <th class="title"><center><?php echo _JNEWS_TEMPLATE_DESC; ?> </center></th> </tr> </thead> <tr class="row0" onclick="insertjnewstag('{tag:date}')"> <td> <strong><?php echo '{tag:date}'; ?> </strong> </td> <td> <?php if (version_compare(JVERSION, '3.0.0', '<')) { $date = JHTML::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC'), JNEWS_TIME_OFFSET); } else { $date = JHtml::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC'), JNEWS_TIME_OFFSET); } echo $date; ?> </td> </tr> <tr class="row0" onclick="insertjnewstag('{tag:date format=1}')"> <td> <strong><?php echo '{tag:date format=1}'; ?> </strong> </td> <td> <?php if (version_compare(JVERSION, '3.0.0', '<')) { $date = JHTML::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC1'), JNEWS_TIME_OFFSET); } else { $date = JHtml::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC1'), JNEWS_TIME_OFFSET); } echo $date; ?> </td> </tr> <tr class="row0" onclick="insertjnewstag('{tag:date format=2}')"> <td> <strong><?php echo '{tag:date format=2}'; ?> </strong> </td> <td> <?php if (version_compare(JVERSION, '3.0.0', '<')) { $date = JHTML::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC2'), JNEWS_TIME_OFFSET); } else { $date = JHtml::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC2'), JNEWS_TIME_OFFSET); } echo $date; ?> </td> </tr> <tr class="row0" onclick="insertjnewstag('{tag:date format=3}')"> <td> <strong><?php echo '{tag:date format=3}'; ?> </strong> </td> <td> <?php if (version_compare(JVERSION, '3.0.0', '<')) { $date = JHTML::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC3'), JNEWS_TIME_OFFSET); } else { $date = JHtml::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC3'), JNEWS_TIME_OFFSET); } echo $date; ?> </td> </tr> <tr class="row0" onclick="insertjnewstag('{tag:date format=4}')"> <td> <strong><?php echo '{tag:date format=4}'; ?> </strong> </td> <td> <?php if (version_compare(JVERSION, '3.0.0', '<')) { $date = JHTML::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC4'), JNEWS_TIME_OFFSET); } else { $date = JHtml::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC4'), JNEWS_TIME_OFFSET); } echo $date; ?> </td> </tr> </tbody> </table> </div> <div class="b"> <div class="b"> <div class="b"></div> </div> </div> </div> <?php }
public static function showSubscribers($subscribers, $action, $listId, &$lists, $start, $limit, $total, $showAdmin, $theLetterId, $emailsearch, $forms, $setLimit = null, $front = false, $setSort = null) { $my = JFactory::getUser(); $mainframe = JFactory::getApplication(); ?> <script language="javascript" type="text/javascript"> //<!-- function jnewsletterselectall(){ var i = 0; allcheck = document.getElementById("selectallcheck"); if(allcheck.checked) checkedvalue = 1; else checkedvalue = 0; while(myelement = document.getElementById("cid["+i+"]")){ myelement.checked = checkedvalue; i++; } if(checkedvalue){ document.getElementById("boxcount").value = i; }else{ document.getElementById("boxcount").value = 0; } } //--> </script> <?php if ($listId == 0) { $message = _JNEWS_SUSCRIB_LIST; } else { $lt_name = jNews_Lists::getLists($listId, 0, null, '', false, false, true); $message = _JNEWS_SUSCRIB_LIST_UNIQUE . "<span style='color: rgb(51, 51, 51);'>" . @$lt_name[0]->list_name . "</span>"; } $filter = _JNEWS_SEL_LIST . ' ' . $lists['listid'] . ' ' . $lists['subscirberType']; $hidden = '<input type="hidden" name="listid" value="' . $listId . '" />'; $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />'; $pos = strpos($forms['main'], "<form"); if ($pos !== false) { $forms['select'] = ""; } echo $forms['main']; // top portion before the table list // for search $toSearch = new stdClass(); $toSearch->forms = $forms['select']; $toSearch->hidden = $hidden; $toSearch->listsearch = $emailsearch; $toSearch->id = 'emailsearch'; echo jnews::setTop($toSearch, $message, $setLimit, $filter); ?> <table class="<?php echo jnews::myTheme(); ?> "> <thead> <tr> <th class="title">#</th> <th class="title"><input type="checkbox" id="selectallcheck" name="allchecked" onclick="jnewsletterselectall();"/></th> <th class="title"><?php echo jnews::HTML_GridSort(_JNEWS_INPUT_NAME, 'name', $setSort->orderDir, $setSort->orderValue); ?> </th> <?php if ($mainframe->isAdmin()) { ?> <th class="title"><?php echo jnews::HTML_GridSort(_JNEWS_INPUT_EMAIL, 'email', $setSort->orderDir, $setSort->orderValue); ?> </th> <?php } else { if ($GLOBALS[JNEWS . 'show_sub_email']) { ?> <th class="title"><?php echo jnews::HTML_GridSort(_JNEWS_INPUT_EMAIL, 'email', $setSort->orderDir, $setSort->orderValue); ?> </th> <?php } } //endelse if ($mainframe->isAdmin()) { ?> <th class="title"><?php echo jnews::HTML_GridSort(_JNEWS_SIGNUP_DATE, 'subscribe_date', $setSort->orderDir, $setSort->orderValue); ?> </th> <?php } ?> <th class="title"><center><?php echo jnews::HTML_GridSort(_JNEWS_REGISTERED, 'user_id', $setSort->orderDir, $setSort->orderValue); ?> </center></th> <th class="title"><center><?php echo jnews::HTML_GridSort(_JNEWS_CONFIRMED, 'confirmed', $setSort->orderDir, $setSort->orderValue); ?> </center></th> <th class="title"><center><?php echo jnews::HTML_GridSort(_JNEWS_HTML, 'receive_html', $setSort->orderDir, $setSort->orderValue); ?> </center></th> <?php if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnewsletter is pro if ($GLOBALS[JNEWS . 'show_column1'] == 1) { ?> <th class="title"><center><?php echo $GLOBALS[JNEWS . 'column1_name']; } //<!--/center></th><!--column 1 in the subscribers list-BE--> if ($GLOBALS[JNEWS . 'show_column2'] == 1) { ?> <th class="title"><center><?php echo $GLOBALS[JNEWS . 'column2_name']; } if ($GLOBALS[JNEWS . 'show_column3'] == 1) { ?> <th class="title"><center><?php echo $GLOBALS[JNEWS . 'column3_name']; } if ($GLOBALS[JNEWS . 'show_column4'] == 1) { ?> <th class="title"><center><?php echo $GLOBALS[JNEWS . 'column4_name']; } if ($GLOBALS[JNEWS . 'show_column5'] == 1) { ?> <th class="title"><center><?php echo $GLOBALS[JNEWS . 'column5_name']; } } if (jnews::checkPermissions('admin')) { ?> <th class="title"><?php echo jnews::HTML_GridSort('ID', 'id', $setSort->orderDir, $setSort->orderValue); ?> </th> <?php } ?> </tr> </thead> <?php $i = 0; if (!empty($subscribers)) { if (version_compare(JVERSION, '3.0.0', '<')) { $onClickFct = ''; } else { $onClickFct = 'Joomla.'; } foreach ($subscribers as $subscriber) { $subscriber->email = trim($subscriber->email); if (!jNews_Subscribers::validEmail($subscriber->email)) { continue; } if ($subscriber->user_id != 0) { $img = '16/status_g.png'; $alt = 'Registered'; jnews::getLegend('status_g.png', _JNEWS_REGISTERED . '/' . _JNEWS_CONFIRMED); } else { $img = '16/status_r.png'; $alt = 'Unregistered'; jnews::getLegend('status_r.png', _JNEWS_SUBSCRIBERS_UNREGISTERED . '/' . _JNEWS_PIE_UNCONFIRMED); } //endelse if ($subscriber->confirmed == 1) { $imgC = '16/status_g.png'; $altC = 'Confirmed'; jnews::getLegend('status_g.png', _JNEWS_REGISTERED . '/' . _JNEWS_CONFIRMED); } else { $imgC = '16/status_r.png'; $altC = 'Not confirmed'; jnews::getLegend('status_r.png', _JNEWS_SUBSCRIBERS_UNREGISTERED . '/' . _JNEWS_PIE_UNCONFIRMED); } //endelse if ($subscriber->receive_html == 1) { $imgH = '16/status_g.png'; $altH = 'HTML'; jnews::getLegend('status_g.png', _JNEWS_REGISTERED . '/' . _JNEWS_CONFIRMED); } else { $imgH = '16/status_r.png'; $altH = 'TEXT'; jnews::getLegend('status_r.png', _JNEWS_SUBSCRIBERS_UNREGISTERED . '/' . _JNEWS_PIE_UNCONFIRMED); } //endelse ?> <tr class="row<?php echo ($i + 1) % 2; ?> "> <td><center><?php echo $i + 1 + $start; ?> </center></td> <td> <center><input type="checkbox" id="cid[<?php echo $i; ?> ]" name="cid[<?php echo $i; ?> ]" value="<?php echo $subscriber->id; ?> " onclick="<?php echo $onClickFct; ?> isChecked(this.checked);" /></center> </td> <td> <?php if (!$front) { $href = "index.php?option=" . JNEWS_OPTION . "&act=" . $action . "&task=show&userid=" . $subscriber->id; } else { $link = "option=" . JNEWS_OPTION . "&act=" . $action . "&task=show&userid=" . $subscriber->id; $href = jNews_Tools::completeLink($link, false, true); } ?> <a href=<?php echo $href; ?> > <?php echo $subscriber->name; ?> </a> </td> <?php if (!jNews_Subscribers::validEmail($subscriber->email)) { $subscriber->email = ''; } if ($mainframe->isAdmin()) { ?> <td><?php echo $subscriber->email; ?> </td> <?php } else { if ($GLOBALS[JNEWS . 'show_sub_email']) { ?> <td><?php echo $subscriber->email; ?> </td> <?php } } //endelse if ($mainframe->isAdmin()) { ?> <td><div align="center"> <?php echo date('D, d M Y H:i:s', jnews::getNow(0, true, $subscriber->subscribe_date)); } ?> </div></td> <td align="center"> <img src="<?php echo JNEWS_PATH_ADMIN_IMAGES2 . $img; ?> " width="12" height="12" border="0" alt="<?php echo $alt; ?> " /> </td> <td align="center"> <a href="<?php echo jnews::createToggleLink('subscribers', 'confirmed', 'subid', $subscriber->id, 'toggle', $listId); ?> "> <img src="<?php echo JNEWS_PATH_ADMIN_IMAGES2 . $imgC; ?> " width="12" height="12" border="0" alt="<?php echo $altC; ?> " /> </a> </td> <td align="center"> <a href="<?php echo jnews::createToggleLink('subscribers', 'receive_html', 'subid', $subscriber->id, 'toggle', $listId); ?> "> <img src="<?php echo JNEWS_PATH_ADMIN_IMAGES2 . $imgH; ?> " width="12" height="12" border="0" alt="<?php echo $altH; ?> " /> </a> </td> <?php $i++; ?> <?php if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnewsletter is 5.0.2 if ($GLOBALS[JNEWS . 'show_column1'] == 1) { ?> <!--check to show/hide column 1 data in the subscribers list--> <td align="center"> <!--data for column1--> <?php echo $subscriber->column1; } ?> </td> <?php if ($GLOBALS[JNEWS . 'show_column2'] == 1) { ?> <!--check to show/hide column 2 data in the subscribers list--> <td align="center"> <!--data for column1--> <?php echo $subscriber->column2; } ?> </td> <?php if ($GLOBALS[JNEWS . 'show_column3'] == 1) { ?> <!--check to show/hide column 3 data in the subscribers list--> <td align="center"> <!--data for column3--> <?php echo $subscriber->column3; } ?> </td> <?php if ($GLOBALS[JNEWS . 'show_column4'] == 1) { ?> <!--check to show/hide column 4 data in the subscribers list--> <td align="center"> <!--data for column4--> <?php echo $subscriber->column4; } ?> </td> <?php if ($GLOBALS[JNEWS . 'show_column5'] == 1) { ?> <!--check to show/hide column 5 data in the subscribers list--> <td align="center"> <!--data for column5--> <?php echo $subscriber->column5; } } //end check of version if (jnews::checkPermissions('admin')) { echo '<td align="center">' . $subscriber->id . '</td>'; } ?> </td> <?php } } ?> </tr> </table> <input type="hidden" name="option" value="<?php echo JNEWS_OPTION; ?> " /> <input type="hidden" name="act" value="<?php echo $action; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="userid" value="" /> <input type="hidden" name="filter_order" value="<?php echo $setSort->orderValue; ?> " /> <input type="hidden" name="filter_order_Dir" value="<?php echo $setSort->orderDir; ?> " /> <input type="hidden" id="boxcount" name="boxchecked" value="0" /> <?php if (version_compare(JVERSION, '3.0.0', '<')) { echo JHTML::_('form.token'); } else { echo JHtml::_('form.token'); } ?> </form> <?php echo '<br />'; echo jnews::setLegend(); }
function onAfterStoreUser($user, $isnew, $success, $msg) { if ($success === false) { return false; } if (strtolower(substr(JPATH_ROOT, strlen(JPATH_ROOT) - 13)) == 'administrator') { $adminPath = strtolower(substr(JPATH_ROOT, strlen(JPATH_ROOT) - 13)); } else { $adminPath = JPATH_ROOT; } if (!@(include_once $adminPath . DS . 'components' . DS . 'com_jnews' . DS . 'defines.php')) { return; } include_once JNEWSPATH_CLASSN . 'class.jnews.php'; require_once JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'administrator' . DS . 'components' . DS . JNEWS_OPTION . DS . 'classes' . DS . 'class.subscribers.php'; require_once JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'administrator' . DS . 'components' . DS . JNEWS_OPTION . DS . 'classes' . DS . 'class.listssubscribers.php'; jimport('joomla.html.parameter'); $plugin =& JPluginHelper::getPlugin('user', 'jnewssyncuser'); $params = new JParameter($plugin->params); $db =& JFactory::getDBO(); $subscriber = null; $confirmed = 1; if ($user['block']) { $confirmed = 0; } $subscriber->email = trim(strip_tags($user['email'])); if (!empty($user['name'])) { $subscriber->name = trim(strip_tags($user['name'])); } if (empty($user['block'])) { $subscriber->confirmed = 1; } $subscriber->user_id = $user['id']; $subscriber->ip = jNews_Subscribers::getIP(); $subscriber->receive_html = 1; $subscriber->confirmed = $confirmed; $subscriber->subscribe_date = jnews::getNow(); $subscriber->language_iso = 'eng'; $subscriber->timezone = '00:00:00'; $subscriber->blacklist = 0; //check if the version of jnews is pro if ($GLOBALS[JNEWS . 'type'] == 'PRO') { $subscriber->column1 = ''; $subscriber->column2 = ''; $subscriber->column3 = ''; $subscriber->column4 = ''; $subscriber->column5 = ''; } //end if check if the version is pro if (!$isnew and !empty($this->oldUser['email']) and $user['email'] != $this->oldUser['email']) { $d['email'] = $this->oldUser['email']; $infos = jNews_Subscribers::getSubscriberIdFromEmail($this->oldUser); $subscriber->id = $infos['subscriberId']; } if ($isnew) { //new registered user $status = jNews_Subscribers::saveSubscriber($subscriber, $subscriber->user_id, true); if (empty($subscriber->id)) { $subscriber->id = jNews_Subscribers::getSubscriberIdFromUserId($subscriber->user_id); } if (!$status) { return; } $listsToSubscribe = $params->get('lists', ''); if (!empty($listsToSubscribe)) { $condition = ' WHERE `id` IN (' . $listsToSubscribe . ')'; } else { $condition = ' WHERE `auto_add` > 0'; } //get list ids of auto_add lists $query = 'SELECT `id`, `list_type`, `params` from `#__jnews_lists`' . $condition; $db->setQuery($query); $autoListId = $db->loadObjectList(); $error = $db->getErrorMsg(); if (!empty($error)) { echo $error; return false; } else { //use for masterlists $listsA = array(); foreach ($autoListId as $autoId) { if (!empty($autoId->params)) { //use for masterlists $listsA[] = $autoId->id; } else { //for non-masterlists $subscriber->list_id = $autoId->id; jNews_ListsSubs::saveToListSubscribers($subscriber); } if ($autoId->list_type == 2) { $subscribe = array(); $subscribe[] = $autoId->id; if (!empty($subscribe)) { jNews_ListsSubs::subscribeARtoQueue($subscriber->id, $subscribe); } } } //end of foreach } if (!empty($listsA)) { //we check if the social class file exists for the implementation of master lists if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) { if (class_exists('social')) { $listidSubsA = array(); $masterListSubscriber = null; //we check if configuration for master lists is enabled if ($GLOBALS[JNEWS . 'use_masterlists']) { if ($GLOBALS[JNEWS . 'type'] == 'PLUS' || $GLOBALS[JNEWS . 'type'] == 'PRO') { //we validate if the user can be subscribed to the list then we return the masterlistid //1 - MasterLists for all Potential Users $listidSubsA[] = jNews_Social::includeMasterListIds($subscriber->id, 1, $listsA); //2 - MasterLists for all Registered Subscribers $listidSubsA[] = jNews_Social::includeMasterListIds($subscriber->id, 2, $listsA); } if ($GLOBALS[JNEWS . 'type'] == 'PRO') { //we validate if the user can be subscribed to the list then we return the masterlistid //3 - MasterLists for all Front-end Subscribers $listidSubsA[] = jNews_Social::includeMasterListIds($subscriber->id, 3, $listsA); } } $masterListSubscriber->id = $subscriber->id; $masterListSubscriber->list_id = $listidSubsA; jNews_ListsSubs::saveToListSubscribers($masterListSubscriber); } } } } else { //confirmed registered user // if(!empty($this->oldUser['block']) AND !empty($subscriber->confirmed)){ if (empty($subscriber->id)) { $subscriber->id = jNews_Subscribers::getSubscriberIdFromUserId($subscriber->user_id); } plgUserjNewssyncuser::_confirmUserSubscription($subscriber->id); // } } //endelse return true; }
/** * This public static function displays the header in the page, it consists of report filters * @param string $currentInterval */ public static function headerFilter($currentInterval) { //Predefined fieldset $currentRange = JRequest::getVar('rptrange'); $currentType = JRequest::getVar('rpttype'); if (empty($currentInterval)) { $currentInterval = JRequest::getVar('rptinterval'); } if (empty($currentRange)) { $currentRange = 'this-month'; } if (empty($currentType)) { if ($GLOBALS[JNEWS . 'level'] > 2) { $currentType = 'graph'; } else { $currentType = 'listing'; } } //drop lists used in the header filter $filters = new stdClass(); $filters->interval = intervalReportType::intervalType($currentInterval); $filters->predefinedRange = rangeReportType::rangeType($currentRange); $filters->reportType = outputReportType::reportType($currentType); $filters->subs = subscribersReportType::subscirbersType(); $mainPath = JNEWS_URL_INCLUDES . 'calendar2/'; //for passing the values in the input of start and end $task = JRequest::getVar('task'); $startdate = $task != 'refresh' ? JRequest::getVar('startdate', '0000-00-00') : '0000-00-00'; $enddate = $task != 'refresh' ? JRequest::getVar('enddate', '0000-00-00') : '0000-00-00'; $mainframe = JFactory::getApplication(); if ($mainframe->isAdmin()) { $width = '450px'; } else { $width = '350px'; } ?> <table align="center" valign="top" > <tr> <td> <fieldset id="predef_date" style="width: <?php echo $width; ?> ; height: 100px;"> <legend><?php echo _JNEWS_GROUP_PREDEFINED_DATE . ':'; ?> </legend> <table align="center"> <tbody> <tr><td valign="top"><?php echo _JNEWS_LABEL_SET_INTERVAL . ':'; ?> </td> <td valign="top"> <?php echo $filters->interval; ?> </td></tr> <tr> <td valign="top"><?php echo _JNEWS_LABEL_DATE_RANGE . ':'; ?> </td> <td valign="top"> <?php echo $filters->predefinedRange; ?> </td></tr> <tr> <td valign="top" style="padding-right:10px;"><?php echo _JNEWS_LABEL_CURRENT_SERVER_TIME . ': '; ?> </td> <td valign="top"><?php echo date("l, j F Y H:i:s", jnews::getNow(0, true)); ?> </td></tr> </tr> </tbody> </table> </fieldset> </td> <td> <script type="text/javascript" src="<?php echo $mainPath . 'js/calendar.js'; ?> " > </script> <table align="center"> <?php if ($GLOBALS[JNEWS . 'level'] > 2) { ?> <tr><td valign="top"><?php echo _JNEWS_LABEL_REPORT_TYPE . ':'; ?> </td> <td valign="top"><?php echo $filters->reportType; ?> </td></tr> <?php } if ($mainframe->isAdmin()) { $width = '350px'; } else { $width = '300px'; } ?> <tr><td colspan="2" valign="top"> <fieldset id="specific_date"style="width: <?php echo $width; ?> ; height: 80px;"><legend><?php echo _JNEWS_GROUP_SPECIFIED_DATE; ?> </legend> <table align="center" > <tbody> <tr><td valign="top"><?php echo _JNEWS_SPECIFIED_DATE_START . ':'; ?> </td> <td valign="top"> <input id="startdate" name="startdate" value="<?php echo $startdate; ?> " type="text"> <input type="button" class="aca_calendar" value="" style ="background:transparent url('<?php echo $mainPath . 'images/dashboard-icon.gif'; ?> ') repeat scroll 0 0;" onclick="displayCalendar(document.getElementById('startdate'),'yyyy-mm-dd',this,false, '<?php echo $mainPath . 'images/'; ?> ')"> </td></tr> <tr><td valign="top"><?php echo _JNEWS_SPECIFIED_DATE_END . ':'; ?> </td> <td valign="top"> <input name="enddate" id="enddate" value="<?php echo $enddate; ?> " type="text"> <input type="button" class="aca_calendar" value="" style ="background:transparent url('<?php echo $mainPath . 'images/dashboard-icon.gif'; ?> ') repeat scroll 0 0;" onclick="displayCalendar(document.getElementById('enddate'),'yyyy-mm-dd',this,false, '<?php echo $mainPath . 'images/'; ?> ')"> </td></tr> </tbody></table> </table> </td></tr> </tbody> </table> <input type="hidden" name="option" value="<?php echo JNEWS_OPTION; ?> " /> <input type="hidden" id ="act" value="statistics"> <input type="hidden" id ="task" value=""> <?php $mainframe = JFactory::getApplication(); if (version_compare(JVERSION, '1.6.0', '<') || $mainframe->isAdmin()) { ?> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'generate') { <?php if ($mainframe->isAdmin()) { ?> form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=statistics&task=generate#'; <?php } else { //frontend $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION . '&act=statistics&task=generate&mid=6'); ?> form.action = '<?php echo $mainLink; ?> '; <?php } ?> }else if (pressbutton == 'refresh') { <?php if ($mainframe->isAdmin()) { ?> form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=statistics&task=refresh'; <?php } else { //frontend $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION . '&act=statistics&task=refresh&mid=6'); ?> form.action = '<?php echo $mainLink; ?> '; <?php } ?> }else if(pressbutton == 'exportmailing'){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=statistics&task=exportm'; }else if(pressbutton == 'exportlist'){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=statistics&task=exportl'; }else if(pressbutton == 'exportsubscribers'){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=statistics&task=exports'; } submitform( pressbutton ); } </script> <?php } else { ?> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'generate') { form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=statistics&task=generate#'; //form.action = 'generate#'; }else if (pressbutton == 'refresh') { form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=statistics&task=refresh'; //form.action = 'refresh'; }else if(pressbutton == 'exportmailing'){ form.action = 'exportm'; }else if(pressbutton == 'exportlist'){ form.action = 'exportl'; }else if(pressbutton == 'exportsubscribers'){ form.action = 'exports'; } submitform( pressbutton ); } </script> <?php } }
function setupMaiOptions($data) { $xf = new jNews_Config(); $return = '<br />' . _JNEWS_INSTALL_CONFIG . ' : '; $config = array(); $exist = jnews::checkExisting(); if ($exist['news1'] == 0) { $config['news1'] = '0'; } if ($exist['news2'] == 0) { $config['news2'] = '0'; } if ($exist['news3'] == 0) { $config['news3'] = '0'; } $conf = JFactory::getConfig(); $config['emailmethod'] = $conf->get('config.mailer'); $config['sendmail_path'] = $conf->get('config.sendmail'); $config['sendmail_from'] = $conf->get('config.mailfrom'); $config['sendmail_email'] = $conf->get('config.mailfrom'); $config['sendmail_name'] = $conf->get('config.fromname'); $config['smtp_host'] = $conf->get('config.smtphost'); $config['smtp_auth_required'] = $conf->get('config.smtpauth'); $config['smtp_secure'] = $conf->get('config.smtpsecure'); $config['smtp_username'] = $conf->get('config.smtpuser'); $config['smtp_password'] = $conf->get('config.smtppass'); $config['confirm_fromname'] = $conf->get('config.fromname'); $config['confirm_fromemail'] = $conf->get('config.mailfrom'); // $config['confirm_return'] = $conf->get('config.mailfrom'); $config['max_queue'] = $conf->get('max_queue'); $config['max_attempts'] = $conf->get('max_attempts'); $config['date_update'] = jnews::getNow(); for ($index = 0; $index < $data['nblist']; $index++) { $xf->insert('listname' . $index, '', 0); $xf->insert('listnames' . $index, '', 0); $xf->insert('listype' . $index, '', 0); $xf->insert('listshow' . $index, '', 0); $xf->insert('classes' . $index, '', 0); $xf->insert('listlogo' . $index, '', 0); $xf->insert('totallist' . $index, '', 0); $xf->insert('act_totallist' . $index, '', 0); $xf->insert('totalmailing' . $index, '', 0); $xf->insert('totalmailingsent' . $index, '', 0); $xf->insert('act_totalmailing' . $index, '', 0); $xf->insert('totalsubcribers' . $index, '', 0); $xf->insert('act_totalsubcribers' . $index, '', 0); } //line to be changed code #73099111 $activeList = '1'; $config['classes1'] = 'jNews_Newsletter'; $config['classes2'] = 'jNews_Autoresponder'; $config['classes7'] = 'jNews_Autonews'; $xf->insert('activelist', $activeList, 0, true); $config['listype0'] = '1'; $config['listname0'] = ''; $config['listnames0'] = _JNEWS_MAILING_ALL; $config['listshow0'] = '1'; $config['listlogo0'] = 'subscribers.png'; $config['classes0'] = ''; $config['listype1'] = '1'; $config['listname1'] = '_JNEWS_NEWSLETTER'; $config['listnames1'] = '_JNEWS_MENU_NEWSLETTERS'; $config['listshow1'] = '1'; $config['listlogo1'] = 'newsletter.png'; $nb = explode(',', $activeList); $size = sizeof($nb); for ($k = 0; $k < $size; $k++) { $index = $nb[$k]; if (class_exists($config['classes' . $index])) { $classConfig = new $config['classes' . $index](); $config = array_merge($config, $classConfig->getActive()); } } if ($xf->saveConfig($config)) { jnews::displayInfo(_JNEWS_INSTALL_SUCCESS, 'success'); } else { jnews::displayInfo('Configuration file not updated', 'error'); } }
function configuration($action, $task) { $db = JFactory::getDBO(); $config = array(); $redirect = true; $xf = new jNews_Config(); $message = JRequest::getVar('message', ''); $clear_log = JRequest::getVar('clear_log', '0'); switch ($task) { case 'syncUsers': echo jnews::printYN(jNews_Subscribers::syncSubscribers(), _JNEWS_SYNC_USERS_SUCCESS, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action); jNews_ConfigHTML::showConfigEdit(); break; case 'sendtest': $my = JFactory::getUser(); $mailing = new stdClass(); $status = false; $mailing->id = 1; $mailing->images = ''; $mailing->attachments = ''; $mailing->fromname = trim($GLOBALS[JNEWS . 'sendmail_name']); $mailing->fromemail = trim($GLOBALS[JNEWS . 'sendmail_email']); if (empty($mailing->fromemail)) { $mailing->fromemail = trim($GLOBALS[JNEWS . 'sendmail_from']); } ### create the mail $mail = jNews_ProcessMail::getMailer($mailing); ### create content $mail->IsHTML(true); $mail->Body = '<p>This message has been sent at ' . date('l, j F Y h:i:s', jnews::getNow(0, true)) . ' from ' . JNEWS_JPATH_LIVE . ' to test your mail configuration.</p><br/><p style="color:green;">' . _JNEWS_SENDTEST_CONFIGSUCC . '</p>'; $mail->AddAddress($my->email, $my->name); $mail->Subject = 'Test Email from ' . JNEWS_JPATH_LIVE; $status = $mail->Send(); $success = 'Email "' . $mail->Subject . '" successfully sent to ' . $my->name . ' (' . $my->email . ')'; $error = 'Failed sending "' . $mail->Subject . '" to ' . $my->name . ' (' . $my->email . '). <br/>' . _JNEWS_SENDTEST_CONFIGERROR; $message = is_bool($status) && $status ? jnews::printM('ok', $success) : jnews::printM('error', $error); backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action); jNews_ConfigHTML::showConfigEdit(); echo $message; break; case 'apply': case 'save': JRequest::checkToken() or die('Invalid Token'); if ($clear_log != 0) { @unlink(JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'save_log_file']); } $config = JRequest::getVar('config'); $message = jnews::printYN($xf->saveConfig($config), _JNEWS_CONFIG_UPDATED, _JNEWS_ERROR); $listCreator = JRequest::getVar('list_creatorfe', '', 'post'); if (!empty($listCreator)) { $xf->update('list_creatorfe', $listCreator); } //we update the active list $xf->updateActiveList(); if ($GLOBALS[JNEWS . 'level'] > 1) { //we require the cron controller require_once JNEWSPATH_ADMIN . 'controllers' . DS . 'cron.jnews.php'; //we update the published/enabld of the jnews cron plugin according to what is selected if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $db->setQuery("UPDATE `#__plugins` SET `published` = " . $config['jnewscronplugin'] . " WHERE `element`='jnewscron' "); } else { //j16 $db->setQuery("UPDATE `#__extensions` SET `enabled` = " . $config['jnewscronplugin'] . " WHERE `type` = 'plugin' AND `element`='jnewscron' "); } $db->query(); //Joobi Cron System $cron = $GLOBALS[JNEWS . 'j_cron']; if ($cron == 2) { joobiCron('Yes'); } else { joobiCron('No'); } } if ($task == 'apply') { backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action); jNews_ConfigHTML::showConfigEdit(); echo $message; } else { backHTML::controlPanel(); } break; case 'cancel': jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); break; case 'cpanel': backHTML::controlPanel(); break; case 'acaupdate': // update jnews datas from acajoom $msg = jNews_TableUpdate::executeUpdate(); echo $msg . '<br><br>'; default: backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action); jNews_ConfigHTML::showConfigEdit(); break; } return true; }
/** * This function do the tag replacement on the notification message * @param string $content the content of the notifcation message * @param object $subscriber the subscriber or unsubscriber of the list * @param object $owner the owner or creator of the list * @param object $list the list * @return string the whole content with the replaced tag */ private static function _replaceTagNotify($content, $subscriber, $owner, $list = null) { $replaceWhat = array('{tag:date}', '[LISTOWNERNAME]', '[LISTOWNEREMAIL]', '[SUBSCRIBERNAME]', '[SUBSCRIBEREMAIL]', '[LISTID]', '[LISTNAME]', '[SITE]'); if (version_compare(JVERSION, '3.0.0', '<')) { $replaceBy = array(JHTML::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC1'), JNEWS_TIME_OFFSET), $owner->name, $owner->email, $subscriber->name, $subscriber->email, $list->id, $list->list_name, JNEWS_JPATH_LIVE_NO_HTTPS); } else { $replaceBy = array(JHtml::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC1'), JNEWS_TIME_OFFSET), $owner->name, $owner->email, $subscriber->name, $subscriber->email, $list->id, $list->list_name, JNEWS_JPATH_LIVE_NO_HTTPS); } $content = str_replace($replaceWhat, $replaceBy, $content); return $content; }
public static function getMailingView($mailingId, $listId = 0) { $archivemailing = new stdClass(); if ($mailingId != 0) { if ($listId > 0) { $list = jNews_Lists::getOneList($listId); $archivemailing = jNews_Mailing::getOneMailing($list, $mailingId, 0, $new); } else { $archivemailing = jNews_Mailing::getOneMailing(0, $mailingId, 0, $new); } $mailingtype = JRequest::getInt('listype'); if ($mailingtype == '7') { $db = JFactory::getDBO(); $query = 'SELECT `delay` FROM `#__jnews_queue` WHERE `type` = 7 AND `mailing_id` = ' . $archivemailing->id; $db->setQuery($query); $snDelay = $db->loadResult(); if (!empty($snDelay)) { $myTime = jnews::getNow(); $computedDate = jNews_Autonews::computeSmartDate($archivemailing->delay_min, $snDelay, $myTime); //We use the start date to previous the first one $computedDate->lastDate = $archivemailing->start_date; $newMailing = jNews_Autonews::loadSmartContent($archivemailing, $computedDate->lastDate, $snDelay); $archivemailing = !empty($newMailing) ? $newMailing : $archivemailing; } } if ($new) { return ''; } else { $mainframe = JFactory::getApplication(); JPluginHelper::importPlugin('jnews'); $bot_results = $mainframe->triggerEvent('jnewsbot_transformall', array(&$archivemailing->htmlcontent, &$archivemailing->textonly, &$archivemailing->subject)); $myReceiver = JFactory::getUser(); $db = JFactory::getDBO(); $query = "SELECT A.`id`, A.`receive_html` "; //we retreive the extra columns info of the user if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnews is pro if ($GLOBALS[JNEWS . 'show_column1']) { $query .= ', A.`column1`'; } if ($GLOBALS[JNEWS . 'show_column2']) { $query .= ',A.`column2`'; } if ($GLOBALS[JNEWS . 'show_column3']) { $query .= ',A.`column3`'; } if ($GLOBALS[JNEWS . 'show_column4']) { $query .= ',A.`column4`'; } if ($GLOBALS[JNEWS . 'show_column5']) { $query .= ',A.`column5`'; } } $query .= " FROM `#__jnews_subscribers` AS A WHERE A.`user_id`=" . $myReceiver->id; $db->setQuery($query); $myReceiverColumns = $db->loadObject(); if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnews is pro if ($GLOBALS[JNEWS . 'show_column1']) { $myReceiver->column1 = $myReceiverColumns->column1; } if ($GLOBALS[JNEWS . 'show_column2']) { $myReceiver->column2 = $myReceiverColumns->column2; } if ($GLOBALS[JNEWS . 'show_column3']) { $myReceiver->column3 = $myReceiverColumns->column3; } if ($GLOBALS[JNEWS . 'show_column4']) { $myReceiver->column4 = $myReceiverColumns->column4; } if ($GLOBALS[JNEWS . 'show_column5']) { $myReceiver->column5 = $myReceiverColumns->column5; } } $myReceiver->receive_html = !empty($myReceiverColumns->id) ? $myReceiverColumns->receive_html : 1; $oneQueue = new stdClass(); $oneQueue->id = $mailingId; $archivemailing->subject = jNews_ProcessMail::replaceTags($archivemailing->subject, $myReceiver, $oneQueue, false, null, false); $archivemailing->htmlcontent = jNews_ProcessMail::replaceTags($archivemailing->htmlcontent, $myReceiver, $oneQueue, true); preg_match_all('/<img([^>]*)src="([^">]+)"([^>]*)>/i', $archivemailing->htmlcontent, $images, PREG_SET_ORDER); if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $imgfolders = '/images/stories'; } else { //j16 $imgfolders = '/images/sampledata'; } foreach ($images as $image) { $image[2] = preg_replace('/(\\.\\.\\/)+/', '/', $image[2]); $image[2] = str_replace(array(JNEWS_JPATH_LIVE, JNEWS_JPATH_LIVE_NO_HTTPS), '', $image[2]); $image[2] = preg_replace('/^\\//', '', $image[2]); if (stristr($image[2], 'http://') === false) { // remove unneeded directory information if (stristr($image[2], $imgfolders) !== false) { $image[2] = '/' . stristr($image[2], $imgfolders); } // end if $replacement = '<img ' . $image[1] . 'src="' . JNEWS_JPATH_LIVE_NO_HTTPS . $image[2] . '"' . $image[3] . '>'; } else { $replacement = '<img ' . $image[1] . 'src="' . $image[2] . '"' . $image[3] . '>'; } // end if } } } return $archivemailing; }
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 }
function lists($action, $task, $listId, $listType) { $db = JFactory::getDBO(); $my = JFactory::getUser(); $css = '.icon-48-lists { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/lists.png)}'; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css, $type = 'text/css'); $img = 'lists.png'; $listsearch = JRequest::getVar('listsearch', ''); $message = ''; $xf = new jNews_Config(); $showLists = true; $checkToggle = false; // defined toggle for publish and unpublish of mailings if (!empty($task) && $task == 'togle') { $checkToggle = true; $id = JRequest::getVar('listid'); $col = JRequest::getVar('col'); $listId = !empty($id) && !empty($col) ? $id : $listId; $task = !empty($listId) && !empty($col) ? $col : $task; } switch ($task) { case 'new': case 'add': $subscriber = jNews_Subscribers::getSubscriberInfoFromUserId($my->id); if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $acl = JFactory::getACL(); $groups = $acl->get_group_children_tree(null, 'USERS', false); } else { //j16 $db = JFactory::getDBO(); $db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC'); $groups = $db->loadObjectList(); } $allGroupIds = array(); foreach ($groups as $oneGroup) { $allGroupIds[] = $oneGroup->value; } $newList = new stdClass(); $showLists = false; $newList->id = ''; $newList->html = 1; $newList->new_letter = 1; $newList->list_name = ''; $newList->list_desc = ''; $newList->template = ''; if (empty($subscriber)) { $newList->sendername = ''; $newList->senderemail = ''; $newList->bounceadres = ''; } else { $newList->sendername = ''; $newList->senderemail = ''; $newList->bounceadres = ''; } $newList->hidden = 1; $newList->auto_add = 0; $newList->list_type = $listType; $newList->delay_min = 1; $newList->delay_max = 7; $newList->user_choose = 0; $newList->cat_id = '0:0'; $newList->follow_up = ''; $newList->notify_id = 0; $newList->owner = $my->id; $newList->acc_level = '24,25,7,8'; $newList->acc_id = implode(',', $allGroupIds); $newList->published = 1; $newList->start_date = date('Y-m-d', time()); $newList->next_date = jnews::getNow(); $newList->subscribemessage = _JNEWS_DEFAULT_SUBSCRIBE_MESS; $newList->unsubscribemessage = _JNEWS_DEFAULT_UNSUBSCRIBE_MESS; $newList->notifyadminmsg = _JNEWS_UNSUBSCRIBE_ADMIN_NOTIFICATION; $newList->subnotifymsg = _JNEWS_SUBSDEFAULT_NOTIFYMSG; $newList->subnotifysend = 1; $newList->unsubscribesend = 1; $newList->unsubscribenotifyadmin = 1; $newList->footer = 1; $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; $show = jNews_ListType::showType($newList->list_type, 'editlist'); if ($listType == 1) { backHTML::_header(_JNEWS_NEW . ' ' . _JNEWS_LIST, $img, $message, $task, $action); } else { backHTML::_header(_JNEWS_NEW . ' ' . _JNEWS_AUTORESP . ' ' . _JNEWS_LIST, $img, $message, $task, $action); } backHTML::formStart('editlist', $newList->html, ''); jNews_ListsHTML::editList($newList, $forms, $show, $listType); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('listid', $newList->id); backHTML::formEnd($go); break; case 'doNew': JRequest::checkToken() or die('Invalid Token'); $listname = JRequest::getVar('list_name', ''); if (empty($listname)) { echo "<script> alert(' List name must be filled out. '); window.history.go(-1);</script>\n"; return false; } $now = jnews::getNow(); $query = "SELECT `id` FROM `#__jnews_lists` WHERE `list_name`= '" . addslashes($listname) . "' "; $db->setQuery($query); $lId = $db->loadResult(); if ($lId > 0) { echo "<script> alert(' This list already exist, please choose another name. '); window.history.go(-1);</script>\n"; return false; } else { $query = "INSERT INTO `#__jnews_lists` (`list_name`,`createdate`) VALUES ( '" . addslashes($listname) . "' , '{$now}' )"; $db->setQuery($query); $db->query(); } $query = "SELECT * FROM `#__jnews_lists` WHERE `list_name`= '" . addslashes($listname) . "' "; $db->setQuery($query); $mynewlist = $db->loadObject(); $mynewlist->list_name = stripslashes($mynewlist->list_name); $mynewlist->list_desc = stripslashes($mynewlist->list_desc); $mynewlist->template = $mynewlist->template; $mynewlist->layout = stripslashes($mynewlist->layout); $mynewlist->subscribemessage = stripslashes($mynewlist->subscribemessage); $mynewlist->unsubscribemessage = stripslashes($mynewlist->unsubscribemessage); $mynewlist->notifyadminmsg = stripslashes($mynewlist->notifyadminmsg); $mynewlist->subnotifysend = stripslashes($mynewlist->subnotifysend); $mynewlist->subnotifymsg = stripslashes($mynewlist->subnotifymsg); $listId = $mynewlist->id; $message = jnews::printYN(jNews_Lists::updateListFromEdit($listId, '', true, $listType), _JNEWS_LIST_ADDED, _JNEWS_ERROR); $xf->plus('totallist0', 1); $xf->plus('act_totallist0', 1); $xf->plus('totallist' . $listType, 1); $xf->plus('act_totallist' . $listType, 1); break; case 'edit': if ($listId == 0) { echo "<script> alert('" . addslashes(_JNEWS_SELECT_LIST) . "'); window.history.go(-1);</script>\n"; return false; } else { $showLists = false; $query = 'SELECT * FROM `#__jnews_lists` WHERE `id` = ' . intval($listId); $db->setQuery($query); $listEdit = $db->loadObject(); if ($listEdit->acc_id == 'all') { if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $acl = JFactory::getACL(); $groups = $acl->get_group_children_tree(null, 'USERS', false); } else { //j16 $db = JFactory::getDBO(); $db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC'); $groups = $db->loadObjectList(); } $allGroupIds = array(); foreach ($groups as $oneGroup) { $allGroupIds[] = $oneGroup->value; } $listEdit->acc_id = implode(',', $allGroupIds); } $listEdit->list_name = stripslashes($listEdit->list_name); $listEdit->list_desc = stripslashes($listEdit->list_desc); $listEdit->template = $listEdit->template; $listEdit->layout = stripslashes($listEdit->layout); $listEdit->subscribemessage = stripslashes($listEdit->subscribemessage); $listEdit->unsubscribemessage = stripslashes($listEdit->unsubscribemessage); $listEdit->notifyadminmsg = stripslashes($listEdit->notifyadminmsg); $listEdit->subnotifysend = stripslashes($listEdit->subnotifysend); $listEdit->subnotifymsg = stripslashes($listEdit->subnotifymsg); $listEdit->new_letter = 0; $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; $show = jNews_ListType::showType($listEdit->list_type, 'editlist'); backHTML::_header(_JNEWS_EDIT_A . @constant($GLOBALS[JNEWS . 'listname' . $listEdit->list_type]) . ' ' . _JNEWS_LIST, $img, $message, $task, $action); backHTML::formStart('listedit', $listEdit->html, ''); jNews_ListsHTML::editList($listEdit, $forms, $show, $listType); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('listid', $listEdit->id); backHTML::formEnd($go); } break; case 'update': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Lists::updateListFromEdit($listId, '', false, $listType), _JNEWS_LIST_UPDATED, _JNEWS_ERROR); break; case 'delete': JRequest::checkToken() or die('Invalid Token'); $query = "SELECT list_name FROM #__jnews_lists WHERE id = {$listId}"; $db->setQuery($query); $listName = $db->loadResult(); $message = jnews::printYN(jNews_Lists::deleteList($listId), '"' . $listName . '"' . _JNEWS_LIST . _JNEWS_SUCCESS_DELETED, _JNEWS_ERROR); break; case 'copy': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Lists::copyList($listId), _JNEWS_LIST_COPY, _JNEWS_ERROR); break; case 'publish': if (!$checkToggle) { JRequest::checkToken() or die('Invalid Token'); } $message = jnews::printYN(jNews_Lists::updateListFromList($listId, true, false), _JNEWS_PUBLISHED, _JNEWS_ERROR); if ($listType == 1) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $listType); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=' . $listType); } break; case 'unpublish': if (!$checkToggle) { JRequest::checkToken() or die('Invalid Token'); } $message = jnews::printYN(jNews_Lists::updateListFromList($listId, false, false), _JNEWS_UNPUBLISHED, _JNEWS_ERROR); if ($listType == 1) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $listType . '&listid=' . $listId); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=' . $listType . '&listid=' . $listId); } break; case 'forms': case 'make': if (class_exists('jNews_CreateForm')) { jNews_CreateForm::taskOptions($task); $showLists = false; } else { $showLists = true; } break; case 'cpanel': backHTML::controlPanel(); return true; break; case 'toggle': $listid = JRequest::getVar('listid'); $column = JRequest::getVar('col'); if (!empty($listid) && !empty($column)) { $passObj = new stdClass(); $passObj->tableName = '#__jnews_lists'; $passObj->columnName = $column; $passObj->whereColumn = 'id'; $passObj->whereColumnValue = $listid; jnews::toggle($passObj); } if ($listType == 1) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=1'); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=2'); } break; } if ($showLists) { $limit = -1; //Title header if ($listType == 1) { backHTML::_header(_JNEWS_MENU_LIST, $img, $message, $task, $action); } else { backHTML::_header(_JNEWS_ARLIST, $img, $message, $task, $action); } $show = jNews_ListType::showType(0, 'showListsBack'); $forms['main'] = "<form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; backHTML::formStart('show_mailing', '', ''); $paginationStart = JRequest::getVar('pg'); $app = JFactory::getApplication(); if (!empty($paginationStart)) { $limitstart = 0; $limitend = $paginationStart; } else { $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int'); $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int'); } $limittotal = jNews_Lists::getListCount($listType); $limittotal = $limittotal[0]; $setLimit = new stdClass(); $setLimit->total = !empty($limittotal) ? $limittotal : 0; $setLimit->start = !empty($limitstart) ? $limitstart : 0; $setLimit->end = !empty($limitend) ? $limitend : $limittotal; // recheck start if ($setLimit->total == $setLimit->end) { $setLimit->start = 0; } $setSort = new stdClass(); if ($listType == '2') { //autoresponder $key = JNEWS_OPTION . '.arlist'; $column = 'id'; $direction = 'desc'; } else { //newsletter $key = JNEWS_OPTION . '.list'; $column = 'list_name'; $direction = 'asc'; } $setSort->orderValue = $app->getUserStateFromRequest($key . 'filter_order', 'filter_order', $column, 'cmd'); $setSort->orderDir = $app->getUserStateFromRequest($key . 'filter_order_Dir', 'filter_order_Dir', $direction, 'word'); if ($listType == 2) { ?> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'delete') { var $ok = confirm('Are you sure you want to delete?\r\nAll of the mailings attached in this auto-responder will be deleted as well.'); if ( $ok == true ){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=arlist&task=delete'; }else{ return; } } submitform( pressbutton ); } </script> <?php } $listing = jNews_Lists::getLists(0, $listType, 1, '', false, false, false, false, false, $listsearch, $setLimit, $setSort); if (isset($setLimit->total) && !empty($listsearch)) { $lists = jNews_Lists::getLists(0, $listType, 1, '', false, false, false, false, false, $listsearch, $setSort); $setLimit->total = !empty($lists) ? count($lists) : $setLimit->total; } $totalSubs = array(); $totalUnSubs = array(); $db = JFactory::getDBO(); if (!empty($listing)) { foreach ($listing as $list) { $totalSubs[] = jNews_Subscribers::getSubscribersCount($list->id, true); $totalUnSubs[] = jNews_Subscribers::getSubscribersCount($list->id, 2); } } jNews_ListsHTML::showListingLists($listing, $action, 'edit', $forms, $show, $listsearch, $setLimit->end, $setLimit, $totalSubs, $setSort, $totalUnSubs); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('filter_order', $setSort->orderValue); $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir); backHTML::formEnd($go); return true; } }
public static function cronSettings($lists) { ?> <fieldset class="jnewscss"> <legend><?php echo _JNEWS_SCHEDULE_TITLE; ?> </legend> <table class="jnewstable" cellspacing="1" width="100%" > <tbody> <tr> <td width="185" class="key"> <span> <?php echo jNews_Tools::toolTip(_JNEWS_CRON_TRIGGERRED_TIPS, '', 280, 'tooltip.png', _JNEWS_CRON_TRIGGERRED, '', 0); ?> </span> </td> <td> <?php if ($GLOBALS[JNEWS . 'lasttime_cron_triggerred'] > 0) { echo date('l, j F Y H:i:s', jnews::getNow(0, true, $GLOBALS[JNEWS . 'lasttime_cron_triggerred'])); } ?> </td> </tr> <tr> <td width="185" class="key"> <span> <?php echo jNews_Tools::toolTip(_JNEWS_CRON_NEXTTRIGGER_TIPS, '', 280, 'tooltip.png', _JNEWS_CRON_NEXTTRIGGER, '', 0); ?> </span> </td> <td> <?php if ($GLOBALS[JNEWS . 'next_cron'] > 0) { // $next_cronTime = $GLOBALS[JNEWS.'next_cron'] - jnews::calculateOffset(JNEWS_TIME_OFFSET); // echo date('l, j F Y H:i:s', $next_cronTime ); echo date('l, j F Y H:i:s', jnews::getNow(0, true, $GLOBALS[JNEWS . 'next_cron'])); } ?> </td> </tr> <tr> <td width="185" class="key"> <span> <?php echo jNews_Tools::toolTip(_JNEWS_JOOBI_CRON_TIPS, '', 280, 'tooltip.png', _JNEWS_JOOBI_CRON, '', 0); ?> </span> </td> <td> <?php echo $lists['j_cron']; ?> </td> </tr> <tr> <td width="185" class="key"> <span> <?php echo jNews_Tools::toolTip(_JNEWS_JNEWS_CRON_TIPS, '', 280, 'tooltip.png', _JNEWS_JNEWS_CRON, '', 0); ?> </span> </td> <td> <?php //we get here if the jnews cron system plugin is published or not $db = JFactory::getDBO(); if (version_compare(JVERSION, '1.6.0', '>=')) { //j16 $query = 'SELECT `enabled` FROM `#__extensions` WHERE `element`="jnewscron"'; } else { $query = 'SELECT `published` FROM `#__plugins` WHERE `element`="jnewscron"'; } $db->setQuery($query); $db->query(); $value = $db->loadResult(); // // if($GLOBALS[JNEWS.'j_cron'] == 2) $value = 1; // else $value = 0; echo jnews::HTML_BooleanList('config[jnewscronplugin]', 'class="inputbox"', $value); ?> </td> </tr> <tr> <td width="185" class="key"> <span> <?php echo jNews_Tools::toolTip(_JNEWS_YOUR_CRON, '', 280, 'tooltip.png', _JNEWS_YOUR_CRON, '', 0); ?> </span> </td> <td> <?php //Cron System $cron = @$GLOBALS[JNEWS . 'j_cron']; switch ($cron) { case '0': //No Cron break; case '1': //jNews Cron System Plugin //jNews Cron System Plugin case '3': //External Cron //External Cron case '2': //Joobi Cron $url = JNEWS_JPATH_LIVE . '/index.php?option=' . JNEWS_OPTION . '&act=cron&tmpl=component'; // echo _JNEWS_YOUR_CRON; // echo '<br><b> ' . $url . '</b>'; echo '<b>' . $url . '</b>'; echo '<br /><b><big>'; ?> <a href="<?php echo $url; ?> " TARGET="_NEW"> <?php echo _JNEWS_LAUNCH_CRON; ?> </a> <?php echo '</big></b>'; break; default: //No Cron break; } ?> </td> </tr> </tbody> </table> </fieldset> <fieldset class="jnewscss"> <legend><?php echo _JNEWS_SCHEDULE_FREQUENCY; ?> </legend> <table class="jnewstable" cellspacing="1" width="100%" > <tbody> <tr> <td width="185" class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_CRON_MAX_FREQ_TIPS; $title = _JNEWS_CRON_MAX_FREQ; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <input class="inputbox" type="text" name="config['cron_max_freq']" size="5" value="<?php echo $GLOBALS[JNEWS . 'cron_max_freq']; ?> "> <?php echo _JNEWS_CRON_MINUTES; ?> </td> </tr> <tr> <td width="185" class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_CRON_MAX_EMAIL_TIPS; $title = _JNEWS_CRON_MAX_EMAIL; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <input class="inputbox" type="text" name="config['cron_max_emails']" size="5" value="<?php echo $GLOBALS[JNEWS . 'cron_max_emails']; ?> "> </td> </tr> <tr> <td width="185" class="key"> <span class="editlinktip"> <?php echo jNews_Tools::toolTip('Maximum number of attempts to send the queue', '', 280, 'tooltip.png', 'Maximum number of attempts', '', 0); ?> </span> </td> <td> <input class="inputbox" type="text" name="config['max_attempts']" size="20" value="<?php echo $GLOBALS[JNEWS . 'max_attempts']; ?> "> </td> </tr> </tbody> </table> </fieldset> <!--Queue Settings--> <fieldset class="jnewscss"> <legend><?php echo _JNEWS_QUEUE_SETTING; ?> </legend> <table class="jnewstable" cellspacing="1" width="100%" > <tbody> <tr> <td width="185" class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_QUEUESTATS_TIPS; $title = _JNEWS_QUEUE_STATUS; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <?php echo $lists['queue_status']; ?> </td> </tr> <!--Smart Queue--> <tr> <td width="185" class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_SMARTQ_TIPS; $title = _JNEWS_SMARTQUEUE; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <?php echo $lists['smart_queue']; ?> </td> </tr> </tbody> </table> </fieldset> <?php if (class_exists('jNews_Pro')) { ?> <fieldset class="jnewscss"> <legend><?php echo _JNEWS_MAINTENANCE_TAB; ?> </legend> <table class="jnewstable" cellspacing="1" width="100%" > <tbody> <tr> <td width="185" class="key"> <span class="editlinktip"> <?php $tip = _JNEWS_MAINTENANCE_FREQ_TIPS; $title = _JNEWS_MAINTENANCE_FREQ; echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0); ?> </span> </td> <td> <input class="inputbox" type="text" name="config['maintenance_clear']" size="5" value="<?php echo $GLOBALS[JNEWS . 'maintenance_clear']; ?> "> <?php echo _JNEWS_CRON_DAYS; ?> </td> </tr> <tr> <td width="185" class="key"> <span class="editlinktip"> <?php echo jNews_Tools::toolTip('The system will automatically delete statistics older than the specified value', '', 280, 'tooltip.png', 'Clean Statistics', '', 0); ?> </span> </td> <td> <input class="inputbox" type="text" name="config['clean_stats']" size="5" value="<?php echo $GLOBALS[JNEWS . 'clean_stats']; ?> "> <?php echo 'days'; ?> </td> </tr> </tbody> </table> </fieldset> <?php } }
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; } }