コード例 #1
0
ファイル: mailings.jnews.php プロジェクト: naka211/kkvn
function mailing($action, $task, $listId, $listType, $mailingId, $message)
{
    $showMailings = false;
    $db = JFactory::getDBO();
    switch ($task) {
        case 'edit':
            $issue_nb = JRequest::getInt('issue_nb', 1);
            $mailingType = JRequest::getVar('listype');
            $isEdit = JRequest::getVar('isEdit', true);
            $mySess = JFactory::getSession();
            $mySess->set('listype', $mailingType, 'LType');
            if (!empty($listId)) {
                $list = jNews_Lists::getOneList($listId);
            } else {
                $list = jNews_Lists::getListFirstEntry();
            }
            $new = empty($mailingId) || $mailingId == 0 ? true : false;
            $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new, false, true);
            $mailing->mailing_type = $mailingType;
            //			if(empty($isEdit)) $isEdit = true;
            // set default mailing parameters
            $my = JFactory::getUser();
            $subscribers = jNews_Subscribers::getSubscriberInfoFromUserId($my->id);
            if (!isset($subscribers)) {
                $subscribers = new stdClass();
            }
            $subscribers->name = isset($subscribers->name) ? $subscribers->name : '';
            $subscribers->email = isset($subscribers->email) ? $subscribers->email : '';
            //			$mailing->fromname = ( !isset( $mailing->fromname ) || empty( $mailing->fromname ) ) ? $subscribers->name : $mailing->fromname;
            //			$mailing->fromemail = ( !isset( $mailing->fromemail ) || empty( $mailing->fromemail ) ) ? $subscribers->email : $mailing->fromemail;
            //			$mailing->frombounce = ( !isset( $mailing->frombounce ) || empty( $mailing->frombounce ) ) ? $GLOBALS[JNEWS.'sendmail_from'] : $mailing->frombounce;
            $show = jNews_ListType::showType($mailing->mailing_type, 'editmailing');
            if ($mailing->published != 1 or $mailing->mailing_type != 1 or isset($show['admin']) and $show['admin']) {
                $forms['main'] = " <form action='index.php' method='post' enctype='multipart/form-data' name='adminForm' id=\"adminForm\">";
                jNews_Mailing::_header($task, $action, $mailing->mailing_type, $message, 'edit');
                jNews_MailingsHTML::editMailing($mailing, $new, $listId, $forms, $show, $isEdit);
                $go[] = jnews::makeObj('act', $action);
                backHTML::formEnd($go);
            } else {
                $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
                jNews_Mailing::_header($task, $action, $mailing->mailing_type, $message);
                //backHTML::formStart();
                jNews_MailingsHTML::viewMailing($mailing, $forms);
                $go[] = jnews::makeObj('act', 'mailing');
                $go[] = jnews::makeObj('task', 'viewmailing');
                $go[] = jnews::makeObj('mailingid', $mailing->id);
                backHTML::formEnd($go);
            }
            break;
        case 'new':
        case 'add':
            // check if atleast one list exist and published
            // if false then restrict entry
            $mailingType = JRequest::getVar('listype');
            $type = $mailingType == 2 ? 2 : 1;
            $result = jNews_Lists::checkListNotEmpty($type);
            if (!$result) {
                if ($type == 2) {
                    $disp = addslashes(_JNEWS_CHECKCAMPAIGNFOUND);
                } else {
                    $disp = addslashes(_JNEWS_CHECKLISTFOUND);
                }
                echo "<script> alert('" . $disp . "'); window.history.go(-1);</script>\n";
                break;
            }
            $mailingType = JRequest::getVar('listype');
            if (empty($listId)) {
                $listId = JRequest::getVar('listid');
            }
            if (!empty($listId)) {
                $mailingType = jNews_Lists::getListType($listId) == 2 ? 2 : 1;
            }
            JRequest::setVar('listype', $mailingType);
            $total = jNews_Mailing::countMailings($listId, $mailingType);
            $total++;
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&mailingid=0&issue_nb=' . $total . '&listype=' . $mailingType . '&listid=' . $listId . '&isEdit=0');
            //mariap
            break;
        case 'saveSend':
            JRequest::checkToken() or die('Invalid Token');
            $mySess = JFactory::getSession();
            $mailingType = $mySess->get('listype', '', 'LType');
            $status = checkMailingSave($mailingType);
            if (!$status) {
                return false;
            }
            jNews_Mailing::saveMailing($mailingId, $listId);
        case 'sendready':
            //we update the senddate of the newsletter
            jNews_Mailing::updatesenddate($mailingId);
            jNews_MailingsHTML::sendReady($mailingId, $listId, $listType);
            break;
        case 'generate':
            if (class_exists('jNews_Auto')) {
                $still = false;
                $message = jnews::printYN(jNews_Auto::processQueue(true, true, $still, true), 'Queue processed', _JNEWS_ERROR);
                jNews_Auto::displayStatus();
            }
            return;
            break;
        case 'send':
            $queueC = new jNews_Queue();
            $queueC->checkForNewsletters($mailingId);
            $queueCount = jNews_Queue::getQueueCount($mailingId);
            $totalSub = JRequest::setVar('totalsend', $queueCount);
            $linkURL = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=continuesend&mailingid=' . $mailingId . '&totalsend=' . $totalSub, true, false, true);
            jNews_Tools::redirect($linkURL);
            break;
        case 'continuesend':
            $queueC = new jNews_Queue();
            //we update the senddate of the mailing to be now to be able to continue the sending and send it after we click continue
            //			$queueC->updateSenddateToNow($mailingId);
            $totalSend = JRequest::getVar('totalsend', 0, '', 'int');
            $alreadySent = JRequest::getVar('alreadysent', 0, '', 'int');
            $queueC->start = $alreadySent;
            $queueC->total = $totalSend;
            $queueC->pause = $GLOBALS[JNEWS . 'pause_time'];
            $queueC->sendQueue(false, $mailingId, false, true);
            ob_start();
            exit;
            break;
        case 'testspam':
            if (empty($message)) {
                $message = _JNEWS_MESSAGE_NOT;
            }
            $mailingId = $mailingId == 0 ? jNews_Mailing::getLastMailingId() : $mailingId;
            $my = JFactory::getUser();
            if ($listId > 0) {
                $archivemailing = jNews_Mailing::getMailingView($mailingId, $listId);
            } else {
                $archivemailing = jNews_Mailing::getMailingView($mailingId);
            }
            $mailing = new stdClass();
            $receivers = new stdClass();
            $receivers->email = '*****@*****.**';
            $receivers->name = $archivemailing->fromname;
            $receivers->receive_html = 1;
            $receivers->id = jNews_Subscribers::getSubscriberIdFromUserId($my->id);
            //if email are different we dont replace because we want to make sure the spam cehck count the fact that
            //sender and bounce back are different
            if ($archivemailing->fromemail == $archivemailing->frombounce) {
                $archivemailing->frombounce = $my->email;
            }
            $archivemailing->fromemail = $my->email;
            $mailerC = new jNews_ProcessMail();
            $status = $mailerC->send($archivemailing, $receivers);
            $message = jnews::printYN($status, _JNEWS_SPAMTEXT_MESSAGE_SENT_SUCCESSFULLY, $message);
            $link = 'http://www.joobi.co/index.php?option=com_jlinks&controller=redirect&link=SpamCheck&alt=jnewsdoc_glossary';
            $iFrame = '<iframe src="' . $link . '" width="100%" height="680px" scrolling="auto"></iframe>';
            echo $iFrame;
            break;
        case 'savePreview':
            JRequest::checkToken() or die('Invalid Token');
            $status = checkMailingSave($mailingType);
            if (!$status) {
                return false;
            }
            if ($mailingType == 7) {
                $mailing = JRequest::getVar('mailing', '');
                $ContentStatus = checkTag();
                if (!$ContentStatus) {
                    return false;
                }
            }
            jNews_Mailing::saveMailing($mailingId, $listId);
        case 'preview':
            $emailaddress = JRequest::getVar('emailaddress', '');
            $mailingId = $mailingId == 0 ? jNews_Mailing::getLastMailingId() : $mailingId;
            if (!empty($emailaddress)) {
                $status = jNews_Mailing::sendTestEmail($mailingId, $listId);
                if (empty($message)) {
                    $message = _JNEWS_MESSAGE_NOT;
                }
                $message = jnews::printYN($status, _JNEWS_MESSAGE_SENT_SUCCESSFULLY, $message);
            }
            if ($listId > 0) {
                $archivemailing = jNews_Mailing::getMailingView($mailingId, $listId);
            } else {
                $archivemailing = jNews_Mailing::getMailingView($mailingId);
            }
            $doc = JFactory::getDocument();
            $css = '.icon-48-preview{ background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/preview.png)}';
            $doc->addStyleDeclaration($css, $type = 'text/css');
            $title = _JNEWS_PREVIEW_TITLE . ': ' . $archivemailing->subject;
            backHTML::_header(_JNEWS_PREVIEW_TITLE, 'preview.png', $message, $task, $action);
            //new view for the preview mailing
            echo '<table cellpadding="0" cellspacing="2" border="0" width="100%"><tr><td width="40%">';
            jNews_MailingsHTML::previewMailingHTML($mailingId, $listId, $listType, $archivemailing->html);
            echo '</td><td width="60%">';
            $forms['main'] = '';
            $list = jNews_Lists::getOneList($archivemailing->list_id);
            $textonly = '';
            $mailerC = new jNews_ProcessMail();
            $queueInfo = new stdClass();
            $queueInfo->mailingid = $mailingId;
            $queueInfo->listid = @$listId;
            $mailerC->getContent($archivemailing->images, $archivemailing->html, $archivemailing->textonly, $archivemailing->subject, false, true, $queueInfo);
            //new $archivemailing->subject
            if ($archivemailing->html == 1) {
                if (empty($template_id)) {
                    $template_id = $archivemailing->template_id;
                }
                if (!empty($template_id)) {
                    jNews_Templates::includeStyles($archivemailing->htmlcontent, $template_id);
                }
            } else {
                $archivemailing->textonly = jNews_ProcessMail::htmlToText($archivemailing->textonly);
            }
            //new view for the preview mailing
            jNews_MailingsHTML::viewHeading($archivemailing);
            echo '</td></tr><tr><td colspan="2">';
            jNews_MailingsHTML::viewMailing($archivemailing, $forms);
            echo '</td></tr></tbody></table>';
            if ($mailingId == 0) {
                JRequest::setVar('mailingid', $mailingId);
            }
            break;
        case 'view':
            $mailingType = JRequest::getVar('listype');
            if (!empty($mailingType)) {
                $mySess = JFactory::getSession();
                $mySess->set('listype', $mailingType, 'LType');
            }
            if ($mailingId != 0) {
                if ($listId > 0) {
                    $archivemailing = jNews_Mailing::getMailingView($mailingId, $listId);
                } else {
                    $archivemailing = jNews_Mailing::getMailingView($mailingId);
                }
                if (empty($template_id)) {
                    $template_id = $archivemailing->template_id;
                }
                if (!empty($template_id)) {
                    jNews_Templates::includeStyles($archivemailing->htmlcontent, $template_id);
                }
                $forms['main'] = "<form action='index.php?option=" . JNEWS_OPTION . "&act=mailing&listype=" . $listType . "&listid=" . $listId . "' method='post' name='adminForm' id=\"adminForm\">";
                jNews_Mailing::_header($task, $action, $listType, $message);
                backHTML::formStart('show_mailing', 0, '');
                jNews_MailingsHTML::viewMailing($archivemailing, $forms);
                $go[] = jnews::makeObj('act', 'mailing');
                $go[] = jnews::makeObj('task', 'viewmailing');
                $go[] = jnews::makeObj('listId', $archivemailing->list_id);
                //listid to listId--original
                backHTML::formEnd($go);
            }
            break;
        case 'deletequeue':
            //implement here what are we going to do with the delete queueu column on the mailing
            $mailingID = JRequest::getVar('mailingid');
            $mailingType = JRequest::getVar('listype');
            if (!empty($mailingID)) {
                $db = JFactory::getDBO();
                $db->setQuery('DELETE FROM `#__jnews_queue` WHERE `mailing_id` = ' . $mailingID);
                $db->query();
                $message = jnews::printYN(true, _JNEWS_MAILING_QUEUE_DELETED, _JNEWS_ERROR);
            } else {
                $message = jnews::printYN(false, _JNEWS_MAILING_QUEUE_DELETED, _JNEWS_ERROR);
            }
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType, $message);
            break;
        case 'deleteMailing':
            JRequest::checkToken() or die('Invalid Token');
            $d['mailing'] = jNews_Mailing::getOneMailing('', $mailingId, '', $new);
            $message = jnews::printYN(jNews_Mailing::delete($d), @constant($GLOBALS[JNEWS . 'listname' . $d['mailing']->list_type]) . '"' . $d['mailing']->subject . '"' . _JNEWS_SUCCESS_DELETED, _JNEWS_ERROR);
            $showMailings = true;
            break;
        case 'cancel':
            $url = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&mailingid=' . $mailingId;
            $url .= (!empty($listId) ? '&listid=' . $listId : '') . '&listype=' . $mailingType;
            jNews_Tools::redirect($url);
            break;
        case 'copy':
            JRequest::checkToken() or die('Invalid Token');
            $message = jnews::printYN(jNews_Mailing::copyMailing($mailingId), _JNEWS_MAILING_COPY, _JNEWS_ERROR);
            $showMailings = true;
            break;
        case 'cancelMailing':
            $showMailings = true;
            break;
        case 'publishMailing':
            JRequest::checkToken() or die('Invalid Token');
            $mailing = jNews_Mailing::getOneMailing('', $mailingId, '', $new);
            $message = jnews::printYN(jNews_Mailing::publishMailing($mailingId), @constant($GLOBALS[JNEWS . 'listname' . $mailing->mailing_type]) . ' ' . _JNEWS_PUBLISHED, _JNEWS_ERROR);
            $mailingType = jNews_Mailing::getMailingInfoz($mailingId);
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType);
            break;
        case 'unpublishMailing':
            JRequest::checkToken() or die('Invalid Token');
            $mailing = jNews_Mailing::getOneMailing('', $mailingId, '', $new);
            $message = jnews::printYN(jNews_Mailing::unpublishMailing($mailingId), @constant($GLOBALS[JNEWS . 'listname' . $mailing->mailing_type]) . ' ' . _JNEWS_UNPUBLISHED, _JNEWS_ERROR);
            $mailingType = jNews_Mailing::getMailingInfoz($mailingId);
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId);
            break;
        case 'cpanel':
            backHTML::controlPanel();
            break;
        case 'save':
            JRequest::checkToken() or die('Invalid Token');
            $subject = JRequest::getVar('subject', '');
            if (empty($subject)) {
                echo "<script> alert('subject needs to be not empty'); window.history.go(-1);</script>\n";
                return false;
            }
            if (!isset($mailingType)) {
                $mySess = JFactory::getSession();
                $mailingType = $mySess->get('listype', '', 'LType');
            }
            $status = checkMailingSave($mailingType);
            if ($mailingType == 7) {
                $mailing = JRequest::getVar('mailing', '');
                $ContentStatus = checkTag();
                if (!$ContentStatus) {
                    return false;
                }
            }
            if (!$status) {
                return false;
            }
            $message = jnews::printYN(jNews_Mailing::saveMailing($mailingId, $listId), _JNEWS_MAILING_SAVED, _JNEWS_ERROR);
            if (!empty($mailingtype)) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId);
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId);
                $showMailings = true;
                unset($GLOBALS["task"]);
                unset($_REQUEST["task"]);
            }
            break;
        case 'apply':
            JRequest::checkToken() or die('Invalid Token');
            $mailingid = JRequest::getVar('mailingid', '0');
            if (!isset($mailingType)) {
                $mySess = JFactory::getSession();
                $mailingType = $mySess->get('listype', '', 'LType');
            }
            $status = checkMailingSave($mailingType);
            if ($mailingType == 7) {
                $mailing = JRequest::getVar('mailing', '');
                $ContentStatus = checkTag();
                if (!$ContentStatus) {
                    return false;
                }
            }
            if (!$status) {
                return false;
            }
            $message = jnews::printYN(jNews_Mailing::saveMailing($mailingId, $listId), _JNEWS_MAILING_SAVED, _JNEWS_ERROR);
            $mailingid = $mailingid == 0 ? jNews_Mailing::getLastMailingId() : $mailingid;
            if (!empty($mailingtype)) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&listype=' . $mailingType . '&mailingid=' . $mailingid . '&listid=' . $listId);
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&listype=' . $mailingType . '&mailingid=' . $mailingid . '&listid=' . $listId);
                $showMailings = true;
                unset($GLOBALS["task"]);
                unset($_REQUEST["task"]);
            }
            break;
        case 'show':
            $id = JRequest::getVar('mailingid');
            $mySess = JFactory::getSession();
            $mailingType = JRequest::getVar('listype', 0);
            $listId = JRequest::getVar('listid', 0);
            $link = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId;
            jNews_Tools::redirect($link);
            $showMailings = true;
            break;
        case 'toggle':
            $listid = JRequest::getVar('listid');
            $column = JRequest::getVar('col');
            $mailingid = JRequest::getVar('mailingid');
            if (!empty($mailingid) && !empty($column)) {
                $passObj = new stdClass();
                $passObj->tableName = '#__jnews_mailings';
                $passObj->columnName = $column;
                $passObj->whereColumn = 'id';
                $passObj->whereColumnValue = $mailingid;
                jnews::toggle($passObj);
            }
            if ($listType == 1) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listid=' . $listid . '&listype=1');
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listid=' . $listid . '&listype=2');
            }
            break;
        default:
            $showMailings = true;
            break;
    }
    if ($showMailings) {
        if (empty($listType)) {
            $listType = JRequest::getVar('listype', 0);
        }
        if (empty($listId)) {
            $listId = JRequest::getVar('listid', 0);
        }
        $paginationStart = JRequest::getVar('pg');
        if (!empty($paginationStart)) {
            $limitstart = 0;
            $limitend = $paginationStart;
        } else {
            $app = JFactory::getApplication();
            $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int');
            $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int');
        }
        $limittotal = jNews_Mailing::countMailings(0, $listType);
        $setLimit = new stdClass();
        $setLimit->total = !empty($limittotal) ? $limittotal : 0;
        $setLimit->start = !empty($limitstart) ? $limitstart : 0;
        $setLimit->end = !empty($limitend) ? $limitend : $limittotal;
        if ($setLimit->total == $setLimit->end) {
            $setLimit->start = 0;
        }
        jNews_Mailing::showMailings($task, $action, $listId, $listType, $message, true, _JNEWS_MENU_MAILING, $setLimit);
    }
    return true;
}
コード例 #2
0
ファイル: frontend.php プロジェクト: naka211/kkvn
 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;
 }
