public static function FEmenu() { $my = JFactory::getUser(); //we check if the user is an admin, is an owner of a list and has access to any list $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 (!jnews::checkPermissions('admin') && !jnews::checkPermissions($gid) && empty($listsAddEdit)) { return ''; } $Itemid = JRequest::getInt('Itemid'); if (empty($Itemid)) { $Itemid = $GLOBALS[JNEWS . 'itemidAca']; } $active = JRequest::getVar('mid', '0'); if ($my->id <= 0) { return true; } $status = false; if (version_compare(JVERSION, '1.6.0', '>=')) { //j15 $usergid = JAccess::getGroupsByUser($my->id, false); $my->gid = $usergid[0]; } $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0; $gids = array(); $gids = explode(',', $gid); if (empty($gids)) { $gids = $gid; } $ownedlists = jNews_Lists::getOwnedlists($my->id); if (empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if ($GLOBALS[JNEWS . 'type'] != 'PRO') { return false; } if (!$status) { if ((!empty($my->id) || !empty($ownedlists)) && jnews::checkPermissions('all') || in_array($my->gid, $gids)) { $status = true; } } if (!$status) { $db = JFactory::getDBO(); $query = 'SELECT * FROM `#__jnews_lists` WHERE `hidden` = 1 AND `published` = 1'; $db->setQuery($query); $lists = $db->loadObjectList(); $access = false; foreach ($lists as $list) { $bit = jnews::checkPermissions($list->acc_level); if ($bit) { $access = true; break; } } $gidAdmins = array(24, 25, 7, 8); if (jnews::checkPermissions($gid) || in_array($my->gid, $gidAdmins) || $access) { $status = true; } } if ($status) { $doc6 = JFactory::getDocument(); $doc6->addStyleSheet(JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/css/menu.css'); $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0; ?> <div class="m"> <ul id="submenu"> <li><a <?php echo $active == 1 ? 'class="active"' : ''; ?> href="index.php?option=<?php echo JNEWS_OPTION; ?> &act=list&listype=1&mid=1&Itemid=<?php echo $Itemid; ?> "><?php echo _JNEWS_EMAIL_LISTS; ?> </a></li> <?php if (!empty($ownedlists) || jnews::checkPermissions('admin') || jnews::checkPermissions($gid)) { if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) { if (class_exists('jNews_Social')) { ?> <li><a <?php echo $active == 2 ? 'class="active"' : ''; ?> href="index.php?option=<?php echo JNEWS_OPTION; ?> &act=subscribers&mid=2&Itemid=<?php echo $Itemid; ?> "><?php echo _JNEWS_MENU_SUBSCRIBERS; ?> </a></li> <?php } } } // if(class_exists('jNews_Social')) { //8254465 ?> <li><a <?php echo $active == 3 ? 'class="active"' : ''; ?> href="index.php?option=<?php echo JNEWS_OPTION; ?> &act=mailing&listype=1&mid=3&Itemid=<?php echo $Itemid; ?> "><?php echo _JNEWS_MENU_NEWSLETTERS; ?> </a></li> <?php if ($GLOBALS[JNEWS . 'allow_sn']) { ?> <li><a <?php echo $active == 4 ? 'class="active"' : ''; ?> href="index.php?option=<?php echo JNEWS_OPTION; ?> &act=mailing&listype=7&mid=4&Itemid=<?php echo $Itemid; ?> "><?php echo _JNEWS_MENU_AUTONEWS; ?> </a></li> <?php } // } if (class_exists('jNews_Social') && $GLOBALS[JNEWS . 'allow_fe_autoresponder']) { ?> <li><a <?php // 88744551 - auto-responder should be list not mailing echo $active == 5 ? 'class="active"' : ''; ?> href="index.php?option=<?php echo JNEWS_OPTION; ?> &act=list&listype=2&mid=5&Itemid=<?php echo $Itemid; ?> "><?php echo _JNEWS_MENU_AUTOS; ?> </a></li> <?php } // if(class_exists('jNews_Social')) { //8254465 if (!empty($ownedlists) || jnews::checkPermissions('admin') || jnews::checkPermissions($gid)) { ?> <li><a <?php echo $active == 6 ? 'class="active"' : ''; ?> href="index.php?option=<?php echo JNEWS_OPTION; ?> &act=statistics&mid=6&Itemid=<?php echo $Itemid; ?> "><?php echo _JNEWS_MENU_STATS_REPORTS; ?> </a></li> <?php } // }endif social ?> </ul> <div class="clr"></div> </div> <?php } return true; }
function subscribers($action, $task, $userid, $listId, $cid, $front = false) { $Itemid = JRequest::getInt('Itemid'); $mainframe = JFactory::getApplication(); $newSubscriber = null; $subscriberId = JRequest::getInt('subscriber_id'); $message = JRequest::getVar('message', ''); $css = '.icon-48-subscribers { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/subscribers.png)}'; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css, $type = 'text/css'); $img = 'subscribers.png'; $emailField = JRequest::getVar('email', ''); $new = true; //new subscriber $my = JFactory::getUser(); //START OF DATA FROM REQUEST $subscriber = new stdClass(); $subscriber->user_id = JRequest::getInt('user_id'); $subscriber->name = JRequest::getVar('name', ''); $subscriber->email = JRequest::getVar('email', '', '', 'STRING'); if (!jNews_Subscribers::validEmail($subscriber->email)) { $subscriber->email = ''; } $subscriber->receive_html = JRequest::getInt('receive_html', 0); if (empty($subscriberId)) { //if it is a new user the confirmed depends if the require confirmation is turned on if ($GLOBALS[JNEWS . 'require_confirmation'] == '1') { $subscriber->confirmed = 0; } else { $subscriber->confirmed = JRequest::getInt('confirmed'); } } else { $subscriber->confirmed = JRequest::getInt('confirmed'); } $subscriber->blacklist = JRequest::getVar('blacklist', 0); $subscriber->timezone = JRequest::getVar('timezone', ''); $subscriber->language_iso = JRequest::getVar('language_iso', ''); if (empty($subscriber->ip)) { $subscriber->ip = jNews_Subscribers::getIP(); } if ($subscriber->ip == '0.0.0.0') { $subscriber->ip = '0'; } $subscriber->subscribe_date = time(); $subscriber->params = JRequest::getVar('params', ''); //column if ($GLOBALS[JNEWS . 'level'] > 2) { $subscriber->column1 = JRequest::getVar('column1', ''); $subscriber->column2 = JRequest::getVar('column2', ''); $subscriber->column3 = JRequest::getVar('column3', ''); $subscriber->column4 = JRequest::getVar('column4', ''); $subscriber->column5 = JRequest::getVar('column5', ''); } //end check of version pro //END OF DATA FROM REQUEST $doShowSubscribers = true; switch ($task) { case 'updateOneSub': JRequest::checkToken() or die('Invalid Token'); $doShowSubscribers = true; $new = false; //we addslashes the name incase an ' is entered in the name $subscriber->name = addslashes($subscriber->name); $message = jnews::printYN(jNews_Subscribers::saveSubscriber($subscriber, $subscriberId, $new), _JNEWS_UPDATED_SUCCESSFULLY, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; case 'deleteOneSub': JRequest::checkToken() or die('Invalid Token'); $doShowSubscribers = true; $message = jnews::printYN(jNews_Subscribers::deleteSubscriber($subscriberId), _JNEWS_SUBSCRIBER_DELETED, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; case 'cancelSub': $doShowSubscribers = true; backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; case 'edit': foreach ($cid as $id) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers&task=show&userid=' . $id); } break; case 'show': $doShowSubscribers = false; $qid[0] = $userid; $subscriber = jNews_Subscribers::getSubscribersFromId($qid, false); $lists = jNews_Lists::getLists(0, 0, 1, '', false, false); $queues = jNews_ListsSubs::getSubscriberLists($userid); $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); backHTML::formStart('', 0, ''); echo jNews_SubscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, jnews::checkPermissions('admin'), false, false); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('subscriber_id', $subscriber->id); $go[] = jnews::makeObj('user_id', $subscriber->user_id); backHTML::formEnd($go); break; case 'new': case 'add': $doShowSubscribers = false; $newSubscriber = new stdClass(); $newSubscriber->id = ''; $newSubscriber->user_id = 0; $newSubscriber->name = ''; $newSubscriber->email = ''; $newSubscriber->ip = jNews_Subscribers::getIP(); $newSubscriber->receive_html = 1; $newSubscriber->confirmed = 1; $newSubscriber->blacklist = 0; $newSubscriber->timezone = '00:00:00'; $newSubscriber->language_iso = 'eng'; $newSubscriber->params = ''; $newSubscriber->subscribe_date = time(); //column if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnews is pro $newSubscriber->column1 = ''; $newSubscriber->column2 = ''; $newSubscriber->column3 = ''; $newSubscriber->column4 = ''; $newSubscriber->column5 = ''; } $lists = jNews_Lists::getLists(0, 0, 1, '', false, false); $queues = ''; $forms['main'] = " <form action='index.php' method='post' name=\"adminForm\" id=\"adminForm\">"; if ($mainframe->isAdmin() || $GLOBALS[JNEWS . 'use_backendview']) { backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); backHTML::formStart('addsubsback', 0, ''); echo jNews_SubscribersHTML::editSubscriber($newSubscriber, $lists, $queues, $forms, jnews::checkPermissions('admin'), false, false); } else { backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); backHTML::formStart('addsubsfront', 0, ''); echo jNews_SubscribersHTML::editSubscriberFE($newSubscriber, $lists, $queues, $forms, jnews::checkPermissions('admin'), false, false); } $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('subscriber_id', $newSubscriber->id); $go[] = jnews::makeObj('user_id', $newSubscriber->user_id); backHTML::formEnd($go); break; case 'doNew': JRequest::checkToken() or die('Invalid Token'); $doShowSubscribers = true; if ($mainframe->isAdmin() || $GLOBALS[JNEWS . 'use_backendview']) { $message = jnews::printYN(jNews_Subscribers::saveSubscriber($subscriber, $subscriberId, $new), _JNEWS_NEW_SUBSCRIBER, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); } else { $status = jNews_Subscribers::importBis(); if ($mainframe->isAdmin()) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers&mid=2'); } else { $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION . '&act=subscribers&mid=2'); jNews_Tools::redirect($mainLink); } } break; case 'delete': JRequest::checkToken() or die('Invalid Token'); if (!is_array($cid) || count($cid) < 1) { echo "<script> alert('Select an item to delete'); window.history.go(-1);</script>\n"; return false; } else { $status = true; foreach ($cid as $id) { if (!jNews_Subscribers::deleteSubscriber($id)) { $status = false; } } $message = jnews::printYN($status, _JNEWS_SUBSCRIBER_DELETED, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); } break; case 'update': JRequest::checkToken() or die('Invalid Token'); if (!is_array($cid) || count($cid) < 1) { echo "<script> alert('Select an item to update'); window.history.go(-1);</script>\n"; return false; } else { foreach ($cid as $id) { $changes = JRequest::getVar($id, array(0)); if (!isset($changes['receive_html'])) { $changes['receive_html'] = 0; } if (!isset($changes['confirmed'])) { $changes['confirmed'] = 0; } } } $message = jnews::print_message(_JNEWS_UPDATED_SUCCESSFULLY, 1); break; case 'export': $doShowSubscribers = false; backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); jNews_SubscribersHTML::export($action, $listId); break; case 'doExport': $message = jnews::printYN(jNews_Subscribers::export($listId), _EXPORT, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; case 'import': $doShowSubscribers = false; backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); $lists = jNews_Lists::getLists('', 0, '', '', false, true, true, false, false); jNews_SubscribersHTML::import($action, $lists, $listId); break; case 'doImport': JRequest::checkToken() or die('Invalid Token'); $message = jNews_Subscribers::importBis(); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); $message = !empty($message) && $message !== true ? $message : ($message === false ? 'Import failed' : _JNEWS_IMPORT_FINISHED); if ($mainframe->isAdmin()) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers', $message); } else { $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION . '&act=subscribers&mid=2'); jNews_Tools::redirect($mainLink); } break; case 'subscribeAll': case 'unsubscribeAll': JRequest::checkToken() or die('Invalid Token'); break; case 'cancel': if ($listId != 0) { $listId = 0; } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); } backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; case 'cpanel': $mainframe = JFactory::getApplication(); if ($mainframe->isAdmin()) { backHTML::controlPanel(); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); } $doShowSubscribers = 0; break; case 'toggle': $subid = JRequest::getVar('subid'); $column = JRequest::getVar('col'); if (!empty($subid) && !empty($column)) { $passObj = new stdClass(); $passObj->tableName = '#__jnews_subscribers'; $passObj->columnName = $column; $passObj->whereColumn = 'id'; $passObj->whereColumnValue = $subid; jnews::toggle($passObj); // change suspend status if column toggled is confirmed if ($column == 'confirmed') { $passObj = new stdClass(); $passObj->tableName = '#__jnews_queue'; $passObj->columnName = 'suspend'; $passObj->whereColumn = 'subscriber_id'; $passObj->whereColumnValue = $subid; jnews::toggle($passObj); } } jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $listId); break; default: backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; } if ($doShowSubscribers) { $limit = -1; $emailsearch = JRequest::getVar('emailsearch', '', '', 'STRING'); $emailsearch = htmlentities($emailsearch, ENT_COMPAT, "UTF-8"); $paginationStart = JRequest::getVar('pg'); $lll = JRequest::getVar('limitstart'); if (empty($lll)) { JRequest::setVar('limitstart', 0, 'int'); } $app = JFactory::getApplication(); $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int'); $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int'); $subscirberTypeID = JRequest::getVar('subtype', 1); if (empty($listId) && in_array($subscirberTypeID, array(1, 2))) { $subscirberTypeID = 0; } if (!empty($listId) && in_array($subscirberTypeID, array(3, 4))) { $subscirberTypeID = 0; } if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } $ztozto = null; $limittotal = jNews_Subscribers::getSubscribers(0, 0, $emailsearch, $ztozto, $listId, '', '', '', 'sub_dateD', '', $ownedlists, '', $subscirberTypeID, true); //added one parameter for mailid $setLimit = new stdClass(); $setLimit->total = !empty($limittotal) ? $limittotal : 0; $setLimit->start = !empty($limitstart) ? $limitstart : 0; $setLimit->end = !empty($limitend) ? $limitend : 20; $setSort = new stdClass(); $setSort->orderValue = $app->getUserStateFromRequest(JNEWS_OPTION . '.subscribers.filter_order', 'filter_order', 'subscribe_date', 'cmd'); $setSort->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.subscribers.filter_order_Dir', 'filter_order_Dir', 'desc', 'word'); if (empty($limitstart)) { $limitstart = 0; } if ($setLimit->end > 200) { $setLimit->end = 200; } if ($setLimit->total == $setLimit->end) { $setLimit->start = 0; } $subscribers = jNews_Subscribers::getSubscribers($setLimit->start, $setLimit->end, $emailsearch, $setLimit->total, $listId, '', '', '', 'sub_dateD', '', $ownedlists, $setSort, $subscirberTypeID); //added one parameter for mailid if ($listId != 0) { $showAdmin = true; } else { $showAdmin = false; } $dropDownList = jNews_ListType::getListsDropList(0, '', ''); $subTypeA = array(); $subTypeA[0] = new stdClass(); $subTypeA[0]->id = 0; $subTypeA[0]->subtype = _JNEWS_SUB_LISTTYPE_ALL; if ($listId != 0) { $subTypeA[1] = new stdClass(); $subTypeA[1]->id = 1; $subTypeA[1]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_SUBCRIBED; $subTypeA[2] = new stdClass(); $subTypeA[2]->id = 2; $subTypeA[2]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_UNSUBCRIBED; } else { $subTypeA[3] = new stdClass(); $subTypeA[3]->id = 3; $subTypeA[3]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_WAITINGCONF; $subTypeA[4] = new stdClass(); $subTypeA[4]->id = 4; $subTypeA[4]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_BLOCKED; } $lists['listid'] = jnews::HTML_GenericList($dropDownList, 'listid', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'id', 'list_name', $listId); $lists['subscirberType'] = jnews::HTML_GenericList($subTypeA, 'subtype', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'id', 'subtype', $subscirberTypeID); if ($mainframe->isAdmin()) { $forms['main'] = " <form action='index.php' method='post' name=\"adminForm\" id=\"adminForm\">"; } else { if (empty($setLimit->start)) { $setLimit->start = 0; } $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION); $forms['main'] = "<form action='" . $mainLink . "' method='post' name=\"adminForm\" id=\"adminForm\">"; } $forms['select'] = " <form method='post' name='jNewsFilterForm'> \n"; backHTML::formStart('show_mailing', 0, ''); jNews_SubscribersHTML::showSubscribers($subscribers, $action, $listId, $lists, $setLimit->start, $setLimit->end, $setLimit->total, $showAdmin, $listId, $emailsearch, $forms, $setLimit, $front, $setSort); } return true; }
public static function lists($mailingEdit, $list, $show, $lType, $arId, $indicate = false, $isEdit = false) { $mainframe = JFactory::getApplication(); if (!isset($mailingEdit)) { $mailingEdit = new stdClass(); } $listType = JRequest::getVar('listype'); if (!isset($mailingEdit->list_type)) { $mySess = JFactory::getSession(); if (!empty($mySess)) { $mailingEdit->list_type = $mySess->get('listype', '', 'LType'); } } $listType = !empty($listType) ? $listType : $mailingEdit->list_type; $typeList = !empty($listType) && $listType == 2 ? 2 : 1; ?> <div style="padding: 2px;"><span style="font-size: 12px;"><?php if ($lType != 2) { //echo _JNEWS_SUBS_LIST; //}else{ if ($typeList == 2) { echo _JNEWS_SUBS_LIST_CAMPAIGN; } else { echo _JNEWS_SUBS_LIST_LABEL; } //edif } ?> </span></div> <table class="<?php echo jnews::myTheme(); ?> "> <thead> <tr> <th class="title"> # </th> <th class="title"> <?php echo _JNEWS_LIST_NAME; ?> </th> <th class="title" style="min-width:200px;"> <?php echo _JNEWS_SUBS_LIST_RECEIVE; ?> </th> </tr> </thead> <tbody> <?php $my = JFactory::getUser(); $ownedlists = 0; if ($GLOBALS[JNEWS . 'enable_jsub']) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (jnews::checkPermissions('admin')) { if ($lType == 2) { $lists = jNews_Lists::getLists('', 1, '', '', false, true, true, false, false); } else { $lists = jNews_Lists::getLists('', $typeList, '', '', false, true, true, false, false); } } else { if ($lType == 2) { $lists = jNews_Lists::getLists('', 1, '', '', false, true, true, false, false, '', '', $ownedlists, $my->id); } else { $lists = jNews_Lists::getLists('', $typeList, '', '', false, true, true, false, false, '', '', $ownedlists, $my->id); } } $k = 0; $i = 0; //$listId=JRequest::getVar('listId'); if (empty($listId)) { $listId = JRequest::getVar('listid'); } $ls = array(); $myKey = null; foreach ($lists as $key => $list) { if ($list->id == $listId) { $myKey = $key; break; } } if (isset($myKey)) { $ls[] = $lists[$myKey]; unset($lists[$myKey]); $lists = array_merge($ls, $lists); } $listsA = array(); if (!$mainframe->isAdmin()) { foreach ($lists as $list) { if (empty($list->params)) { $listsA[] = $list; } } } else { $listsA = $lists; } foreach ($listsA as $list) { ?> <tr class="<?php echo "row{$k}"; ?> "> <td width="5%"> <center> <?php echo $i + 1; ?> </center> </td> <td> <?php $getMailingId = !empty($mailingEdit->id) ? $mailingEdit->id : JRequest::getVar('mailingid'); $result = jNews_Mailing::mailingListFound($getMailingId, $list->id); $result = $result ? 1 : 0; if ($result == 0) { $lstID = JRequest::getVar('listid'); $result = $lstID == $list->id ? 1 : 0; } //check if this view will be displayed upon the creation of new list if ($lType == 2) { $result = jNews_Lists::followupListFound($arId, $list->id); } //public static function booleanlist( $name, $attribs = null, $selected = null, $yes='yes', $no='no', $id=false ) $text = '<b>List ID: </b>' . $list->id; $text .= '<br/>' . str_replace(array("'", '"'), array("'", '"'), $list->list_desc); $title = str_replace(array("'", '"'), array("'", '"'), $list->list_name); //echo jNews_Tools::toolTip( $tip, '', 280, 'tooltip.png', $title, '', 0 ); echo JHTML::_('tooltip', $text, $title, 'tooltip.png', $title); ?> </td> <td width="100px" nowrap="nowrap"> <center> <?php //if the listid in the request is equal to this listid the default value of the radio button should be yes if ($listId == $list->id) { echo jnews::HTML_BooleanList("aca_mailing_addto[" . $list->id . "]", 'class="inputbox"', 1, 'Yes', 'No'); } else { echo jnews::HTML_BooleanList("aca_mailing_addto[" . $list->id . "]", 'class="inputbox"', $result, 'Yes', 'No'); } ?> </center> </td> </tr> <?php $k = 1 - $k; $i++; } if (count($lists > 3)) { ?> <tr> <td colspan="3" align="center" nowrap="nowrap"> <script language="javascript" type="text/javascript"> function updateStatus(statusval){ <?php foreach ($lists as $row) { ?> window.document.getElementById('aca_mailing_addto[<?php echo $row->id; ?> ]'+statusval).checked = true; <?php } ?> } </script> <div style="float:right; font-size: 12px;"><a title="Click to select all list" href="#" onclick="updateStatus(1);"><?php echo _JNEWS_SUBS_LIST_TOALL; ?> </a> | <a href="#" onclick="updateStatus(0);"><?php echo _JNEWS_SUBS_LIST_TONONE; ?> </a></div> </td> </tr> <?php } ?> </tbody> </table> <?php }
public static function showType($listType, $screen) { $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0; if (is_array($listType)) { $listType = array_pop($listType); } switch ($screen) { case 'editmailing': $className = JNEWS . (!isset($GLOBALS[JNEWS . 'classes' . $listType]) ? $GLOBALS[JNEWS . 'classes' . $listType] : ''); if (class_exists($className)) { $view = new $className(); $show = $view->editmailing(); } else { $show['sender_info'] = true; $show['published'] = true; $show['pub_date'] = true; $show['hide'] = true; $show['issuenb'] = true; $show['delay'] = false; $show['htmlcontent'] = true; $show['textcontent'] = true; $show['attachement'] = true; $show['auto_option'] = true; $show['images'] = true; $show['sitecontent'] = true; $show['admin'] = true; } break; case 'editlist': $show['access'] = $GLOBALS[JNEWS . 'level'] > 2 ? true : false; $className = JNEWS . (!isset($GLOBALS[JNEWS . 'classes' . $listType]) ? $GLOBALS[JNEWS . 'classes' . $listType] : ''); if (class_exists($className)) { $view = new $className(); $show = array_merge($show, $view->editlist()); } else { $show['sender_info'] = true; $show['hide'] = true; $show['auto_option'] = true; $show['htmlmailing'] = true; $show['auto_subscribe'] = true; $show['email_unsubcribe'] = false; $show['unsusbcribe'] = false; } break; case 'showMailings': $show['admin'] = jnews::checkPermissions('admin'); $show['index'] = 'index2'; $show['buttons'] = false; if ($show['admin']) { if (empty($listType)) { $listType = 1; } $className = JNEWS . (!isset($GLOBALS[JNEWS . 'classes' . $listType]) ? $GLOBALS[JNEWS . 'classes' . $listType] : ''); if (class_exists($className)) { $view = new $className(); $show = array_merge($show, $view->showMailings()); } else { $show['id'] = true; $show['dropdown'] = true; $show['select'] = true; $show['issue'] = true; $show['sentdate'] = true; $show['delay'] = false; $show['status'] = true; } } else { $show['id'] = false; $show['dropdown'] = false; $show['select'] = false; $show['issue'] = true; $show['sentdate'] = true; $show['delay'] = false; $show['status'] = false; } break; case 'showListsBack': if (jnews::checkPermissions('admin')) { $show['id'] = true; } else { $show['id'] = false; } $show['index'] = 'index2'; $show['select'] = true; $show['published'] = true; $show['sender'] = true; $show['sender_email'] = false; $show['mailings_link'] = true; $show['mailings_sub'] = true; $show['list_type'] = true; $show['visible'] = true; $show['color'] = true; $show['buttons'] = false; $show['front'] = false; break; case 'showListsFront': $db = JFactory::getDBO(); $query = 'SELECT * FROM `#__jnews_lists` WHERE `hidden` = 1 AND `published` = 1 AND '; if (is_array($listType)) { $query .= ' `list_type` IN (' . jnews::implode(',', $listType) . ') '; } else { $query .= ' `list_type`=' . intval($listType); } $db->setQuery($query); $lists = $db->loadObjectList(); $access = false; $my = JFactory::getUser(); foreach ($lists as $list) { $bit = jnews::checkPermissions($list->acc_level); if ($bit) { $access = true; break; } } if (jnews::checkPermissions($gid) || $access && $my->id > 0) { $show['id'] = true; $show['published'] = true; $show['sender'] = true; $show['sender_email'] = false; $show['list_type'] = true; $show['visible'] = true; $show['mailings_sub'] = false; $show['color'] = true; $show['mailings_link'] = true; $show['front'] = true; } else { $show['id'] = false; $show['published'] = false; $show['sender'] = false; $show['sender_email'] = false; $show['list_type'] = false; $show['visible'] = false; $show['mailings_sub'] = false; $show['mailings_link'] = false; $show['color'] = false; $show['front'] = true; } $show['index'] = 'index'; $show['select'] = false; $show['buttons'] = true; break; default: $show = ''; break; } return $show; }
public static function showListingLists($lists, $action, $task, $forms, $show, $listsearch = '', $limit = 0, $setLimit = null, $totalSubs = null, $setSort = null, $totalUnSubs = null) { $Itemid = JRequest::getInt('Itemid'); $mainframe = JFactory::getApplication(); $my = JFactory::getUser(); $loggedin = false; if ($my->id > 0) { $loggedin = true; } if (empty($Itemid) and !$mainframe->isAdmin() and !empty($GLOBALS[JNEWS . 'itemidAca'])) { $Itemid = $GLOBALS[JNEWS . 'itemidAca']; } if (!empty($Itemid)) { $item = '&Itemid=' . $Itemid; } else { $item = ''; } echo $forms['main']; // top portion before the table list if ($mainframe->isAdmin()) { // for search $toSearch = new stdClass(); $toSearch->listsearch = $listsearch; $toSearch->id = 'listsearch'; echo jnews::setTop($toSearch, null, $setLimit); } echo '<table class="' . jnews::myTheme() . '"><thead><tr>'; echo '<th width="2%" class="title">#</td>'; if ($show['select']) { echo '<th width="3%" style="text-align:center;" class="title"></th>'; } echo '<th width="30%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_LIST_NAME, 'list_name', $setSort->orderDir, $setSort->orderValue) . '</th>'; if ($show['sender']) { echo '<th width="20%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_LIST_SENDER, 'sendername', $setSort->orderDir, $setSort->orderValue) . '</center> </th>'; } if ($show['sender_email']) { echo ' <th width="15%" class="title"><center>' . _JNEWS_SENDER_EMAIL . '</center></th>'; } if ($show['mailings_link']) { echo '<th width="17%" class="title"><center>' . _JNEWS_MENU_MAILING_TITLE . '</center></th>'; } if ($show['mailings_sub']) { echo '<th width="17%" class="title"><center>' . _JNEWS_SUBSCRIBER_CONFIG . '</center></th>'; echo '<th width="17%" class="title"><center>' . _JNEWS_UNSUBSCRIBER_CONFIG . '</center></th>'; } if ($show['visible']) { echo '<th width="5%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_VISIBLE, 'hidden', $setSort->orderDir, $setSort->orderValue) . '</center></th>'; } if ($show['published']) { echo '<th width="5%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_PUBLISHED, 'published', $setSort->orderDir, $setSort->orderValue) . '</center></th>'; } if ($show['buttons']) { if ($GLOBALS[JNEWS . 'allow_unregistered'] or $loggedin) { echo '<th class="title" width="90"><center>' . _JNEWS_SUBSCRIB . '</center></th>'; } if ($GLOBALS[JNEWS . 'show_archive'] == '1') { echo '<th class="title" width="90"><center>' . _JNEWS_VIEW_ARCHIVE . '</center></th>'; } } if ($show['id']) { echo '<th width="2%" class="title">' . jnews::HTML_GridSort('ID', 'id', $setSort->orderDir, $setSort->orderValue) . '</th>'; } echo '</tr></thead>'; $i = 0; $ctr = 0; //total subs if (!empty($lists)) { if (version_compare(JVERSION, '3.0.0', '<')) { $onClickFct = ''; } else { $onClickFct = 'Joomla.'; } foreach ($lists as $list) { $i++; if ($list->list_type == 1 or $list->list_type == 7) { //mariap $linkArchive = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive' . $item; } else { $linkArchive = '#'; } ?> <tr class="row<?php echo ($i + 2) % 2; ?> "> <?php $num = isset($setLimit->start) ? $i + $setLimit->start : $i; echo '<td width="2%" class="title"><center>' . $num . '</center></td>'; ?> <?php if ($show['select']) { ?> <td><center><input type="radio" name="listid" value="<?php echo $list->id; ?> " onclick="<?php echo $onClickFct; ?> isChecked(this.checked);" /></center></td> <?php } if ($show['index'] == 'index') { if ($mainframe->isAdmin()) { if (jnews::checkPermissions('admin')) { $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id . $item; } else { $link = $linkArchive; } } else { if (jnews::checkPermissions('admin')) { $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id . '&listype=' . $list->list_type . $item; } else { $link = $linkArchive; } } $link = jNews_Tools::completeLink($link, false); } else { if ($mainframe->isAdmin()) { $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id; $link = jNews_Tools::completeLink($link); } else { $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id . '&listype=' . $list->list_type; $link = jNews_Tools::completeLink($link); } } ?> <td> <span class="aca_letter_names" <?php if ($link == "#" or $link == "administrator/#") { echo " onclick='return false;' "; } ?> > <?php echo jNews_Tools::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, $link, 1); ?> </span> </td> <?php if ($show['sender']) { echo '<td>' . $list->sendername . '</td>'; } if ($show['sender_email']) { echo ' <td width="20%" class="title">' . $list->senderemail . '</td>'; } if ($show['mailings_link']) { $ltype = isset($list->list_type) && $list->list_type == 2 ? 2 : 1; if ($show['index'] == 'index') { $link = 'option=' . JNEWS_OPTION . '&act=mailing&task=show&listid=' . $list->id; if (!empty($ltype)) { $link .= '&listype=' . $ltype; } $link .= $item; $link = jNews_Tools::completeLink($link, false); } else { $link = 'option=' . JNEWS_OPTION . '&act=mailing&task=show&listid=' . $list->id; if (!empty($ltype)) { $link .= '&listype=' . $ltype; } $link = jNews_Tools::completeLink($link); } //for autoresponder list only we need to filter the autoresponders to their associated list if ($action == 'arlist') { $link = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=2&listid=' . $list->id; } //listType to listype ?> <td><center><a href="<?php echo $link; ?> "> <?php echo _JNEWS_MALING_EDIT_VIEW; ?> </a></center></td> <?php } if ($show['mailings_sub']) { if ($show['index'] == 'index') { $link = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=1' . $item; $link = jNews_Tools::completeLink($link, false); $linkUnsubscribed = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=2' . $item; $linkUnsubscribed = jNews_Tools::completeLink($linkUnsubscribed, false); } else { $link = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=1'; $link = jNews_Tools::completeLink($link); $linkUnsubscribed = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=2'; $linkUnsubscribed = jNews_Tools::completeLink($linkUnsubscribed); } ?> <td><center><a href="<?php echo $link; ?> "> <?php echo _JNEWS_SUBCRIBERS_VIEW . " ( {$totalSubs[$ctr]} ) "; ?> </center> </td> <td><center><a href="<?php echo $linkUnsubscribed; ?> "> <?php echo _JNEWS_UNSUBCRIBERS_VIEW . " ( {$totalUnSubs[$ctr]} ) "; // $totalSubs[$ctr] ?> </center> </td> <?php $ctr++; } if ($show['visible']) { if ($list->hidden == 1) { $img = '16/status_g.png'; jnews::getLegend('status_g.png', _JNEWS_VISIBLE . '/' . _JNEWS_TEMPLATE_PUBLISH); } else { $img = '16/status_r.png'; jnews::getLegend('status_r.png', _JNEWS_NOTVISIBLE . '/' . _JNEWS_UNPUBLISHED); } ?> <td height="20"><center> <?php if ($mainframe->isAdmin()) { ?> <a href="<?php $act = JRequest::getVar('act', 'list', '', 'WORD'); echo jnews::createToggleLink($act, 'hidden', 'listid', $list->id); ?> "> <img src="<?php echo JNEWS_PATH_ADMIN_IMAGES2 . $img; ?> " width="12" height="12" border="0" alt="" /> </a> <?php } else { ?> <img src="<?php echo JNEWS_PATH_ADMIN_IMAGES2 . $img; ?> " width="12" height="12" border="0" alt="" /> <?php } ?> </center></td> <?php } if ($show['published']) { ?> <td align="center"><center> <?php if ($list->published == 1) { $img = '16/status_g.png'; $alt = 'Published'; jnews::getLegend('status_g.png', _JNEWS_VISIBLE . '/' . _JNEWS_TEMPLATE_PUBLISH); } else { if ($list->published == 2) { $img = '16/status_y.png'; $alt = 'Scheduled'; jnews::getLegend('status_y.png', _JNEWS_SCHEDULED); } else { $img = '16/status_r.png'; $alt = 'Unpublished'; jnews::getLegend('status_r.png', _JNEWS_NOTVISIBLE . '/' . _JNEWS_UNPUBLISHED); } } $status = !empty($list->published) && $list->published == 1 ? 'unpublish' : 'publish'; if ($mainframe->isAdmin()) { ?> <a href="<?php $act = JRequest::getVar('act', 'list', '', 'WORD'); echo jnews::createToggleLink($act, $status, 'listid', $list->id, 'togle'); ?> "> <img src="<?php echo JNEWS_PATH_ADMIN_IMAGES2 . $img; ?> " width="12" height="12" border="0" alt="<?php echo $alt; ?> " /> </a> <?php } else { ?> <img src="<?php echo JNEWS_PATH_ADMIN_IMAGES2 . $img; ?> " width="12" height="12" border="0" alt="<?php echo $alt; ?> " /> <?php } ?> </center></td> <?php } ?> <?php if ($show['buttons']) { $backendLink = $show['index'] == 'index' ? false : true; if ($GLOBALS[JNEWS . 'allow_unregistered'] or $loggedin) { $link = 'index.php?option=' . JNEWS_OPTION . '&act=subone&listid=' . $list->id . $item; $link = JRoute::_($link); $img = 'folder_add_f2.png'; echo '<td align="center" height="24"><center>'; echo '<a href="' . $link . '" >' . "\n\r"; echo '<img src="' . JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/images/' . $img . '" width="20" height="20" border="0" alt="" /></a></center></td>' . "\n\r"; } if (($list->list_type == 1 or $list->list_type == 7) && $GLOBALS[JNEWS . 'show_archive'] == '1') { $linkArchive = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive' . $item; $linkArchive = jNews_Tools::completeLink($linkArchive, true); $img = 'move_f2.png'; echo '<td height="24"><center>'; echo '<a href="' . $linkArchive . '" >' . "\n\r"; echo '<img src="' . JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/images/' . $img . '" width="20" height="20" border="0" alt="' . _JNEWS_VIEW_ARCHIVE . '" /></a></center></td>' . "\n\r"; } elseif ($GLOBALS[JNEWS . 'show_archive'] == '1') { //ifthe list is an autoresponder don't need to show the archives echo '<td height="24"><center>-</center></td>' . "\n\r"; } } if ($show['id']) { echo '<td width="2%" class="title"><center>' . $list->id . '</center></td>'; } echo ' </tr>' . "\n\r"; } } echo '</table>'; echo '<br />'; echo jnews::setLegend(); }
public static function mailingEdit($subscriberId, $mailingId, $listId, $listType = '', $action, $grantCAnAccess = false) { global $my, $Itemid; $issue_nb = JRequest::getVar('issue_nb', '0'); $my = JFactory::getUser(); if (version_compare(JVERSION, '1.6.0', '>=')) { //j16 $usergid = JAccess::getGroupsByUser($my->id, false); $my->gid = $usergid[0]; } $accessGrant = false; if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } $new = 0; if (class_exists('jNews_Pro')) { if ($issue_nb == 0) { $issue_nb = jNews_Mailing::countMailings($listId, ''); $issue_nb++; } if ($listId > 0) { $list = jNews_Lists::getOneList($listId); $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new); $acc_level = $list->acc_level; } else { if (!empty($ownedlists)) { $list = jNews_Lists::getOneList($listId); $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new); $acc_level = $list->acc_level; } else { $listId = jNews_Lists::getIDacclevel($my->gid); $list = jNews_Lists::getOneList($listId); $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new); $acc_level = $list->acc_level; } } $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($acc_level)) { $accessGrant = true; } } else { if ($subscriberId != 0 && jnews::checkPermissions('admin')) { $accessGrant = true; } } if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) { if (class_exists('jNews_Social') && !$GLOBALS[JNEWS . 'enable_jsub']) { $accessGrant = true; } } if ($accessGrant || $grantCAnAccess) { if ($issue_nb == 0) { $issue_nb = jNews_Mailing::countMailings($listId, ''); $issue_nb++; } if (empty($mailing)) { if ($mailingId > 0) { $mailing = jNews_Mailing::getOneMailing('', $mailingId, $issue_nb, $new); } else { if ($listId > 0) { $list = jNews_Lists::getOneList($listId); $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new); } else { return false; } } } $mainLink = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $listId . '&listype=' . $listType . '&Itemid=' . $Itemid; $mainLink = jNews_Tools::completeLink($mainLink, false, false); $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION); //$forms['main'] = '<form method="post" enctype="multipart/form-data" action="'. $mainLink . '" onsubmit="submitbutton();return false;" name="adminForm" id="adminForm">'."\n\r"; $forms['main'] = '<form method="post" enctype="multipart/form-data" action="' . $mainLink . '" name="adminForm" id="adminForm">' . "\n\r"; $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; $show = jNews_ListType::showType($mailing->mailing_type, 'editmailing'); $menuA = null; if ($GLOBALS[JNEWS . 'level'] > 1) { //menu object start here //to create the template menu $listype = JRequest::getInt('listype', 0, 'request'); $menuTag = new stdClass(); $menuTag->link = 'administrator/' . jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags', true, false, true); if ($listype == 7) { $delaymax = JRequest::getInt('delay_max', 0, 'request'); $notifyID = JRequest::getInt('notify_id', 0, 'request'); $catid = JRequest::getVar('cat_id', 0, 'request'); $menuTag->link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags&listype=' . $listype . '&cat_id=' . $catid . '&delay_max=' . $delaymax . '¬ify_id=' . $notifyID, false, false, true); } else { $menuTag->link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags', false, false, true); } $menuTag->popup = new stdClass(); $menuTag->popup->isPop = true; $menuTag->popup->rel = true; $menuTag->popup->x = 750; $menuTag->popup->y = 500; $menuTag->action = 'tags'; $menuTag->title = _JNEWS_MAILING_TAG; //to create the template menu $menuTemplate = new stdClass(); $menuTemplate->link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=templates&task=assign', false, false, true); $menuTemplate->popup = new stdClass(); $menuTemplate->popup->isPop = true; $menuTemplate->popup->rel = true; $menuTemplate->popup->x = 640; $menuTemplate->popup->y = 480; $menuTemplate->action = 'template'; $menuTemplate->title = _JNEWS_LIST_T_TEMPLATE; //to create cancel menu $menuCancel = new stdClass(); $menuCancel->popup = new stdClass(); $menuCancel->popup->isPop = false; $menuCancel->link = '#'; $menuCancel->action = 'cancel'; $menuCancel->onclick = new stdClass(); $menuCancel->onclick->custom = false; $menuCancel->onclick->js = ''; $menuCancel->title = _JNEWS_CANCEL; //to create save menu $linksave = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $listId . '&listype=' . $listType . '&Itemid=' . $Itemid; if ($listId == 0) { $linksave = 'option=' . JNEWS_OPTION . '&act=mailing&listype=' . $listType . '&Itemid=' . $Itemid; } $linksave = jNews_Tools::completeLink($linksave, false); $menuSave = new stdClass(); $menuSave->popup = new stdClass(); $menuSave->popup->isPop = false; $menuSave->link = '#'; $menuSave->action = 'save'; $menuSave->onclick = new stdClass(); $menuSave->onclick->custom = false; $menuSave->onclick->js = ''; $menuSave->title = _JNEWS_SAVE; //to create preview menu $menuPreview = new stdClass(); $menuPreview->popup = new stdClass(); $menuPreview->popup->isPop = false; $menuPreview->link = '#'; $menuPreview->action = 'savepreview'; $menuPreview->onclick = new stdClass(); $menuPreview->onclick->custom = false; $menuPreview->onclick->js = ''; $menuPreview->title = 'Preview'; //to create send menu $menuSend = new stdClass(); $menuSend->popup = new stdClass(); $menuSend->popup->isPop = true; $menuSend->popup->rel = true; $menuSend->popup->x = 750; $menuSend->popup->y = 500; $linkBut = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=sendready&mailingid=' . $mailingId . '&listype=' . $listType, true, false, true); $menuSend->link = $linkBut; $menuSend->action = 'sendready'; $menuSend->onclick = new stdClass(); $menuSend->onclick->custom = false; $menuSend->onclick->js = ""; $menuSend->title = _JNEWS_MENU_SEND; //to create the divider $menuDivider = new stdClass(); $menuDivider->divider = true; $menuA = array(); if (empty($mailingId)) { $menuA['template'] = $menuTemplate; } $menuA['tags'] = $menuTag; $menuA['divider1'] = $menuDivider; $menuA['preview'] = $menuPreview; $menuA['save'] = $menuSave; if ($listType == 1 && $mailingId != 0) { $menuA['send'] = $menuSend; } $menuA['divider'] = $menuDivider; $menuA['cancel'] = $menuCancel; } frontHTML::formStart(_JNEWS_EDIT_A . @constant($GLOBALS[JNEWS . 'listname' . $mailing->mailing_type]), $mailing->html, 'edit_mailing', $menuA); jNews_MailingsHTML::editMailing($mailing, $new, $listId, $forms, $show, $listType); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('listype', $listType); frontHTML::formEnd(_CMN_SAVE . ' ' . @constant($GLOBALS[JNEWS . 'listname' . $mailing->mailing_type]), $go); } else { echo jnews::printM('red', _NOT_AUTH); } return true; }
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(); }
/** * This public static function generates the view of the mailing statistics * and reports lists and graphs. * @param array $filters array of header filters * @param string $type type of reports(listing, graph & export file) * @param string $task * @param string $fileNameExport */ public static function mailingReports($filters, $type, $task, $fileNameExport) { $my = JFactory::getUser(); if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (version_compare(JVERSION, '1.6.0', '>=')) { //j16 $usergid = JAccess::getGroupsByUser($my->id, false); $my->gid = $usergid[0]; } $gidAdmins = array(24, 25, 7, 8); $dateFormat = $filters['dateFormat']; $specialFormat = $filters['specialFormat']; $dateFormat4DateNumber = $filters['dateFormat4DateNumber']; $specialNo = $filters['specialNo']; $startdate = $filters['startdate']; $enddate = $filters['enddate']; $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); $sql = "SELECT FROM_UNIXTIME(N.sentdate {$specialFormat}) AS s_date," . "\t{$dateFormat4DateNumber} N.sentdate {$specialNo} AS DateNumber, " . "\tM.subject, N.html_sent, N.text_sent, N.html_read as html_views, " . "\tN.pending, N.failed, N.bounces, N.sent, " . "\tN.mailing_id as id" . " FROM #__jnews_mailings AS M" . " LEFT JOIN #__jnews_stats_global AS N ON N.mailing_id = M.id"; if (!$mainframe->isAdmin()) { if ($GLOBALS[JNEWS . 'enable_jsub']) { $sql .= " LEFT JOIN #__jnews_listmailings AS O ON O.mailing_id = M.id"; } if (!in_array($my->gid, $gidAdmins) && jnews::checkpermissions($my->gid)) { //come back here if (!empty($ownedlists)) { $sql .= " LEFT JOIN #__jnews_listmailings AS O ON O.mailing_id = M.id"; } } } $sql .= " WHERE N.sentdate BETWEEN {$startdate} AND {$enddate}"; if (!$mainframe->isAdmin() && !jnews::checkPermissions('admin')) { if ($GLOBALS[JNEWS . 'enable_jsub'] && !empty($ownedlists)) { $sql .= " AND O.list_id IN (" . implode($ownedlists, ',') . ")"; } if (!in_array($my->gid, $gidAdmins) && jnews::checkpermissions($my->gid)) { $sql .= " AND O.list_id IN (" . implode($ownedlists, ',') . ")"; } } $sql .= " GROUP BY M.id, DateNumber ORDER BY DateNumber "; $db->setQuery($sql); $results = $db->loadObjectList(); $mainPath = JNEWS_PATH_ADMIN_IMAGES2 . '16/'; ?> <div id="wizard" class=""></div> <?php if ($GLOBALS[JNEWS . 'level'] > 2) { ?> <div id="exportbtn" style="float:right;"> <a href="#" name="exportmailing" value="<?php echo _JNEWS_STATS_EXPORT; ?> " onclick="submitbutton('exportmailing')" > <img src="<?php echo $mainPath . 'export_statistics.png'; ?> "/> </a> </div> <br/> <br/> <?php if ($task == 'exportm') { //Go to a public static function to export the generated file outputReportGraph::mailingExport($results, $fileNameExport); } if ($type == 'graph') { //tallying totals $totalData = array(); $totalData['subject'] = ''; $totalData['html_sent'] = 0; $totalData['text_sent'] = 0; $totalData['html_views'] = 0; $totalData['pending'] = 0; // $totalData['failed'] = 0; // $totalData['bounces'] = 0; $totalData['sent'] = 0; $totalData['mailings'] = 0; if (!empty($results)) { foreach ($results as $row) { $totalData['html_sent'] += $row->html_sent; $totalData['text_sent'] += $row->text_sent; $totalData['html_views'] += $row->html_views; $totalData['pending'] += $row->pending; // $totalData['failed'] += $row->failed; // $totalData['bounces'] += $row->bounces; $totalData['sent'] += $row->sent; // $totalData['sent'] += $row->html_sent + $row->text_sent; //fixed $totalData['mailings']++; } //end4each } // Fix by Amod Begins //outputReportGraph::mailingGraph( $totalData ); outputReportGraph::mailingGraph($results); // Fix by Amod Ends } } if ($type == 'listing') { //call the public static function that wil display the reports in listing type outputReportGraph::mailingList($results, str_replace("'", "", $startdate), str_replace("'", "", $enddate)); } return true; }
public static function getMailings($listId, $listType, $start = -1, $limit = -1, $emailsearch = '', $order = '', $showOnlyPublished = true, $viewArchive = false, $setSort = null) { $my = JFactory::getUser(); $db = JFactory::getDBO(); $where = array(); $flag = false; $sortList = false; $query = 'SELECT * FROM `#__jnews_mailings`'; if ($listType > 0) { if (is_array($listType)) { $where[] = ' `mailing_type` IN (' . jnews::implode(',', $listType) . ') '; } else { $where[] = ' `mailing_type` = ' . $listType . ' '; } } if ($listId > 0) { // will filter the mailings shown based on the listid passed on the url $query2 = 'SELECT B.`mailing_id` FROM `#__jnews_listmailings` AS B WHERE B.`list_id` = ' . $listId; $db->setQuery($query2); $result = $db->loadObjectList(); $resArr = ""; foreach ($result as $rstl) { $resArr[] = $rstl->mailing_id; } if (!empty($resArr)) { $results = jnews::implode(',', $resArr); if (!empty($results)) { $where[] = ' `id` IN ( ' . $results . ' )'; } $sortList = true; } else { return array(); } } if ($showOnlyPublished) { $where[] = ' `published` =1 '; $where[] = ' `visible`=1 '; } else { $where[] = ' `published`<>-1 '; } if (class_exists('jNews_Pro') && $sortList) { } elseif (!jnews::checkPermissions('admin') && !$viewArchive) { $where[] = ' `author_id` = ' . $my->id; } //added this if statement to filter only all the published and visible mailings in the archive in the fe if ($viewArchive && !$showOnlyPublished) { // && $my->id <=0 $where[] = ' `published` =1 '; $where[] = ' `visible`=1 '; } if (!empty($emailsearch)) { if (is_numeric($emailsearch)) { $where[] = ' `id`=' . $emailsearch; } else { $where[] = ' (subject LIKE \'%' . $emailsearch . '%\' OR fromname LIKE \'%' . $emailsearch . '%\') '; } } $query .= count($where) ? " WHERE " . implode(' AND ', $where) : ""; if (!empty($setSort->orderValue) && !empty($setSort->orderDir)) { $query .= " ORDER BY `{$setSort->orderValue}` {$setSort->orderDir}"; } else { if (empty($order)) { $order = 'idD'; } $query .= jnews::orderBy($order); } if ($start >= 0 && $limit > 0) { $db->setQuery($query, $start, $limit); } else { $db->setQuery($query); } $mailing = $db->loadObjectList(); if (!empty($mailing)) { foreach ($mailing as $key => $mail) { $mailing[$key]->htmlcontent = stripslashes($mailing[$key]->htmlcontent); $mailing[$key]->subject = stripslashes($mailing[$key]->subject); $mailing[$key]->attachments = stripslashes($mailing[$key]->attachments); $mailing[$key]->images = stripslashes($mailing[$key]->images); $mailing[$key]->textonly = stripslashes($mailing[$key]->textonly); $mailing[$key]->send_date = stripslashes($mailing[$key]->send_date); } } return $mailing; }
public static function quickiconButton($link, $image, $text, $external = false, $accessLevel = '', $frontEnd = false) { if (jnews::checkPermissions($accessLevel)) { if ($frontEnd) { $link = JRoute::_($link); } ?> <div style="float:left;"> <div class="icon"> <a href="<?php echo $link; ?> " <?php if ($external) { echo 'target="_blank"'; } ?> > <?php jNews_Tools::showIcon($image, $text); ?> <span><?php echo $text; ?> </span> </a> </div> </div> <?php } }
function getEditTab($tab, $user, $ui) { $Itemid = JRequest::getInt('Itemid'); $my = JFactory::getUser(); if ($my->get('id') < 1) { echo JText::_('ALERTNOTAUTH'); echo "<br />" . JText::_('You need to login.'); return false; } if (!getjNewsTab::checkInstalled()) { return _UE_NEWSLETTERNOTINSTALLED; } $html = ''; require_once JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'administrator' . DS . 'components' . DS . JNEWS_OPTION . DS . 'classes' . DS . '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'; require_once JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'administrator' . DS . 'components' . DS . JNEWS_OPTION . DS . 'classes' . DS . 'class.lists.php'; require_once JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'administrator' . DS . 'components' . DS . JNEWS_OPTION . DS . 'views' . DS . 'subscribers.jnews.html.php'; if (!empty($my->id)) { $subscriberId = jNews_Subscribers::getSubscriberIdFromUserId($my->id); $qid[0] = $subscriberId; $subscriber = jNews_Subscribers::getSubscribersFromId($qid, false); $queues = jNews_ListsSubs::getSubscriberLists($subscriberId); $access = jnews::checkPermissions('admin', $my->id); } else { $userId = 0; $queues = ''; $access = false; $subscriberId = 0; $subscriber = new stdClass(); $subscriber->id = ''; $subscriber->user_id = 0; $subscriber->name = ''; $subscriber->email = ''; $subscriber->ip = jNews_Subscribers::getIP(); $subscriber->receive_html = 1; $subscriber->confirmed = 1; $subscriber->blacklist = 0; $subscriber->timezone = '00:00:00'; $subscriber->language_iso = 'eng'; $subscriber->params = ''; $subscriber->subscribe_date = time(); if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnews is pro $subscriber->column1 = ''; $subscriber->column2 = ''; $subscriber->column3 = ''; $subscriber->column4 = ''; $subscriber->column5 = ''; } } if (!empty($my->user_id)) { if ($my->user_id > 0) { $access = jnews::checkPermissions('admin'); } else { $access = false; } } $query = 'SELECT * FROM `#__jnews_lists` WHERE `published`=1 AND `hidden`=1 '; $db = JFactory::getDBO(); $db->setQuery($query); $lists = $db->loadObjectList(); $doShowSubscribers = false; $mainLink = 'option=' . JNEWS_OPTION; $selectLink = 'option=' . JNEWS_OPTION . '&act=subscriber'; $mainLink = jNews_Tools::completeLink($mainLink, false); $selectLink = jNews_Tools::completeLink($selectLink, false); $forms['main'] = '<form method="post" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="mosForm" >' . "\n\r"; $forms['select'] = '<form method="post" action="' . $selectLink . '" name="jNewsFilterForm">'; if (empty($access)) { $access = 29; } $html .= jNews_SubscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, $access, true, true); $html .= '<input type="hidden" name="subscriber_id" value="' . $subscriber->id . '" />'; return $html; }