Пример #1
0
 public static function rangeType($selected)
 {
     $values = array();
     $values[] = jnews::HTML_SelectOption('yesterday', JText::_(_JNEWS_DEFINED_RANGE_YESTERDAY));
     $values[] = jnews::HTML_SelectOption('today', JText::_(_JNEWS_DEFINED_RANGE_TODAY));
     $values[] = jnews::HTML_SelectOption('this-week', JText::_(_JNEWS_DEFINED_RANGE_THIS_WEEK));
     $values[] = jnews::HTML_SelectOption('last-week', JText::_(_JNEWS_DEFINED_RANGE_LAST_WEEK));
     $values[] = jnews::HTML_SelectOption('last-2-weeks', JText::_(_JNEWS_DEFINED_RANGE_LAST_TWO_WEEK));
     $values[] = jnews::HTML_SelectOption('this-month', JText::_(_JNEWS_DEFINED_RANGE_THIS_MONTH));
     $values[] = jnews::HTML_SelectOption('last-month', JText::_(_JNEWS_DEFINED_RANGE_LAST_MONTH));
     $values[] = jnews::HTML_SelectOption('this-year', JText::_(_JNEWS_DEFINED_RANGE_THIS_YEAR));
     $values[] = jnews::HTML_SelectOption('last-year', JText::_(_JNEWS_DEFINED_RANGE_LAST_YEAR));
     $values[] = jnews::HTML_SelectOption('2-years-ago', JText::_(_JNEWS_DEFINED_RANGE_TWO_YEARS_AGO));
     $values[] = jnews::HTML_SelectOption('3-years-ago', JText::_(_JNEWS_DEFINED_RANGE_3_YEARS_AGO));
     return jnews::HTML_GenericList($values, "rptrange", 'class="inputbox" size="1"', 'value', 'text', $selected);
 }
Пример #2
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $db = JFactory::getDBO();
     $db->setQuery('SELECT `virtuemart_custom_id`, `custom_title` FROM #__virtuemart_customs ');
     $tableField = $db->loadObjectList();
     if (empty($tableField)) {
         //old VM version
         $tableField = $db->getTableFields('#__vm_user_info');
         $fields = reset($tableField);
         $dropdown = array();
         foreach ($fields as $oneField => $fieldType) {
             $dropdown[] = jnews::HTML_SelectOption($oneField, $oneField);
         }
         return jnews::HTML_GenericList($dropdown, $control_name . '[' . $name . ']', 'size="1"', 'value', 'text', $value);
     }
     //new VM version
     $dropdown = array();
     foreach ($tableField as $oneField => $fieldType) {
         $dropdown[] = jnews::HTML_SelectOption($fieldType->virtuemart_custom_id, $fieldType->custom_title);
     }
     return jnews::HTML_GenericList($dropdown, $control_name . '[' . $name . ']', 'size="1"', 'value', 'text', $value);
 }
Пример #3
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;
}
Пример #4
0
 /**
  * <p>public static function to create the header or the subject area of the smart newsletter</p>
  */
 public static function smartNewsHead($mailingEdit, $lists, $show)
 {
     $option = array();
     $my = JFactory::getUser();
     $acl = JFactory::getACL();
     //$gtree = $acl->get_group_children_tree( null, 'USERS', false );
     $option[] = jnews::HTML_SelectOption('1800', 'Every 30 minutes');
     $option[] = jnews::HTML_SelectOption('3600', 'Every hour');
     $option[] = jnews::HTML_SelectOption('43200', 'Every 12 hours');
     $option[] = jnews::HTML_SelectOption('1', _JNEWS_AUTO_DAY_CH1);
     $option[] = jnews::HTML_SelectOption('3', _JNEWS_AUTO_DAY_CH3);
     $option[] = jnews::HTML_SelectOption('5', _JNEWS_AUTO_DAY_CH5);
     $option[] = jnews::HTML_SelectOption('6', _JNEWS_AUTO_DAY_CH6);
     $option[] = jnews::HTML_SelectOption('7', _JNEWS_AUTO_DAY_CH7);
     $option[] = jnews::HTML_SelectOption('8', _JNEWS_AUTO_DAY_CH8);
     $option[] = jnews::HTML_SelectOption('9', _JNEWS_AUTO_DAY_CH9);
     $auto_option[] = jnews::HTML_SelectOption('0', _JNEWS_AUTO_OPTION_NONE);
     $auto_option[] = jnews::HTML_SelectOption('1', _JNEWS_AUTO_OPTION_NEW);
     if (isset($mailingEdit->new_letter) && $mailingEdit->new_letter == 1) {
         $auto_option[] = jnews::HTML_SelectOption('2', _JNEWS_AUTO_OPTION_ALL);
     }
     if (!isset($lists['delay_min'])) {
         $lists['delay_min'] = null;
     }
     $lists['delay_min'] = jnews::HTML_GenericList($option, 'delay_min', 'class="inputbox" size="1"', 'value', 'text', isset($mailingEdit->delay_min) ? $mailingEdit->delay_min : 1);
     $lists['catid'] = !empty($mailingEdit->cat_id) ? $mailingEdit->cat_id : '';
     $lists['notify_id'] = !empty($mailingEdit->notify_id) ? $mailingEdit->notify_id : '';
     $lists['delay_max'] = !empty($mailingEdit->delay_max) ? $mailingEdit->delay_max : '';
     $lists['smart_date'] = !empty($mailingEdit->smart_date) ? $mailingEdit->smart_date : '';
     if (!empty($mailingEdit->delay_max)) {
         JRequest::setVar('delay_max', $mailingEdit->delay_max);
     }
     if (!empty($mailingEdit->notify_id)) {
         JRequest::setVar('notify_id', $mailingEdit->notify_id);
     }
     if (!empty($mailingEdit->cat_id)) {
         JRequest::setVar('cat_id', base64_encode($mailingEdit->cat_id));
     }
     //		if(!empty($mailingEdit->template_id))JRequest::setVar('template_id', base64_encode($mailingEdit->template_id));
     jNews_Autonews::edit($mailingEdit, $lists, $show);
 }