コード例 #3
0
ファイル: toolbar30.jnews.php プロジェクト: naka211/kkvn
 public static function NEWMAILING()
 {
     JToolBarHelper::custom('apply', 'apply.png', 'apply.png', 'JTOOLBAR_APPLY', false);
     JToolBarHelper::custom('save', 'save.png', 'save.png', 'JTOOLBAR_SAVE', false);
     JToolBarHelper::custom('show', 'cancel.png', 'cancel.png', _JNEWS_MENU_CANCEL, false);
     JToolBarHelper::divider();
     $mailingID = JRequest::getInt('mailingid', '', 'request');
     $bar = JToolBar::getInstance('toolbar');
     $doc = JFactory::getDocument();
     if (empty($mailingID) || $mailingID < 1) {
         $css = 'span.icon-32-acatemplate {background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'toolbar/templates.png)}';
         $doc->addStyleDeclaration($css, $type = 'text/css');
         $bar->appendButton('Popup', 'acatemplate', _JNEWS_TEMPLATE, jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=templates&task=assign', true, false, true));
         JToolBarHelper::divider();
     }
     $listype = JRequest::getInt('listype', 0);
     $css = 'span.icon-32-acatags {background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'toolbar/tag.png)}';
     $doc->addStyleDeclaration($css, $type = 'text/css');
     if ($listype == 7) {
         $catid = JRequest::getVar('cat_id', 0, 'request');
         if (empty($mailingID) || $mailingID < 1) {
             $link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags&listype=' . $listype . '&cat_id=' . $catid . '&new=1', true, false, true);
         } else {
             $delaymax = JRequest::getInt('delay_max', 0, 'request');
             $notifyID = JRequest::getInt('notify_id', 0, 'request');
             $link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags&listype=' . $listype . '&cat_id=' . $catid . '&delay_max=' . $delaymax . '&notify_id=' . $notifyID, true, false, true);
         }
     } else {
         $link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags&listype=' . $listype, true, false, true);
     }
     $bar->appendButton('Popup', 'acatags', _JNEWS_MENU_TAG, $link);
     JToolBarHelper::divider();
     JToolBarHelper::custom('savePreview', 'share.png', 'share.png', _JNEWS_MENU_PREVIEW, false);
     if (empty($listype)) {
         $droplistW = JRequest::getVar('droplist', '');
         $maliste = explode('-', $droplistW);
         if (!empty($maliste[0])) {
             $listype = $maliste[0];
         } else {
             $listidW = JRequest::getVar('listid', 0);
             $maliste = jNews_Lists::getLists($listidW, 0, null, 'listnameA', false, false, false, false);
             $listype = $maliste[0]->list_type;
         }
     }
     JToolBarHelper::divider();
     $docLink = $listype == '7' ? 'edit-smart-newsletter' : 'edit-newsletter';
     jNews_Menu::_wizardBtn($docLink);
 }
