Esempio n. 1
0
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;
}
Esempio n. 2
0
    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;
    }
Esempio n. 3
0
    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("&#039;", '&quot;'), $list->list_desc);
            $title = str_replace(array("'", '"'), array("&#039;", '&quot;'), $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 
    }
Esempio n. 4
0
 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 . '&notify_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;
 }
Esempio n. 5
0
    /**
     * 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;
    }
Esempio n. 6
0
 public static function getLists($listId, $listType, $author = null, $order = 'listnameA', $autoAdd = false, $onlyPublished = true, $onlyName = false, $notification = false, $onlyVisible = false, $listsearch = '', $setLimit = null, $setSort = null, $ownedlists = 0, $ownerid = 0)
 {
     $db = JFactory::getDBO();
     $acl = JFactory::getACL();
     $my = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0;
     $gids = array();
     $gids = explode(',', $gid);
     if (empty($gids)) {
         $gids = $gid;
     }
     if ($onlyName) {
         $query = 'SELECT `id` AS id, `list_name` AS list_name, `list_desc` AS list_desc, `list_type` AS list_type, `hidden` FROM `#__jnews_lists` ';
     } else {
         $query = 'SELECT * FROM `#__jnews_lists` ';
     }
     $where = array();
     if ($listId > 0) {
         $where[] = ' `id`=' . intval($listId);
     }
     if ($listType > 0) {
         //			$where[] = ' `list_type`='.intval($listType);
         if (is_array($listType)) {
             $where[] = '  `list_type` IN (' . jnews::implode(',', $listType) . ') ';
         } else {
             $where[] = ' `list_type`=' . intval($listType);
         }
     }
     if ($autoAdd) {
         $where[] = ' `auto_add`=1 ';
     }
     if ($onlyPublished == true) {
         $where[] = ' `published`=1 ';
     }
     if ($onlyVisible == true) {
         $where[] = ' `hidden`=1 ';
     }
     if (!empty($listsearch)) {
         if (is_numeric($listsearch)) {
             $where[] = ' `id`=' . $listsearch;
         } else {
             $where[] = ' (list_name LIKE \'%' . $listsearch . '%\' OR sendername LIKE \'%' . $listsearch . '%\')';
         }
     }
     if (class_exists('jNews_Pro') && isset($author)) {
         static $accIds = array();
         if (!isset($accIds[$my->id])) {
             if ($mainframe->isAdmin()) {
                 if (version_compare(JVERSION, '1.6.0', '<')) {
                     $acl = JFactory::getACL();
                     $usergroups = $acl->get_group_children_tree(null, 'USERS', false);
                 } else {
                     $db->setQuery('SELECT a.*, a.title as text, a.id as value  FROM #__usergroups AS a ORDER BY a.lft ASC');
                     $usergroups = $db->loadObjectList();
                 }
                 foreach ($usergroups as $usergroup) {
                     $allgroups[] = $usergroup->value;
                 }
                 $accIds[$my->id] = implode(',', $allgroups);
                 $subaccess = $accIds[$my->id];
                 //$where[] = " (`acc_id` IN ($subaccess) OR `acc_id` LIKE '%all%' )"; //we should not have this where clause since this is the backend 8855445
             } else {
                 if (version_compare(JVERSION, '1.6.0', '>=')) {
                     //j16
                     $my->gid = JAccess::getGroupsByUser($my->id, false);
                     $accIds[$my->id] = $my->gid[0];
                 } else {
                     $accIds[$my->id] = $my->gid;
                 }
                 $subaccess = $accIds[$my->id];
                 $where[] = " (`acc_id` LIKE '%{$subaccess},%' OR `acc_id` LIKE '%all%' )";
             }
         }
     }
     if (!empty($my->id)) {
         $ownedlists = jNews_Lists::getOwnedlists($my->id);
     }
     $gidAdmins = array(24, 25, 7, 8);
     if (version_compare(JVERSION, '1.6.0', '>=')) {
         //j16
         $gid = JAccess::getGroupsByUser($my->id, false);
         $my->gid = $gid[0];
     }
     if (JRequest::getVar('act', '', '', 'WORD') != 'show') {
         //we don't filter the lists in the "My Subscriptions"
         //filter lists by ownerid
         if (!empty($my->id) && !$mainframe->isAdmin() && !in_array($my->gid, $gidAdmins) && !empty($ownedlists)) {
             $allUserAccessA = jNews_Lists::getUserGroups($my);
             //$my->getAuthorisedGroups();
             //				$where[] = "( `acc_level` LIKE '%" . implode( ",%' OR `acc_level` LIKE '%", $allUserAccessA ) . ",%' OR `owner`=".$my->id.")";
             $where[] = "( `acc_level` LIKE '%" . implode(",%' OR `acc_level` LIKE '%", $allUserAccessA) . ",%' OR `acc_level` LIKE '%" . implode("%' OR `acc_level` LIKE '%", $allUserAccessA) . "%' OR `owner`=" . $my->id . ")";
         }
         //filter lists by acclevel
         if (!empty($my->id) && !$mainframe->isAdmin() && !in_array($my->gid, $gidAdmins) && empty($ownedlists)) {
             $allUserAccessA = jNews_Lists::getUserGroups($my);
             //$my->getAuthorisedGroups();
             //$where[] = "(  `acc_level` LIKE '%all%' OR `acc_level` LIKE '%" . implode( ",%' OR `acc_level` LIKE '%", $allUserAccessA ) . ",%' )";
         }
         if (!$mainframe->isAdmin() && (!empty($ownedlists) or $ownedlists != 0) && !empty($my->id) && !in_array($my->gid, $gidAdmins) && in_array($my->gid, $gids)) {
             $allUserAccessA = jNews_Lists::getUserGroups($my);
             //$my->getAuthorisedGroups();
             //				$where[] = " ( `acc_level` LIKE '%" . implode( ",%' OR `acc_level` LIKE '%", $allUserAccessA ) . ",%' )";
             $where[] = " (  `acc_level` LIKE '%" . implode(",%' OR `acc_level` LIKE '%", $allUserAccessA) . ",%'  OR `acc_level` LIKE '%" . implode("%' OR `acc_level` LIKE '%", $allUserAccessA) . "%' )";
         }
     }
     if (JRequest::getVar('act', '', '', 'WORD') == 'show') {
         //filter lists by acclevel
         if (!empty($my->id) && !$mainframe->isAdmin() && !in_array($my->gid, $gidAdmins)) {
             $where[] = "(`acc_id` LIKE '%{$my->gid},%' OR `acc_id` LIKE '%all%')";
         }
     }
     $wheretag = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $wheretag;
     //sorting of columns
     if (!empty($setSort)) {
         $query .= " ORDER BY `{$setSort->orderValue}` {$setSort->orderDir}";
     } else {
         $query .= class_exists('jnews') ? jnews::orderBy($order) : '';
     }
     //var_dump(($setSort->orderValue)) ; die;
     if (!empty($setLimit)) {
         $limitStart = !empty($setLimit->start) ? $setLimit->start : 0;
         //$setLimit->start;
         $limitEnd = !empty($setLimit->end) ? $setLimit->end : '-1';
         $db->setQuery($query, $limitStart, $limitEnd);
     } else {
         $db->setQuery($query);
     }
     $lists = $db->loadObjectList();
     if (!empty($lists)) {
         foreach ($lists as $key => $list) {
             $lists[$key]->list_name = stripslashes($lists[$key]->list_name);
             $lists[$key]->list_desc = stripslashes($lists[$key]->list_desc);
         }
     }
     return $lists;
 }