Пример #5
0
 public static function showMailingsFront($task, $action, $subscriberId, $listId, $listType = '', $viewArchive, $pageTile)
 {
     $Itemid = JRequest::getInt('Itemid');
     if (empty($Itemid)) {
         $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
     }
     $gidAdmins = array(24, 25, 7, 8);
     $my = JFactory::getUser();
     if (version_compare(JVERSION, '1.6.0', '>=')) {
         //j16
         $usergid = JAccess::getGroupsByUser($my->id, false);
         $my->gid = $usergid[0];
     }
     $start = JRequest::getVar('start', '0');
     if (!$start) {
         $start = JRequest::getVar('limitstart', '0');
     }
     JRequest::setVar('limitstart', $start);
     $emailsearch = JRequest::getVar('emailsearch', '', '', 'STRING');
     $emailsearch = htmlentities($emailsearch, ENT_COMPAT, "UTF-8");
     $obj_for_order = new stdClass();
     if (version_compare(JVERSION, '3.0.0', '>=')) {
         //j16
         //alex filter
         if ($action === 'mailing') {
             $order = JRequest::getVar('filter_order', 'send_date');
             $obj_for_order->orderValue = $order;
             $obj_for_order->orderDir = JRequest::getVar('filter_order_Dir', 'desc');
         } else {
             $order = JRequest::getVar('filter_order', 'id');
             $obj_for_order->orderValue = $order;
             $obj_for_order->orderDir = JRequest::getVar('filter_order_Dir', 'asc');
         }
     } else {
         $order = JRequest::getVar('order', 'sendDateD');
     }
     $dropList = JRequest::getVar('droplist', 'ZZZZ');
     $my = JFactory::getUser();
     $accessGrant = false;
     $limit = JRequest::getInt('limit');
     if (empty($limit) || $limit > 100) {
         $limit = 20;
     }
     $total = 0;
     if ($dropList == 'ZZZZ') {
         $dropList = $listType . '-' . $listId;
     }
     $total = 0;
     $dropListValues = explode('-', $dropList);
     $listType = $dropListValues[0];
     $listId = $dropListValues[1];
     $id = 0;
     if ($GLOBALS[JNEWS . 'enable_jsub']) {
         if (!empty($my->id)) {
             $ownedlists = jNews_Lists::getOwnedlists($my->id);
         }
         if (!empty($ownedlists)) {
             $id = $my->id;
         }
     }
     $allowed = false;
     if (class_exists('jNews_Pro') && $listId > 0) {
         $list = jNews_Lists::getOneList($listId);
         $allowed = jnews::checkPermissions($list->acc_level);
     } elseif (class_exists('jNews_Pro') && empty($listId)) {
         //check all list
         $myQ = 'SELECT `acc_level` FROM `#__jnews_lists` ';
         $db = JFactory::getDBO();
         $db->setQuery($myQ);
         $listsAccessHere = $db->loadObjectList();
         $allowed = false;
         if (!empty($listsAccessHere)) {
             foreach ($listsAccessHere as $oneAcessL) {
                 if (jnews::checkPermissions($oneAcessL->acc_level)) {
                     $allowed = true;
                     break;
                 }
             }
             //endfoerach
         }
     } else {
         $allowed = in_array($my->gid, $gidAdmins);
     }
     if (!empty($my->id)) {
         $ownedlists = jNews_Lists::getOwnedlists($my->id);
     }
     $accessGrant = !empty($ownedlists) ? true : $allowed;
     if ($accessGrant || $GLOBALS[JNEWS . 'level'] > 2) {
         //we don't filter the newsletters by lists yet - 8889955
         if ($task === "archive") {
             $listType_old = $listType;
             $listType = 1;
         }
         if (empty($listType)) {
             $listType = 1;
         }
         $mailings = jNews_Mailing::getMailings($listId, $listType, $start, $limit, $emailsearch, $order, false, $viewArchive, $obj_for_order);
         $total = count(jNews_Mailing::getMailings($listId, $listType, '0', '100000000', $emailsearch, $order, false, $viewArchive, $obj_for_order));
         if ($task === "archive") {
             $listType = $listType_old;
         }
     } else {
         if ($listType == 1 || $listType == 2 || $listType == 7) {
             $mailings = jNews_Mailing::getMailings($listId, $listType, $start, $limit, $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $total = count(jNews_Mailing::getMailings($listId, $listType, '0', '100000000', $emailsearch, $order, true, $viewArchive, $obj_for_order));
         } elseif ($listType == 0) {
             $mailings1 = jNews_Mailing::getMailings($listId, 1, $start, $limit, $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $mailings2 = jNews_Mailing::getMailings($listId, 2, $start, $limit, $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $mailings7 = jNews_Mailing::getMailings($listId, 7, $start, $limit, $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $mailings = array_merge($mailings1, $mailings2, $mailings7);
             $totalmailings1 = jNews_Mailing::getMailings($listId, 1, '0', '100000000', $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $totalmailings2 = jNews_Mailing::getMailings($listId, 2, '0', '100000000', $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $totalmailings7 = jNews_Mailing::getMailings($listId, 7, '0', '100000000', $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $totalmailings = array_merge($totalmailings1, $totalmailings2, $totalmailings7);
             $total = count($totalmailings);
         } else {
             $mailings = '';
         }
     }
     if ($listId == 0) {
         $lists['title'] = jNews_ListType::chooseType($task, $action, $listType, 'titles', '', _JNEWS_MENU_MAILING);
     } else {
         $listing = jNews_Lists::getLists($listId, 0, $subscriberId, '', false, false, true);
         $listType = $listType > 0 ? $listType : '0';
         $lists['title'] = _JNEWS_NEWSLETTER_ARCHIVE;
     }
     //we check if the user has access to addedit mailing to a list
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $listsAddEdit = jNews_Lists::getIDswithacclevel($my->gid, $listId);
     } else {
         $groups = JAccess::getGroupsByUser($my->id);
         $listsAddEdit = jNews_Lists::getIDswithacclevel($groups, $listId);
     }
     $haveaccesstoList = true;
     $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0;
     if (!$allowed && empty($listsAddEdit) && !empty($my->id) && !jnews::checkPermissions('admin') && !jnews::checkPermissions($gid)) {
         $haveaccesstoList = false;
     }
     if ($haveaccesstoList) {
         $dropDownList = jNews_ListType::getMailingDropList($listId, $listType, 'idA');
         // $order
         if (!empty($dropDownList)) {
             $lists['droplist'] = jnews::HTML_GenericList($dropDownList, 'droplist', 'class="inputbox" size="1" onchange="document.jNewsFilterForm.submit();"', 'id', 'name', $dropList);
         }
     }
     $linkMain = 'index.php?option=' . JNEWS_OPTION . '&act=' . $action;
     $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION);
     //alex pagination
     if (!empty($task)) {
         $mainLink .= '&task=' . $task;
     }
     if (!empty($action)) {
         $mainLink .= '&act=' . $action;
     }
     if (!empty($listType)) {
         $mainLink .= '&listype=' . $listType;
     }
     if (!empty($listId)) {
         $mainLink .= '&listid=' . $listId;
     }
     $forms['main'] = '<form method="post" action="' . $mainLink . '" enctype="multipart/form-data" onsubmit="submitbutton();return false;" name="adminForm" id="adminForm">' . "\n\r";
     $forms['select'] = '<form method="post" action="' . $linkMain . '"  name="jNewsFilterForm">' . "\n\r";
     $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
     $forms['select'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
     $show = jNews_ListType::showType($listType, 'showMailings');
     $show['index'] = 'index';
     $show['select'] = false;
     $show['send'] = false;
     $show['buttons'] = true;
     if (class_exists('jNews_Pro') && !$viewArchive) {
         $show['admin'] = true;
         $show['status'] = true;
     }
     $mailingType = $listType == 7 ? 1 : $listType;
     $db = JFactory::getDBO();
     $query = 'SELECT * FROM `#__jnews_lists` WHERE `hidden` = 1 AND `published` = 1 AND ';
     if (is_array($mailingType)) {
         $query .= '  `list_type` IN (' . jnews::implode(',', $mailingType) . ') ';
     } else {
         $query .= ' `list_type`=' . intval($mailingType);
     }
     $db->setQuery($query);
     $lists = $db->loadObjectList();
     $access = false;
     foreach ($lists as $list) {
         $bit = jnews::checkPermissions($list->acc_level);
         if ($bit) {
             $access = true;
             break;
         }
     }
     $menuA = null;
     if ($my->id > 0 && jnews::checkPermissions('all') && $haveaccesstoList) {
         if ($GLOBALS[JNEWS . 'level'] > 2) {
             if ((empty($ownedlists) || !in_array($my->gid, $gidAdmins)) && !$access) {
                 $accessGrant = false;
             } else {
                 $accessGrant = true;
             }
             if ($accessGrant) {
                 $show['select'] = true;
                 $show['send'] = true;
                 // menu new
                 $link = 'option=' . JNEWS_OPTION . '&act=mailing&task=new&listid=' . $listId . '&listype=' . $listType . '&Itemid=' . $Itemid;
                 $link = jNews_Tools::completeLink($link, false);
                 $menuNew = new stdClass();
                 $menuNew->popup = new stdClass();
                 $menuNew->popup->isPop = false;
                 $menuNew->link = '#';
                 $menuNew->action = 'new';
                 $menuNew->onclick = new stdClass();
                 $menuNew->onclick->custom = false;
                 $menuNew->onclick->js = '';
                 $menuNew->title = _JNEWS_NEW;
                 //menu edit
                 $menuEdit = new stdClass();
                 $menuEdit->popup = new stdClass();
                 $menuEdit->popup->isPop = false;
                 $menuEdit->link = '#';
                 $menuEdit->action = 'edit';
                 $menuEdit->onclick = new stdClass();
                 $menuEdit->onclick->custom = false;
                 $menuEdit->onclick->js = '';
                 $menuEdit->title = _JNEWS_MENU_EDIT;
                 //menu delete
                 $menuDelete = new stdClass();
                 $menuDelete->popup = new stdClass();
                 $menuDelete->popup->isPop = false;
                 $menuDelete->link = '#';
                 $menuDelete->action = 'delete';
                 $menuDelete->onclick = new stdClass();
                 $menuDelete->onclick->custom = false;
                 $menuDelete->onclick->js = '';
                 $menuDelete->title = _JNEWS_DELETE;
                 $menuPreview = new stdClass();
                 $menuPreview->popup = new stdClass();
                 $menuPreview->popup->isPop = false;
                 $menuPreview->link = '#';
                 $menuPreview->action = 'preview';
                 $menuPreview->onclick = new stdClass();
                 $menuPreview->onclick->custom = true;
                 $menuPreview->onclick->js = 'javascript:if(document.adminForm.boxchecked.value==0){alert(\'Please make a selection from the mailings to preview\');}else{  submitbutton(\'preview\')}';
                 $menuPreview->title = 'Preview';
                 $menuCopy = new stdClass();
                 $menuCopy->popup = new stdClass();
                 $menuCopy->popup->isPop = false;
                 $menuCopy->link = '#';
                 $menuCopy->action = 'copy';
                 $menuCopy->onclick = new stdClass();
                 $menuCopy->onclick->custom = false;
                 $menuCopy->onclick->js = '';
                 $menuCopy->title = 'Copy';
                 $menuUnpub = new stdClass();
                 $menuUnpub->popup = new stdClass();
                 $menuUnpub->popup->isPop = false;
                 $menuUnpub->link = '#';
                 $menuUnpub->action = 'unpublished';
                 $menuUnpub->onclick = new stdClass();
                 $menuCopy->onclick->custom = false;
                 $menuUnpub->onclick->js = '';
                 $menuUnpub->title = 'Unpublished';
                 $menuDivider = new stdClass();
                 $menuDivider->divider = true;
             } else {
                 $menuNew = new stdClass();
                 $menuEdit = new stdClass();
                 $menuDelete = new stdClass();
                 $menuCopy = new stdClass();
                 $menuUnpub = new stdClass();
                 $menuSend = new stdClass();
                 $menuPreview = new stdClass();
                 $menuDivider = new stdClass();
             }
         } else {
             $menuNew = new stdClass();
             $menuEdit = new stdClass();
             $menuDelete = new stdClass();
             $menuCopy = new stdClass();
             $menuUnpub = new stdClass();
             $menuSend = new stdClass();
             $menuPreview = new stdClass();
             $menuDivider = new stdClass();
         }
         // menu cpanel
         $link = 'option=' . JNEWS_OPTION;
         $link = jNews_Tools::completeLink($link, false);
         $menuCpanel = new stdClass();
         $menuCpanel->popup = new stdClass();
         $menuCpanel->popup->isPop = false;
         $menuCpanel->popup->isPop = false;
         $menuCpanel->link = $link;
         $menuCpanel->action = 'cpanel';
         $menuCpanel->onclick = new stdClass();
         $menuCpanel->onclick->custom = true;
         $menuCpanel->onclick->js = "javascript: submitbutton('cpanel')";
         $menuCpanel->title = _JNEWS_MENU_CPANEL;
         $menuA = array();
         if ($listType != 7) {
             $menuA['unpublished'] = $menuUnpub;
         }
         $menuA['preview'] = $menuPreview;
         $menuA['new'] = $menuNew;
         $menuA['edit'] = $menuEdit;
         if ($listType != 7) {
             $menuA['copy'] = $menuCopy;
         }
         $menuA['delete'] = $menuDelete;
         //			$menuA['divider1'] = $menuDivider;
     }
     //menu back
     if ($listType == 2) {
         $link = 'option=' . JNEWS_OPTION . '&act=list&Itemid=' . $Itemid;
     }
     $link = 'option=' . JNEWS_OPTION . '&Itemid=' . $Itemid;
     $link = jNews_Tools::completeLink($link, false, false);
     $menuBack = new stdClass();
     $menuBack->popup = new stdClass();
     $menuBack->popup = new stdClass();
     $menuBack->popup->isPop = false;
     $menuBack->link = $link;
     $menuBack->action = 'back';
     $menuBack->onclick = new stdClass();
     $menuBack->onclick->custom = false;
     $menuBack->onclick->js = '';
     $menuBack->title = _JNEWS_MENU_BACK;
     $menuBack = new stdClass();
     $menuA['cpanel'] = $menuBack;
     $title = !empty($lists['title']) ? $lists['title'] : '';
     if (in_array($my->gid, $gidAdmins) or !empty($ownedlists) or $accessGrant) {
         if ($listType == 1) {
             $title = 'Newsletters';
         }
         if ($listType == 7) {
             $title = 'Smart-Newsletters';
         }
         if ($listType == 2) {
             $title = 'Auto-responders';
         }
     }
     $app = JFactory::getApplication();
     $setSort = new stdClass();
     if ($listType == '2') {
         //autoresponder
         $key = JNEWS_OPTION . '.mailing2';
         $column = 'delay';
         $direction = 'asc';
     } elseif ($listType == '7') {
         //smartnewsletter
         $key = JNEWS_OPTION . '.mailing7';
         $column = 'id';
         $direction = 'desc';
     } else {
         //newsletter
         $key = JNEWS_OPTION . '.mailing1';
         $column = 'send_date';
         $direction = 'desc';
     }
     $setSort->orderValue = $app->getUserStateFromRequest($key . 'filter_order', 'filter_order', $column, 'cmd');
     $setSort->orderDir = $app->getUserStateFromRequest($key . 'filter_order_Dir', 'filter_order_Dir', $direction, 'word');
     $setLimit = new stdClass();
     $setLimit->start = $start;
     $setLimit->end = $limit;
     $setLimit->total = $total;
     frontHTML::formStart($title, 0, 'show_mailing', $menuA);
     frontHTML::FEmenu();
     jNews_MailingsHTML::showMailingList($mailings, $lists, $start, $limit, $total, $emailsearch, $listId, $listType, $forms, $show, $action, $setLimit, $setSort);
     $go[] = jnews::makeObj('filter_order', $setSort->orderValue);
     $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir);
     backHTML::formEnd($go);
     return true;
 }
Пример #6
0
 public static function prepList($listEdit, $listType)
 {
     $lists = array();
     $jour = array();
     $listEdit->unsubscribesend = isset($listEdit->unsubscribesend) ? $listEdit->unsubscribesend : '';
     $listEdit->unsubscribenotifyadmin = isset($listEdit->unsubscribenotifyadmin) ? $listEdit->unsubscribenotifyadmin : '';
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     $acl = JFactory::getACL();
     $jour[] = jnews::HTML_SelectOption('1800', 'Every 30 minutes');
     $jour[] = jnews::HTML_SelectOption('3600', 'Every hour');
     $jour[] = jnews::HTML_SelectOption('43200', 'Every 12 hours');
     $jour[] = jnews::HTML_SelectOption('1', _JNEWS_AUTO_DAY_CH1);
     $jour[] = jnews::HTML_SelectOption('3', _JNEWS_AUTO_DAY_CH3);
     $jour[] = jnews::HTML_SelectOption('5', _JNEWS_AUTO_DAY_CH5);
     $jour[] = jnews::HTML_SelectOption('6', _JNEWS_AUTO_DAY_CH6);
     $jour[] = jnews::HTML_SelectOption('7', _JNEWS_AUTO_DAY_CH7);
     $jour[] = jnews::HTML_SelectOption('8', _JNEWS_AUTO_DAY_CH8);
     $jour[] = jnews::HTML_SelectOption('9', _JNEWS_AUTO_DAY_CH9);
     $auto_option[] = jnews::HTML_SelectOption('0', _JNEWS_AUTO_OPTION_NO_SYNC);
     $auto_option[] = jnews::HTML_SelectOption('1', _JNEWS_AUTO_OPTION_NEW);
     //we get all of the templates available and published
     $templates = jNews_Templates::getTemplatesForPicklist();
     $list_templates = array();
     foreach ($templates as $oneTemplate) {
         $list_templates[] = jnews::HTML_SelectOption($oneTemplate->template_id, $oneTemplate->name);
     }
     //enfor
     $templateID = !empty($listEdit->template) ? $listEdit->template : '';
     $lists['list_templates'] = jnews::HTML_GenericList($list_templates, 'templatelist', 'class="inputbox"', 'value', 'text', $templateID);
     if ($mainframe->isAdmin()) {
         if ($listEdit->new_letter == 1 && $listType != 2) {
             $auto_option[] = jnews::HTML_SelectOption('2', _JNEWS_AUTO_OPTION_ALL);
         }
     }
     $lists['delay_min'] = jnews::HTML_GenericList($jour, 'delay_min', 'class="inputbox" size="1"', 'value', 'text', $listEdit->delay_min);
     $lists['auto_add'] = jnews::HTML_GenericList($auto_option, 'auto_add', 'class="inputbox"', 'value', 'text', $listEdit->auto_add);
     $lists['published'] = jnews::HTML_BooleanList('published', 'class="inputbox"', $listEdit->published);
     $lists['hidden'] = jnews::HTML_BooleanList('hidden', 'class="inputbox"', $listEdit->hidden);
     $lists_option = jNews_ListType::getListOption(2);
     $lists['list_type'] = jNews_ListsHTML::aca_radioList($lists_option, 'list_type', 'class="inputbox"', $listEdit->list_type);
     $lists['html_mailings'] = jnews::HTML_BooleanList('html', 'class="inputbox"', $listEdit->html);
     $lists['unsubscribesend'] = jnews::HTML_BooleanList("unsubscribesend", 'class="inputbox"', $listEdit->unsubscribesend);
     $lists['subnotifysend'] = jnews::HTML_BooleanList("subnotifysend", 'class="inputbox"', $listEdit->subnotifysend);
     $lists['unsubscribenotifyadmin'] = jnews::HTML_BooleanList("unsubscribenotifyadmin", 'class="inputbox"', $listEdit->unsubscribenotifyadmin);
     $lists['footer'] = jnews::HTML_BooleanList("footer", 'class="inputbox"', $listEdit->footer);
     return $lists;
 }
Пример #7
0
 public static function editSubscriberFE($subscriber, $listings, $queues, $forms, $access = false, $frontEnd = false, $cb = false)
 {
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     if (!$GLOBALS[JNEWS . 'disabletooltip']) {
         if (version_compare(JVERSION, '3.0.0', '<')) {
             JHTML::_('behavior.tooltip');
         } else {
             JHtml::_('behavior.tooltip');
         }
     }
     if (empty($subscriber->name)) {
         $subscriber->name = '';
     }
     $text = str_replace('"', '&quot;', $subscriber->name);
     if (function_exists('htmlspecialchars_decode')) {
         $text = htmlspecialchars_decode($text, ENT_NOQUOTES);
     } elseif (function_exists('html_entity_decode')) {
         $text = html_entity_decode($text, ENT_NOQUOTES);
     }
     if (version_compare(JVERSION, '1.6.0', '>=')) {
         //j16
         $gid = JAccess::getGroupsByUser($my->id, false);
         $my->gid = $gid[0];
     }
     $gidAdmins = array(24, 25, 7, 8);
     $nRows = intval($GLOBALS[JNEWS . 'create_newsubsrows']);
     if (in_array($my->gid, $gidAdmins)) {
         $ownedLists = jNews_Lists::getLists('', 1, '', '', false, true, false, false, true);
     } else {
         $ownedLists = jNews_Lists::getFEListsByOwner($my->id);
     }
     $listOpt = array();
     $selectedList = 0;
     $listOpt[] = jnews::HTML_SelectOption(0, 'No List Selected');
     foreach ($ownedLists as $list) {
         $listOpt[] = jnews::HTML_SelectOption($list->id, $list->list_name);
     }
     $br = "\n\r";
     $html = $forms['main'];
     $html .= '<div style="width:100%; align:left;">' . $br;
     $html .= '<fieldset class="jnewscss" style="padding: 10px; text-align: left">' . $br;
     $html .= '<legend><strong>' . _JNEWS_SUB_INFO . '</strong></legend>' . $br;
     $html .= '<div><strong>Subscribe Contacts to a List:</strong>&nbsp;&nbsp;&nbsp;' . jnews::HTML_GenericList($listOpt, 'opted_list', 'class="inputbox"', 'value', 'text', $selectedList) . '</div>';
     $html .= '<table cellpadding="2" cellspacing="0" align="center">';
     $count = 0;
     for ($count = 1; $count <= $nRows; $count++) {
         if (!$cb) {
             $html .= '<tr id=tr' . $count . '>';
             $html .= '<td style="padding-right: 10px; padding-top: 15px;"> <input id="name" type="text" name="name' . $count . '" size="20" value="' . addslashes(_JNEWS_NAME) . '" class="inputbox" name="name" onblur="if(this.value==\'\') this.value=\'' . addslashes(_JNEWS_NAME) . '\';" onfocus="if(this.value==\'' . addslashes(_JNEWS_NAME) . '\') this.value=\'\' ; "  /></td>';
             if (empty($subscriber->email) || !jNews_Subscribers::validEmail($subscriber->email)) {
                 $subscriber->email = '';
             }
             $html .= '<td style="padding-right: 10px; padding-top: 15px;"> <input id="email" type="text" name="email' . $count . '" size="20" value="' . addslashes(_JNEWS_EMAIL) . '" class="inputbox" name="name" onblur="if(this.value==\'\') this.value=\'' . addslashes(_JNEWS_EMAIL) . '\'; else {status= checkEmail(this.value);  if(!status) this.focus;}" onfocus="if(this.value==\'' . addslashes(_JNEWS_EMAIL) . '\') this.value=\'\' ; "  /></td>';
             //additional columns
             if ($GLOBALS[JNEWS . 'level'] > 2) {
                 //check if the version of jnewsletter is pro
                 if (empty($subscriber->column1)) {
                     $subscriber->column1 = '';
                 }
                 if (empty($subscriber->column2)) {
                     $subscriber->column2 = '';
                 }
                 if (empty($subscriber->column3)) {
                     $subscriber->column3 = '';
                 }
                 if (empty($subscriber->column4)) {
                     $subscriber->column4 = '';
                 }
                 if (empty($subscriber->column5)) {
                     $subscriber->column5 = '';
                 }
                 if ($GLOBALS[JNEWS . 'show_column1']) {
                     //show column1
                     $html .= '<td style="padding-right: 10px; padding-top: 15px;"> <input id="column1" type="text" name="column1' . $count . '" size="20" value="' . $GLOBALS[JNEWS . 'column1_name'] . '" class="inputbox" name="name" onblur="if(this.value==\'\') this.value=\'' . $GLOBALS[JNEWS . 'column1_name'] . '\';" onfocus="if(this.value==\'' . $GLOBALS[JNEWS . 'column1_name'] . '\') this.value=\'\' ; "  /></td>';
                 }
                 if ($GLOBALS[JNEWS . 'show_column2']) {
                     //show column2
                     $html .= '<td style="padding-right: 10px; padding-top: 15px;"> <input id="column2" type="text" name="column2' . $count . '" size="20" value="' . $GLOBALS[JNEWS . 'column2_name'] . '" class="inputbox" name="name" onblur="if(this.value==\'\') this.value=\'' . $GLOBALS[JNEWS . 'column2_name'] . '\';" onfocus="if(this.value==\'' . $GLOBALS[JNEWS . 'column2_name'] . '\') this.value=\'\' ; "  /></td>';
                 }
                 if ($GLOBALS[JNEWS . 'show_column3']) {
                     //show column3
                     $html .= '<td style="padding-right: 10px; padding-top: 15px;"> <input id="column3" type="text" name="column3' . $count . '" size="20" value="' . $GLOBALS[JNEWS . 'column3_name'] . '" class="inputbox" name="name" onblur="if(this.value==\'\') this.value=\'' . $GLOBALS[JNEWS . 'column3_name'] . '\';" onfocus="if(this.value==\'' . $GLOBALS[JNEWS . 'column3_name'] . '\') this.value=\'\' ; "  /></td>';
                 }
                 if ($GLOBALS[JNEWS . 'show_column4']) {
                     //show column4
                     $html .= '<td style="padding-right: 10px; padding-top: 15px;"> <input id="column4" type="text" name="column4' . $count . '" size="20" value="' . $GLOBALS[JNEWS . 'column4_name'] . '" class="inputbox" name="name" onblur="if(this.value==\'\') this.value=\'' . $GLOBALS[JNEWS . 'column4_name'] . '\';" onfocus="if(this.value==\'' . $GLOBALS[JNEWS . 'column4_name'] . '\') this.value=\'\' ; "   /></td>';
                 }
                 if ($GLOBALS[JNEWS . 'show_column5']) {
                     //show column5
                     $html .= '<td style="padding-right: 10px; padding-top: 15px;"> <input id="column5" type="text" name="column5' . $count . '" size="20" value="' . $GLOBALS[JNEWS . 'column5_name'] . '" class="inputbox" name="name" onblur="if(this.value==\'\') this.value=\'' . $GLOBALS[JNEWS . 'column5_name'] . '\';" onfocus="if(this.value==\'' . $GLOBALS[JNEWS . 'column5_name'] . '\') this.value=\'\' ; "  /></td>';
                 }
             }
         } else {
             $html .= '<input type="hidden" name="cb_integration" value="1"  />';
         }
         $html .= '<input id="confirmed" type="hidden" name="confirmed' . $count . '" value="1" />';
         $html .= '<input id="receive_html" type="hidden" name="receive_html' . $count . '" value="1" />';
         $html .= '<input id="blacklist" type="hidden" name="blacklist' . $count . '" value="0" />';
         $html .= '</tr>';
     }
     $html .= '</table>';
     $html .= '<br><div id="addmore" >';
     $html .= '<input id="count" type="hidden" name="count" value="' . $count . '" />';
     $html .= '<input id="jnewsname" type="hidden" name="jnewsname" value="' . addslashes(_JNEWS_NAME) . '" />';
     $html .= '<input id="jnewsemail" type="hidden" name="jnewsemail" value="' . addslashes(_JNEWS_EMAIL) . '" />';
     $html .= '<input id="jnewscolumn1" type="hidden" name="jnewscolumn1" value="' . $GLOBALS[JNEWS . 'column1_name'] . '" />';
     $html .= '<input id="jnewscolumn2" type="hidden" name="jnewscolumn2" value="' . $GLOBALS[JNEWS . 'column2_name'] . '" />';
     $html .= '<input id="jnewscolumn3" type="hidden" name="jnewscolumn3" value="' . $GLOBALS[JNEWS . 'column3_name'] . '" />';
     $html .= '<input id="jnewscolumn4" type="hidden" name="jnewscolumn4" value="' . $GLOBALS[JNEWS . 'column4_name'] . '" />';
     $html .= '<input id="jnewscolumn5" type="hidden" name="jnewscolumn5" value="' . $GLOBALS[JNEWS . 'column5_name'] . '" />';
     $html .= '<input id="aca_22" type="button" value="Add More" alt="addmore" name="addmore" onclick="addmorefields();" /></div>';
     $html .= '</fieldset></div>';
     return $html;
 }
Пример #8
0
/**
 * <p>Function to insert a module tag<p>
 * @param string $forms - the start html form
 * @param object $params - the plugin parameters
 */
function tagsite($forms, $params = null)
{
    $limit = -1;
    $action = JRequest::getVar('act', '', '', 'WORD');
    $task = JRequest::getVar('task');
    echo $forms['main'];
    $customlink = trim($params->get('customlink'));
    $customlinkA = array();
    if (!empty($customlink)) {
        $customlinkA = explode(',', $customlink);
    }
    $countParams = count($customlinkA);
    ?>
<style type="text/css">
	table.sitetaginput {
		border: 1px solid #D5D5D5;
		background-color: #F6F6F6;
		width: 100%;
		margin-bottom: 10px;
		-moz-border-radius:3px;
 		-webkit-border-radius:3px;
 		padding: 5px;
 	}
 	table.sitetaginput td.key {
 		background-color: #f6f6f6;
		text-align: left;
		width: 140px;
		color: #666;
		font-weight: bold;
		border-bottom: 1px solid #e9e9e9;
		border-right: 1px solid #e9e9e9;
 	}
	div.sitetaglist {
		border-spacing:1px;
		border:3px double #D5D5D5;
		padding: 5px;
		margin-bottom: 5px;
		cursor: pointer;
	}
 	div.k0 {
		background-color:#f4f4ff;
		color:#666;
	}
	div.k0:hover, div.k1:hover{
		background-color:#CFF;
		color:#666;
	}
	div.k1 {
		background-color:#FFF;
		color:#666;
	}
	div.k1:hover, div.k1:hover{
		background-color:#CFF;
		color:#666;
	}

	div.selectedtag {
		background-color:#87c331;
		color:#FFF;
		font-weight:bold;
	}

	table.sitetaginput tr.inputhide {
		display: none;
	}

	table.sitetaginput tr.inputunhide {
		display: table-row;
	}
 </style>
<div id="element-box">
	<div class="t">
		<div class="t">
			<div class="t"></div>
		</div>
	</div>
<div class="m">
	<?php 
    $js = 'function insertjnewstag(tag){';
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //1.5
        $js .= ' if(window.top.insertTag(tag)){window.top.document.getElementById(\'sbox-window\').close();}';
    } else {
        if (version_compare(JVERSION, '3.0.0', '<')) {
            $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}';
        } else {
            $js .= ' if(window.top.insertTag(tag)) {           
                     var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                    if(need_click.length == 0) window.parent.SqueezeBox.close();
                    else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
        }
    }
    $js .= '}';
    $script = 'function setCaption(newtag){window.document.getElementById(\'jnewstag\').value = newtag}';
    $doc = JFactory::getDocument();
    $doc->addScriptDeclaration($js);
    ?>
	<script language="javascript" type="text/javascript">
	 function jNewsTagInsert(tag, id) {
		var form = document.adminForm;
		if(!form){
			form = document.mosForm;
		}
		form.jnewstag.value = tag;
		form.jnewsselecttag.value = id;
		document.getElementById('tagvisibility').className = 'inputunhide';
		document.getElementById(id).className = 'selectedtag sitetaglist';
	 	switch(id){
	 		case 'divviewonline':
	 			form.jnewstagcaption.value = '<?php 
    echo _JNEWS_TAG_VIEWONLINE;
    ?>
';
		 		document.getElementById('divfwdtofriend').className = 'k1 sitetaglist';
				<?php 
    for ($a = 0; $a <= count($customlinkA); $a++) {
        ?>
				document.getElementById('div<?php 
        echo 'site' . $a;
        ?>
').className = 'k<?php 
        $x = $a % 2;
        echo $x;
        ?>
 sitetaglist';
				<?php 
    }
    ?>
		 		break;
		 	case 'divfwdtofriend':
		 		form.jnewstagcaption.value = '<?php 
    echo _JNEWS_TAG_FWDTOFRIEND;
    ?>
';
				document.getElementById('divviewonline').className = 'k1 sitetaglist';
				<?php 
    for ($b = 0; $b <= $countParams; $b++) {
        ?>
				document.getElementById('div<?php 
        echo 'site' . $b;
        ?>
').className = 'k<?php 
        $x = $b % 2;
        echo $x;
        ?>
 sitetaglist';
				<?php 
    }
    ?>
		 		break;
		 	<?php 
    for ($c = 0; $c <= $countParams; $c++) {
        ?>
			case 'div<?php 
        echo 'site' . $c;
        ?>
':
				form.jnewstagcaption.value = '<?php 
        if (isset($customlinkA[$c])) {
            if (substr_count($customlinkA[$c], '|') == 1) {
                $linkCaption = explode('|', $customlinkA[$c]);
                echo $linkCaption[0];
            }
        }
        ?>
';
				document.getElementById('divviewonline').className = 'k0 sitetaglist';
				document.getElementById('divfwdtofriend').className = 'k1 sitetaglist';
				<?php 
        $tagA = $customlinkA;
        for ($ci = 0; $ci <= count($tagA); $ci++) {
            if ($c != $ci) {
                ?>
				document.getElementById('divsite<?php 
                echo $ci;
                ?>
').className = 'k<?php 
                $x = $ci % 2;
                echo $x;
                ?>
 sitetaglist';
				<?php 
            }
        }
        ?>
				break;
			<?php 
    }
    ?>
		 	default:
		 		document.getElementById('divviewonline').className = 'k0 sitetaglist';
				document.getElementById('divfwdtofriend').className = 'k1 sitetaglist';
				<?php 
    for ($d = 0; $d <= $countParams; $d++) {
        ?>
				document.getElementById('divsite<?php 
        echo $d;
        ?>
').className = 'k<?php 
        $x = $d % 2;
        echo $x;
        ?>
 sitetaglist';
				<?php 
    }
    ?>
	 	}
	}


	function setCaptionTags() {
		var form = document.adminForm;
		if(!form){
			form = document.mosForm;
		}
		var selectedtag = form.jnewsselecttag.value;
		if (selectedtag == 'divviewonline'){
			form.jnewstag.value = '{tag:viewonline name='+form.jnewstagcaption.value+' theme='+form.jnewstagtheme.value+'}';
		}
		if (selectedtag == 'divfwdtofriend'){
			form.jnewstag.value = '{tag:fwdtofriend name='+form.jnewstagcaption.value+' theme='+form.jnewstagtheme.value+'}';
		}
		<?php 
    for ($e = 0; $e <= $countParams; $e++) {
        if (isset($customlinkA[$e])) {
            if (substr_count($customlinkA[$e], '|') == 1) {
                $tagCaption = explode('|', $customlinkA[$e]);
                ?>
			if (selectedtag == 'divsite<?php 
                echo $e;
                ?>
'){
				form.jnewstag.value = '{tagsite:'+form.jnewstagcaption.value+'|<?php 
                echo $tagCaption[1];
                ?>
}';
			}
		<?php 
            }
        }
    }
    ?>
	}
	</script>
	<table class="sitetaginput" width="100%"">
			<tbody>
				<tr id="tagvisibility" class="inputhide">
					<td width="80" class="key">
						<span class="editlinktip">
						<?php 
    $tip = _JNEWS_TAGSITE_TAGTIP;
    $title = _JNEWS_MAILING_TAG;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
						</span>
					</td>
					<td>
						<input type="text" name="jnewstag" class="inputbox" size="60px">
					</td>
				</tr>
				<tr style="display:visible;">
					<td width="80" class="key">
						<span class="editlinktip">
						<?php 
    $title = _JNEWS_TAGSITE_THEME;
    $tip = _JNEWS_TAGSITE_THEME_TIPS;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
						</span>
					</td>
					<td>
						<?php 
    $themeOption = array();
    $themeOption[] = jnews::HTML_SelectOption('0', 'Joomla Page');
    $themeOption[] = jnews::HTML_SelectOption('1', 'Standalone newsletter');
    echo jnews::HTML_GenericList($themeOption, "jnewstagtheme", 'onchange="setCaptionTags();" class="inputbox" size="1"', 'value', 'text', '0');
    ?>
					</td>
				</tr>
				<tr style="display:visible;">
					<td width="80" class="key">
						<span class="editlinktip">
						<?php 
    $tip = _JNEWS_TAGSITE_CAPTIONTIP;
    $title = _JNEWS_TAGSITE_CAPTION;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
						</span>
					</td>
					<td>
						<input type="text" onchange="setCaptionTags();" size="60px" name="jnewstagcaption">
						<input type="hidden" size="60px" name="jnewsselecttag">
					</td>
				</tr>
				<tr style="display:visible;">
					<td width="80" class="key">
						<span class="editlinktip">
						<?php 
    echo ' ';
    ?>
						</span>
					</td>
					<td>
						<input type="button" style="font-weight:bold;font-size:1.2em;" value="<?php 
    echo _JNEWS_TAG_INSERT_TAG;
    ?>
" onclick="insertjnewstag(form.jnewstag.value);" class="joobibutton">
					</td>
				</tr>
			</tbody>
		</table>

	<div id="divviewonline" class="k0 sitetaglist" onclick="jNewsTagInsert('{tag:viewonline name=<?php 
    echo _JNEWS_TAG_VIEWONLINE;
    ?>
}', 'divviewonline');">Insert a "VIEW IT ONLINE" link in your e-mail</div>
	<div id="divfwdtofriend" class="k1 sitetaglist" onclick="jNewsTagInsert('{tag:fwdtofriend name=<?php 
    echo _JNEWS_TAG_FWDTOFRIEND;
    ?>
}', 'divfwdtofriend');">Insert a "FORWARD TO A FRIEND" link in your e-mail</div>
	<?php 
    $k = 0;
    foreach ($customlinkA as $customlinkOne) {
        //check if | exist
        if (substr_count($customlinkOne, '|') == 1) {
            $customlinkOneA = explode('|', $customlinkOne);
            ?>
		<div id="divsite<?php 
            echo $k;
            ?>
" class="k<?php 
            echo $k % 2;
            ?>
 sitetaglist" onclick="jNewsTagInsert('{tagsite:<?php 
            echo $customlinkOneA[0];
            ?>
|<?php 
            echo $customlinkOneA[1];
            ?>
}', 'divsite<?php 
            echo $k;
            ?>
');">Insert "<?php 
            echo $customlinkOneA[0];
            ?>
" link in your e-mail</div>
	<?php 
            $k++;
        }
    }
    ?>

	</div>
	<div class="b">
		<div class="b">
			<div class="b"></div>
		</div>
	</div>
</div>
	<input type="hidden" value="<?php 
    echo JNEWS_OPTION;
    ?>
" name="option"/>
	<input type="hidden" value="<?php 
    echo $action;
    ?>
" name="act"/>
	<input type="hidden" value="<?php 
    echo $task;
    ?>
" name="task"/>
  	</form>
<?php 
}
Пример #9
0
 public static function showMailings($task, $action, $listId, $listType, $message, $showHeader, $title, $setLimit = null)
 {
     $start = JRequest::getVar('start', '0');
     $emailsearch = JRequest::getVar('emailsearch', '', '', 'STRING');
     $emailsearch = htmlentities($emailsearch, ENT_COMPAT, "UTF-8");
     $dropList = JRequest::getVar('droplist', 'ZZZZ');
     $limit = -1;
     if ($dropList == 'ZZZZ') {
         $dropList = $listType . '-' . $listId;
     }
     $total = 0;
     $dropListValues = explode('-', $dropList);
     $listType = $dropListValues[0];
     $listId = $dropListValues[1];
     //		if ( $listId>0 ) $listTypeM = 0;
     //		else $listTypeM = $listType;
     $listTypeM = $listType;
     $orddef = 'idD';
     if ($listType == 2) {
         $orddef = 'idA';
     }
     $order = JRequest::getVar('order', $orddef);
     if ($listId == 0) {
         $lists['title'] = jNews_ListType::chooseType($task, $action, $listType, 'titles', '', $title);
     } else {
         $listing = jNews_Lists::getLists($listId, 0, 1, '', false, false, true);
         $lists['title'] = $title . "<span style='color: rgb(51, 51, 51);'>" . $listing[0]->list_name . "</span>";
     }
     $app = JFactory::getApplication();
     if ($listType == '2') {
         //autoresponder
         $key = JNEWS_OPTION . '.mailing2';
         $column = 'id';
         $direction = 'desc';
     } elseif ($listType == '7') {
         //smartnewsletter
         $key = JNEWS_OPTION . '.mailing7';
         $column = 'id';
         $direction = 'desc';
     } else {
         //newsletter
         $key = JNEWS_OPTION . '.mailing1';
         $column = 'id';
         $direction = 'desc';
     }
     $setSort = new stdClass();
     $setSort->orderValue = $app->getUserStateFromRequest($key . 'filter_order', 'filter_order', $column, 'cmd');
     $setSort->orderDir = $app->getUserStateFromRequest($key . 'filter_order_Dir', 'filter_order_Dir', $direction, 'word');
     $dropDownList = jNews_ListType::getMailingDropList($listId, $listType, $order);
     if (!empty($dropDownList)) {
         $lists['droplist'] = jnews::HTML_GenericList($dropDownList, 'droplist', 'class="inputbox" size="1" onchange="document.jNewsFilterForm.submit();"', 'id', 'name', $dropList);
     }
     $mailings = jNews_Mailing::getMailings($listId, $listTypeM, $setLimit->start, $setLimit->end, $emailsearch, $order, false, false, $setSort);
     //recheck limit total [pagination]
     if (isset($setLimit->total) && !empty($emailsearch)) {
         $mails = jNews_Mailing::getMailings($listId, $listTypeM, 0, 0, $emailsearch, $order, false, false);
         $setLimit->total = !empty($mails) ? count($mails) : $setLimit->total;
     }
     $forms['main'] = "<form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
     $forms['select'] = "<form action='index.php' method='post' name='jNewsFilterForm'>";
     $show = jNews_ListType::showType($listType, 'showMailings');
     if ($showHeader) {
         jNews_Mailing::_header($task, $action, $listType, $message, '');
     }
     backHTML::formStart('show_mailing', 0, '');
     jNews_MailingsHTML::showMailingList($mailings, $lists, $setLimit->start, $setLimit->end, $setLimit->total, $emailsearch, $listId, $listType, $forms, $show, $action, $setLimit, $setSort);
     $go[] = jnews::makeObj('act', 'mailing');
     $go[] = jnews::makeObj('filter_order', $setSort->orderValue);
     $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir);
     backHTML::formEnd($go);
 }
Пример #10
0
    public static function showConfigEdit()
    {
        $mailOpt = array();
        $mailOpt[] = jnews::HTML_SelectOption('mail', 'PHP mail function');
        $mailOpt[] = jnews::HTML_SelectOption('sendmail', 'Sendmail');
        $mailOpt[] = jnews::HTML_SelectOption('smtp', 'SMTP Server');
        $logFormat = array();
        $logFormat[] = jnews::HTML_SelectOption('0', _JNEWS_DETAILED);
        $logFormat[] = jnews::HTML_SelectOption('1', _JNEWS_SIMPLE);
        $themeOption = array();
        $themeOption[] = jnews::HTML_SelectOption('joobilist', 'jNews Look');
        $themeOption[] = jnews::HTML_SelectOption('adminlist', 'Joomla look');
        $lists = array();
        $lists['component_theme'] = jnews::HTML_GenericList($themeOption, "config['component_theme']", 'class="inputbox" size="1"', 'value', 'text', jnews::myTheme());
        $lists['mailermethod'] = jnews::HTML_GenericList($mailOpt, "config['emailmethod']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'emailmethod']);
        $lists['send_log_simple'] = jnews::HTML_GenericList($logFormat, "config['send_log_simple']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'send_log_simple']);
        $lists['save_log_simple'] = jnews::HTML_GenericList($logFormat, "config['save_log_simple']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'save_log_simple']);
        $mailSecure[] = jnews::HTML_SelectOption('', '---');
        $mailSecure[] = jnews::HTML_SelectOption('ssl', 'SSL');
        $mailSecure[] = jnews::HTML_SelectOption('tls', 'TLS');
        $lists['smtp_secure'] = jnews::HTML_GenericList($mailSecure, "config['smtp_secure']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'smtp_secure']);
        $lists['auth_required'] = jnews::HTML_BooleanList("config['smtp_auth_required']", 'class="inputbox"', $GLOBALS[JNEWS . 'smtp_auth_required']);
        $lists['allow_unregistered'] = jnews::HTML_BooleanList("config['allow_unregistered']", 'class="inputbox"', $GLOBALS[JNEWS . 'allow_unregistered']);
        $lists['require_confirmation'] = jnews::HTML_BooleanList("config['require_confirmation']", 'class="inputbox"', $GLOBALS[JNEWS . 'require_confirmation']);
        // DKIM code addition by Amod begins
        $GLOBALS[JNEWS . 'dkim_activated'] = !empty($GLOBALS[JNEWS . 'dkim_activated']) ? $GLOBALS[JNEWS . 'dkim_activated'] : null;
        $lists['dkim_activated'] = jnews::HTML_BooleanList("config['dkim_activated']", 'class="inputbox"', $GLOBALS[JNEWS . 'dkim_activated']);
        // DKIM code addition by Amod ends
        //These options are transfered from lists to configuration
        $lists['show_unsubscribelink'] = jnews::HTML_BooleanList("config['show_unsubscribelink']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_unsubscribelink']);
        $lists['show_subscriptionlink'] = jnews::HTML_BooleanList("config['show_subscriptionlink']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_subscriptionlink']);
        //Queue Settings for queue status
        $queuestatus = array();
        $queuestatus[] = jnews::HTML_SelectOption('1', _JNEWS_QUEUESTATS_ON);
        $queuestatus[] = jnews::HTML_SelectOption('0', _JNEWS_QUEUESTATS_OF);
        $lists['queue_status'] = jnews::HTML_RadioList($queuestatus, "config['queue_status']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'queue_status']);
        $archiveLink = array();
        $archiveLink[] = jnews::HTML_SelectOption('standard', _JNEWS_ARCHIVELINK_STANDARD);
        $archiveLink[] = jnews::HTML_SelectOption('popup', _JNEWS_ARCHIVELINK_POPUP);
        $archiveLink[] = jnews::HTML_SelectOption('newpage', _JNEWS_ARCHIVELINK_PAGE);
        $lists['archive_link'] = jnews::HTML_RadioList($archiveLink, "config['archive_link']", 'class="inputbox" size="1"', 'value', 'text', @$GLOBALS[JNEWS . 'archive_link']);
        $joobicron = array();
        $joobicron[] = jnews::HTML_SelectOption('1', _JNEWS_JOOBICRON_NO);
        $joobicron[] = jnews::HTML_SelectOption('2', _JNEWS_JOOBICRON_YES);
        if ($GLOBALS[JNEWS . 'j_cron'] != 2) {
            $GLOBALS[JNEWS . 'j_cron'] = 1;
        }
        //set to no
        $lists['j_cron'] = jnews::HTML_RadioList($joobicron, "config['j_cron']", 'class="inputbox" size="1"', 'value', 'text', @$GLOBALS[JNEWS . 'j_cron']);
        //Queue Settings for Queue Process
        //$queueprocess=array();
        //$queueprocess[]=jnews::HTML_SelectOption('1', _JNEWS_QUEUESTATS_ON);
        //$queueprocess[]=jnews::HTML_SelectOption('0', _JNEWS_QUEUESTATS_OF);
        //$lists['queue_process'] = jnews::HTML_RadioList( $queueprocess, "config['queue_process']" , 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS.'queue_process'] );
        //Queue Settings for Smart Queue
        $smartqueue = array();
        $smartqueue[] = jnews::HTML_SelectOption('1', _JNEWS_SMARTQ_ON);
        $smartqueue[] = jnews::HTML_SelectOption('0', _JNEWS_SMARTQ_OF);
        $lists['smart_queue'] = jnews::HTML_RadioList($smartqueue, "config['smart_queue']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'smart_queue']);
        $lists['show_login'] = jnews::HTML_BooleanList("config['show_login']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_login']);
        $lists['show_logout'] = jnews::HTML_BooleanList("config['show_logout']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_logout']);
        $lists['confirm_html'] = jnews::HTML_BooleanList("config['confirm_html']", 'class="inputbox"', $GLOBALS[JNEWS . 'confirm_html']);
        $lists['time_zone'] = jnews::HTML_BooleanList("config['time_zone']", 'class="inputbox"', $GLOBALS[JNEWS . 'time_zone']);
        $lists['sub_info_fields'] = jnews::HTML_BooleanList("config['sub_info_fields']", 'class="inputbox"', $GLOBALS[JNEWS . 'sub_info_fields']);
        $lists['show_archive'] = jnews::HTML_BooleanList("config['show_archive']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_archive']);
        $lists['enable_statistics'] = jnews::HTML_BooleanList("config['enable_statistics']", 'class="inputbox"', $GLOBALS[JNEWS . 'enable_statistics']);
        $lists['statistics_per_subscriber'] = jnews::HTML_BooleanList("config['statistics_per_subscriber']", 'class="inputbox"', $GLOBALS[JNEWS . 'statistics_per_subscriber']);
        //Send only HTML Mailin
        $lists['forced_html'] = jnews::HTML_BooleanList("config['forced_html']", 'class="inputbox"', $GLOBALS[JNEWS . 'forced_html']);
        $lists['wait_for_user'] = jnews::HTML_BooleanList("config['wait_for_user']", 'class="inputbox"', $GLOBALS[JNEWS . 'wait_for_user']);
        $lists['display_trace'] = jnews::HTML_BooleanList("config['display_trace']", 'class="inputbox"', $GLOBALS[JNEWS . 'display_trace']);
        $lists['send_data'] = jnews::HTML_BooleanList("config['send_data']", 'class="inputbox"', $GLOBALS[JNEWS . 'send_data']);
        $lists['send_auto_log'] = jnews::HTML_BooleanList("config['send_auto_log']", 'class="inputbox"', $GLOBALS[JNEWS . 'send_auto_log']);
        $lists['send_log'] = jnews::HTML_BooleanList("config['send_log']", 'class="inputbox"', $GLOBALS[JNEWS . 'send_log']);
        $lists['save_log'] = jnews::HTML_BooleanList("config['save_log']", 'class="inputbox"', $GLOBALS[JNEWS . 'save_log']);
        $lists['send_log_closed'] = jnews::HTML_BooleanList("config['send_log_closed']", 'class="inputbox"', $GLOBALS[JNEWS . 'send_log_closed']);
        $lists['clear_log'] = jnews::HTML_BooleanList("clear_log", 'class="inputbox"', 0);
        $lists['show_footer'] = jnews::HTML_BooleanList("config['show_footer']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_footer']);
        $lists['show_jcalpro'] = jnews::HTML_BooleanList("config['show_jcalpro']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_jcalpro']);
        $lists['show_jlinks'] = jnews::HTML_BooleanList("config['show_jlinks']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_jlinks']);
        // $lists['enable_jsub'] = jnews::HTML_BooleanList( "config['enable_jsub']" , 'class="inputbox"', $GLOBALS[JNEWS.'enable_jsub'] );
        $lists['allow_sn'] = jnews::HTML_BooleanList("config['allow_sn']", 'class="inputbox"', $GLOBALS[JNEWS . 'allow_sn']);
        $lists['sntag_norequired'] = jnews::HTML_BooleanList("config['sntag_norequired']", 'class="inputbox"', $GLOBALS[JNEWS . 'sntag_norequired']);
        $lists['show_unsubscribe_all'] = jnews::HTML_BooleanList("config['show_unsubscribe_all']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_unsubscribe_all']);
        $lists['show_terms'] = jnews::HTML_BooleanList("config['show_terms']", 'class="inputbox"', @$GLOBALS[JNEWS . 'show_terms']);
        $lists['check_terms'] = jnews::HTML_BooleanList("config['check_terms']", 'class="inputbox"', @$GLOBALS[JNEWS . 'check_terms']);
        //column1
        $lists['show_column1'] = jnews::HTML_BooleanList("config['show_column1']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_column1']);
        $lists['show_column2'] = jnews::HTML_BooleanList("config['show_column2']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_column2']);
        $lists['show_column3'] = jnews::HTML_BooleanList("config['show_column3']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_column3']);
        $lists['show_column4'] = jnews::HTML_BooleanList("config['show_column4']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_column4']);
        $lists['show_column5'] = jnews::HTML_BooleanList("config['show_column5']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_column5']);
        //end of columns
        //captcha
        //			 $lists['enable_captcha'] = jnews::HTML_BooleanList( "config['enable_captcha']" , 'class="inputbox"', $GLOBALS[JNEWS.'enable_captcha'] );
        //$lists['use_cron_pass'] = jnews::HTML_BooleanList( "config['use_cron_pass']" , 'class="inputbox"', $GLOBALS[JNEWS.'use_cron_pass'] );
        $lists['show_signature'] = jnews::HTML_BooleanList("config['show_signature']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_signature']);
        $lists['show_lists'] = jnews::HTML_BooleanList("config['show_lists']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_lists']);
        $lists['embed_images'] = jnews::HTML_BooleanList("config['embed_images']", 'class="inputbox"', $GLOBALS[JNEWS . 'embed_images']);
        $lists['use_tags'] = jnews::HTML_BooleanList("config['use_tags']", 'class="inputbox"', $GLOBALS[JNEWS . 'use_tags']);
        $lists['show_guide'] = jnews::HTML_BooleanList("config['show_guide']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_guide']);
        $lists['show_author'] = jnews::HTML_BooleanList("config['show_author']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_author']);
        $lists['show_tips'] = jnews::HTML_BooleanList("config['show_tips']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_tips']);
        //$lists['update_notification'] = jnews::HTML_BooleanList( "config['update_notification']" , 'class="inputbox"', $GLOBALS[JNEWS.'update_notification'] );
        $lists['use_sef'] = jnews::HTML_BooleanList("config['use_sef']", 'class="inputbox"', $GLOBALS[JNEWS . 'use_sef']);
        $lists['listype1'] = jnews::HTML_BooleanList("config['listype1']", 'class="inputbox"', $GLOBALS[JNEWS . 'listype1']);
        $lists['listype2'] = jnews::HTML_BooleanList("config['listype2']", 'class="inputbox"', $GLOBALS[JNEWS . 'listype2']);
        $lists['listHTMLeditor'] = jnews::HTML_BooleanList("config['listHTMLeditor']", 'class="inputbox"', $GLOBALS[JNEWS . 'listHTMLeditor']);
        //for social version
        if ($GLOBALS[JNEWS . 'level'] > 2) {
            if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) {
                if (class_exists('jNews_Social')) {
                    $lists['use_masterlists'] = jnews::HTML_BooleanList("config['use_masterlists']", 'class="inputbox"', $GLOBALS[JNEWS . 'use_masterlists']);
                    $lists['allow_fe_autoresponder'] = jnews::HTML_BooleanList("config['allow_fe_autoresponder']", 'class="inputbox"', $GLOBALS[JNEWS . 'allow_fe_autoresponder']);
                }
            }
        }
        if (empty($lists['allow_fe_autoresponder'])) {
            $lists['allow_fe_autoresponder'] = 'jNews Social Only';
        }
        $lists['send_error'] = jnews::HTML_BooleanList("config['send_error']", 'class="inputbox"', $GLOBALS[JNEWS . 'send_error']);
        $lists['report_error'] = jnews::HTML_BooleanList("config['report_error']", 'class="inputbox"', $GLOBALS[JNEWS . 'report_error']);
        $lists['fullcheck'] = jnews::HTML_BooleanList("config['fullcheck']", 'class="inputbox"', $GLOBALS[JNEWS . 'fullcheck']);
        $lists['addEmailRedLink'] = jnews::HTML_BooleanList("config['addEmailRedLink']", 'class="inputbox"', $GLOBALS[JNEWS . 'addEmailRedLink']);
        $lists['disabletooltip'] = jnews::HTML_BooleanList("config['disabletooltip']", 'class="inputbox"', $GLOBALS[JNEWS . 'disabletooltip']);
        $lists['minisendmail'] = jnews::HTML_BooleanList("config['minisendmail']", 'class="inputbox"', $GLOBALS[JNEWS . 'minisendmail']);
        //<!-- content ordering -->
        $sortContent[] = jnews::HTML_SelectOption('0', _JNEWS_SORT_DATE);
        $sortContent[] = jnews::HTML_SelectOption('1', _JNEWS_SORT_SECTION);
        $sortContent[] = jnews::HTML_SelectOption('2', _JNEWS_SORT_CATEGORY);
        //$lists['content_order'] = jnews::HTML_GenericList( $sortContent, "config['content_order']" , 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS.'content_order'] );
        $schedPrior = array();
        $schedPrior[] = jnews::HTML_SelectOption('1', '1');
        $schedPrior[] = jnews::HTML_SelectOption('2', '2');
        $schedPrior[] = jnews::HTML_SelectOption('3', '3');
        $enable_jsub = array();
        $enable_jsub[] = jnews::HTML_SelectOption('0', _JNEWS_LIST_ACESS);
        $enable_jsub[] = jnews::HTML_SelectOption('1', _JNEWS_BYOWNER);
        $lists['enable_jsub'] = jnews::HTML_RadioList($enable_jsub, "config['enable_jsub']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'enable_jsub']);
        $GLOBALS[JNEWS . 'sched_prior'] = isset($GLOBALS[JNEWS . 'sched_prior']) ? $GLOBALS[JNEWS . 'sched_prior'] : 3;
        $lists['sched_prior'] = jnews::HTML_RadioList($schedPrior, "config['sched_prior']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'sched_prior']);
        $arPrior = array();
        $arPrior[] = jnews::HTML_SelectOption('1', '1');
        $arPrior[] = jnews::HTML_SelectOption('2', '2');
        $arPrior[] = jnews::HTML_SelectOption('3', '3');
        $GLOBALS[JNEWS . 'ar_prior'] = isset($GLOBALS[JNEWS . 'ar_prior']) ? $GLOBALS[JNEWS . 'ar_prior'] : '';
        $lists['ar_prior'] = jnews::HTML_RadioList($arPrior, "config['ar_prior']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'ar_prior']);
        $smPrior = array();
        $smPrior[] = jnews::HTML_SelectOption('1', '1');
        $smPrior[] = jnews::HTML_SelectOption('2', '2');
        $smPrior[] = jnews::HTML_SelectOption('3', '3');
        $GLOBALS[JNEWS . 'sm_prior'] = isset($GLOBALS[JNEWS . 'sm_prior']) ? $GLOBALS[JNEWS . 'sm_prior'] : '';
        $lists['sm_prior'] = jnews::HTML_RadioList($arPrior, "config['sm_prior']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'sm_prior']);
        $priord_list = array();
        $priord_list[] = jnews::HTML_SelectOption('0', _JNEWS_AUTORESP);
        $priord_list[] = jnews::HTML_SelectOption('1', _JNEWS_LIST);
        $GLOBALS[JNEWS . 'priord_list'] = isset($GLOBALS[JNEWS . 'priord_list']) ? $GLOBALS[JNEWS . 'priord_list'] : '';
        $lists['priord_list'] = jnews::HTML_RadioList($priord_list, "config['priord_list']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'priord_list']);
        $priord_subs = array();
        $priord_subs[] = jnews::HTML_SelectOption('0', _JNEWS_REMAIN_SUBS);
        $priord_subs[] = jnews::HTML_SelectOption('1', _JNEWS_LIST_T_SUBSCRIPTION);
        $priord_subs[] = jnews::HTML_SelectOption('2', _JNEWS_UNSUBS);
        $GLOBALS[JNEWS . 'priord_subs'] = isset($GLOBALS[JNEWS . 'priord_subs']) ? $GLOBALS[JNEWS . 'priord_subs'] : '';
        $lists['priord_subs'] = jnews::HTML_RadioList($priord_subs, "config['priord_subs']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'priord_subs']);
        if (class_exists('jNews_Social')) {
            $lists['list_creatorfe'] = jnews::displayAccessRoles('list_creatorfe', $GLOBALS[JNEWS . 'list_creatorfe']);
            //since 6.1.0
            $lists['use_backendview'] = jnews::HTML_BooleanList("config['use_backendview']", 'class="inputbox"', $GLOBALS[JNEWS . 'use_backendview']);
        }
        if (class_exists('aca_archive')) {
            $jour = array();
            $jour[] = jnews::HTML_SelectOption('0', _JNEWS_FREQ_OPT_0);
            $jour[] = jnews::HTML_SelectOption('1', _JNEWS_FREQ_OPT_1);
            $jour[] = jnews::HTML_SelectOption('2', _JNEWS_FREQ_OPT_2);
            $jour[] = jnews::HTML_SelectOption('3', _JNEWS_FREQ_OPT_3);
            $jour[] = jnews::HTML_SelectOption('4', _JNEWS_FREQ_OPT_4);
            $jour[] = jnews::HTML_SelectOption('5', _JNEWS_FREQ_OPT_5);
            $jour[] = jnews::HTML_SelectOption('6', _JNEWS_FREQ_OPT_6);
            $dateType = array();
            $dateType[] = jnews::HTML_SelectOption('1', _JNEWS_DATE_OPT_1);
            $dateType[] = jnews::HTML_SelectOption('2', _JNEWS_DATE_OPT_2);
            $lists['frequency'] = jnews::HTML_GenericList($jour, "config['frequency']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'frequency']);
            $lists['date_type'] = jnews::HTML_GenericList($dateType, "config['date_type']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'date_type']);
        }
        //encoding format
        $mail_format[] = jnews::HTML_SelectOption('0', 'Text (8bit)');
        $mail_format[] = jnews::HTML_SelectOption('1', 'MIME (base64)');
        $lists['mail_format'] = jnews::HTML_RadioList($mail_format, "config['mail_format']", 'class="inputbox"', 'value', 'text', $GLOBALS[JNEWS . 'mail_format']);
        //encoding formart
        $mail_encoding[] = jnews::HTML_SelectOption('0', 'UTF-8');
        $mail_encoding[] = jnews::HTML_SelectOption('1', 'ISO-8859-2');
        $lists['mail_encoding'] = jnews::HTML_RadioList($mail_encoding, "config['mail_encoding']", 'class="inputbox"', 'value', 'text', $GLOBALS[JNEWS . 'mail_encoding']);
        backHTML::formStart('configpanel', 0, '');
        ?>
	<table style="width: 100%;" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td>
	<form action="index.php" method="post" name="adminForm" id="adminForm">
	<?php 
        $config_tabs = new MosTabsjNews(1);
        $config_tabs->startPane('acaConfig');
        $config_tabs->startTab(_JNEWS_MAIL_CONFIG, 'mail');
        jNews_ConfigHTML::mailSettings($lists);
        $config_tabs->endTab();
        $config_tabs->startTab(_JNEWS_SUBSCRIBER_CONFIG, 'subscribers');
        jNews_ConfigHTML::subcriberSettings($lists);
        $config_tabs->endTab();
        if (class_exists('jNews_Auto')) {
            $config_tabs->startTab(_JNEWS_SCHEDULER, 'scheduler');
            jNews_ConfigHTML::cronSettings($lists);
            $config_tabs->endTab();
        }
        $config_tabs->startTab(_JNEWS_LOGGING_CONFIG, 'logging');
        jNews_ConfigHTML::logsSettings($lists);
        $config_tabs->endTab();
        if ($GLOBALS[JNEWS . 'integration'] and ($GLOBALS[JNEWS . 'cb_integration'] or class_exists('aca_virtuemart') && $GLOBALS[JNEWS . 'virtuemart'])) {
            $config_tabs->startTab(_JNEWS_CONFIG_INTEGRATION, 'integration');
            if ($GLOBALS[JNEWS . 'cb_integration']) {
                jNews_ConfigHTML::cbSettings();
            }
            if (class_exists('aca_virtuemart') && isset($GLOBALS[JNEWS . 'virtuemart']) && $GLOBALS[JNEWS . 'virtuemart']) {
                aca_virtuemart::tab();
            }
            $config_tabs->endTab();
        }
        $config_tabs->startTab(_JNEWS_MISC_CONFIG, 'misc');
        jNews_ConfigHTML::miscSettings($lists);
        $config_tabs->endTab();
        if (class_exists('jNews_Auto')) {
            $config_tabs->startTab(_JNEWS_LICENSE_CONFIG, 'licence');
            jNews_Auto::licenseSettings($lists);
            $config_tabs->endTab();
        }
        $config_tabs->endPane();
        if (version_compare(JVERSION, '3.0.0', '<')) {
            echo JHTML::_('form.token');
        } else {
            echo JHtml::_('form.token');
        }
        ?>
		<input type="hidden" name="option" value="<?php 
        echo JNEWS_OPTION;
        ?>
" />
		<input type="hidden" name="act" value="configuration" />
    	<input type="hidden" name="boxchecked" value="0" />
    	<input type="hidden" name="task" value="" />
	</form>
	</td></tr></tbody></table>
	<?php 
    }
Пример #11
0
    public static function showMailingQueue($mailingq = null, $lists = null, $form, $start, $limit, $mailingsearch, $setLimit = null, $setSort = null)
    {
        $listId = null;
        ?>

		<script language="javascript" type="text/javascript">
		<!--
			function jnewsselectall(){
				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 (empty($mailingq)) {
            echo '<center>' . jnews::printYN(true, _JNEWS_Q_M1, _JNEWS_ERROR) . '</center>';
        }
        if ($listId == 0) {
            $message = _JNEWS_MESSAGE_QUEUE;
        } else {
            $lt_name = jNews_Lists::getLists($listId, 0, null, '', false, false, true, false, false, '');
            $message = _JNEWS_SUSCRIB_LIST_UNIQUE . "<span style='color: rgb(51, 51, 51);'>" . @$lt_name[0]->list_name . "</span>";
        }
        if (!isset($action)) {
            $action = JRequest::getVar('act', '', '', 'WORD');
        }
        $mySepList = array();
        $mySepList[0] = new stdClass();
        $mySepList[0]->subject = 'All Mailings';
        $mySepList[0]->id = 0;
        $myMailingQueA = jNews_Mailing::getMailingsForQueue();
        if (empty($myMailingQueA) || !is_array($myMailingQueA)) {
            $myMailingQueA = array();
        }
        $lt = array_merge($mySepList, $myMailingQueA);
        $mailingId = JREquest::getVar('mailingid', '');
        $dropDown = jnews::HTML_GenericList($lt, 'mailingid', '' . 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'id', 'subject', $mailingId);
        $filter = _JNEWS_FILTER_MAILING . $dropDown;
        $hidden = '<input type="hidden" name="option" value="' . JNEWS_OPTION . '" />';
        $hidden .= '<input type="hidden" name="act" value="' . $action . '" />';
        $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />';
        ?>

	<?php 
        echo $form['main'];
        if ($form['main'] !== "") {
            $form['select'] = "";
        }
        // top portion before the table list
        // for search
        $toSearch = new stdClass();
        $toSearch->forms = $form['select'];
        $toSearch->hidden = $hidden;
        $toSearch->listsearch = $mailingsearch;
        $toSearch->id = 'mailingsearch';
        echo jnews::setTop($toSearch, $message, $setLimit, $filter);
        ?>
		<table class="<?php 
        echo jnews::myTheme();
        ?>
">
			<thead><tr>
				<th width="2%" class="title">#</th>
				<th width="2%" class="title"><input type="checkbox" id="selectallcheck" name="allchecked" onclick="jnewsselectall();"></th>
				<th width="22%" class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_QUEUE_SUBJECT, 'm.subject', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<th width="22%" class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_QUEUE_EMAIL, 's.email', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<th width="22%" class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_SENDDATE, 'q.send_date', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<th width="3%" class="title"><center><?php 
        echo jnews::HTML_GridSort(_JNEWS_QUEUE_PRIOR, 'q.priority', $setSort->orderDir, $setSort->orderValue);
        ?>
</center></th>
				<th width="2%" class="title"><center><?php 
        echo jnews::HTML_GridSort(_JNEWS_QUEUE_ATT, 'q.attempt', $setSort->orderDir, $setSort->orderValue);
        ?>
</center></th>
				<th width="3%" class="title"><?php 
        echo jnews::HTML_GridSort('Suspend', 'q.suspend', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<th width="3%" class="title"><?php 
        echo jnews::HTML_GridSort('Blocked', 'q.block', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<th width="3%" class="title"><?php 
        echo jnews::HTML_GridSort('ID', 'q.qid', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
			</thead></tr>
			<?php 
        $i = $start;
        jNews_QueueHTML::_displayQueue($mailingq, $i);
        ?>
		</table>
		<?php 
        echo '<br />';
        echo jnews::setLegend();
    }