コード例 #4
0
    public static function showSubscribers($subscribers, $action, $listId, &$lists, $start, $limit, $total, $showAdmin, $theLetterId, $emailsearch, $forms, $setLimit = null, $front = false, $setSort = null)
    {
        $my = JFactory::getUser();
        $mainframe = JFactory::getApplication();
        ?>

	<script language="javascript" type="text/javascript">
	//<!--
	function jnewsletterselectall(){
		var i = 0;
		allcheck = document.getElementById("selectallcheck");
		if(allcheck.checked) checkedvalue = 1;
		else checkedvalue = 0;

		while(myelement = document.getElementById("cid["+i+"]")){
			myelement.checked = checkedvalue;
			i++;
		}

		if(checkedvalue){
			document.getElementById("boxcount").value = i;
		}else{
			document.getElementById("boxcount").value = 0;
		}
	}
	 //-->
	</script>

	<?php 
        if ($listId == 0) {
            $message = _JNEWS_SUSCRIB_LIST;
        } else {
            $lt_name = jNews_Lists::getLists($listId, 0, null, '', false, false, true);
            $message = _JNEWS_SUSCRIB_LIST_UNIQUE . "<span style='color: rgb(51, 51, 51);'>" . @$lt_name[0]->list_name . "</span>";
        }
        $filter = _JNEWS_SEL_LIST . '  ' . $lists['listid'] . ' ' . $lists['subscirberType'];
        $hidden = '<input type="hidden" name="listid" value="' . $listId . '" />';
        $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />';
        $pos = strpos($forms['main'], "<form");
        if ($pos !== false) {
            $forms['select'] = "";
        }
        echo $forms['main'];
        // top portion before the table list
        // for search
        $toSearch = new stdClass();
        $toSearch->forms = $forms['select'];
        $toSearch->hidden = $hidden;
        $toSearch->listsearch = $emailsearch;
        $toSearch->id = 'emailsearch';
        echo jnews::setTop($toSearch, $message, $setLimit, $filter);
        ?>

		<table class="<?php 
        echo jnews::myTheme();
        ?>
">
		<thead>
		<tr>
			<th class="title">#</th>
			<th class="title"><input type="checkbox" id="selectallcheck" name="allchecked" onclick="jnewsletterselectall();"/></th>
			<th class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_INPUT_NAME, 'name', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
		<?php 
        if ($mainframe->isAdmin()) {
            ?>
			<th class="title"><?php 
            echo jnews::HTML_GridSort(_JNEWS_INPUT_EMAIL, 'email', $setSort->orderDir, $setSort->orderValue);
            ?>
</th>
		<?php 
        } else {
            if ($GLOBALS[JNEWS . 'show_sub_email']) {
                ?>
				<th class="title"><?php 
                echo jnews::HTML_GridSort(_JNEWS_INPUT_EMAIL, 'email', $setSort->orderDir, $setSort->orderValue);
                ?>
</th>
		<?php 
            }
        }
        //endelse
        if ($mainframe->isAdmin()) {
            ?>
			<th class="title"><?php 
            echo jnews::HTML_GridSort(_JNEWS_SIGNUP_DATE, 'subscribe_date', $setSort->orderDir, $setSort->orderValue);
            ?>
</th>
		<?php 
        }
        ?>
			<th class="title"><center><?php 
        echo jnews::HTML_GridSort(_JNEWS_REGISTERED, 'user_id', $setSort->orderDir, $setSort->orderValue);
        ?>
</center></th>
			<th class="title"><center><?php 
        echo jnews::HTML_GridSort(_JNEWS_CONFIRMED, 'confirmed', $setSort->orderDir, $setSort->orderValue);
        ?>
</center></th>
			<th class="title"><center><?php 
        echo jnews::HTML_GridSort(_JNEWS_HTML, 'receive_html', $setSort->orderDir, $setSort->orderValue);
        ?>
</center></th>
		<?php 
        if ($GLOBALS[JNEWS . 'level'] > 2) {
            //check if the version of jnewsletter is pro
            if ($GLOBALS[JNEWS . 'show_column1'] == 1) {
                ?>
				<th class="title"><center><?php 
                echo $GLOBALS[JNEWS . 'column1_name'];
            }
            //<!--/center></th><!--column 1 in the subscribers list-BE-->
            if ($GLOBALS[JNEWS . 'show_column2'] == 1) {
                ?>
				<th class="title"><center><?php 
                echo $GLOBALS[JNEWS . 'column2_name'];
            }
            if ($GLOBALS[JNEWS . 'show_column3'] == 1) {
                ?>
				<th class="title"><center><?php 
                echo $GLOBALS[JNEWS . 'column3_name'];
            }
            if ($GLOBALS[JNEWS . 'show_column4'] == 1) {
                ?>
				<th class="title"><center><?php 
                echo $GLOBALS[JNEWS . 'column4_name'];
            }
            if ($GLOBALS[JNEWS . 'show_column5'] == 1) {
                ?>
				<th class="title"><center><?php 
                echo $GLOBALS[JNEWS . 'column5_name'];
            }
        }
        if (jnews::checkPermissions('admin')) {
            ?>
			<th class="title"><?php 
            echo jnews::HTML_GridSort('ID', 'id', $setSort->orderDir, $setSort->orderValue);
            ?>
</th>
		<?php 
        }
        ?>
		</tr>
		</thead>
		<?php 
        $i = 0;
        if (!empty($subscribers)) {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $onClickFct = '';
            } else {
                $onClickFct = 'Joomla.';
            }
            foreach ($subscribers as $subscriber) {
                $subscriber->email = trim($subscriber->email);
                if (!jNews_Subscribers::validEmail($subscriber->email)) {
                    continue;
                }
                if ($subscriber->user_id != 0) {
                    $img = '16/status_g.png';
                    $alt = 'Registered';
                    jnews::getLegend('status_g.png', _JNEWS_REGISTERED . '/' . _JNEWS_CONFIRMED);
                } else {
                    $img = '16/status_r.png';
                    $alt = 'Unregistered';
                    jnews::getLegend('status_r.png', _JNEWS_SUBSCRIBERS_UNREGISTERED . '/' . _JNEWS_PIE_UNCONFIRMED);
                }
                //endelse
                if ($subscriber->confirmed == 1) {
                    $imgC = '16/status_g.png';
                    $altC = 'Confirmed';
                    jnews::getLegend('status_g.png', _JNEWS_REGISTERED . '/' . _JNEWS_CONFIRMED);
                } else {
                    $imgC = '16/status_r.png';
                    $altC = 'Not confirmed';
                    jnews::getLegend('status_r.png', _JNEWS_SUBSCRIBERS_UNREGISTERED . '/' . _JNEWS_PIE_UNCONFIRMED);
                }
                //endelse
                if ($subscriber->receive_html == 1) {
                    $imgH = '16/status_g.png';
                    $altH = 'HTML';
                    jnews::getLegend('status_g.png', _JNEWS_REGISTERED . '/' . _JNEWS_CONFIRMED);
                } else {
                    $imgH = '16/status_r.png';
                    $altH = 'TEXT';
                    jnews::getLegend('status_r.png', _JNEWS_SUBSCRIBERS_UNREGISTERED . '/' . _JNEWS_PIE_UNCONFIRMED);
                }
                //endelse
                ?>
					<tr class="row<?php 
                echo ($i + 1) % 2;
                ?>
">
						<td><center><?php 
                echo $i + 1 + $start;
                ?>
</center></td>

						<td>
							<center><input type="checkbox" id="cid[<?php 
                echo $i;
                ?>
]" name="cid[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo $subscriber->id;
                ?>
" onclick="<?php 
                echo $onClickFct;
                ?>
isChecked(this.checked);" /></center>
						</td>
						<td>

			<?php 
                if (!$front) {
                    $href = "index.php?option=" . JNEWS_OPTION . "&act=" . $action . "&task=show&userid=" . $subscriber->id;
                } else {
                    $link = "option=" . JNEWS_OPTION . "&act=" . $action . "&task=show&userid=" . $subscriber->id;
                    $href = jNews_Tools::completeLink($link, false, true);
                }
                ?>

						<a href=<?php 
                echo $href;
                ?>
 >
						<?php 
                echo $subscriber->name;
                ?>
</a>
						</td>
					<?php 
                if (!jNews_Subscribers::validEmail($subscriber->email)) {
                    $subscriber->email = '';
                }
                if ($mainframe->isAdmin()) {
                    ?>
						<td><?php 
                    echo $subscriber->email;
                    ?>
</td>
					<?php 
                } else {
                    if ($GLOBALS[JNEWS . 'show_sub_email']) {
                        ?>
							<td><?php 
                        echo $subscriber->email;
                        ?>
</td>
					<?php 
                    }
                }
                //endelse
                if ($mainframe->isAdmin()) {
                    ?>
						<td><div align="center">
						<?php 
                    echo date('D, d M Y H:i:s', jnews::getNow(0, true, $subscriber->subscribe_date));
                }
                ?>
					</div></td>
						<td align="center">
							<img src="<?php 
                echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                ?>
" width="12" height="12" border="0" alt="<?php 
                echo $alt;
                ?>
" />
						</td>

						<td align="center">
							<a href="<?php 
                echo jnews::createToggleLink('subscribers', 'confirmed', 'subid', $subscriber->id, 'toggle', $listId);
                ?>
"> <img src="<?php 
                echo JNEWS_PATH_ADMIN_IMAGES2 . $imgC;
                ?>
" width="12" height="12" border="0" alt="<?php 
                echo $altC;
                ?>
" /> </a>
						</td>
						<td align="center">
							<a href="<?php 
                echo jnews::createToggleLink('subscribers', 'receive_html', 'subid', $subscriber->id, 'toggle', $listId);
                ?>
"> <img src="<?php 
                echo JNEWS_PATH_ADMIN_IMAGES2 . $imgH;
                ?>
" width="12" height="12" border="0" alt="<?php 
                echo $altH;
                ?>
" /> </a>
						</td>
						<?php 
                $i++;
                ?>
						<?php 
                if ($GLOBALS[JNEWS . 'level'] > 2) {
                    //check if the version of jnewsletter is 5.0.2
                    if ($GLOBALS[JNEWS . 'show_column1'] == 1) {
                        ?>
 <!--check to show/hide column 1 data in the subscribers list-->
							<td align="center"> <!--data for column1-->
								<?php 
                        echo $subscriber->column1;
                    }
                    ?>
							</td>
							<?php 
                    if ($GLOBALS[JNEWS . 'show_column2'] == 1) {
                        ?>
 <!--check to show/hide column 2 data in the subscribers list-->
							<td align="center"> <!--data for column1-->
								<?php 
                        echo $subscriber->column2;
                    }
                    ?>
							</td>
							<?php 
                    if ($GLOBALS[JNEWS . 'show_column3'] == 1) {
                        ?>
 <!--check to show/hide column 3 data in the subscribers list-->
							<td align="center"> <!--data for column3-->
								<?php 
                        echo $subscriber->column3;
                    }
                    ?>
							</td>
							<?php 
                    if ($GLOBALS[JNEWS . 'show_column4'] == 1) {
                        ?>
 <!--check to show/hide column 4 data in the subscribers list-->
							<td align="center"> <!--data for column4-->
								<?php 
                        echo $subscriber->column4;
                    }
                    ?>
							</td>
							<?php 
                    if ($GLOBALS[JNEWS . 'show_column5'] == 1) {
                        ?>
 <!--check to show/hide column 5 data in the subscribers list-->
							<td align="center"> <!--data for column5-->
								<?php 
                        echo $subscriber->column5;
                    }
                }
                //end check of version
                if (jnews::checkPermissions('admin')) {
                    echo '<td align="center">' . $subscriber->id . '</td>';
                }
                ?>
						</td>
					<?php 
            }
        }
        ?>
			</tr>
		</table>
		<input type="hidden" name="option" value="<?php 
        echo JNEWS_OPTION;
        ?>
" />
		<input type="hidden" name="act" value="<?php 
        echo $action;
        ?>
" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="userid" value="" />
		<input type="hidden" name="filter_order" value="<?php 
        echo $setSort->orderValue;
        ?>
" />
		<input type="hidden" name="filter_order_Dir" value="<?php 
        echo $setSort->orderDir;
        ?>
" />
		<input type="hidden" id="boxcount" name="boxchecked" value="0" />
		<?php 
        if (version_compare(JVERSION, '3.0.0', '<')) {
            echo JHTML::_('form.token');
        } else {
            echo JHtml::_('form.token');
        }
        ?>
		</form>
		<?php 
        echo '<br />';
        echo jnews::setLegend();
    }
コード例 #5
0
ファイル: class.module.php プロジェクト: naka211/kkvn
 function notification()
 {
     $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
     $item = !empty($Itemid) ? '&Itemid=' . $Itemid : '';
     if (isset($this->catId) and isset($this->notifType)) {
         if (jNews_Lists::getNotifLists($this->lists, $this->notifType, $this->catId)) {
             $this->linear = 1;
             $this->introtext = 'Notify me of new product';
             $this->redirectURL = 'index.php?option=com_virtuemart&page=shop.browse&category_id=' . $this->catId . $item;
             $this->buttonRegistered = _CMN_YES;
             $this->buttonUnregistered = _CMN_NO;
             //			$this->_html = '<!--  Beginning Module : '.jnews::version().'   -->'."\n\r";
             if ($this->use_new) {
                 $html = $this->create();
             } else {
                 $html = $this->createOld();
             }
             //			$this->_html .= '<!--  End Module : '.jnews::version().'   -->'."\n\r";
         }
     }
     return $html;
 }
コード例 #6
0
 public static function processTypeEightfromQueue()
 {
     $ARtoUnsubA = array();
     $followupToSubscribeA = array();
     //get entries in the queue where type =8
     $typeEightinQueue = jNews_Queue::typeEight();
     if (empty($typeEightinQueue)) {
         return false;
     }
     foreach ($typeEightinQueue as $oneTypeEight) {
         $subscriberId = $oneTypeEight->subscriber_id;
         $ARtoUnsubA[0] = $oneTypeEight->delay;
         //we use the delay column of the queue saving the AR id being subscribed of the subscriber
         $mailId = $oneTypeEight->mailing_id;
         //we get the followup of the listid saved in the delay column
         $followupid = jNews_Lists::getFollowup($ARtoUnsubA[0]);
         $followupToSubscribeA[0] = $followupid;
         //$subs=jNews_ListsSubs::getSubs($subscriberId);
         //we unsubscribe the user from the list using the data saved in the delay column in the queue
         jNews_ListsSubs::_applyChangedSubscription($subscriberId, '', $ARtoUnsubA);
         //we delete this type 8 entry in the queue
         $db = JFactory::getDBO();
         $query = 'DELETE FROM `#__jnews_queue` WHERE `type`=8 AND `subscriber_id`=' . $subscriberId . ' AND `mailing_id`=' . $mailId;
         $db->setQuery($query);
         $db->query();
         //we subscribe the user to the followup
         if ($followupToSubscribeA[0] != 0 && !empty($followupToSubscribeA[0])) {
             jNews_ListsSubs::_applyChangedSubscription($subscriberId, $followupToSubscribeA, '');
             $followupType = jNews_Lists::getListType($followupid);
             if ($followupType == 2) {
                 //we add entries in the queue if the type is equal 2
                 jNews_ListsSubs::subscribeARtoQueue($subscriberId, $followupToSubscribeA);
             }
         }
         //$subs=jNews_ListsSubs::getSubs($subscriberId);
     }
     return true;
 }
コード例 #7
0
ファイル: class.jmail.php プロジェクト: naka211/kkvn
 private static function _processConfirmationEmail($receiver, $subscriberId, $listSub)
 {
     $status = true;
     $listIds = trim(implode(",", $listSub), ',');
     $lists = jNews_Lists::getSpecifiedLists($listIds, false);
     //check that there is at least one list not hidden.
     $haveNotHiddenList = false;
     foreach ($lists as $oneList) {
         if (!empty($oneList->hidden)) {
             $haveNotHiddenList = true;
             break;
         }
     }
     $message = '';
     foreach ($lists as $list) {
         $Sub_TAG = '';
         //if we have a hidden list we dont take the subscirption message
         if ($haveNotHiddenList && empty($list->hidden)) {
             continue;
         }
         if (empty($list->subscribemessage) || substr_count($list->subscribemessage, '{tag:confirm}') < 1) {
             $Sub_TAG = '{tag:confirm}';
             //'[CONFIRM]';
         }
         $mailing = new stdClass();
         $mailing->subject = _JNEWS_SUBSCRIBE_SUBJECT_MESS;
         $mailing->html = 1;
         if (!empty($list->subscribemessage)) {
             $mailing->htmlcontent = $list->subscribemessage . '<br />' . $Sub_TAG;
         } else {
             // default message
             $mailing->htmlcontent = 'Hi {tag:name},<br /><br />Please confirm your subscription to our website by clicking on the following link.<br /><br />';
             $mailing->htmlcontent .= $Sub_TAG;
         }
         $mailing->textonly = '';
         if (!$GLOBALS[JNEWS . 'minisendmail']) {
             $mailing->fromname = $list->sendername;
         }
         $mailing->fromemail = $list->senderemail;
         $mailing->frombounce = $list->bounceadres;
         $mailing->id = 0;
         $mailing->issue_nb = 0;
         $mailing->images = '';
         $mailing->attachments = '';
         $GLOBALS[JNEWS . 'show_signature'] = 0;
         $mailerC = new jNews_ProcessMail();
         if (!$mailerC->send($mailing, $receiver)) {
             $status = false;
         }
         //we send only one notification
         break;
     }
     return $status;
 }
コード例 #8
0
ファイル: class.listype.php プロジェクト: naka211/kkvn
 public static function getMailingDropList($listId, $listType, $order)
 {
     $lists = '';
     $i = 0;
     $flag = array();
     $lists[0] = new stdClass();
     $lists[0]->name = _JNEWS_SEL_ALL;
     $lists[0]->id = '0-0';
     $nb = explode(',', $GLOBALS[JNEWS . 'activelist']);
     $size = sizeof($nb);
     for ($k = 0; $k < $size; $k++) {
         $index = $nb[$k];
         if ($listType == $index or $GLOBALS[JNEWS . 'listype' . $index] == 1 and $GLOBALS[JNEWS . 'totallist' . $index] > 0) {
             $i++;
             $lists[$i] = new stdClass();
             $lists[$i]->name = _JNEWS_ALL . ' ' . @constant($GLOBALS[JNEWS . 'listnames' . $index]);
             $lists[$i]->id = $index . '-0';
             $flag[$index] = 0;
         }
     }
     if ($listId > 0) {
         $i++;
         $getList = jNews_Lists::getLists($listId, 0, 1, $order, false, false, true);
         if (empty($getList)) {
             return;
         }
         if (!isset($lists[$i])) {
             $lists[$i] = new stdClass();
         }
         $lists[$i]->name = $getList[0]->list_name;
         $lists[$i]->id = $getList[0]->list_type . '-' . $getList[0]->id;
     } else {
         if ($listType == 0) {
             $getLists = jNews_Lists::getLists(0, 0, 1, 'listype_name', false, false, false);
         } else {
             $getLists = jNews_Lists::getLists(0, $listType, 1, $order, false, false, false);
         }
         foreach ($getLists as $getList) {
             $size = sizeof($nb);
             for ($k = 0; $k < $size; $k++) {
                 $index = $nb[$k];
                 if ($getList->list_type == $index && empty($flag[$index]) && @$GLOBALS[JNEWS . 'listype' . $index] == 1 && @$GLOBALS[JNEWS . 'totallist' . $index] > 0) {
                     $i++;
                     $lists[$i] = new stdClass();
                     $lists[$i]->name = '-- ' . @constant($GLOBALS[JNEWS . 'listnames' . $index]) . ' --';
                     $lists[$i]->id = $index . '-0';
                     $flag[$index] = true;
                 }
             }
             if ($GLOBALS[JNEWS . 'listype' . $getList->list_type]) {
                 $i++;
                 $lists[$i] = new stdClass();
                 $lists[$i]->name = $getList->list_name;
                 $lists[$i]->id = $getList->list_type . '-' . $getList->id;
             }
         }
     }
     return $lists;
 }
コード例 #9
0
ファイル: admin.jnews.html.php プロジェクト: naka211/kkvn
    public static function controlPanel()
    {
        unset($GLOBALS["task"]);
        unset($_REQUEST["task"]);
        $doc = JFactory::getDocument();
        $doc->addStyleSheet(JNEWS_URL_ADMIN . 'cssadmin/jnews.css');
        ?>
<div align="center" class="centermain">
<div id="jnews">
		<table class="">
            <tr>
         	<td width="58%" valign="top">
				<?php 
        echo backHTML::iconsPanel();
        ?>
			</td>
			<td width="42%" valign="top">

			<div style="width=100%;">

			<script type="text/javascript">
				function checkcid(myField) {
					myField.checked = true;
					isChecked(true);
				}
			</script>

			<form action="index.php" method="post" name="adminForm" id="adminForm">
				<input type="hidden" name="option" value="<?php 
        echo JNEWS_OPTION;
        ?>
" />
				<input type="hidden" name="act" value="jnews" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="userid" value="" />
		    	<input type="hidden" name="boxchecked" value="0" />

			<?php 
        $tabs = new MosTabsjNews(1);
        $tabs->startPane('acaControlPanel');
        $tabs->startTab(_JNEWS_MENU_TAB_SUM, "acaControlPanel.Summary");
        ?>
			<table class="<?php 
        echo jnews::myTheme();
        ?>
">
			<tbody>
				<thead>
					<tr>
					 <th class="title" style="text-align: center;"><?php 
        echo '#';
        ?>
</th>
					 <th class="title" style="text-align: center;"><?php 
        echo _JNEWS_MENU_TAB_LIST;
        ?>
</th>
					 <th class="title" style="text-align: center;"><?php 
        echo _JNEWS_MENU_MAILING_TITLE;
        ?>
</th>
					</tr>
				</thead>
			 <?php 
        $html = '';
        $totalist = 0;
        $totalmail = 0;
        $totalsub = $GLOBALS[JNEWS . 'act_totalsubcribers0'];
        $totalsent = 0;
        $nb = explode(',', $GLOBALS[JNEWS . 'activelist']);
        $size = sizeof($nb);
        $countOfLists[1] = jNews_Lists::countLists(1);
        $countOfLists[2] = jNews_Lists::countLists(2);
        $countOfLists[7] = jNews_Mailing::countMails(7, true);
        $countOfMailings[1] = jNews_Mailing::countMails(1);
        $countOfMailings[2] = jNews_Mailing::countMails(2);
        $countOfMailings[7] = jNews_Mailing::countMails(7);
        for ($i = 0; $i < $size; $i++) {
            $index = $nb[$i];
            if ($GLOBALS[JNEWS . 'listshow' . $index] > 0 and $GLOBALS[JNEWS . 'listype' . $index] == 1) {
                $row = ($i + 1) % 2;
                $html .= '<tr class="row' . $row . '">';
                $html .= '<td><b>' . @constant($GLOBALS[JNEWS . 'listnames' . $index]) . '</b></td>';
                //					$html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'act_totallist'.$index].'1 </td>';
                $html .= '<td style="text-align: center; ">' . $countOfLists[$index] . ' </td>';
                //if the value to be is less than 0 we will display 0
                if ($GLOBALS[JNEWS . 'act_totalmailing' . $index] > 0) {
                    //						$html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'act_totalmailing'.$index].' </td>';
                    $html .= '<td style="text-align: center; ">' . $countOfMailings[$index] . ' </td>';
                } else {
                    $html .= '<td style="text-align: center; ">0</td>';
                }
                //					$html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'totalmailingsent'.$index].' </td>';
                $html .= '</tr>';
                //					$totalist = $totalist + $GLOBALS[JNEWS.'act_totallist'.$index];
                $totalist = array_sum($countOfLists);
                //					$totalmail = $totalmail + $GLOBALS[JNEWS.'act_totalmailing'.$index];
                $totalmail = array_sum($countOfMailings);
                $totalsent = $totalsent + $GLOBALS[JNEWS . 'totalmailingsent' . $index];
                if ($GLOBALS[JNEWS . 'act_totalsubcribers' . $index] > $totalsub) {
                    $totalsub = $GLOBALS[JNEWS . 'act_totalsubcribers' . $index];
                }
            }
        }
        $html .= '<tr>';
        $html .= '<td style="background-color: #CCFFFF;"><b>' . _JNEWS_CP_TOTAL . '</b></td>';
        $html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' . $totalist . ' </td>';
        $html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' . $totalmail . ' </td>';
        //			$html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' .$totalsent.' </td>';
        //$html .= '<td style="text-align: center; ">' .$totalsub.' </td>';
        $html .= '</tr>';
        echo $html;
        ?>
			 </tbody></table>
			 <br />
			<?php 
        if (class_exists('jNews_Auto')) {
            echo jNews_Auto::showQueue();
        }
        $tabs->endTab();
        $tabs->startTab(_JNEWS_MENU_SUBSCRIBERS, "acaControlPanel.Subscribers");
        $emailsearch = '';
        $listId = 0;
        $limittotal = jNews_Subscribers::getSubscribersCount($listId);
        $setLimitSubs = jnews::setLimitPagination($limittotal);
        ?>
			<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
			<input type="hidden" name="start" value="<?php 
        echo $setLimitSubs->start;
        ?>
" />
			<input type="hidden" name="limit" value="<?php 
        echo $setLimitSubs->end;
        ?>
" />
			<input type="hidden" name="listsearch" value="<?php 
        echo $emailsearch;
        ?>
" />

			<div style="margin-top: 10px;"><?php 
        echo jnews::setTop('', '', $setLimitSubs);
        ?>
</div>

			<table class="<?php 
        echo jnews::myTheme();
        ?>
">
				<thead>
					<tr>
						<th class="title">#</th>
						<th class="title" style="text-align: left;"><?php 
        echo _JNEWS_INPUT_NAME;
        ?>
</th>
						<th class="title" style="text-align: left;"><?php 
        echo _JNEWS_INPUT_EMAIL;
        ?>
</th>
						<th class="title" style="text-align: center;"><?php 
        echo _JNEWS_SIGNUP_DATE;
        ?>
</th>
					</tr>
				</thead>
				<?php 
        $subscribers = jNews_Subscribers::getSubscribers($setLimitSubs->start, $setLimitSubs->end, $emailsearch, $setLimitSubs->total, $listId, '', 0, 0, 'sub_dateD', 0, 0, null, 0);
        $i = 0;
        foreach ($subscribers as $subscriber) {
            $i++;
            if (!jNews_Subscribers::validEmail($subscriber->email)) {
                continue;
            }
            ?>
				<tr class="row<?php 
            echo ($i + 2) % 2;
            ?>
">
				<td><center><?php 
            echo $i + $setLimitSubs->start;
            ?>
</center></td>
				<td style="text-align: left;">
				<a href="index.php?option=<?php 
            echo JNEWS_OPTION;
            ?>
&act=subscribers&task=show&userid=<?php 
            echo $subscriber->id;
            ?>
" >
				<?php 
            echo $subscriber->name;
            ?>
</a></td>
				<td style="text-align: left;"><?php 
            echo $subscriber->email;
            ?>
</td>
				<td style="text-align: center;">
				<?php 
            echo date('l, jS F Y h:i:s A', jnews::getNow(0, true, $subscriber->subscribe_date));
            ?>
				</td>
				</tr>
				<?php 
        }
        ?>
			</table>

			<?php 
        $tabs->endTab();
        $tabs->startTab(_JNEWS_MENU_TAB_LIST, "acaControlPanel.Lists");
        $listsearch = '';
        $lists = jNews_Lists::getLists(0, 0, 1, '', false, false, false);
        $limittotal = count($lists);
        $setLimitLists = jnews::setLimitPagination($limittotal);
        ?>

			<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
			<input type="hidden" name="start" value="<?php 
        echo $setLimitLists->start;
        ?>
" />
			<input type="hidden" name="limit" value="<?php 
        echo $setLimitLists->end;
        ?>
" />
			<input type="hidden" name="listsearch" value="<?php 
        echo $listsearch;
        ?>
" />

			<div style="margin-top: 10px;"><?php 
        echo jnews::setTop('', '', $setLimitLists);
        ?>
</div>

			<table class="<?php 
        echo jnews::myTheme();
        ?>
">
				<thead>
				<tr>
					<th class="title">#</th>
					<th class="title" width="65%"  style="text-align: left;"><?php 
        echo _JNEWS_LIST_NAME;
        ?>
</th>
					<th class="title" width="25%"  style="text-align: left;"><?php 
        echo _JNEWS_LIST_TYPE;
        ?>
</th>
					<th class="title"  style="text-align: center;">ID</th>
				</tr>
				</thead>
			<?php 
        $lists = jNews_Lists::getLists(0, 0, 1, 'listtypeA', false, false, false, false, false, $listsearch, $setLimitLists, 0, 0);
        $i = 0;
        foreach ($lists as $list) {
            $i++;
            $link = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&task=show&listid=' . $list->id;
            ?>
				<tr class="row<?php 
            echo ($i + 2) % 2;
            ?>
">
					<td><?php 
            echo $i + $setLimitLists->start;
            ?>
</td>
					<td  style="text-align: left;">
						<a href="<?php 
            echo $link;
            ?>
">
							<?php 
            echo $list->list_name;
            ?>
</a>
					</td>
					<td  style="text-align: left;"><?php 
            if ($list->list_type == 1) {
                echo _JNEWS_LIST;
            } else {
                echo _JNEWS_AR;
            }
            ?>
</td>
					<td  style="text-align: center;"><?php 
            echo $list->id;
            ?>
</td>
					</tr>
			<?php 
        }
        ?>
			<tr>
				<th colspan="4">
				</th>
			</tr>
			</table>
			<?php 
        $tabs->endTab();
        ?>
			<?php 
        $tabs->endPane();
        ?>
			</form>
		</div>
		<div style="clear:both; float:left; margin-top: 10px;">
		<?php 
        echo jnews::printM('ok', _JNEWS_SERVER_LOCAL_TIME . ' : ' . date('l, j F Y H:i:s', jnews::getNow(0, true)));
        // - date('Z')
        ?>
		</div>
   <td>
   </tr>
   </table>
   </div>
</div>
<?php 
    }
コード例 #10
0
ファイル: class.mailing.php プロジェクト: naka211/kkvn
 public static function getListMailingToDelete($listID)
 {
     if (empty($listID)) {
         return false;
     }
     $type = jNews_Lists::getListType($listID);
     $query = 'SELECT `mailing_id` FROM `#__jnews_listmailings` WHERE `list_id`=' . $listID;
     $db = JFactory::getDBO();
     $db->setQuery($query);
     $loadResultArray = $db->loadObjectList();
     $resultA = jnews::convertObjectList2Array($loadResultArray);
     return $resultA;
 }
コード例 #11
0
ファイル: lists.jnews.php プロジェクト: naka211/kkvn
function lists($action, $task, $listId, $listType)
{
    $db = JFactory::getDBO();
    $my = JFactory::getUser();
    $css = '.icon-48-lists { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/lists.png)}';
    $doc = JFactory::getDocument();
    $doc->addStyleDeclaration($css, $type = 'text/css');
    $img = 'lists.png';
    $listsearch = JRequest::getVar('listsearch', '');
    $message = '';
    $xf = new jNews_Config();
    $showLists = true;
    $checkToggle = false;
    // defined toggle for publish and unpublish of mailings
    if (!empty($task) && $task == 'togle') {
        $checkToggle = true;
        $id = JRequest::getVar('listid');
        $col = JRequest::getVar('col');
        $listId = !empty($id) && !empty($col) ? $id : $listId;
        $task = !empty($listId) && !empty($col) ? $col : $task;
    }
    switch ($task) {
        case 'new':
        case 'add':
            $subscriber = jNews_Subscribers::getSubscriberInfoFromUserId($my->id);
            if (version_compare(JVERSION, '1.6.0', '<')) {
                //j15
                $acl = JFactory::getACL();
                $groups = $acl->get_group_children_tree(null, 'USERS', false);
            } else {
                //j16
                $db = JFactory::getDBO();
                $db->setQuery('SELECT a.*, a.title as text, a.id as value  FROM #__usergroups AS a ORDER BY a.lft ASC');
                $groups = $db->loadObjectList();
            }
            $allGroupIds = array();
            foreach ($groups as $oneGroup) {
                $allGroupIds[] = $oneGroup->value;
            }
            $newList = new stdClass();
            $showLists = false;
            $newList->id = '';
            $newList->html = 1;
            $newList->new_letter = 1;
            $newList->list_name = '';
            $newList->list_desc = '';
            $newList->template = '';
            if (empty($subscriber)) {
                $newList->sendername = '';
                $newList->senderemail = '';
                $newList->bounceadres = '';
            } else {
                $newList->sendername = '';
                $newList->senderemail = '';
                $newList->bounceadres = '';
            }
            $newList->hidden = 1;
            $newList->auto_add = 0;
            $newList->list_type = $listType;
            $newList->delay_min = 1;
            $newList->delay_max = 7;
            $newList->user_choose = 0;
            $newList->cat_id = '0:0';
            $newList->follow_up = '';
            $newList->notify_id = 0;
            $newList->owner = $my->id;
            $newList->acc_level = '24,25,7,8';
            $newList->acc_id = implode(',', $allGroupIds);
            $newList->published = 1;
            $newList->start_date = date('Y-m-d', time());
            $newList->next_date = jnews::getNow();
            $newList->subscribemessage = _JNEWS_DEFAULT_SUBSCRIBE_MESS;
            $newList->unsubscribemessage = _JNEWS_DEFAULT_UNSUBSCRIBE_MESS;
            $newList->notifyadminmsg = _JNEWS_UNSUBSCRIBE_ADMIN_NOTIFICATION;
            $newList->subnotifymsg = _JNEWS_SUBSDEFAULT_NOTIFYMSG;
            $newList->subnotifysend = 1;
            $newList->unsubscribesend = 1;
            $newList->unsubscribenotifyadmin = 1;
            $newList->footer = 1;
            $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
            $show = jNews_ListType::showType($newList->list_type, 'editlist');
            if ($listType == 1) {
                backHTML::_header(_JNEWS_NEW . ' ' . _JNEWS_LIST, $img, $message, $task, $action);
            } else {
                backHTML::_header(_JNEWS_NEW . ' ' . _JNEWS_AUTORESP . ' ' . _JNEWS_LIST, $img, $message, $task, $action);
            }
            backHTML::formStart('editlist', $newList->html, '');
            jNews_ListsHTML::editList($newList, $forms, $show, $listType);
            $go[] = jnews::makeObj('act', $action);
            $go[] = jnews::makeObj('listid', $newList->id);
            backHTML::formEnd($go);
            break;
        case 'doNew':
            JRequest::checkToken() or die('Invalid Token');
            $listname = JRequest::getVar('list_name', '');
            if (empty($listname)) {
                echo "<script> alert(' List name must be filled out. '); window.history.go(-1);</script>\n";
                return false;
            }
            $now = jnews::getNow();
            $query = "SELECT `id` FROM `#__jnews_lists` WHERE `list_name`= '" . addslashes($listname) . "' ";
            $db->setQuery($query);
            $lId = $db->loadResult();
            if ($lId > 0) {
                echo "<script> alert(' This list already exist, please choose another name. '); window.history.go(-1);</script>\n";
                return false;
            } else {
                $query = "INSERT INTO `#__jnews_lists` (`list_name`,`createdate`) VALUES ( '" . addslashes($listname) . "'  , '{$now}' )";
                $db->setQuery($query);
                $db->query();
            }
            $query = "SELECT * FROM `#__jnews_lists` WHERE `list_name`= '" . addslashes($listname) . "' ";
            $db->setQuery($query);
            $mynewlist = $db->loadObject();
            $mynewlist->list_name = stripslashes($mynewlist->list_name);
            $mynewlist->list_desc = stripslashes($mynewlist->list_desc);
            $mynewlist->template = $mynewlist->template;
            $mynewlist->layout = stripslashes($mynewlist->layout);
            $mynewlist->subscribemessage = stripslashes($mynewlist->subscribemessage);
            $mynewlist->unsubscribemessage = stripslashes($mynewlist->unsubscribemessage);
            $mynewlist->notifyadminmsg = stripslashes($mynewlist->notifyadminmsg);
            $mynewlist->subnotifysend = stripslashes($mynewlist->subnotifysend);
            $mynewlist->subnotifymsg = stripslashes($mynewlist->subnotifymsg);
            $listId = $mynewlist->id;
            $message = jnews::printYN(jNews_Lists::updateListFromEdit($listId, '', true, $listType), _JNEWS_LIST_ADDED, _JNEWS_ERROR);
            $xf->plus('totallist0', 1);
            $xf->plus('act_totallist0', 1);
            $xf->plus('totallist' . $listType, 1);
            $xf->plus('act_totallist' . $listType, 1);
            break;
        case 'edit':
            if ($listId == 0) {
                echo "<script> alert('" . addslashes(_JNEWS_SELECT_LIST) . "'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $showLists = false;
                $query = 'SELECT * FROM `#__jnews_lists` WHERE `id` = ' . intval($listId);
                $db->setQuery($query);
                $listEdit = $db->loadObject();
                if ($listEdit->acc_id == 'all') {
                    if (version_compare(JVERSION, '1.6.0', '<')) {
                        //j15
                        $acl = JFactory::getACL();
                        $groups = $acl->get_group_children_tree(null, 'USERS', false);
                    } else {
                        //j16
                        $db = JFactory::getDBO();
                        $db->setQuery('SELECT a.*, a.title as text, a.id as value  FROM #__usergroups AS a ORDER BY a.lft ASC');
                        $groups = $db->loadObjectList();
                    }
                    $allGroupIds = array();
                    foreach ($groups as $oneGroup) {
                        $allGroupIds[] = $oneGroup->value;
                    }
                    $listEdit->acc_id = implode(',', $allGroupIds);
                }
                $listEdit->list_name = stripslashes($listEdit->list_name);
                $listEdit->list_desc = stripslashes($listEdit->list_desc);
                $listEdit->template = $listEdit->template;
                $listEdit->layout = stripslashes($listEdit->layout);
                $listEdit->subscribemessage = stripslashes($listEdit->subscribemessage);
                $listEdit->unsubscribemessage = stripslashes($listEdit->unsubscribemessage);
                $listEdit->notifyadminmsg = stripslashes($listEdit->notifyadminmsg);
                $listEdit->subnotifysend = stripslashes($listEdit->subnotifysend);
                $listEdit->subnotifymsg = stripslashes($listEdit->subnotifymsg);
                $listEdit->new_letter = 0;
                $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
                $show = jNews_ListType::showType($listEdit->list_type, 'editlist');
                backHTML::_header(_JNEWS_EDIT_A . @constant($GLOBALS[JNEWS . 'listname' . $listEdit->list_type]) . ' ' . _JNEWS_LIST, $img, $message, $task, $action);
                backHTML::formStart('listedit', $listEdit->html, '');
                jNews_ListsHTML::editList($listEdit, $forms, $show, $listType);
                $go[] = jnews::makeObj('act', $action);
                $go[] = jnews::makeObj('listid', $listEdit->id);
                backHTML::formEnd($go);
            }
            break;
        case 'update':
            JRequest::checkToken() or die('Invalid Token');
            $message = jnews::printYN(jNews_Lists::updateListFromEdit($listId, '', false, $listType), _JNEWS_LIST_UPDATED, _JNEWS_ERROR);
            break;
        case 'delete':
            JRequest::checkToken() or die('Invalid Token');
            $query = "SELECT list_name FROM #__jnews_lists WHERE id = {$listId}";
            $db->setQuery($query);
            $listName = $db->loadResult();
            $message = jnews::printYN(jNews_Lists::deleteList($listId), '"' . $listName . '"' . _JNEWS_LIST . _JNEWS_SUCCESS_DELETED, _JNEWS_ERROR);
            break;
        case 'copy':
            JRequest::checkToken() or die('Invalid Token');
            $message = jnews::printYN(jNews_Lists::copyList($listId), _JNEWS_LIST_COPY, _JNEWS_ERROR);
            break;
        case 'publish':
            if (!$checkToggle) {
                JRequest::checkToken() or die('Invalid Token');
            }
            $message = jnews::printYN(jNews_Lists::updateListFromList($listId, true, false), _JNEWS_PUBLISHED, _JNEWS_ERROR);
            if ($listType == 1) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $listType);
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=' . $listType);
            }
            break;
        case 'unpublish':
            if (!$checkToggle) {
                JRequest::checkToken() or die('Invalid Token');
            }
            $message = jnews::printYN(jNews_Lists::updateListFromList($listId, false, false), _JNEWS_UNPUBLISHED, _JNEWS_ERROR);
            if ($listType == 1) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $listType . '&listid=' . $listId);
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=' . $listType . '&listid=' . $listId);
            }
            break;
        case 'forms':
        case 'make':
            if (class_exists('jNews_CreateForm')) {
                jNews_CreateForm::taskOptions($task);
                $showLists = false;
            } else {
                $showLists = true;
            }
            break;
        case 'cpanel':
            backHTML::controlPanel();
            return true;
            break;
        case 'toggle':
            $listid = JRequest::getVar('listid');
            $column = JRequest::getVar('col');
            if (!empty($listid) && !empty($column)) {
                $passObj = new stdClass();
                $passObj->tableName = '#__jnews_lists';
                $passObj->columnName = $column;
                $passObj->whereColumn = 'id';
                $passObj->whereColumnValue = $listid;
                jnews::toggle($passObj);
            }
            if ($listType == 1) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=1');
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=2');
            }
            break;
    }
    if ($showLists) {
        $limit = -1;
        //Title header
        if ($listType == 1) {
            backHTML::_header(_JNEWS_MENU_LIST, $img, $message, $task, $action);
        } else {
            backHTML::_header(_JNEWS_ARLIST, $img, $message, $task, $action);
        }
        $show = jNews_ListType::showType(0, 'showListsBack');
        $forms['main'] = "<form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
        backHTML::formStart('show_mailing', '', '');
        $paginationStart = JRequest::getVar('pg');
        $app = JFactory::getApplication();
        if (!empty($paginationStart)) {
            $limitstart = 0;
            $limitend = $paginationStart;
        } else {
            $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int');
            $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int');
        }
        $limittotal = jNews_Lists::getListCount($listType);
        $limittotal = $limittotal[0];
        $setLimit = new stdClass();
        $setLimit->total = !empty($limittotal) ? $limittotal : 0;
        $setLimit->start = !empty($limitstart) ? $limitstart : 0;
        $setLimit->end = !empty($limitend) ? $limitend : $limittotal;
        // recheck start
        if ($setLimit->total == $setLimit->end) {
            $setLimit->start = 0;
        }
        $setSort = new stdClass();
        if ($listType == '2') {
            //autoresponder
            $key = JNEWS_OPTION . '.arlist';
            $column = 'id';
            $direction = 'desc';
        } else {
            //newsletter
            $key = JNEWS_OPTION . '.list';
            $column = 'list_name';
            $direction = 'asc';
        }
        $setSort->orderValue = $app->getUserStateFromRequest($key . 'filter_order', 'filter_order', $column, 'cmd');
        $setSort->orderDir = $app->getUserStateFromRequest($key . 'filter_order_Dir', 'filter_order_Dir', $direction, 'word');
        if ($listType == 2) {
            ?>
<script language="javascript" type="text/javascript">
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'delete') {
			var $ok = confirm('Are you sure you want to delete?\r\nAll of the mailings attached in this auto-responder will be deleted as well.');
			if ( $ok == true ){
				form.action = 'index.php?option=<?php 
            echo JNEWS_OPTION;
            ?>
&act=arlist&task=delete';
			}else{
				return;
			}
		}
		submitform( pressbutton );
	}
</script>
<?php 
        }
        $listing = jNews_Lists::getLists(0, $listType, 1, '', false, false, false, false, false, $listsearch, $setLimit, $setSort);
        if (isset($setLimit->total) && !empty($listsearch)) {
            $lists = jNews_Lists::getLists(0, $listType, 1, '', false, false, false, false, false, $listsearch, $setSort);
            $setLimit->total = !empty($lists) ? count($lists) : $setLimit->total;
        }
        $totalSubs = array();
        $totalUnSubs = array();
        $db = JFactory::getDBO();
        if (!empty($listing)) {
            foreach ($listing as $list) {
                $totalSubs[] = jNews_Subscribers::getSubscribersCount($list->id, true);
                $totalUnSubs[] = jNews_Subscribers::getSubscribersCount($list->id, 2);
            }
        }
        jNews_ListsHTML::showListingLists($listing, $action, 'edit', $forms, $show, $listsearch, $setLimit->end, $setLimit, $totalSubs, $setSort, $totalUnSubs);
        $go[] = jnews::makeObj('act', $action);
        $go[] = jnews::makeObj('filter_order', $setSort->orderValue);
        $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir);
        backHTML::formEnd($go);
        return true;
    }
}
コード例 #12
0
ファイル: class.queue.php プロジェクト: naka211/kkvn
 function insertIntoQueue($queue)
 {
     static $alradyProceesed = array();
     $db = JFactory::getDBO();
     if ($queue->subscriber_id < 0) {
         return false;
     }
     //Added by Grace for the pending of queue
     $queue->published = $queue->send_date > time() ? 2 : 0;
     //Note: know what's the use of this line
     if (empty($queue->list_id)) {
         //this is for the smartnewsletter
         $queue->published = 2;
     }
     $confirmed = jNews_Subscribers::isConfirmed($queue->subscriber_id);
     $queue->suspend = $confirmed;
     $key = serialize($queue);
     if (isset($alradyProceesed[$key])) {
         return true;
     }
     $alradyProceesed[$key] = true;
     //if (!$exist){
     $query = 'INSERT IGNORE INTO `#__jnews_queue` (`type` , `subscriber_id` ,  `mailing_id`, `issue_nb`,' . ' `send_date`, `suspend` , `delay`, `acc_level`, `published`, `priority`, `attempt`) VALUES (' . intval($queue->type) . ', ' . intval($queue->subscriber_id) . ' , ' . intval($queue->mailing_id) . ', ' . intval($queue->issue_nb) . ', \'' . $queue->send_date . '\', ' . $queue->suspend . ' , ' . $queue->delay . ' , ' . $queue->acc_level . ' , ' . $queue->published . ' , ' . $queue->priority . ' , ' . $queue->attempt . ')';
     $db->setQuery($query);
     $db->query();
     // ONLY FOR AUTO-RESPONDERS --- ONLY FOR AUTO-RESPONDERS --- ONLY FOR AUTO-RESPONDERS --- ONLY FOR AUTO-RESPONDERS --- ONLY FOR AUTO-RESPONDERS --- ONLY FOR AUTO-RESPONDERS ---
     if (!empty($queue->list_id)) {
         $type = jNews_Lists::getListType($queue->list_id);
         if ($type == 2) {
             $delays = jNews_Mailing::getMailingInfoz($queue->mailing_id, 'delay');
             $newQueue->delay = $delays;
             $newQueue->send_date = time() + $delays * 60;
             // jnews::getNow( $delays );
             $newQueue->published = 2;
             $arPRiority = empty($GLOBALS[JNEWS . 'ar_prior']) ? 1 : $GLOBALS[JNEWS . 'ar_prior'];
             $newQueue->priority = $arPRiority;
             $query = 'UPDATE `#__jnews_queue` SET `send_date`=' . $newQueue->send_date;
             $query .= ' , `delay`=' . $newQueue->delay;
             $query .= ' , `published`=' . $newQueue->published;
             $query .= ' , `priority`=' . $newQueue->priority;
             $query .= ' , `suspend`=' . $confirmed;
             $query .= ' WHERE `subscriber_id` = ' . $queue->subscriber_id;
             $query .= ' and `mailing_id` = ' . $queue->mailing_id;
             $db->setQuery($query);
             $db->query();
         }
         return true;
     }
     //end if
     return true;
     //}
 }
コード例 #13
0
ファイル: jnews_cb.php プロジェクト: naka211/kkvn
 function getDisplayRegistration($tab, $user, $ui)
 {
     $my = JFactory::getUser();
     require_once JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'administrator' . DS . 'components' . DS . JNEWS_OPTION . DS . 'classes' . DS . 'class.jnews.php';
     require_once JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'administrator' . DS . 'components' . DS . JNEWS_OPTION . DS . 'classes' . DS . 'class.lists.php';
     $html = '';
     if ($GLOBALS['jnews_cb_plugin'] == '1') {
         $lists = jNews_Lists::getSpecifiedLists($GLOBALS['jnews_cb_listIds'], false);
         if (!empty($lists)) {
             $i = 0;
             $accessLevel = 18;
             //default access level jack 31
             $htmlOK = false;
             if (!empty($GLOBALS['jnews_cb_intro'])) {
                 $html .= '<tr><td class="titleCell" colspan="2">' . $GLOBALS['jnews_cb_intro'] . '</td></tr>';
             }
             if ($GLOBALS['jnews_cb_showname']) {
                 foreach ($lists as $list) {
                     $i++;
                     $subscribed = 0;
                     if ($list->html == 1) {
                         $htmlOK = true;
                     }
                     $checked = $GLOBALS['jnews_cb_checkLists'];
                     if ($list->hidden == 1) {
                         $subscriber->blacklist = 0;
                         if ($checked != 0) {
                             $checkedPrint = ' checked="checked" ';
                         } else {
                             $checkedPrint = '';
                         }
                         $html .= '<tr>';
                         if ($GLOBALS['jnews_cb_checkLists'] == 1) {
                             $text = "\n" . '<td class="titleCell" style="text-align: right;"><input type="checkbox" class="inputbox" value="1" name="subscribed[' . $i . ']" checked="checked" /></td>';
                         } else {
                             $text = "\n" . '<td class="titleCell" style="text-align: right;"><input type="checkbox" class="inputbox" value="1" name="subscribed[' . $i . ']" ' . $checkedPrint . ' /></td>';
                         }
                         $text .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />';
                         $text .= "\n" . '<td class="fieldCell"><span class="aca_list_name" onclick=\'return false;\'>' . jNews_Tools::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, '#', 1) . '</span></td>';
                         $html .= $text;
                         $html .= '</tr>';
                     } else {
                         $html .= '<input type="hidden"  value=1 name="subscribed[' . $i . ']" />';
                         $html .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />';
                     }
                     $html .= "\n" . '<input type="hidden" name="acc_level[' . $i . ']" value="' . $accessLevel . '" />';
                 }
             } else {
                 foreach ($lists as $list) {
                     $i++;
                     $html .= '<input type="hidden"  value="1" name="subscribed[' . $i . ']" />';
                     $html .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />';
                     $html .= "\n" . '<input type="hidden" name="acc_level[' . $i . ']" value="' . $accessLevel . '" />';
                     if ($list->html == 1) {
                         $htmlOK = true;
                     }
                 }
             }
             $checked = $GLOBALS['jnews_cb_defaultHTML'];
             if ($htmlOK) {
                 if ($GLOBALS['jnews_cb_showHTML']) {
                     $html .= '<tr>';
                     if ($checked != 0) {
                         $checkedPrint = ' checked="checked" ';
                     } else {
                         $checkedPrint = '';
                     }
                     $text = '<td class="titleCell" style="text-align: right;"><input type="checkbox" class="inputbox" value="1" name="receive_html" ' . $checkedPrint . ' /></td>';
                     $text .= '<td class="fieldCell">' . _JNEWS_RECEIVE_HTML . '</td>';
                     $html .= jnews::printLine(false, $text);
                     $html .= '</tr>';
                 } else {
                     $html .= '<input type="hidden" value="' . $checked . '" name="receive_html" />' . "\n";
                 }
             } else {
                 $html .= '<input type="hidden" value="' . $checked . '" name="receive_html" />' . "\n";
             }
         } else {
             $html = '<input type="hidden" value="' . $GLOBALS['jnews_cb_defaultHTML'] . '" name="receive_html" />' . "\n";
         }
     } else {
         $html = '<input type="hidden" value="' . $GLOBALS['jnews_cb_defaultHTML'] . '" name="receive_html" />' . "\n";
     }
     return $html;
 }
コード例 #14
0
ファイル: mailings.jnews.html.php プロジェクト: naka211/kkvn
    public static function layoutBE($mailingEdit, $lists, $show, $isEdit = false)
    {
        $tagjs = "function insertTag(tag){\n\t\ttry{\n\t\t\tstatus=jInsertEditorText(tag,'jnewsContent');\n\t\t\treturn true;\n\t\t} catch(err){\n\t\t\talert('Your editor does not enable jNews to automatically insert the tag, please copy/paste it manually in your Newsletter'); return false;\n\t\t}\n\t\t}";
        $editor = JFactory::getEditor();
        $script = "function changeTemplate(newbody,newaltbody,templateid){\n\t\t\tif(newbody.length>2){" . jnews::EditorSetContent($editor, 'jnewsContent', 'newbody') . ";}\n\t\t\tvar jnewstextarea =\$('altbody'); if(newaltbody.length>2){jnewstextarea.setHTML(newaltbody);}\n\t\t\tvar jnewstemplateid =\$('template_id'); jnewstemplateid.value = templateid;\n\n\t\t\t}\n\t\t\t";
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($script . $tagjs);
        if (!empty($_SESSION['skip_subscribers' . $mailingEdit->id])) {
            echo 'If you click on the Send button, the process will skip the first ' . $_SESSION['skip_subscribers' . $mailingEdit->id] . ' subscribers';
        }
        ?>
	<!--<fieldset class="jnewscss">-->
	<!--<legend><?php 
        echo @constant($GLOBALS[JNEWS . 'listname' . $mailingEdit->mailing_type]) . ' ' . _JNEWS_CONTENT;
        ?>
</legend>-->
	<table class="jnewstable" cellspacing="1" width="100%" border="0">
		<tbody>
		<tr>
			<td valign="top">

		<?php 
        $mailingType = JRequest::getVar('listype');
        $listId = JRequest::getVar('listid');
        $list_template_id = jNews_Lists::getListTemplate($listId);
        if ($mailingEdit->mailing_type == '7' || $mailingType == '7' and class_exists('jNews_Autonews')) {
            jNews_MailingsHTML::smartNewsHead($mailingEdit, $lists, $show);
        } else {
            jNews_MailingsHTML::subject($mailingEdit, $lists, $show);
        }
        if (empty($mailingEdit->id)) {
            if (!empty($mailingEdit->template_id)) {
                $template = jNews_Templates::loadOneTemplate('*', $mailingEdit->template_id);
            } else {
                if (!empty($list_template_id)) {
                    $template = jNews_Templates::loadOneTemplate('*', $list_template_id, 'template_id', 'DESC', false);
                } else {
                    $template = jNews_Templates::loadOneTemplate('*', '', 'template_id', 'DESC', true);
                }
                $mailingEdit->template_id = $template->template_id;
            }
            $mailingEdit->htmlcontent = isset($template->body) ? $template->body : '';
            $mailingEdit->textonly = isset($template->altbody) ? $template->altbody : '';
        }
        if ($show['htmlcontent']) {
            echo '<fieldset class="jnewscss" id="htmlfieldset">';
            echo '<legend>';
            echo _JNEWS_HTML_VERSION;
            echo '</legend>';
            echo $editor->display('jnewsContent', $mailingEdit->htmlcontent, '100%', '600', '80', '30');
            echo '</fieldset>';
        }
        ?>
			</td>
			<td valign="top" width="330px" rowspan="2">
			<?php 
        $config_tabs = new MosTabsjNews(0);
        $config_tabs->startPane('acaMailingOptions');
        $config_tabs->startTab(_JNEWS_LIST_T_LIST, 'acaMailingOptions.general');
        jNews_MailingsHTML::lists($mailingEdit, $lists, $show, 0, 0, false, $isEdit);
        //added another parameter for the list type ---mary
        $config_tabs->endTab();
        $config_tabs->startTab(_JNEWS_LIST_T_SENDER, 'acaMailingOptions.general');
        jNews_MailingsHTML::senderinfo($mailingEdit, $lists, $show);
        $config_tabs->endTab();
        if ($GLOBALS[JNEWS . 'show_jcalpro'] and class_exists('jNews_Pro')) {
            $config_tabs->startTab(_JNEWS_SHOW_JCALPRO, 'acaMailingOptions.jcalpro');
            jNews_MailingsHTML::jcalpro();
            $config_tabs->endTab();
        }
        if ($show['attachement']) {
            $config_tabs->startTab(_JNEWS_ATTACHMENTS, 'acaMailingOptions.attachement');
            jNews_MailingsHTML::attachement($mailingEdit, null, null);
            $config_tabs->endTab();
        }
        $config_tabs->endPane();
        ?>
			</td>
		</tr>


	<?php 
        if ($show['textcontent']) {
            ?>
		<tr>
			<td>
				<fieldset class="jnewscss">
				<legend><?php 
            echo _JNEWS_NONHTML_VERSION;
            ?>
</legend>
				<textarea name="altbody" id="altbody" rows="20" cols="70" style="width: 100%; height: 400px;">
					<?php 
            echo strip_tags($mailingEdit->textonly);
            ?>
				</textarea>
				</fieldset>
			</td>
			<td>
			</td>
		</tr>
	<?php 
        }
        ?>
		</tbody>
	</table>
	<!--</fieldset>-->
	<input type="hidden" id="template_id" name="template_id" value="<?php 
        echo $mailingEdit->template_id;
        ?>
" />
	<?php 
    }
コード例 #15
0
ファイル: class.lists.php プロジェクト: naka211/kkvn
 public static function deleteList($listId)
 {
     $db = JFactory::getDBO();
     $total = 0;
     $xf = new jNews_Config();
     $list = jNews_Lists::getOneList($listId);
     $query = 'DELETE FROM `#__jnews_lists` WHERE `id` = ' . $listId;
     $db->setQuery($query);
     $db->query();
     //delete mailings in listmailings where listid=listid
     $query = 'DELETE FROM `#__jnews_listmailings` WHERE `list_id` = ' . $listId;
     $db->setQuery($query);
     $db->query();
     //delete listsubscribers in listsubscribers where listid=listid
     $query = 'DELETE FROM `#__jnews_listssubscribers` WHERE `list_id` = ' . $listId;
     $db->setQuery($query);
     $db->query();
     //delete entries in the followup
     $query = 'DELETE FROM `#__jnews_followup` WHERE `followup_id` = ' . $listId;
     //for autoresponders
     $query .= ' OR `list_id`=' . $listId;
     //for lists
     $db->setQuery($query);
     $db->query();
     return true;
 }
コード例 #16
0
ファイル: class.subscribers.php プロジェクト: naka211/kkvn
 public static function importBis()
 {
     @set_time_limit(0);
     $returnMessage = '';
     //If memory_limit less than 128M
     $limit = jnews::convertToBytes(@ini_get('memory_limit'));
     if ($limit < jnews::convertToBytes('128M')) {
         @ini_set('memory_limit', '128M');
     }
     $allAvailableListsA = JRequest::getVar('sub_list_id', '');
     $list2SubcribeToA = JRequest::getVar('subscribed', '');
     $filename = $_FILES['importfile']['name'];
     if (!empty($filename)) {
         //if we import a file
         //the flag is true coz we add subscribers in frontend through rows
         $saveSubsInRows = true;
         $path = JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'upload_url'];
         $path = str_replace(array('/', '\\'), DS, $path);
         if (!is_writable($path)) {
             $returnMessage .= '<br/>The file could not be imported because the folder is not writable.';
             $returnMessage .= '<br/>Please make sure the path "' . JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'upload_url'] . '" is writable';
             return $returnMessage;
         }
         if (!@move_uploaded_file($_FILES['importfile']['tmp_name'], $path . $filename)) {
             $path .= DS;
             if (!@move_uploaded_file($_FILES['importfile']['tmp_name'], $path . $filename)) {
                 $returnMessage .= _JNEWS_ERROR_MOVING_UPLOAD;
                 $returnMessage .= '<br/>Please make sure the path "' . JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'upload_url'] . '" is writable';
                 return $returnMessage;
             }
         }
         $import = file_get_contents($path . $filename);
         $import = str_replace(array("\r\n", "\r"), "\n", $import);
         $allLinesA = explode("\n", $import);
     } else {
         //if we add subscribers in frontend through rows
         //the flag is true coz we add subscribers in frontend through rows
         $saveSubsInRows = true;
         //we get the number of rows
         $rows = JRequest::getVar('count', '');
         $nRows = intval($rows) - 1;
         if ($nRows == 0) {
             $nRows = intval($GLOBALS[JNEWS . 'create_newsubsrows']);
         }
         //we get the value of each element from the rows
         for ($count = 1; $count <= $nRows; $count++) {
             $allLinesA[$count] = JRequest::getVar('name' . $count, '') . ', ' . JRequest::getVar('email' . $count, '') . ', ' . JRequest::getVar('receive_html' . $count, '') . ', ' . JRequest::getVar('confirmed' . $count, '') . ', ' . JRequest::getVar('column1' . $count, '') . ', ' . JRequest::getVar('column2' . $count, '') . ', ' . JRequest::getVar('column3' . $count, '') . ', ' . JRequest::getVar('column4' . $count, '') . ', ' . JRequest::getVar('column5' . $count, '');
         }
     }
     if (empty($allLinesA)) {
         return false;
     }
     $db = JFactory::getDBO();
     $insertQuery = '';
     $selectQuery = '';
     $firstValue = true;
     $time = time();
     $totalInsert = 0;
     $allSubscribersIDA = array();
     foreach ($allLinesA as $line) {
         $line = trim($line);
         if (empty($line)) {
             continue;
         }
         $line = str_replace(';', ',', $line);
         $subscriberA = explode(',', $line);
         $email = trim($subscriberA[1], ' "\'');
         if (!jNews_Subscribers::validEmail($email)) {
             if (!$saveSubsInRows) {
                 //if import of file is done
                 echo '<br />' . jnews::printM('red', _JNEWS_EMAIL_INVALID . ': ' . $email);
                 continue;
             } else {
                 continue;
             }
         }
         if ($GLOBALS[JNEWS . 'level'] > 2) {
             $column4 = !empty($subscriberA[4]) ? mysql_escape_string(trim($subscriberA[4], '"')) : '';
             $column5 = !empty($subscriberA[5]) ? mysql_escape_string(trim($subscriberA[5], '"')) : '';
             $column6 = !empty($subscriberA[6]) ? mysql_escape_string(trim($subscriberA[6], '"')) : '';
             $column7 = !empty($subscriberA[7]) ? mysql_escape_string(trim($subscriberA[7], '"')) : '';
             $column8 = !empty($subscriberA[8]) ? mysql_escape_string(trim($subscriberA[8], '"')) : '';
             $ip = !empty($subscriberA[9]) ? mysql_escape_string(trim($subscriberA[9], '"')) : '';
         }
         $comfirmation = $GLOBALS[JNEWS . 'require_confirmation'] ? 0 : (int) trim($subscriberA[3], ' "\'');
         // i need to know if exist user
         $db = JFactory::getDBO();
         $quer = "SELECT id FROM `#__jnews_subscribers` WHERE `email` = '{$email}'";
         $db->setQuery($quer);
         $res = $db->loadResult();
         if ($res) {
             //i need to update
             $isResiveHtml = (int) trim($subscriberA[2], ' "\'');
             $querUpdate = "UPDATE `#__jnews_subscribers` SET confirmed = '{$comfirmation}', receive_html= '{$isResiveHtml}',column1 = '{$column4}', column2 = '{$column5}', column3 = '{$column5}', column4 = '{$column7}', column5= '{$column8}',ip = '{$ip}' WHERE `email` = '{$email}'";
             $db->setQuery($querUpdate);
             $db->query();
             if (!empty($allAvailableListsA) && !empty($list2SubcribeToA)) {
                 foreach ($list2SubcribeToA as $oneneedList => $noneed) {
                     $listId = $allAvailableListsA[$oneneedList];
                     //
                     $query = "INSERT IGNORE `#__jnews_listssubscribers` (`list_id`,`subscriber_id`,`subdate`) VALUES ({$listId}, {$res}, {$time})";
                     $db->setQuery($query);
                     $db->query();
                 }
             }
             continue;
         }
         if (!$firstValue) {
             $insertQuery .= ',';
         }
         /*$insertQuery .= '(\''. htmlentities(trim($subscriberA[0],' "\'') ) . '\',\''.$email.'\','.$comfirmation.','.(int)trim($subscriberA[2],' "\'').',\''.$time.'\',\''.$column4.'\',\''.$column5.'\',\''.$column6.'' .
         		'\',\''.$column7.'\',\''.$column8.'\',\''.$ip.'\')';*/
         $insertQuery .= '(\'' . addslashes(trim($subscriberA[0], ' "\'')) . '\',\'' . $email . '\',' . $comfirmation . ',' . (int) trim($subscriberA[2], ' "\'') . ',\'' . $time . '\',\'' . $column4 . '\',\'' . $column5 . '\',\'' . $column6 . '' . '\',\'' . $column7 . '\',\'' . $column8 . '\',\'' . $ip . '\')';
         if (!$firstValue) {
             $selectQuery .= ',';
         }
         $selectQuery .= '\'' . $email . '\'';
         $firstValue = false;
         $totalInsert++;
         if ($totalInsert % 50 == 0) {
             if (empty($insertQuery)) {
                 continue;
             }
             $db = JFactory::getDBO();
             $query = 'INSERT IGNORE `#__jnews_subscribers` (`name`,`email`,`confirmed`,`receive_html`,`subscribe_date`,`column1`,`column2`,`column3`,`column4`,`column5`,`ip`) VALUES ' . $insertQuery;
             $db->setQuery($query);
             $db->query();
             $firstValue = true;
             $insertQuery = '';
             //get the id of the subscribers
             $query = 'SELECT `id` FROM `#__jnews_subscribers` WHERE `email` IN (' . $selectQuery . ')';
             $db->setQuery($query);
             $loadResultArray = $db->loadObjectList();
             $resultsSubClA = jnews::convertObjectList2Array($loadResultArray);
             $allSubscribersIDA = array_merge($allSubscribersIDA, $resultsSubClA);
             $selectQuery = '';
         } else {
             if (empty($insertQuery)) {
                 return false;
             }
             $db = JFactory::getDBO();
             $query = 'INSERT IGNORE `#__jnews_subscribers` (`name`,`email`,`confirmed`,`receive_html`,`subscribe_date`,`column1`,`column2`,`column3`,`column4`,`column5`,`ip`) VALUES ' . $insertQuery;
             $db->setQuery($query);
             $db->query();
         }
     }
     //send confirmation email if required
     if ($GLOBALS[JNEWS . 'require_confirmation'] && !empty($list2SubcribeToA)) {
         $list4Message = $allAvailableListsA[key($list2SubcribeToA)];
         $myList = jNews_Lists::getOneList($list4Message);
         $myList->subscribemessage = trim($myList->subscribemessage);
         if (empty($myList->subscribemessage) || substr_count($myList->subscribemessage, '{tag:confirm}') < 1) {
             $Sub_TAG = '{tag:confirm}';
             //'[CONFIRM]';
         } else {
             $Sub_TAG = '';
         }
         $mailing = new stdClass();
         if (!empty($myList->subscribemessage)) {
             $mailing->htmlcontent = $myList->subscribemessage;
             $mailing->textonly = $myList->subscribemessage;
         } else {
             // default message
             $mailing->textonly = 'Please confirm your subscription to our website by clicking on the following link.';
             $mailing->htmlcontent = '<br />' . $mailing->textonly . '<br /><br />';
         }
         $mailing->textonly .= $Sub_TAG;
         $mailing->htmlcontent .= $Sub_TAG;
         //insert the mailing in the mailing table
         $mailing->mailing_type = 1;
         $mailing->template_id = 0;
         $mailing->senddate = $time;
         $mailing->subject = _JNEWS_SUBSCRIBE_SUBJECT_MESS;
         $mailing->attachments = '';
         $mailing->images = '';
         $mailing->published = 1;
         $mailing->html = 1;
         $mailing->visible = 0;
         $mailing->fromname = '';
         $mailing->fromemail = '';
         $mailing->frombounce = '';
         $mailing->author_id = 0;
         $mailing->delay = 0;
         $mailing->follow_up = 0;
         $mailing->cat_id = 0;
         $mailing->delay_min = 0;
         $mailing->delay_max = 0;
         $mailing->notify_id = 0;
         $mailing->next_date = 0;
         $mailing->start_date = $time - 2;
         $mailing->issue_nb = 0;
         $mailing->createdate = $time;
         $mailing->acc_level = 0;
         $mailingID = jNews_Mailing::insertMailingData($mailing);
         //enter the emails in the queue
         $query = 'INSERT IGNORE INTO `#__jnews_queue` (`subscriber_id`,`mailing_id`,`send_date`,`priority`) ';
         $query .= 'SELECT `id`,' . intval($mailingID) . ',' . $time . ',1';
         $query .= ' FROM `#__jnews_subscribers` ';
         $query .= 'WHERE `subscribe_date`=' . $time . ' AND `confirmed`=0';
         $db->setQuery($query);
         $db->query();
     }
     if (!empty($selectQuery)) {
         //get the id of the subscribers
         $query = 'SELECT `id` FROM `#__jnews_subscribers` WHERE `email` IN (' . $selectQuery . ')';
         $db->setQuery($query);
         $loadResultArray = $db->loadObjectList();
         $resultsSubClA = jnews::convertObjectList2Array($loadResultArray);
         $allSubscribersIDA = array_merge($allSubscribersIDA, $resultsSubClA);
     }
     if (!empty($allAvailableListsA)) {
         //if lists in checkbox are not empty
         if (empty($list2SubcribeToA)) {
             jnews::printM('red', 'You need to select at least one list. Emails have been imported but not subscribed.');
             if ($GLOBALS[JNEWS . 'require_confirmation']) {
                 return 'The confirmation email cannot be sent because there is not list selected to subscribe the users.';
             } else {
                 return _JNEWS_IMPORT_FINISHED;
             }
         }
         foreach ($list2SubcribeToA as $oneselected => $vval) {
             $seleeected[] = $allAvailableListsA[$oneselected];
         }
         foreach ($list2SubcribeToA as $oneneedList => $noneed) {
             $listId = $allAvailableListsA[$oneneedList];
             //
             $query = 'INSERT IGNORE `#__jnews_listssubscribers` (`list_id`,`subscriber_id`,`subdate`) VALUES ';
             $firstTime = true;
             if (!empty($allSubscribersIDA)) {
                 foreach ($allSubscribersIDA as $oneSubcriber) {
                     if (!$firstTime) {
                         $query .= ',';
                     }
                     $query .= '(' . $listId . ',' . $oneSubcriber . ',' . $time . ')';
                     $firstTime = false;
                     if (jNews_Lists::getListType($listId) == 2) {
                         //we add directly the imported subscribers to the queue if they are imported to an autoresponder type of list
                         jNews_ListsSubs::subscribeARtoQueue($oneSubcriber, $listId);
                         //
                     } else {
                         if (jNews_Lists::getListType($listId) == 1) {
                             $arrayFollowUp = jNews_Subscribers::followInSelected($listId);
                             if (!$arrayFollowUp) {
                                 continue;
                             }
                             foreach ($arrayFollowUp as $onefollow_id) {
                                 if (in_array($onefollow_id, $seleeected)) {
                                     continue;
                                 }
                                 $query .= ',(' . $onefollow_id . ',' . $oneSubcriber . ',' . $time . ')';
                                 jNews_ListsSubs::subscribeARtoQueue($oneSubcriber, $onefollow_id);
                             }
                         }
                     }
                 }
                 $db->setQuery($query);
                 $db->query();
             }
         }
     } else {
         //otherwise we get the value from dropdown box
         $listId = JRequest::getVar('opted_list', '');
         if ($listId) {
             $query = 'INSERT IGNORE `#__jnews_listssubscribers` (`list_id`,`subscriber_id`,`subdate`) VALUES ';
             $firstTime = true;
             if (!empty($allSubscribersIDA)) {
                 foreach ($allSubscribersIDA as $oneSubcriber) {
                     if (!$firstTime) {
                         $query .= ',';
                     }
                     $query .= '(' . $listId . ',' . $oneSubcriber . ',' . $time . ')';
                     $firstTime = false;
                     if (jNews_Lists::getListType($listId) == 2) {
                         //we add directly the imported subscribers to the queue if they are imported to an autoresponder type of list
                         jNews_ListsSubs::subscribeARtoQueue($oneSubcriber, $listId);
                     } else {
                         if (jNews_Lists::getListType($listId) == 1) {
                             $arrayFollowUp = jNews_Subscribers::followInSelected($listId);
                             if (!$arrayFollowUp) {
                                 continue;
                             }
                             foreach ($arrayFollowUp as $onefollow_id) {
                                 if (in_array($onefollow_id, $seleeected)) {
                                     continue;
                                 }
                                 $query .= ',(' . $onefollow_id . ',' . $oneSubcriber . ',' . $time . ')';
                                 jNews_ListsSubs::subscribeARtoQueue($oneSubcriber, $onefollow_id);
                             }
                         }
                     }
                 }
                 $db->setQuery($query);
                 $db->query();
             }
         }
     }
     if ($saveSubsInRows) {
         //if adding subscribers in frontend through rows
         jnews::printM('green', count($allSubscribersIDA) . ' subscribers successfully added!');
     } else {
         //otherwise we import subscribers
         jnews::printM('green', count($allSubscribersIDA) . ' subscribers successfully imported!');
     }
     return _JNEWS_IMPORT_FINISHED;
 }
コード例 #17
0
ファイル: class.jnews.php プロジェクト: naka211/kkvn
 public static function upgrade_News3()
 {
     $my = JFactory::getUser();
     $db = JFactory::getDBO();
     $xf = new jNews_Config();
     $newLists = array();
     $idImportedList = array();
     $i = 0;
     $db->setQuery("SELECT * FROM #__yanc_letters");
     $newsletters = $db->loadObjectList();
     $error = $db->getErrorMsg();
     $newSubscriber = null;
     $list = null;
     $mailings = null;
     $subscriberId = 0;
     $total = 0;
     if (!empty($error)) {
         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error getting newsletters. Database error: <br />' . $error . '</p>';
         return false;
     } else {
         foreach ($newsletters as $newsletter) {
             $list->list_name = $newsletter->list_name;
             $list->list_desc = $newsletter->list_desc;
             $list->sendername = $newsletter->sendername;
             $list->senderemail = $newsletter->senderemail;
             $list->bounceadres = $newsletter->bounceadres;
             $list->layout = $newsletter->layout;
             $list->template = 0;
             $list->subscribemessage = $newsletter->subscribemessage;
             $list->unsubscribemessage = $newsletter->unsubscribemessage;
             $list->notifyadminmsg = $newsletter->notifyadminmsg;
             $list->html = $newsletter->html;
             $list->hidden = !$newsletter->hidden;
             $list->unsubscribesend = 1;
             $list->unsubscribenotifyadmin = 1;
             $list->list_type = '1';
             $list->auto_add = 0;
             $list->user_choose = 0;
             $list->cat_id = '0:0';
             $list->delay_min = 0;
             $list->delay_max = 0;
             $list->follow_up = 0;
             $list->owner = $my->id;
             $list->acc_level = $newsletter->aid;
             $list->acc_id = 29;
             $list->published = 1;
             $list->createdate = time();
             $list->footer = 1;
             $list->notify_id = 0;
             $list->notification = 0;
             $query = 'INSERT INTO `#__jnews_lists` (`list_name`) VALUES (\'' . $list->list_name . '\'  )';
             $db->setQuery($query);
             $db->query();
             $error = $db->getErrorMsg();
             if (!empty($error)) {
                 echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error adding list to database. Database error: <br />' . $error . '</p><br /><br />Are you trying to insert a list name which is already in use?    The list name has to be different for each list! <br /><br />';
             } else {
                 $query = 'SELECT * FROM `#__jnews_lists` WHERE `list_name`= \'' . $list->list_name . '\'';
                 $db->setQuery($query);
                 $mynewlist = $db->loadObject();
                 $error = $db->getErrorMsg();
                 $xf->plus('totallist0', 1);
                 $xf->plus('act_totallist0', 1);
                 $xf->plus('totallist1', 1);
                 $xf->plus('act_totallist1', 1);
                 if (!empty($error)) {
                     echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting listname. Database error: <br />' . $error . '</p>';
                     return false;
                 } else {
                     $idImportedList[$newsletter->id] = $mynewlist->list_id;
                     $newLists[$i] = $mynewlist->list_id;
                     $i++;
                     $list->id = $mynewlist->list_id;
                     $error = jNews_Lists::updateListData($list);
                     if (!$error) {
                         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting list. Database error: <br />' . $error . '</p>';
                     } else {
                         echo '<br /><b>' . @constant($GLOBALS[JNEWS . 'listnames1']) . ': </b>' . $list->list_name . ': ' . jnews::printM('green', _JNEWS_IMPORT_SUCCESS);
                         $db->setQuery("SELECT * FROM #__yanc_letters WHERE `list_id`=" . $newsletter->id);
                         $mailingsImports = $db->loadObjectList();
                         $error = $db->getErrorMsg();
                         if (!empty($error)) {
                             echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting mailings. Database error: <br />' . $error . '</p>';
                             return false;
                         } else {
                             $issue_nb = 1;
                             foreach ($mailingsImports as $mailingsImport) {
                                 $mailings->list_id = $mynewlist->list_id;
                                 $mailings->list_type = '1';
                                 $mailings->send_date = $mailingsImport->send_date;
                                 $mailings->subject = $mailingsImport->subject;
                                 $mailings->htmlcontent = $mailingsImport->htmlcontent;
                                 $mailings->textonly = $mailingsImport->textonly;
                                 $mailings->attachments = $mailingsImport->attachments;
                                 $mailings->images = $mailingsImport->images;
                                 $mailings->published = $mailingsImport->published;
                                 $mailings->visible = $mailingsImport->visible;
                                 $mailings->html = $mynewlist->html;
                                 $mailings->fromname = $list->sendername;
                                 $mailings->fromemail = $list->senderemail;
                                 $mailings->frombounce = $list->bounceadres;
                                 $mailings->author_id = $my->id;
                                 $mailings->delay = 0;
                                 $mailings->issue_nb = $issue_nb;
                                 $mailings->acc_level = 25;
                                 $mailings->createdate = $list->createdate;
                                 $issue_nb++;
                                 $error = jNews_Mailing::insertMailingData($mailings);
                                 if (!$error) {
                                     echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error inserting mailing. Database error: <br />' . $error . '</p>';
                                 } else {
                                     echo '<br /><b>' . _JNEWS_MENU_MAILING_TITLE . ': </b>' . $mailingsImport->subject . ': ' . jnews::printM('green', _JNEWS_IMPORT_SUCCESS);
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $db->setQuery("SELECT * FROM #__yanc_subscribers");
         $subscribers = $db->loadObjectList();
         $error = $db->getErrorMsg();
         if (!empty($error)) {
             echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting subscribers. Database error: <br />' . $error . '</p>';
             return false;
         } else {
             foreach ($subscribers as $subscriber) {
                 $newSubs = true;
                 $jnewssubscribers = jNews_Subscribers::getSubscribers(-1, -1, '', $total, 0, '', '', '', '', '');
                 //added one parameter for mailid
                 foreach ($jnewssubscribers as $jnewssubscriber) {
                     if ($subscriber->subscriber_email == $jnewssubscriber->email) {
                         $newSubs = false;
                         $subId[0] = $jnewssubscriber->id;
                     }
                 }
                 if ($newSubs) {
                     $newSubscriber->user_id = $subscriber->userid;
                     $newSubscriber->name = $subscriber->subscriber_name;
                     $newSubscriber->email = $subscriber->subscriber_email;
                     $newSubscriber->ip = $subscriber->ip;
                     $newSubscriber->receive_html = $subscriber->receive_html;
                     $newSubscriber->confirmed = $subscriber->confirmed;
                     $newSubscriber->subscribe_date = $subscriber->subscribe_date;
                     $newSubscriber->blacklist = 0;
                     $newSubscriber->timezone = '00:00:00';
                     $newSubscriber->language_iso = 'eng';
                     $newSubscriber->params = '';
                     if ($GLOBALS[JNEWS . 'level'] > 2) {
                         //check if the version of jnews is pro
                         $newSubscriber->column1 = $newSubscriber->column1;
                         $newSubscriber->column2 = $newSubscriber->column2;
                         $newSubscriber->column3 = $newSubscriber->column3;
                         $newSubscriber->column4 = $newSubscriber->column4;
                         $newSubscriber->column5 = $newSubscriber->column5;
                     }
                     //end if for check version pro
                     $error = jNews_Subscribers::saveSubscriber($newSubscriber, $subscriberId, true);
                     if (!empty($error)) {
                         if ($subscriberId < 1) {
                             echo ' Error inserting subscriber:' . $newSubscriber->name;
                         }
                         $error = '';
                         $subId[0] = $subscriberId;
                     } else {
                         echo '<br /><b>' . _JNEWS_MENU_SUBSCRIBERS . ': </b>' . $newSubscriber->name . ': ' . jnews::printM('green', _JNEWS_IMPORT_SUCCESS);
                         $d['email'] = $subscriber->email;
                         jNews_Subscribers::getSubscriberIdFromEmail($d);
                         $subId[0] = $d['subscriberId'];
                     }
                 } else {
                     echo '<br /><b>' . _JNEWS_MENU_SUBSCRIBERS . ': </b>' . $subscriber->subscriber_name . ': ' . jnews::printM('red', _JNEWS_IMPORT_EXIST);
                 }
                 $j = 0;
                 $queue = jNews_ListsSubs::getListSubscriberInfo($subId[0], $idImportedList[$subscriber->list_id]);
                 if (empty($queue)) {
                     $error = jNews_Queue::insertQueuesForNews($subId, $idImportedList[$subscriber->list_id], 29);
                     if (!$error) {
                         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting queue. Database error: <br />' . $error . '</p>';
                     }
                 }
             }
         }
     }
     return true;
 }
コード例 #18
0
ファイル: jnews.html.php プロジェクト: naka211/kkvn
    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;
    }
コード例 #19
0
ファイル: class.statistics.php プロジェクト: naka211/kkvn
    /**
     * 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;
    }
コード例 #20
0
ファイル: subscribers.jnews.php プロジェクト: naka211/kkvn
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;
}
コード例 #21
0
ファイル: queue.jnews.html.php プロジェクト: naka211/kkvn
    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();
    }