예제 #1
0
파일: modules.php 프로젝트: naka211/kkvn
 function fetchElement($name, $value, &$node, $control_name)
 {
     if (version_compare(JVERSION, '3.0.0', '<')) {
         JHTML::_('behavior.modal');
     } else {
         JHtml::_('behavior.modal');
     }
     $link = jNews_Tools::completeLink('option=com_content&task=element&object=content', true, false, true);
     $text = '<input class="inputbox" id="' . $control_name . 'termscontent" name="' . $control_name . '[termscontent]" type="text" size="20" value="' . $value . '">';
     $text .= '<a class="modal" id="termscontent" title="' . JText::_('Select one content which will be displayed for the Terms & Conditions') . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 650, y: 375}}"><button onclick="return false">' . JText::_('Select') . '</button></a>';
     $js = "function jSelectArticle(id, title, object) {\n\t\t\tdocument.getElementById('" . $control_name . "termscontent').value = id;\n\t\t\tdocument.getElementById('sbox-window').close();\n\t\t}";
     $doc = JFactory::getDocument();
     $doc->addScriptDeclaration($js);
     return $text;
 }
예제 #2
0
 static function displaySocialShare($mailingId = 0, $social = 'facebook', $full_screen = false)
 {
     $socialShareHTML = '';
     $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
     $archivelink = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=view&mailingid=' . $mailingId, false, $GLOBALS[JNEWS . 'use_sef']);
     $subject = jNews_Mailing::getMailingsSubject($mailingId);
     if ($social == 'twitter') {
         $img = 'twitter.png';
         $link = "http://twitter.com/home?status=" . urlencode($archivelink) . "&title=" . $subject;
         $title = "Share on Twitter";
     } elseif ($social == 'linkedin') {
         $img = 'linkedin.png';
         $link = "http://www.linkedin.com/shareArticle?mini=true&url=" . urlencode($archivelink) . "&title=" . $subject;
         $title = "Share on LinkedIn";
     } else {
         $img = 'facebook.png';
         $full_screen_text = $full_screen ? "&format=raw" : "";
         $link = "http://www.facebook.com/sharer.php?u=" . urlencode($archivelink . $full_screen_text) . "&title=" . $subject;
         $title = "Share on Facebook";
     }
     $imageLink = '<a target="_blank" href="' . $link . '" title="' . $title . '"><img src="' . JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/images/share/' . $img . '" width="16" height="16" border="0" alt="" /></a>';
     $socialShareHTML .= '<td>' . $imageLink . '</td>';
     return $socialShareHTML;
 }
예제 #3
0
파일: tags.jnews.php 프로젝트: naka211/kkvn
/**
* <p>Tags Controller</p>
* <p>This function is the controller to view the fwdtofrien view</p>
* @author Joobi Limited <wwww.joobi.co>
*/
function tags($action, $task, $templateid = '')
{
    $doc = JFactory::getDocument();
    $doc->addStyleSheet(JNEWS_URL_ADMIN . 'cssadmin/jnews.css');
    $mailing = new stdClass();
    $new = JRequest::getInt('new', 0, 'request');
    if ($GLOBALS[JNEWS . 'level'] > 2 && !$new) {
        $mailing->delay_max = JRequest::getInt('delay_max', 0, 'request');
        $mailing->notify_id = JRequest::getInt('notify_id', 0, 'request');
        $mailing->cat_id = JRequest::getVar('cat_id', 0, 'request');
    }
    jNews_TagsHTML::menuTags($mailing, $new);
    switch ($task) {
        case 'datetime':
            jNews_TagsHTML::datetimeTags();
            break;
        case 'virtuemartproduct':
            $linkTagg = jNews_Tools::completeLink('option=' . JNEWS_OPTION, true, false, true);
            //second parameter was false
            $forms['main'] = "<form action=" . $linkTagg . " method='post' name=\"adminForm\" id=\"adminForm\">";
            jNews_TagsHTML::virtuemartproduct($forms);
            break;
        case 'subscription':
            jNews_TagsHTML::subscriptionTags();
            break;
        case 'lyften':
            //for lyften blog
            $forms['main'] = " <form action='" . jNews_Tools::completeLink('option=' . JNEWS_OPTION, true, false, true) . "' method='post' name=\"adminForm\" id=\"adminForm\">";
            jNews_TagsHTML::lyftenblog();
            break;
        case 'deals':
            //for deals
            $forms['main'] = " <form action='" . jNews_Tools::completeLink('option=' . JNEWS_OPTION, true, false, true) . "' method='post' name=\"adminForm\" id=\"adminForm\">";
            jNews_TagsHTML::deals();
            break;
        case 'subscriber':
            jNews_TagsHTML::subscriberTags();
            break;
        case 'mod':
            ## joomla module
            if ($GLOBALS[JNEWS . 'level'] > 1) {
                $linkTagg = jNews_Tools::completeLink('option=' . JNEWS_OPTION, true, false, true);
                //second parameter was false
                $forms['main'] = " <form action=" . $linkTagg . " method='post' name=\"adminForm\" id=\"adminForm\">";
                jNews_TagsHTML::modTags($forms);
            } else {
                echo 'This functionality in only available for Plus and PRO version.';
            }
            break;
        case 'content':
            ## joomla content
            $linkTagg = jNews_Tools::completeLink('option=' . JNEWS_OPTION, true, false, true);
            //second parameter was false
            $forms['main'] = "<form action=" . $linkTagg . " method='post' name=\"adminForm\" id=\"adminForm\">";
            jNews_TagsHTML::contentTags($forms);
            break;
        case 'k2content':
            ## k2 content
            jNews_TagsHTML::k2contentTags();
            break;
        case 'smart':
            ## smart news
            if ($GLOBALS[JNEWS . 'level'] > 2) {
                jNews_Autonews::selectCat($mailing);
            } else {
                echo 'This functionality in only available for PRO version.';
            }
            break;
        case 'smartk2':
            ## smart news
            if ($GLOBALS[JNEWS . 'level'] > 2) {
                jNews_Autonews::selectCatK2($mailing);
            } else {
                echo 'This functionality in only available for PRO version.';
            }
            break;
        case 'site':
            $linkTagg = jNews_Tools::completeLink('option=' . JNEWS_OPTION, false, false, true);
            $forms['main'] = "<form action=" . $linkTagg . " method='post' name=\"adminForm\" id=\"adminForm\">";
            jNews_TagsHTML::siteTags($forms);
            break;
        case 'jomsocial':
            $linkTagg = jNews_Tools::completeLink('option=' . JNEWS_OPTION, false, false, true);
            $forms['main'] = "<form action=" . $linkTagg . " method='post' name=\"adminForm\" id=\"adminForm\">";
            jNews_TagsHTML::jomsocialTags($forms);
            break;
        case 'share':
            $linkTagg = jNews_Tools::completeLink('option=' . JNEWS_OPTION, false, false, true);
            $forms['main'] = "<form action=" . $linkTagg . " method='post' name=\"adminForm\" id=\"adminForm\">";
            jNews_TagsHTML::shareTags($forms);
            break;
        case 'flexicontent':
            if ($GLOBALS[JNEWS . 'level'] > 2) {
                $linkTagg = jNews_Tools::completeLink('option=' . JNEWS_OPTION, false, false, true);
                $forms['main'] = "<form action=" . $linkTagg . " method='post' name=\"adminForm\" id=\"adminForm\">";
                jNews_TagsHTML::flexicontent($mailing);
            } else {
                echo 'This functionality in only available for PRO version.';
            }
            break;
        default:
            $linkTagg = jNews_Tools::completeLink('option=' . JNEWS_OPTION, false, false, true);
            $forms['main'] = "<form action=" . $linkTagg . " method='post' name=\"adminForm\" id=\"adminForm\">";
            jNews_TagsHTML::subscriptionTags($forms);
    }
    return true;
}
예제 #4
0
    /**
     * <p>public static function to create the menu of the tags popup view<p>
     * @param object $mailing - used by the autocontent tagging which is only for pro version
     */
    public static function menuTags($mailing = null, $new = 1)
    {
        $mainframe = JFactory::getApplication();
        $url = JURI::base();
        $doc = JFactory::getDocument();
        if ($mainframe->isAdmin()) {
            $doc->addStyleSheet(JNEWS_URL_ADMIN . 'cssadmin/jnews.css');
            //css for the table
            $doc->addStyleSheet('components/' . JNEWS_OPTION . '/cssadmin/jnews.tags.css');
            //css for the menu
        } else {
            $doc->addStyleSheet('components/' . JNEWS_OPTION . '/css/jnews.tags.css');
        }
        $task = JRequest::getVar('task');
        $listype = JRequest::getInt('listype');
        switch ($task) {
            case 'site':
                $title = _JNEWS_TAGTITLE_SITE;
                break;
            case 'content':
                $title = _JNEWS_TAGTITLE_CONTENT;
                break;
            case 'k2content':
                $title = _JNEWS_TAGMENU_K2CONTENT;
                break;
            case 'smart':
                $title = _JNEWS_TAGTITLE_AUTOCONTENT;
                break;
            case 'smartk2':
                $title = _JNEWS_TAGTITLE_AUTOCONTENT_K2;
                break;
            case 'mod':
                $title = _JNEWS_TAGTITLE_MOD;
                break;
            case 'subscription':
                $title = _JNEWS_TAGMENU_SUBSCRIPTION;
                break;
            case 'subscriber':
                $title = _JNEWS_MENU_SUBSCRIBERS;
                break;
            case 'datetime':
                $title = _JNEWS_TAGMENU_DATETIME;
                break;
            case 'virtuemartproduct':
                $title = _JNEWS_TAGMENU_VMPRODUCTS;
                break;
            case 'jomsocial':
                $title = _JNEWS_TAGMENU_JOMSOCIAL;
                break;
            case 'share':
                $title = _JNEWS_TAGMENU_MEDIA_SHARE;
                break;
            case 'lyften':
                $title = _JNEWS_TAGMENU_BLOGS;
                break;
            case 'deals':
                $title = _JNEWS_TAGMENU_DEALS;
                break;
            case 'flexicontent':
                //$title = _JNEWS_TAGMENU_FLEXICONTENT;
                break;
            default:
                $title = _JNEWS_TAGMENU_SUBSCRIPTION;
        }
        ?>
<h1><?php 
        echo 'Tag: ' . $title;
        ?>
</h1>

<div id="submenu-box">
		<div class="t">
                    <div class="t">
                    <div class="t"></div>
                    </div>
 		</div>
		<div class="m">
			<div style="display:block; height:45px;">
			<ul id="submenu">
			<?php 
        $tags = array(_JNEWS_TAGMENU_SUBSCRIPTION, _JNEWS_MENU_SUBSCRIBERS, _JNEWS_TAGMENU_DATETIME, _JNEWS_TAGMENU_WEBSITE, _JNEWS_TAGMENU_CONTENT);
        //we check first if the plugins(virtuemart, k2 and jomsocial) are installed or unpublished
        JPluginHelper::importPlugin('jnews');
        $vmp = JPluginHelper::getPlugin('jnews', 'virtuemartproduct');
        $jomsocial = $mainframe->triggerEvent('jnewsbot_jomsocial_editabs');
        $share = $mainframe->triggerEvent('jnewsbot_share_editabs');
        $k2 = $mainframe->triggerEvent('jnewsbot_k2editabs');
        $blogs = $mainframe->triggerEvent('jnewsbot_blog_editabs');
        $deals = $mainframe->triggerEvent('jnewsbot_deal_editabs');
        if (!empty($vmp)) {
            $tags[] = _JNEWS_TAGMENU_VMPRODUCTS;
        }
        if (!empty($k2)) {
            $tags[] = _JNEWS_TAGMENU_K2CONTENT;
        }
        if ($GLOBALS[JNEWS . 'level'] > 2) {
            $joobiInclude = jnews::includejoobi();
            if (!empty($jomsocial) and $joobiInclude) {
                if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) {
                    //we check if the social class file exists for the implementation of master lists
                    if (class_exists('jNews_Social')) {
                        $tags[] = _JNEWS_TAGMENU_JOMSOCIAL;
                    }
                }
            }
        }
        if (!empty($share)) {
            $tags[] = _JNEWS_TAGMENU_MEDIA_SHARE;
        }
        if (!empty($blogs)) {
            $tags[] = _JNEWS_TAGMENU_BLOGS;
        }
        if (!empty($deals)) {
            $tags[] = _JNEWS_TAGMENU_DEALS;
        }
        if ($GLOBALS[JNEWS . 'level'] > 2 && $listype == 7) {
            $tags[] = _JNEWS_TAGMENU_AUTOCONTENT;
            $tags[] = _JNEWS_TAGMENU_AUTOCONTENT_K2;
            //$tags[]=_JNEWS_TAGMENU_FLEXICONTENT;
        }
        if ($GLOBALS[JNEWS . 'level'] > 1) {
            $tags[] = _JNEWS_TAGMENU_MODULE;
        }
        foreach ($tags as $tag) {
            switch ($tag) {
                case _JNEWS_TAGMENU_SUBSCRIPTION:
                    $task = 'subscription';
                    break;
                case _JNEWS_MENU_SUBSCRIBERS:
                    $task = 'subscriber';
                    break;
                case _JNEWS_TAGMENU_USERS:
                    $task = 'user';
                    break;
                case _JNEWS_TAGMENU_DATETIME:
                    $task = 'datetime';
                    break;
                case _JNEWS_TAGMENU_VMPRODUCTS:
                    $task = 'virtuemartproduct';
                    break;
                case _JNEWS_TAGMENU_WEBSITE:
                    $task = 'site';
                    break;
                case _JNEWS_TAGMENU_CONTENT:
                    $task = 'content';
                    break;
                case _JNEWS_TAGMENU_K2CONTENT:
                    $task = 'k2content';
                    break;
                case _JNEWS_TAGMENU_JOMSOCIAL:
                    $task = 'jomsocial';
                    break;
                case _JNEWS_TAGMENU_MEDIA_SHARE:
                    $task = 'share';
                    break;
                case _JNEWS_TAGMENU_AUTOCONTENT:
                    $task = 'smart';
                    break;
                case _JNEWS_TAGMENU_AUTOCONTENT_K2:
                    $task = 'smartk2';
                    break;
                case _JNEWS_TAGMENU_MODULE:
                    $task = 'mod';
                    break;
                case _JNEWS_TAGMENU_BLOGS:
                    $task = 'lyften';
                    break;
                case _JNEWS_TAGMENU_DEALS:
                    $task = 'deals';
                    break;
                case _JNEWS_TAGMENU_FLEXICONTENT:
                    $task = 'flexicontent';
                    break;
                default:
                    $task = '';
            }
            //endswicth
            $class = '';
            if ($GLOBALS[JNEWS . 'level'] > 2) {
                if (!$new) {
                    echo '<li' . $class . '><a href="' . jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags&task=' . $task . '&cat_id=' . $mailing->cat_id . '&listype=' . $listype . '&delay_max=' . $mailing->delay_max . '&notify_id=' . $mailing->notify_id, true, false, true) . '">' . $tag . '</a></li>';
                } else {
                    echo '<li' . $class . '><a href="' . jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags&task=' . $task . '&cat_id=0:0&listype=' . $listype . '&new=1', true, false, true) . '">' . $tag . '</a></li>';
                }
            } else {
                $linkTh = jNews_Tools::completeLink('option=' . JNEWS_OPTION, true, false, true);
                echo '<li' . $class . '><a href="' . jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags&task=' . $task . '&listype=' . $listype, true, false, true) . '">' . $tag . '</a></li>';
            }
        }
        ?>
		</ul>
		<div class="clr"></div>
		</div>
	</div>
	<div class="b">
	<div class="b">
 	<div class="b"></div>
	</div>
	</div>
</div>
<div style="clear:both; margin-bottom:25px;"></div>
	<?php 
    }
예제 #5
0
파일: content.php 프로젝트: naka211/kkvn
 function _convertAndLayoutText($articleA, $layout)
 {
     global $mainframe;
     if (empty($layout)) {
         $layout = 1;
     }
     foreach ($articleA as $oneArticle) {
         if (version_compare(JVERSION, '1.6.0', '<')) {
             $Itemid = $mainframe->getItemId($oneArticle->id);
         }
         if (empty($Itemid)) {
             $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
         }
         if ($GLOBALS[JNEWS . 'show_author'] == 1) {
             $author = "\r\n" . $oneArticle->created_by_alias;
         } else {
             $author = '';
         }
         $oneArticle->title = "<b>" . strtoupper(jNews_ProcessMail::htmlToText($oneArticle->title)) . "</b>";
         $oneArticle->introtext = jNews_ProcessMail::htmlToText($oneArticle->introtext);
         $oneArticle->fulltext = jNews_ProcessMail::htmlToText($oneArticle->fulltext);
         if ($layout == 0) {
             $text = $oneArticle->title . $author . "\r\n" . $oneArticle->introtext . "\r\n" . $oneArticle->fulltext . "\r\n" . $text;
         } else {
             $link = 'option=com_content&view=article&id=' . $oneArticle->id . '&Itemid=' . $Itemid;
             $link = jNews_Tools::completeLink($link, false, $GLOBALS[JNEWS . 'use_sef']);
             if ($layout == 1) {
                 if (empty($oneArticle->fulltext) and !empty($GLOBALS[JNEWS . 'word_wrap'])) {
                     if (strlen($oneArticle->introtext) > $GLOBALS[JNEWS . 'word_wrap']) {
                         $oneArticle->introtext = substr(strip_tags($oneArticle->introtext), 0, $GLOBALS[JNEWS . 'word_wrap']) . '...';
                     }
                 }
                 $text = $oneArticle->title . $author . "\r\n" . $oneArticle->introtext . "\r\n" . '* ' . _JNEWS_READMORE . ' ( ' . $link . ' )' . "\r\n";
             } else {
                 $text = $oneArticle->title . ' ( ' . $link . ' )';
             }
         }
         $text = str_replace('{mosimage}', '', $text);
     }
     $text = str_replace('{mospagebreak}', "\r\n \r\n", $text);
 }
예제 #6
0
파일: jnews.html.php 프로젝트: naka211/kkvn
 public static function cpanelHTML($listId, $Itemid)
 {
     if (empty($Itemid)) {
         $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
     }
     $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0;
     if (jnews::checkPermissions('admin') || jnews::checkPermissions($gid)) {
         //subscribers button
         //		$link = 'option='.JNEWS_OPTION.'&act=subscribers&mid=2&Itemid='.$Itemid;//.'&listid='.$listId;
         //alex pagination
         $link = 'option=' . JNEWS_OPTION . '&act=subscribers&mid=2';
         $link = jNews_Tools::completeLink($link, false);
         backHTML::quickiconButton($link, 'addusers.png', _JNEWS_SUBSCRIBERS, false, 'all', false);
     }
     //add the newsletter button and smartnewsletter button in the cpanel
     // newsletter button
     //    	$link = 'option='.JNEWS_OPTION.'&act=mailing&mid=3&listype=1&Itemid='.$Itemid;
     //alex pagination
     $link = 'option=' . JNEWS_OPTION . '&act=mailing&mid=3&listype=1';
     $link = jNews_Tools::completeLink($link, false);
     backHTML::quickiconButton($link, 'newsletterFE.png', _JNEWS_NEWSLETTER, false, 'all', false);
     // smart newsletter button
     if ($GLOBALS[JNEWS . 'allow_sn']) {
         $link = 'option=' . JNEWS_OPTION . '&act=mailing&mid=4&listid=' . $listId . '&listype=7&Itemid=' . $Itemid;
         $link = jNews_Tools::completeLink($link, false);
         backHTML::quickiconButton($link, 'smartnewsletterFE.png', _JNEWS_AUTONEWS, false, 'all', false);
     }
     //		88744551 - auto-responder action should be list not mailing
     //autoresponder button
     if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) {
         if (class_exists('jNews_Social') && $GLOBALS[JNEWS . 'allow_fe_autoresponder']) {
             //8254465
             if (jnews::checkPermissions('admin') || jnews::checkPermissions($gid)) {
                 $link = 'option=' . JNEWS_OPTION . '&act=list&mid=5&listype=2&Itemid=' . $Itemid;
                 $link = jNews_Tools::completeLink($link, false);
                 backHTML::quickiconButton($link, 'autoresponderFE.png', _JNEWS_MENU_AUTOS, false, 'all', false);
             }
         }
     }
     if (jnews::checkPermissions('admin') || jnews::checkPermissions($gid)) {
         //statistics and reports button
         //    		$link = 'option='.JNEWS_OPTION.'&act=statistics&mid=6&listype=1&listid='. $listId .'&Itemid='.$Itemid;
         //alex pagination
         $link = 'option=' . JNEWS_OPTION . '&act=statistics&mid=6&listype=1&listid=' . $listId;
         $link = jNews_Tools::completeLink($link, false);
         backHTML::quickiconButton($link, 'statistics.png', _JNEWS_MENU_STATS_REPORTS, false, 'all', false);
     }
     return true;
 }
예제 #7
0
    public static function attachement($mailingEdit, $lists, $show)
    {
        $js = "function deleteattach(rem, reml, url){\n\t";
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //1.5
            $js .= "\n \t\t\t\tvar ajax = new Ajax(url,\n \t\t\t\t\t{data: 'rem='+rem+'&reml='+reml,\n \t\t\t\t\tmethod: 'POST',\n \t\t\t\t\tonComplete : function(result){\n \t\t\t\t\t\t\tvar myElement = document.getElementById(rem);\n\t\t\t\t\t\t\tmyElement.remove();\n\t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t);\n \t\t\t\tajax.request();\n \t\t\t";
        } else {
            $js .= "\n\t\tvar ajax = new Request({\n\t\turl : url,\n\t\tdata: 'rem='+rem+'&reml='+reml,\n\t\tmethod: 'POST',\n\t\tonComplete : function(result){\n\t\t\t\tvar myElement = document.getElementById(rem);\n\t\t\t\tmyElement.destroy();\n\t\t\t}\n\t\t});\n\t\tajax.send();\n \t\t\t";
        }
        $js .= "}";
        $urlcomm = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=deleteattach', false, false, true);
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        foreach ($mailingEdit->attachments as $attach => $k) {
            $mailingEdit->attachments[$attach] = basename($k);
        }
        $path = JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'upload_url'];
        $arr = array(null);
        // Get the files and folders
        jimport('joomla.filesystem.folder');
        $files2 = JFolder::files($path, '.', true, true);
        $folders = JFolder::folders($path, '.', true, true);
        // Merge files and folders into one array
        if (!is_array($files2)) {
            $files = $folders;
        } else {
            $files = array_merge($files2, $folders);
        }
        // Sort them all
        if (!empty($files)) {
            asort($files);
        } else {
            $files = array();
        }
        // check deleted attachments
        $rem = JRequest::getVar('rem');
        if (!empty($rem)) {
            // get the lenght of the previous url
            $reml = JRequest::getVar('reml');
            jNews_Attachment::deleteAttachment($rem);
            jNews_Attachment::deleteAttachmentQuery($rem);
            if (version_compare(JVERSION, '1.6.0', '<')) {
                //j15
                // create delete link for attachment files
                $urlInstances = JURI::getInstance();
                $uri = $urlInstances->_uri;
            } else {
                $urlInstances = JURI::getInstance();
                $uri = $urlInstances->toString();
            }
            if (isset($uri) && !empty($uri)) {
                $url = $uri;
                $url = substr($url, 0, '-' . (int) $reml);
                // refresh or reload page with the extra url [previous]
                jNews_Tools::redirect($url);
            }
        }
        if (sizeof($files) > 0) {
            if (version_compare(JVERSION, '1.6.0', '<')) {
                //j15
                $delImgPath = JNEWS_JPATH_LIVE . DS . 'administrator' . DS . 'images' . DS . 'delete_f2.png';
            } else {
                //j16
                $delImgPath = JNEWS_JPATH_LIVE . DS . 'administrator' . DS . 'components' . DS . JNEWS_OPTION . DS . 'images' . DS . 'delete_queue.png';
            }
            $urlExtraLength = 0;
            foreach ($files as $file) {
                $file = basename($file);
                if (version_compare(JVERSION, '1.6.0', '<')) {
                    //j15
                    // create delete link for attachment files
                    $urlInstances = JURI::getInstance();
                    $uri = $urlInstances->_uri;
                } else {
                    //					$uri = JURI::getInstance()->toString();
                    $urlInstances = JURI::getInstance();
                    $uri = $urlInstances->toString();
                }
                if (!empty($uri)) {
                    $url = $uri;
                    $urlExtra = "&rem=" . $file . "&reml=";
                    $urlExtraMain = $urlExtra;
                    // we need to get the extra url length
                    $urlExtraLength = strlen($urlExtra);
                    // now we need to add the length count
                    $urlExtra .= $urlExtraLength;
                    // we need to get the extra url length again with its length count
                    $urlExtraLength = strlen($urlExtra);
                    // we need to set the length count again [ now with its full count] and set it as our final url
                    $url .= $urlExtraMain . $urlExtraLength;
                    $link = '<a href="' . $url . '">';
                } else {
                    $url = "Link Error";
                    $link = '<a href="' . $url . '" onClick="window.alert("wee");">';
                }
                if (in_array($file, $mailingEdit->attachments)) {
                    //					echo "<input name='attachments[]' type='checkbox' value='".$file."' checked> ". $file ." ". $link ." <img src='". $delImgPath ."'  title='Delete ". $file ."' style='width:16px;height:16px;'></a> <br>";
                    echo "<div id='" . $file . "'><input name='attachments[]' type='checkbox' value='" . $file . "' checked> " . $file . " " . " <img src='" . $delImgPath . "' onclick='deleteattach(\"" . $file . "\",\"" . $urlExtraLength . "\",\"" . $urlcomm . "\")'  title='Delete " . $file . "' style='width:16px;height:16px;'> </div>";
                } else {
                    //wwe comment this one this one because we ewill not show the index.html
                    //					echo "<input name='attachments[]' type='checkbox' value='".$file."'> ". $file ." ". $link ." <img src='". $delImgPath ."' title='Delete ". $file ."' style='width:16px;height:16px;'></a> <br>";
                }
            }
        }
        echo "<br><br>";
        ?>
		<script src="<?php 
        echo JNEWS_URL_INCLUDES;
        ?>
multifile.js"></script>

		<input id="my_file_element" type="file" name="file_1" >
		</input>

		<br /><b><?php 
        echo _JNEWS_FILES;
        ?>
:</b>

		<div id="files_list"></div>
		<script>

			var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 10 );
			multi_selector.addElement( document.getElementById( 'my_file_element' ) );
		</script>

	<?php 
    }
예제 #8
0
파일: frontend.php 프로젝트: naka211/kkvn
 /**
  * @param string $action
  * @param string $task
  * to display the redirect  on the view
  */
 public static function leads($action, $task)
 {
     if (empty($GLOBALS[JNEWS . 'show_jlinks'])) {
         return true;
     }
     $acajLinkey = 'jnewslink5wroot';
     $acajNewsKey = 'jnewsKa2f6gpw';
     $acajAutoKey = 'jnewsK9dfn7lws';
     $acajSmartKey = 'jnewsK8kd92hf';
     $acajMailKey = 'jnewsKo02j6d4u5aco';
     static $ezlinks = false;
     static $loaded = false;
     //TODO put priority if easylinks and jlinks exist or add checking if easylinks is installed instead of jlinks
     if (!$loaded) {
         if (!defined('JOOBI_SECURE')) {
             define('JOOBI_SECURE', true);
         }
         $joobiEntryPoint = __FILE__;
         if (defined('JPATH_ROOT')) {
             $path = JPATH_ROOT;
         } elseif (isset($mosConfig_absolute_path)) {
             $path = $mosConfig_absolute_path;
         }
         $status = false;
         //if EasyLinks or jLinks is not installed on the website there is no need to proceed
         if (file_exists($path . DS . 'administrator' . DS . 'components' . DS . 'com_jlink' . DS . 'y.php')) {
             //Prioritize Easy Links	loading
             $status = @(include $path . DS . 'administrator' . DS . 'components' . DS . 'com_jlink' . DS . 'y.php');
             if (!$status && !defined('INSTALLER_FOLDER')) {
                 echo "We were unable to load Easy Links library.";
             } else {
                 $ezlinks = true;
             }
         }
         //if Easylinks is not installed or is installed but file include was not successful
         if (!$ezlinks) {
             //if jLinks is not installed on the website there is no need to proceed
             if (!file_exists($path . DS . 'joobi' . DS . 'entry.php')) {
                 return true;
             }
             $status = @(include $path . DS . 'joobi' . DS . 'entry.php');
             if (!$status && !defined('INSTALLER_FOLDER')) {
                 echo "We were unable to load Joobi library.";
             }
         }
         //file include trials failed
         if (!$status) {
             return true;
         }
         $loaded = true;
     }
     switch ($task) {
         case 'show':
             $linkForm = 'option=' . JNEWS_OPTION . '&act=leads&mid=7&type=50';
             $linkForm = jNews_Tools::completeLink($linkForm, false);
             $menuBack = new stdClass();
             $menuBack->popup = new stdClass();
             $menuBack->popup->isPop = false;
             $menuBack->link = $linkForm;
             $menuBack->action = 'back';
             $menuBack->onclick = new stdClass();
             $menuBack->onclick->custom = true;
             $menuBack->onclick->js = 'javascript:history.go(-1)';
             $menuBack->title = _JNEWS_MENU_BACK;
             frontHTML::formStart(_JNEWS_LEADS_REP, 0, '', $menuA);
             $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0;
             frontHTML::FEmenu();
             frontHTML::formEndFN(null, '');
             $params = new stdClass();
             $params->controller = 'redirect-history';
             $params->task = 'show';
             $params->option = JNEWS_OPTION;
             $params->level = 50;
             $params->wid = WGet::extension('redirect.node', 'wid');
             $this->layout = WView::get('redirect_historylist', 'html', null, '', $params);
             $view = $this->layout->make();
             break;
         default:
             //default task = listing
             $linkForm = 'option=' . JNEWS_OPTION;
             $linkForm = jNews_Tools::completeLink($linkForm, false);
             $menuCpanel = new stdClass();
             $menuCpanel->popup = new stdClass();
             $menuCpanel->popup->isPop = false;
             $menuCpanel->link = $linkForm;
             $menuCpanel->action = 'cpanel';
             $menuCpanel->onclick = new stdClass();
             $menuCpanel->onclick->custom = true;
             $menuCpanel->onclick->js = 'javascript:history.go(-1)';
             $menuCpanel->title = _JNEWS_MENU_CPANEL;
             $menuA['cpanel'] = $menuCpanel;
             frontHTML::formStart(_JNEWS_LEADS_REP, 0, '', $menuA);
             frontHTML::FEmenu();
             frontHTML::formEndFN(null, '');
             $params = new stdClass();
             $params->controller = 'redirect';
             $params->task = 'listing';
             $params->option = JNEWS_OPTION;
             $params->wid = WGet::extension('redirect.node', 'wid');
             $this->layout = WView::get('redirects_listing', 'html', null, '', $params);
             $view = $this->layout->make();
             $view = str_replace('option=com_jcenter&controller=redirect-history', 'option=' . JNEWS_OPTION . '&act=leads&task=show&mid=7', $view);
             $view = str_replace('option=com_jcenter&controller=redirect&task=edit', 'option=' . JNEWS_OPTION . '&act=leads&mid=7&type=50', $view);
     }
     WPage::addScript(JOOBI_JS . 'rootscript.js');
     echo $view;
     return true;
 }
예제 #9
0
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;
}
예제 #10
0
 /** we call this public static function to get the content of the articles via ajax
  * we directly insert the article in the newsletter without the tags
  * */
 public static function getContent($artId = 0, $contentType = 0, $task = '', $template_id = '')
 {
     $mainframe = JFactory::getApplication();
     ob_clean();
     //j15
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $Itemid = $mainframe->getItemId($artId);
     }
     if (empty($Itemid)) {
         $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
     }
     if ($task == 'articleContent') {
         $content = jNews_Mailing::getContentDetail($artId);
     } elseif ($task == 'blogContent') {
         $content = jNews_Mailing::getBlogDetail($artId);
     }
     if ($GLOBALS[JNEWS . 'show_author'] == 1) {
         $author = '<br />' . $content->created_by_alias;
     } else {
         $author = '';
     }
     //we get the details of the article
     //if show only the title
     if ($contentType == 2) {
         $link = 'option=com_content&view=article&id=' . $artId . '&Itemid=' . $Itemid;
         $link = jNews_Tools::completeLink($link, false, $GLOBALS[JNEWS . 'use_sef']);
         $contentD = '<a href="' . $link . '"><span class="aca_title">' . $content->title . '</span></a>';
     } elseif ($contentType == 0) {
         //to show the  full article
         $contentD = '<div class="aca_content"><span class="aca_title">' . $content->title . '</span>' . "\r\n" . $author . '<br />' . $content->introtext . '<br />' . "\r\n" . $content->fulltext . "\r\n" . '</div>';
         //TO DO: images
     } else {
         //title, intro and readmore
         if ($task == 'articleContent') {
             $link = 'option=com_content&view=article&id=' . $artId . '&Itemid=' . $Itemid;
         } elseif ($task == 'blogContent') {
             $link = 'option=com_lyftenbloggie&view=lyftenbloggie&view=entry&id=' . $artId . '&Itemid=' . $Itemid;
         }
         $link = jNews_Tools::completeLink($link, false, $GLOBALS[JNEWS . 'use_sef']);
         $wordwrap = $GLOBALS[JNEWS . 'word_wrap'];
         if (empty($content->fulltext) and !empty($wordwrap)) {
             //Limit the number of words
             if (strlen($content->introtext) > $wordwrap) {
                 //$fulltext = $content->introtext;
                 $fulltext = strip_tags($content->introtext, '<br><img>');
                 if (strlen($fulltext) > $wordwrap) {
                     //We make sure we won't cut any html tag :
                     $open = 0;
                     $limitText = strlen($fulltext) - 1;
                     for ($i = 0; $i < strlen($fulltext); $i++) {
                         if ($content->introtext[$i] == '<') {
                             $open++;
                         }
                         continue;
                         if ($content->introtext[$i] == '>') {
                             $open--;
                         }
                         continue;
                         if ($content->introtext[$i] == " " and $i > $wordwrap and $open == 0) {
                             $limitText = $i - 1;
                             break;
                         }
                     }
                     $content->introtext = substr($fulltext, 0, $limitText) . '...';
                 }
             }
             if (empty($content->fulltext) and !empty($GLOBALS[JNEWS . 'word_wrap'])) {
                 if (strlen($content->introtext) > $GLOBALS[JNEWS . 'word_wrap']) {
                     //$content->introtext = substr(strip_tags($content->introtext),0,$GLOBALS[JNEWS.'word_wrap']).'...';
                     $content->introtext = substr($content->introtext, 0, $GLOBALS[JNEWS . 'word_wrap']) . '...';
                 }
             }
         }
         $images = jNews_Mailing::getimage($content->images);
         foreach ($images as $image) {
             $image_string = '<img src="' . JNEWS_JPATH_LIVE_NO_HTTPS . '/images/stories/' . $image['image'] . '" align="' . $image['align'] . '" alt="' . $image['alttext'] . '" border="' . $image['border'] . '" />';
             $contentD = preg_replace('/{mosimage}/', $image_string, $contentD, 1);
         }
         $contentD = str_replace('{mosimage}', '', $contentD);
         $contentD = '<div class="aca_content"><span class="aca_title">' . $content->title . '</span>' . "\r\n" . $author . '<br />' . $content->introtext . '<br />' . "\r\n" . '<a href="' . $link . '"><span class="aca_readmore">' . _JNEWS_READMORE . '</span></a>' . "\r\n" . '</div>';
         //$contentD = '<div class="aca_content"><span class="aca_title" style="display:block; text-indent:5px; font-weight: bold; width: 100%; font-size: 1.2em; text-decoration: none; color: rgb(255, 255, 255); border: 1px solid rgb(50, 154, 167); background-color: rgb(2, 91, 135);">' . $content->title . '</span>' . "\r\n" . $author . '<br />' . $content->introtext . '<br />' . "\r\n" . '<a href="' . $link . '"><span class="aca_readmore" style="font-weight:bold; color:#ffffff; font-size:11px; float: right; border: 1px solid rgb(50, 154, 167); background-color: rgb(2, 91, 135); padding: 2px 8px;">' . _JNEWS_READMORE . '</span></a>' . "\r\n".'</div>';
         //}
     }
     //insert the styles of this template
     if (!empty($template_id)) {
         jNews_Templates::includeStyles($contentD, $template_id);
     }
     if ($task == 'articleContent') {
         echo "<div id=artcontent_{$artId}>{$contentD}</div>";
     } elseif ($task == 'blogContent') {
         echo "<div id=blogcontent_{$artId}>{$contentD}</div>";
     }
     return true;
 }
예제 #11
0
    public static function showCompsList($update)
    {
        $link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=subscribers&task=import');
        ?>
		</table>
		If you want to import a list of subscribers from a file, <a href="<?php 
        echo $link;
        ?>
">please click here.</a>
		<br/>
		<?php 
        if ($update->otherComponent) {
            ?>
				<table width="100%" cellpadding="4" cellspacing="0" border="0" align="left" class="adminlist">
					<tr>
						<th colspan="4"><?php 
            echo _JNEWS_CHECK_COMP;
            ?>
</th>
					</tr>
				<?php 
            foreach ($update->otherComponent as $component) {
                $moreLink = '<a href="' . $component->homePath . '" traget="_blank">' . _JNEWS_MORE_INFO . '</a>';
                $tryitLink = '<a href="' . $component->download . '" traget="_blank">' . _JNEWS_TRY_IT . '</a>';
                ?>
					<tr>
						<td>
						<?php 
                echo $component->longVersion;
                echo '<br />' . $component->desc;
                ?>
						</td>
					<td>
					<?php 
                echo $tryitLink;
                ?>
					</td>
					<td>
					<?php 
                echo $moreLink;
                ?>
					</td>
					</tr>
				<?php 
            }
            ?>
				</table>
				<?php 
        }
    }
예제 #12
0
/**
 * <p>Function to replace {fwdtofriend:Forward to a friend.} tag to a forward to a friend link</p>
 * @param string $content - the html/text version of mailing
 * @param object $receiver - receiver of the newsletter
 */
function fwdtofriendTransform(&$content, $fwdObj = null)
{
    if (empty($fwdObj->subscriber)) {
        $my = JFactory::getUser();
        if ($fwdObj == null) {
            $fwdObj = new stdClass();
        }
        $fwdObj->subscriber->name = $my->name;
        $fwdObj->subscriber->email = $my->email;
        $fwdObj->subscriber->receive_html = true;
    }
    JPluginHelper::importPlugin('jnews');
    $plugin = JPluginHelper::getPlugin('jnews', 'forwardtofriend');
    jimport('joomla.html.parameter');
    $registry = new JRegistry();
    if (!method_exists($registry, 'loadString')) {
        $data = trim($plugin->params);
        $options = array('processSections' => false);
        if (substr($data, 0, 1) != '{' && substr($data, -1, 1) != '}') {
            $ini = JRegistryFormat::getInstance('INI');
            $obj = $ini->stringToObject($data, $options);
        } else {
            $obj = json_decode($data);
        }
        $registry->loadObject($obj);
    } else {
        $registry->loadString($plugin->params);
    }
    $params = $registry;
    $paramView = $params->get('viewtemplate', 'notemplate');
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //j15
        $viewtemp = $paramView == 'notemplate' ? true : false;
    } else {
        //j16
        $viewtemp = false;
    }
    $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
    ##catches all the fwdtofriend tags on the newsletter html and text body
    preg_match_all('#\\{tag:fwdtofriend.{3,}?\\}#', $content, $tags);
    $replace = array();
    $replacebyHTML = array();
    $replacebyText = array();
    if (!empty($tags[0])) {
        ##create the link
        $frmEmail = base64_encode($fwdObj->subscriber->email);
        $frmName = base64_encode($fwdObj->subscriber->name);
        foreach ($tags[0] as $tag) {
            $fwdtofriendhtml = '';
            $fwdtofriendtext = '';
            $isolate = explode('tag:fwdtofriend name=', $tag);
            $themeEx = explode('theme=', $isolate[1]);
            if (!empty($themeEx[1])) {
                $themURL = '&format=raw';
                $themeEx[0] .= '}';
            } else {
                $themURL = '';
            }
            $details = explode('}', $themeEx[0]);
            if (!empty($replace[$tag])) {
                continue;
            }
            $link = 'option=' . JNEWS_OPTION . '&act=fwdtofriend&frmname=' . $frmName . '&frmemail=' . $frmEmail . '&html=' . $fwdObj->subscriber->receive_html . '&mailingid=' . $fwdObj->mailingid . '&listid=' . $fwdObj->listid . '&Itemid=' . $Itemid;
            $link = jNews_Tools::completeLink($link . $themURL, false, $GLOBALS[JNEWS . 'use_sef'], $viewtemp);
            $replace[$tag] = $tag;
            $fwdtofriendhtml = '<a href="' . $link . '"><span class="aca_fwdtofriend">' . $details[0] . '</span></a>';
            $fwdtofriendtext = "" . ' * ' . $details[0] . ' ( ' . $link . ' )';
            $replacebyHTML[$tag] = empty($fwdObj->subscriber->id) || $fwdObj->subscriber->receive_html ? $fwdtofriendhtml : $fwdtofriendtext;
        }
    }
    //replace the tag with the exact link
    $content = str_replace($replace, $replacebyHTML, $content);
}
예제 #13
0
    /** Send element stored in the queue
     * @return bool if the queue still have values to be sent then return true ( for manual send ) otherwise return false
     */
    function sendQueue($showHTML = false, $mailingId = null, $onlyAutoRsponder = false, $manualSend = false)
    {
        $showHTML = true;
        $stillProcess = null;
        $maxTask = $manualSend ? $this->limitEmails : $this->maxQueue;
        if ($maxTask < 1) {
            $maxTask = 1;
        }
        if ($maxTask > 1000) {
            $maxTask = 1000;
        }
        //8889990
        $arPRiority = empty($GLOBALS[JNEWS . 'ar_prior']) ? 1 : $GLOBALS[JNEWS . 'ar_prior'];
        //get all the queue
        $query = 'SELECT A.qid,A.subscriber_id,A.attempt, A.params as `qparams`, A.delay as `qdelay`, B.* FROM `#__jnews_queue` as A';
        $query .= ' LEFT JOIN `#__jnews_mailings` as B on A.mailing_id = B.id ';
        $query .= ' WHERE A.send_date <= ' . time() . ' AND B.published > 0 AND A.type != 8 AND A.type != 99';
        if (!empty($mailingId)) {
            $query .= ' AND A.mailing_id = ' . $mailingId;
        }
        if ($onlyAutoRsponder && $GLOBALS[JNEWS . 'level'] > 1) {
            $query .= ' AND A.`priority` = ' . $arPRiority;
        }
        //do not select the suspend
        $query .= ' AND `suspend`= 0';
        //filter for unconfirmed subscribers
        $query .= ' AND `block` = 0';
        //filter the entries are still being processed from the last sending/processing of the queue
        $query .= ' ORDER BY A.`priority` ASC, A.send_date ASC';
        $query .= ' LIMIT ' . $maxTask;
        $this->db->setQuery($query);
        $allQueuedA = $this->db->loadObjectList();
        $error = $this->db->getErrorMsg();
        if (!empty($error)) {
            //prompt message if an error occured while retrieving entries from the queue
            echo '<br><br><span style="font-weight:bold; font-style:italic; color:blue;">' . _JNEWS_QUEUE_PROCESS_ERROR . '<span><br><br>';
            echo $error;
        }
        if (empty($allQueuedA)) {
            echo '<br><br><span style="font-weight:bold; font-style:italic; color:blue;">' . _JNEWS_NO_MAILINGS_YET . '<span>';
            // prompt message if there is nothing to send
            jNews_Queue::sendReport();
            return false;
        }
        //we update the retrieved allQueuedA to blocked so that  the entries will not be processed double
        foreach ($allQueuedA as $oneQueue) {
            $this->updateQueueBlock($oneQueue->qid, 1);
        }
        $totalSubscribers = count($allQueuedA);
        //make an array of all subscribers and all mailings
        $mySubcribersA = array();
        $subscribersPerMailingsA = array();
        foreach ($allQueuedA as $oneQueue) {
            $mySubcribersA[$oneQueue->subscriber_id] = true;
        }
        //get all the subcribers
        $query = 'SELECT A.`id`,A.`user_id`,A.`name`,A.`email`,A.`receive_html`,A.`confirmed`,A.`blacklist`, B.`id` AS \'user\' ';
        if ($GLOBALS[JNEWS . 'level'] > 2) {
            //check if the version of jnews is pro
            if ($GLOBALS[JNEWS . 'show_column1']) {
                $query .= ',A.`column1`';
            }
            if ($GLOBALS[JNEWS . 'show_column2']) {
                $query .= ',A.`column2`';
            }
            if ($GLOBALS[JNEWS . 'show_column3']) {
                $query .= ',A.`column3`';
            }
            if ($GLOBALS[JNEWS . 'show_column4']) {
                $query .= ',A.`column4`';
            }
            if ($GLOBALS[JNEWS . 'show_column5']) {
                $query .= ',A.`column5`';
            }
        }
        $query .= ' FROM `#__jnews_subscribers` AS A  ';
        $query .= ' LEFT JOIN  `#__users` AS B ON A.id=B.id';
        $query .= ' WHERE A.`id` IN (' . jnews::implode(',', array_keys($mySubcribersA)) . ' )';
        $this->db->setQuery($query);
        $allSubcribersA = $this->db->loadObjectList('id');
        if (empty($allSubcribersA)) {
            jNews_Queue::sendReport();
            return false;
        }
        $mailerC = new jNews_ProcessMail();
        $queueToBeDelted = array();
        $queueToBeAttempted = array();
        $queueSuccessfullySent = array();
        $addToStatisticsA = array();
        $log_detailed = '';
        $message = '';
        $screenMsg = '';
        $maxAttempt = $GLOBALS[JNEWS . 'max_attempts'] < 1 ? 1 : $GLOBALS[JNEWS . 'max_attempts'];
        if ($this->total == 0) {
            $this->total = jNews_Queue::getQueueCount($mailingId);
        }
        //for manual sending processing
        if ($manualSend) {
            if (!headers_sent() and ob_get_level() > 0) {
                @ob_end_flush();
            }
            $url = JURI::base() . jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=continuesend&mailingid=' . $mailingId . '&totalsend=' . $this->total . '&alreadysent=', true, false, true);
            $screenMsg = "<div style='position:fixed; top:3px;left:3px;color:orange; padding : 3px;'>";
            $screenMsg .= "<span id='waitinginfo' style='padding:10px;margin:5px;font-size:16px;font-weight:bold;display:none;background-color:#FFF8C6; color:red;'> </span>";
            $screenMsg .= '<i>' . _JNEWS_SENDING_EMAIL . ' <span id="emailcounter"/><strong>' . $this->start . '</strong></span> out of <strong>' . $this->total . '</strong>... </i>';
            $screenMsg .= "</div><div id='details' style='display:none; position:fixed; bottom:3px;left:3px;background-color : white; border : 1px solid grey; padding : 3px;'> </div><br /><br />";
            $screenMsg .= '<script type="text/javascript" language="javascript">';
            $screenMsg .= 'var myEmailCounter = document.getElementById("emailcounter");';
            $screenMsg .= 'var details = document.getElementById("details");
var waitinginfo = document.getElementById("waitinginfo");
function setDetails(message){ details.style.display = \'block\';details.innerHTML=message; }
function setWaitingInfo(waitingtime){ waitinginfo.style.display = \'\';waitinginfo.innerHTML="Waiting "+waitingtime+" seconds..."; }
function setEmailCounter(val){ myEmailCounter.innerHTML=val;}
var waitingtime = ' . intval($this->pause) . ';
function setWaitingTime(){
	setWaitingInfo(waitingtime);
	if(waitingtime > 0){
		waitingtime = waitingtime - 1;
		setTimeout(\'setWaitingTime()\',1000);
	}else{
		document.location.href=\'' . $url . '\'+myEmailCounter.innerHTML;
	}
}
</script>';
            echo $screenMsg;
            if (function_exists('ob_flush')) {
                @ob_flush();
            } else {
                @flush();
            }
        }
        //we assign counter for the current email being processed
        $counterEmail = $this->start;
        //we determine if the mailings on the queue is lesser than the limit given per batch of manual sending
        if (count($allQueuedA) < $maxTask) {
            $stillProcess = false;
        }
        //get the size of the queue
        foreach ($allQueuedA as $oneQueue) {
            $counterEmail++;
            if ($manualSend) {
                echo '<script type="text/javascript" language="javascript">setEmailCounter(' . $counterEmail . ')</script>';
                if (function_exists('ob_flush')) {
                    @ob_flush();
                }
                @flush();
            }
            //attachements
            if (!empty($oneQueue->attachments)) {
                $oneQueue->attachments = explode("\n", $oneQueue->attachments);
                if (count($oneQueue->attachments) != 0 && trim($oneQueue->attachments[count($oneQueue->attachments) - 1]) == "") {
                    array_pop($oneQueue->attachments);
                }
            } else {
                $oneQueue->attachments = array();
            }
            //images
            if (!empty($oneQueue->images)) {
                $oneQueue->images = explode("\n", $oneQueue->images);
            } else {
                $oneQueue->images = array();
            }
            //5 is maximun attempt
            if ($oneQueue->attempt >= $maxAttempt) {
                $queueToBeDelted[] = $oneQueue->qid;
                continue;
            }
            if (!isset($this->sentHTML[$oneQueue->id])) {
                $this->sentHTML[$oneQueue->id] = 0;
            }
            if (!isset($this->sentText[$oneQueue->id])) {
                $this->sentText[$oneQueue->id] = 0;
            }
            if (!isset($this->sentFailed[$oneQueue->id])) {
                $this->sentFailed[$oneQueue->id] = 0;
            }
            if (isset($allSubcribersA[$oneQueue->subscriber_id]) && is_object($allSubcribersA[$oneQueue->subscriber_id])) {
                $emailSentStatus = $mailerC->send($oneQueue, $allSubcribersA[$oneQueue->subscriber_id]);
                if ($emailSentStatus) {
                    //we update the senddate of the newsletter
                    jNews_Mailing::updatesenddate($oneQueue->id);
                }
            } else {
                continue;
            }
            if (!empty($allSubcribersA[$oneQueue->subscriber_id]->email)) {
                if ($GLOBALS[JNEWS . 'save_log']) {
                    if (!$emailSentStatus) {
                        $log_detailed .= '[' . $oneQueue->id . '] ' . $oneQueue->subject . ' : ' . $allSubcribersA[$oneQueue->subscriber_id]->email . ' -> ' . _JNEWS_MESSAGE_NOT . "\r\n" . _JNEWS_MAILER_ERROR . ': ' . $mailerC->ErrorInfo . "\r\n";
                    } else {
                        $log_detailed .= '[' . $oneQueue->id . '] ' . $oneQueue->subject . ' : ' . $allSubcribersA[$oneQueue->subscriber_id]->email . ' -> ' . _JNEWS_MESSAGE_SENT_SUCCESSFULLY . "\r\n";
                    }
                } else {
                    $log_detailed .= '[' . $oneQueue->id . '] ' . $oneQueue->subject . ' : ' . $allSubcribersA[$oneQueue->subscriber_id]->email . ' -> ' . _JNEWS_MESSAGE_SENT_SUCCESSFULLY . "\r\n";
                }
            }
            //Screen message for manual sending
            if ($manualSend) {
                if ($emailSentStatus) {
                    $message = '<strong><i>' . $oneQueue->subject . '</i></strong> ' . _JNEWS_MSG_SENT_SUCCESS . ' <strong><i>' . $allSubcribersA[$oneQueue->subscriber_id]->name . ' ( ' . $allSubcribersA[$oneQueue->subscriber_id]->email . ' )</i></strong>' . "\r\n";
                } else {
                    $message = '<i>' . _JNEWS_ATTEMPTED . ' ' . $oneQueue->subject . ' to ' . $allSubcribersA[$oneQueue->subscriber_id]->name . ' ( ' . $allSubcribersA[$oneQueue->subscriber_id]->email . ' )' . ".\r\n" . _JNEWS_RESCHEDULED . "\r\n\r\n" . _JNEWS_REACHED_MAX_ATTEMPT . "</i>\r\n\r\n";
                }
                $this->_displayDetails($message, $emailSentStatus, $counterEmail);
            }
            if ($emailSentStatus) {
                //succeess send
                $query = 'DELETE FROM `#__jnews_queue` WHERE `qid`=' . $oneQueue->qid;
                $this->db->setQuery($query);
                $this->db->query();
                if ($mailerC->html) {
                    $this->sentHTML[$oneQueue->id]++;
                } else {
                    $this->sentText[$oneQueue->id]++;
                }
                //user statistics
                if ($GLOBALS[JNEWS . 'enable_statistics'] && $GLOBALS[JNEWS . 'statistics_per_subscriber']) {
                    $addToStatisticsA[$oneQueue->id][$oneQueue->subscriber_id] = (int) $mailerC->html;
                }
                $this->sentSuccess++;
                $this->recurringError = 0;
                $queueSuccessfullySent[] = $oneQueue->qid;
                //we save the successfully sent qids so that we can differentiate from the allqueue what qids that were not processed because the max execution time has been reached
            } else {
                // failed send
                $queueToBeAttempted[] = $oneQueue->qid;
                $this->sentFailed[$oneQueue->id]++;
                $this->recurringError++;
            }
            $time = time();
            if ($this->maxExetime != 0 && $this->maxExetime <= $time) {
                $stillProcess = true;
                break;
            }
            if ($this->recurringError > 2 && $this->sentSuccess > 3) {
                $stillProcess = false;
                break;
            }
            if ($this->recurringError > 5 || connection_aborted()) {
                $stillProcess = false;
                break;
            }
        }
        //we close the processing of emails
        $mail = JFactory::getMailer();
        $mailerC->close($mail);
        if (!empty($this->total) && $counterEmail >= $this->total) {
            $stillProcess = false;
        }
        //update queue with try + 1;
        if (!empty($queueToBeAttempted)) {
            $query = 'UPDATE `#__jnews_queue` SET `attempt`=`attempt`+1,`send_date`=`send_date`+`attempt`*25299+4000, `block`= 0 WHERE `qid` IN (' . jnews::implode(',', $queueToBeAttempted) . ')';
            //we will also update the block to 0 so that it will be processed again
            $this->db->setQuery($query);
            $this->db->query();
        }
        //delete the queue when the emails are sent successfully after x number of attempts
        if (!empty($queueToBeDelted)) {
            $query = 'DELETE FROM `#__jnews_queue` WHERE `qid` IN (' . jnews::implode(',', $queueToBeDelted) . ')';
            $this->db->setQuery($query);
            $this->db->query();
        }
        //unblock again the queue that were not sent because the timeout has been reached so that they will be processed again
        if (!empty($allQueuedA)) {
            foreach ($allQueuedA as $oneQueue) {
                if (!in_array($oneQueue->qid, $queueSuccessfullySent)) {
                    $query = 'UPDATE `#__jnews_queue` SET `block` = 0 WHERE `qid` =' . $oneQueue->qid;
                    $this->db->setQuery($query);
                    $this->db->query();
                }
            }
        }
        //we update and increment the statistics
        if ($GLOBALS[JNEWS . 'enable_statistics']) {
            $this->_updateStatsGlobal($allQueuedA);
        }
        if (!empty($addToStatisticsA)) {
            $this->_insertStats($addToStatisticsA);
        }
        //we prompt message that the mailing has been sent successfully for each batch
        //		echo '<br><br><span style="font-weight:bold; font-style:italic; color:green;">'.$oneQueue->subject.' successfully sent to subscribers.'.'</span> ';
        //mailing reports
        $this->_writeLogs($log_detailed);
        if (isset($stillProcess)) {
            //manual sending
            if ($stillProcess && $manualSend) {
                echo '<script type="text/javascript" language="javascript">setWaitingTime();</script>';
            } else {
                echo '<br><br><span style="font-weight:bold; font-style:italic; color:green;">' . _JNEWS_THE_MAILING . $oneQueue->subject . _JNEWS_SENT_ALL . '</span> ';
                //					$subject = 'jNews Mailing Notification - Status: End';
                //					$content = 'The mailing '.$oneQueue->subject.' has been successfully sent.';
                //					if( version_compare(JVERSION,'1.6.0','<') ){ //j15
                //						$this->db->setQuery( "SELECT * FROM `#__users` WHERE `gid` = 25 ORDER BY `id` ASC LIMIT 1" );
                //					}else{
                //						$this->db->setQuery( "SELECT * FROM `#__users` AS U LEFT JOIN `#__user_usergroup_map` AS UGM ON U.id =UGM.user_id  WHERE `group_id` = 8 ORDER BY `id` ASC LIMIT 1" );
                //					}
                //					$admin = $this->db->loadObject();
                //
                //					JUTility::sendMail($admin->email, $admin->name, $admin->email, $subject, $content );
            }
            if (!$stillProcess) {
                jNews_Queue::sendReport();
            }
            return $stillProcess ? true : false;
        } else {
            //manual sending
            if ($manualSend && $maxTask < $this->total) {
                echo '<script type="text/javascript" language="javascript">setWaitingTime();</script>';
            } else {
                echo '<br><br><span style="font-weight:bold; font-style:italic; color:green;">' . _JNEWS_THE_MAILING . $oneQueue->subject . _JNEWS_SENT_ALL . '</span> ';
                //					$subject = 'jNews Mailing Notification - Status: End';
                //					$content = 'The mailing '.$oneQueue->subject.' has been successfully sent.';
                //					if( version_compare(JVERSION,'1.6.0','<') ){ //j15
                //						$this->db->setQuery( "SELECT * FROM `#__users` WHERE `gid` = 25 ORDER BY `id` ASC LIMIT 1" );
                //					}else{
                //						$this->db->setQuery( "SELECT * FROM `#__users` AS U LEFT JOIN `#__user_usergroup_map` AS UGM ON U.id =UGM.user_id  WHERE `group_id` = 8 ORDER BY `id` ASC LIMIT 1" );
                //					}
                //					$admin = $this->db->loadObject();
                //
                //					JUTility::sendMail($admin->email, $admin->name, $admin->email, $subject, $content );
            }
            if ($this->maxQueue > count($allQueuedA)) {
                jNews_Queue::sendReport();
            }
            return $this->maxQueue > count($allQueuedA) ? false : true;
        }
    }
예제 #14
0
파일: jnews_cb.php 프로젝트: naka211/kkvn
 function _showSubscriberLists($user, $subscriber, $lists, $queues, $frontEnd, $accessAdmin)
 {
     $Itemid = JRequest::getInt('Itemid');
     $tabparams = $this->_memGetTabParameters($user);
     if (!empty($lists)) {
         $br = "\n\r";
         $html = '<fieldset class="jnewscss" style="padding: 4px; text-align: left">' . $br;
         $html .= '<legend><strong>' . _JNEWS_SUBSCRIPTIONS . '</strong></legend>' . $br;
         $html .= '<table width="100%"  border="0" cellspacing="0" cellpadding="4" class="adminlist">' . $br;
         $html .= '<tr><th class="title">#</th>' . $br;
         $html .= '<th class="title">' . _JNEWS_LIST_NAME . '</th>' . $br;
         $html .= '<th class="title" style="text-align: center;">' . _JNEWS_LIST_T_SUBSCRIPTION . '</th>' . $br;
         if ($tabparams['show_archive']) {
             $html .= '<th class="title" style="text-align: center;">' . _JNEWS_VIEW_ARCHIVE . '</th>' . $br;
         }
         $html .= '</tr>' . $br;
         $subscribed = '';
         $i = 0;
         foreach ($lists as $list) {
             $i++;
             $subscribed = 0;
             if (!empty($queues)) {
                 foreach ($queues as $queue) {
                     if ($queue->list_id == $list->id) {
                         $subscribed = 1;
                     }
                 }
             }
             if (!empty($tabparams['jnews_itemid'])) {
                 $item_id = $tabparams['jnews_itemid'];
             } else {
                 $item_id = $Itemid;
             }
             $html .= '<tr><td>' . $i . '</td><td>' . $br;
             $link = ($list->hidden and ($list->list_type == '1' or $list->list_type == '7') and $GLOBALS[JNEWS . 'show_archive']) ? 'index.php?option=' . JNEWS_OPTION . '&act=mailing&task=archive&listid=' . $list->id . '&Itemid=' . $item_id : '#';
             $html .= '<span class="aca_letter_names"';
             if ($link == "#") {
                 $html .= " onclick='return false;' ";
             }
             $html .= '>' . jNews_Tools::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, $link, 1) . ' </span>' . $br;
             $html .= '</td><td style="text-align: center;">' . $br;
             if ($subscribed == 1) {
                 $html .= _CMN_YES;
             }
             if ($subscribed == 0) {
                 $html .= _CMN_NO;
             }
             $html .= '</td>' . $br;
             if ($tabparams['show_archive'] && ($list->list_type == 1 or $list->list_type == 7)) {
                 $link = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive&Itemid=' . $item_id;
                 $link = jNews_Tools::completeLink($link, false);
                 $img = 'move_f2.png';
                 $html .= '<td height="20" style="text-align: center;">';
                 $html .= '<a href="' . $link . '" >' . "\n\r";
                 $html .= '<img src="' . JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/images/' . $img . '" width="20" height="20" border="0" alt="' . _JNEWS_VIEW_ARCHIVE . '" /></a></td>' . "\n\r";
             } elseif ($tabparams['show_archive']) {
                 $html .= '<td height="20"><center>-</center></td>' . "\n\r";
             }
         }
         $html .= '<tr></table></fieldset>';
         return $html;
     }
 }
예제 #15
0
    public static function EDITTEMPLATE()
    {
        if (class_exists('jNews_TemplatesHTML')) {
            $script = 'function getTemplate() {
var form = form = document.adminForm;
template_id = form.template_id.value;
	 		}';
            $doc = JFactory::getDocument();
            $doc->addScriptDeclaration($script);
            $template_id = JRequest::getVar('template_id');
            $html = '<a class="modal" onclick="getTemplate()" title="' . _JNEWS_MENU_PREVIEW . '" href="' . jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=templates&task=preview&template_id=' . $template_id, true, false, true) . '" rel="{handler: \'iframe\', size: {x: 850, y: 500}}"> <img src="' . JNEWS_PATH_ADMIN_IMAGES2 . 'toolbar/preview_template.png"> <br/><center>' . _JNEWS_MENU_PREVIEW . '</center> </a>';
            $HTML = '<a class="modal" title="' . _JNEWS_MAILING_TAG . '" href="' . jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags', true, false, true) . '" rel="{handler: \'iframe\', size: {x: 850, y: 500}}"> <img src="' . JNEWS_PATH_ADMIN_IMAGES2 . 'toolbar/tag.png"/> <br/><center>' . _JNEWS_MAILING_TAG . '</center> </a>';
            JToolBarHelper::custom('sendtest', 'preview.png', 'preview.png', _JNEWS_SENDTEST_TEMP, false);
            JToolBarHelper::divider();
            $bar = JToolBar::getInstance('toolbar');
            $bar->appendButton('Custom', $html);
            $bar->appendButton('Custom', $HTML);
            JToolBarHelper::divider();
            JToolBarHelper::custom('apply', 'applyT.png', 'applyT.png', _JNEWS_MENU_APPLY, false);
            JToolBarHelper::custom('save', 'saveT.png', 'saveT.png', _JNEWS_SAVE, false);
            JToolBarHelper::divider();
            JToolBarHelper::custom('cancel', 'cancelT.png', 'cancelT.png', _JNEWS_CANCEL, false);
            JToolBarHelper::divider();
            jNews_Menu::_wizardBtn('edit-template');
            //			jNews_Menu::_cPanelBtn();
        }
    }
예제 #16
0
파일: jnewsbot.php 프로젝트: naka211/kkvn
function jnewsbot_jcalpro_transformall(&$html, &$text, &$subject, $queueInfo = null)
{
    $db = JFactory::getDBO();
    $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
    preg_match_all('#{jcalevent:.{7,15}}#', $html . $text, $tags);
    $replace = array();
    $replacebyHTML = array();
    $replacebyText = array();
    if (!empty($tags[0])) {
        foreach ($tags[0] as $tag) {
            $isolate = explode(':', $tag);
            if (count($isolate) != 2) {
                continue;
            }
            $parameters = explode('|', $isolate[1]);
            if (count($parameters) != 4) {
                continue;
            }
            if (!empty($replace[$tag])) {
                continue;
            }
            $replace[$tag] = $tag;
            $query = 'SELECT `title`, `description`, `end_date`, `start_date`, `extid` from #__jcalpro2_events where `extid` = ' . intval($parameters[0]);
            $db->setQuery($query);
            $event = $db->loadObject();
            $db->loadObject($event);
            if (empty($event->extid)) {
                $replacebyHTML[$tag] = '';
                $replacebyText[$tag] = '';
                continue;
            }
            if (get_magic_quotes_runtime()) {
                $event->title = stripslashes($event->title);
                $event->description = stripslashes($event->description);
            }
            $eventhtml = '';
            if ($parameters[2]) {
                $eventhtml .= '<div class="aca_jcalcontent">';
            }
            $eventhtml .= '<span class="aca_jcaltitle">' . $event->title . '</span>';
            $eventtext = strtoupper(jNews_ProcessMail::htmlToText($event->title));
            if ($parameters[1]) {
                $start_date_array = explode('-', $event->start_date);
                $start_time_array = explode(':', substr($event->start_date, 10, 15));
                $date = strftime(JText::_('DATE_FORMAT_LC'), mktime($start_time_array[0], $start_time_array[1], 0, $start_date_array[1], $start_date_array[2], $start_date_array[0]));
                $eventhtml .= '<br/>' . $date;
                $eventtext .= "\r\n" . $date;
            }
            if ($parameters[2]) {
                $eventhtml .= '<br/>' . $event->description;
                $eventtext .= "\r\n" . jNews_ProcessMail::htmlToText($event->description);
            }
            if ($parameters[3]) {
                $link = 'option=com_jcalpro&extmode=view&extid=' . $event->extid . '&Itemid=' . $Itemid;
                $link = jNews_Tools::completeLink($link, false, $GLOBALS[JNEWS . 'use_sef']);
                $eventhtml .= '<br/><a href="' . $link . '"><span class="aca_readmore">' . _JNEWS_READMORE . '</span></a>';
                $eventtext .= "\r\n" . ' * ' . _JNEWS_READMORE . ' ( ' . $link . ' )';
            }
            if ($parameters[2]) {
                $eventhtml .= '</div>';
            }
            $replacebyHTML[$tag] = $eventhtml;
            $replacebyText[$tag] = $eventtext;
        }
    }
    $html = str_replace($replace, $replacebyHTML, $html);
    $text = str_replace($replace, $replacebyText, $text);
}
예제 #17
0
 public static function showSubscriberLists($subscriber, $lists, $queues, $frontEnd, $accessAdmin)
 {
     $Itemid = JRequest::getInt('Itemid');
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     if (empty($Itemid) and !$mainframe->isAdmin()) {
         $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
     }
     if (!empty($Itemid)) {
         $item = '&Itemid=' . $Itemid;
     } else {
         $item = '';
     }
     $html = '';
     if (!empty($lists)) {
         $br = "\n\r";
         $html = '<fieldset class="jnewscss" style="padding: 4px; text-align: left">' . $br;
         static $cnt = 1;
         if ($cnt == 1) {
             $html .= '<legend><strong>' . _JNEWS_SUBSCRIPTION_LIST . '</strong></legend>' . $br;
             $cnt++;
         } else {
             $html .= '<legend><strong>' . _JNEWS_SUBSCRIPTION_AR . '</strong></legend>' . $br;
         }
         $html .= '<table class="' . jnews::myTheme() . '"><thead>' . $br;
         $html .= '<tr><th class="title" width="3%">#</th>' . $br;
         $html .= '<th class="title" width="50%">' . _JNEWS_LIST_NAME . '</th>' . $br;
         $html .= '<th class="title" align=center width="30%">' . _JNEWS_SUBSCRIB . '</th>' . $br;
         if ($accessAdmin) {
             $html .= '<th class="title" width="3%"><center>ID</center></th>' . $br;
         }
         if ($frontEnd and $GLOBALS[JNEWS . 'show_archive'] == '1') {
             $html .= '<th class="title" width="30%"><center>' . _JNEWS_VIEW_ARCHIVE . '</center></th>' . $br;
         }
         $html .= '</tr></thead>' . $br;
         if ($frontEnd and empty($subscriber->id)) {
             $forceCheck = true;
         } else {
             $forceCheck = false;
         }
         $subscribed = '';
         $script = '';
         static $i = 1;
         $lisType = 1;
         foreach ($lists as $list) {
             $i++;
             $lisType = $list->list_type;
             $subscribed = 0;
             if (!empty($queues)) {
                 foreach ($queues as $queue) {
                     if ($queue->list_id == $list->id) {
                         $subscribed = 1;
                         $access = $queue->acc_level;
                     } else {
                         $access = 29;
                     }
                 }
             } else {
                 $access = 29;
             }
             $num = ($i + 1) % 2;
             $s = $i - 1;
             $html .= '<tr class="row' . $num . '"><td><center>' . $s . '</center></td><td width="50%">' . $br;
             $link = ($list->hidden and ($list->list_type == '1' or $list->list_type == '7') and $GLOBALS[JNEWS . 'show_archive']) ? 'index.php?option=' . JNEWS_OPTION . '&act=mailing&task=archive&listid=' . $list->id . '&listype=' . $list->list_type . $item : '#';
             $html .= '<span class="aca_letter_names"';
             if ($link == "#") {
                 $html .= " onclick='return false;' ";
             }
             $html .= '>' . jNews_Tools::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, $link, 1) . ' </span>' . $br;
             $html .= '</td><td align="center" width="30%">' . $br;
             //radio yes
             $html .= '<input name="subscribed[' . $list->id . ']" value="1" id="subscribed[' . $list->id . ']1"';
             if ($subscribed == 1 or $forceCheck) {
                 $html .= ' checked="checked"';
             }
             $html .= ' type="radio">' . _CMN_YES . $br;
             //radio no
             $html .= '<input name="subscribed[' . $list->id . ']" value="0" id="subscribed[' . $list->id . ']0"';
             if ($subscribed == 0 and !$forceCheck) {
                 $html .= ' checked="checked"';
             }
             $html .= ' type="radio">' . _CMN_NO . $br;
             $html .= '<input type="hidden" name="sub_list_id[' . $list->id . ']" value="' . $list->id . '" />' . $br;
             $html .= '<input type="hidden" name="acc_level[' . $list->id . ']" value="' . $access . '" />';
             $html .= '<input type="hidden" name="passwordA" value="' . crypt($GLOBALS[JNEWS . 'url_pass'], $GLOBALS[JNEWS . 'url_pass']) . '" />';
             $html .= '<input type="hidden" name="fromFrontend" value="1" />' . "\n";
             $html .= '</td>' . $br;
             if ($accessAdmin) {
                 $html .= '<td><center>' . $list->id . '</center></td> ';
             }
             if ($frontEnd) {
                 if (($list->list_type == 1 or $list->list_type == 7) && $GLOBALS[JNEWS . 'show_archive'] == '1') {
                     $link = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive' . $item;
                     //						$link = jNews_Tools::completeLink($link,false);
                     $link = jNews_Tools::completeLink($link, false);
                     $img = 'move_f2.png';
                     $html .= '<td height="20"><center>';
                     $html .= '<a href="' . $link . '" >' . "\n\r";
                     $html .= '<img src="' . JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/images/' . $img . '" width="20" height="20" align="center" border="0" alt="' . _JNEWS_VIEW_ARCHIVE . '" /></a></center></td>' . "\n\r";
                 } elseif ($GLOBALS[JNEWS . 'show_archive'] == '1') {
                     $html .= '<td height="20"><center>-</center></td>';
                 }
             }
             $script .= "window.document.getElementById('subscribed[{$list->id}]'+statusval).checked = true;" . $br;
         }
         $messagejs = $lisType == 2 ? _JNEWS_SELECT_ALLLAUTOR : _JNEWS_SELECT_ALLLISTS;
         if (count($lists) > 1) {
             $html .= '<tr><td colspan="4" align="center" nowrap="nowrap">';
             $html .= '<script type="text/javascript">';
             $html .= 'function updateStatus' . $lisType . '(statusval){' . $br;
             $html .= $script;
             $html .= '}</script><div style="float:right; font-size: 12px;">';
             $html .= '<a title="' . $messagejs . '" href="#tablelist" onclick="updateStatus' . $lisType . '(1)">';
             $html .= _JNEWS_SUBS_LIST_TOALL;
             $html .= '</a> | <a href="#tablelist" onclick="updateStatus' . $lisType . '(0)">';
             $html .= _JNEWS_SUBS_LIST_TONONE . '</a></div></td></tr>';
         }
         $html .= '</table></fieldset>';
     }
     return $html;
 }
예제 #18
0
 public static function replaceTags($content, $subscriber, $oneQueue, $html, $tags = null, $showSign = true)
 {
     $mailingId = $oneQueue->id;
     $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
     $listId = '0';
     //can be empty
     $subscriptionslink = 'option=' . JNEWS_OPTION . '&Itemid=' . $Itemid . '&act=change&subscriber=' . $subscriber->id . '&cle=' . md5($subscriber->email);
     $unsubscribelink = 'option=' . JNEWS_OPTION . '&Itemid=' . $Itemid . '&act=unsubscribe&subscriber=' . $subscriber->id . '&mailingid=' . $mailingId . '&cle=' . md5($subscriber->email);
     $subscriptiontext = '';
     $subscriptionslink = jNews_Tools::completeLink($subscriptionslink, false, $GLOBALS[JNEWS . 'use_sef']);
     $unsubscribelink = jNews_Tools::completeLink($unsubscribelink, false, $GLOBALS[JNEWS . 'use_sef']);
     if ($html) {
         $subscriptionslink = '<a href="' . $subscriptionslink . '" target="_blank"><span class="aca_subscribe">' . _JNEWS_CHANGE_EMAIL_SUBSCRIPTION . '</span></a>';
         $unsubscribelink = '<a href="' . $unsubscribelink . '" target="_blank"><span class="aca_unsubscribe">' . _JNEWS_SAFEUNSUBSCRIBE . '</span></a>';
         $subscriptionstext = '<p>' . $subscriptionslink . '<br />' . $unsubscribelink . '</p>';
     } else {
         $subscriptionslink = _JNEWS_CHANGE_EMAIL_SUBSCRIPTION . ' ( ' . $subscriptionslink . ' )';
         $unsubscribelink = _JNEWS_SAFEUNSUBSCRIBE . ' ( ' . $unsubscribelink . ' )';
         $subscriptionstext = "\r\n" . $subscriptionslink . "\r\n" . $unsubscribelink;
     }
     $subscriptionstext = '';
     if ($showSign && $GLOBALS[JNEWS . 'show_signature']) {
         if ($html) {
             $signatureText = '<a href="http://www.joobi.co" target="_blank">';
             $signatureText .= '<br /><center><div style="width: 99%; color:#000; font-size: 0.8em; text-align: center; ">Powered by Joobi</div></center>';
             $signatureText .= '</a>';
         } else {
             $signatureText = '<br />Powered by Joobi ( http://www.joobi.co )';
         }
         $subscriptionstext .= "\r\n\r\n" . $signatureText;
     }
     $confirmlink = 'option=' . JNEWS_OPTION . '&act=confirm&listid=' . $listId . '&cle=' . md5($subscriber->email) . '&subscriber=' . $subscriber->id . '&Itemid=' . $Itemid;
     $confirmlink = jNews_Tools::completeLink($confirmlink, false, $GLOBALS[JNEWS . 'use_sef']);
     //for rpelacement of the {tag:title}
     $mailSubject = '';
     //		$mailingid = empty($oneQueue->mailing_id) OR !isset($oneQueue->mailing_id) ? jNews_Queue::getQueueMailingId($oneQueue->id) : $oneQueue->mailing_id;
     $mailSubject = jNews_Mailing::getMailingsSubject($oneQueue->id);
     if ($html) {
         $confirmlink = '<a href="' . $confirmlink . '" target="_blank">' . _JNEWS_CONFIRM_LINK . '</a>';
     } else {
         $confirmlink = _JNEWS_CONFIRM_LINK . "\n" . $confirmlink;
     }
     $tname = explode(" ", $subscriber->name);
     $firstname = $tname[0];
     $username = empty($subscriber->username) ? $firstname : $subscriber->username;
     $archiveLink = 'option=' . JNEWS_OPTION . '&act=mailing&task=view&mailingid=' . $mailingId . '&Itemid=' . $Itemid;
     $archiveLink = jNews_Tools::completeLink($archiveLink, false, $GLOBALS[JNEWS . 'use_sef']);
     $archiveAll = '<a href="' . $archiveLink . '">' . _JNEWS_VIEWARCHIVE . '</a>';
     //		$replaceWhat = array('[CONFIRM]','[NAME]','[FIRSTNAME]','[EMAIL]','[DATE]','[USERNAME]','[LINK]','[ARCHIVE]', '[SUBSCRIPTIONS]', '[UNSUBSCRIBE]');
     //		$replaceWhat = array('{tag:confirm}','{tag:name}','{tag:firstname}','{tag:email}','{tag:date}','{tag:username}','{tag:link}','{tag:archive}', '{tag:subscriptions}', '{tag:unsubscribe}', '{tag:title}');
     $replaceTagsA = array();
     $replaceTagsA['{tag:confirm}'] = $confirmlink;
     $replaceTagsA['{tag:name}'] = $subscriber->name;
     $replaceTagsA['{tag:firstname}'] = $firstname;
     $replaceTagsA['{tag:email}'] = $subscriber->email;
     if (version_compare(JVERSION, '3.0.0', '<')) {
         $replaceTagsA['{tag:date}'] = JHTML::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC1'));
         // , JNEWS_TIME_OFFSET
     } else {
         $replaceTagsA['{tag:date}'] = JHtml::_('date', jnews::getNow(), JText::_('DATE_FORMAT_LC1'));
         // , JNEWS_TIME_OFFSET
     }
     $replaceTagsA['{tag:username}'] = $username;
     $replaceTagsA['{tag:link}'] = $archiveLink;
     $replaceTagsA['{tag:archive}'] = $archiveAll;
     $mainframe = JFactory::getApplication();
     if (!$mainframe->isAdmin() && JRequest::getVar('act', '', '', 'WORD') == 'mailing' && JRequest::getVar('task') == 'view') {
         $replaceTagsA['{tag:subscriptions}'] = '';
         $replaceTagsA['{tag:unsubscribe}'] = '';
     } else {
         $replaceTagsA['{tag:subscriptions}'] = $subscriptionslink;
         $replaceTagsA['{tag:unsubscribe}'] = $unsubscribelink;
     }
     $replaceTagsA['{tag:title}'] = $mailSubject;
     if ($GLOBALS[JNEWS . 'level'] > 2) {
         //check if the version of jnews is pro
         $replaceTagsA['{tag:profile nb=1}'] = empty($subscriber->column1) ? '' : $subscriber->column1;
         $replaceTagsA['{tag:profile nb=2}'] = empty($subscriber->column2) ? '' : $subscriber->column2;
         $replaceTagsA['{tag:profile nb=3}'] = empty($subscriber->column3) ? '' : $subscriber->column3;
         $replaceTagsA['{tag:profile nb=4}'] = empty($subscriber->column4) ? '' : $subscriber->column4;
         $replaceTagsA['{tag:profile nb=5}'] = empty($subscriber->column5) ? '' : $subscriber->column5;
     }
     $replaceTagsKeysA = array_keys($replaceTagsA);
     $content = str_replace($replaceTagsKeysA, $replaceTagsA, $content);
     if (class_exists('jNews_Auto')) {
         jNews_Auto::tags($content, $tags);
     }
     $content = stristr($content, 'Powered by Joobi') !== false ? $content : $content . $subscriptionstext;
     if (class_exists('jNews_Tags')) {
         jNews_Tags::replace($content, $tags);
     }
     $mainframe = JFactory::getApplication();
     JPluginHelper::importPlugin('jnews');
     $plugin = JPluginHelper::getPlugin('jnews', 'forwardtofriend');
     if (!empty($plugin)) {
         jimport('joomla.html.parameter');
         $fwdObj = new stdClass();
         $fwdObj->subscriber = $subscriber;
         $fwdObj->mailingid = $mailingId;
         $fwdObj->listid = $listId;
         $bot_results = $mainframe->triggerEvent('jnewsbot_fwdtofriendTransform', array(&$content, $fwdObj));
     }
     if (!defined('JOOBI_SECURE')) {
         define('JOOBI_SECURE', true);
     }
     //check if we have Joobi install if so check for tags
     $joobiEntryPoint = '';
     if (defined('JPATH_ROOT')) {
         $path = JPATH_ROOT;
     } elseif (isset($mosConfig_absolute_path)) {
         $path = $mosConfig_absolute_path;
     }
     $status = @(include_once $path . DIRECTORY_SEPARATOR . 'joobi' . DIRECTORY_SEPARATOR . 'entry.php');
     if ($status) {
         //process joobi tag
         $tagProcessC = WClass::get('output.process', null, 'class', false);
         if (!empty($tagProcessC)) {
             $tagProcessC->replaceTags($content);
         }
     }
     if (!empty($mailingId) and $GLOBALS[JNEWS . 'enable_statistics'] == 1) {
         if ($GLOBALS[JNEWS . 'statistics_per_subscriber'] == 1) {
             if ($html) {
                 $content .= '<img src="' . JNEWS_JPATH_LIVE_NO_HTTPS . '/index.php?option=' . JNEWS_OPTION . '&Itemid=' . $Itemid . '&act=log' . '&mailingid=' . $mailingId . '&subscriber=' . $subscriber->id . '" border="0" width="1" height="1" />';
             }
         } else {
             if ($html) {
                 $content .= '<img src="' . JNEWS_JPATH_LIVE_NO_HTTPS . '/index.php?option=' . JNEWS_OPTION . '&Itemid=' . $Itemid . '&act=log' . '&mailingid=' . $mailingId . '" border="0" width="1" height="1" />';
             }
         }
     }
     // replace for images
     //  put the good mailto tag back (replaced before the content mambot)
     $replaceTag = array('href="mailto:', '@', 'href="#');
     $replaceBy = array('9aca7aca5', '9aca4aca1', '9aca12aca3');
     $content = str_replace($replaceTag, $replaceBy, $content);
     $content = preg_replace('#src[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'src="' . JNEWS_JPATH_LIVE_NO_HTTPS . '/', $content);
     $content = preg_replace('#href[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'href="' . JNEWS_JPATH_LIVE_NO_HTTPS . '/', $content);
     $content = str_replace($replaceBy, $replaceTag, $content);
     $content = preg_replace('#\\.(jpg|gif|jpeg|png)(?:(?!").)?"#', '.\\1"', $content);
     if (!$html) {
         $content = str_replace('&amp;', '&', $content);
     }
     return $content;
 }
예제 #19
0
    public static function showListingLists($lists, $action, $task, $forms, $show, $listsearch = '', $limit = 0, $setLimit = null, $totalSubs = null, $setSort = null, $totalUnSubs = null)
    {
        $Itemid = JRequest::getInt('Itemid');
        $mainframe = JFactory::getApplication();
        $my = JFactory::getUser();
        $loggedin = false;
        if ($my->id > 0) {
            $loggedin = true;
        }
        if (empty($Itemid) and !$mainframe->isAdmin() and !empty($GLOBALS[JNEWS . 'itemidAca'])) {
            $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
        }
        if (!empty($Itemid)) {
            $item = '&Itemid=' . $Itemid;
        } else {
            $item = '';
        }
        echo $forms['main'];
        // top portion before the table list
        if ($mainframe->isAdmin()) {
            // for search
            $toSearch = new stdClass();
            $toSearch->listsearch = $listsearch;
            $toSearch->id = 'listsearch';
            echo jnews::setTop($toSearch, null, $setLimit);
        }
        echo '<table class="' . jnews::myTheme() . '"><thead><tr>';
        echo '<th width="2%" class="title">#</td>';
        if ($show['select']) {
            echo '<th width="3%" style="text-align:center;" class="title"></th>';
        }
        echo '<th width="30%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_LIST_NAME, 'list_name', $setSort->orderDir, $setSort->orderValue) . '</th>';
        if ($show['sender']) {
            echo '<th width="20%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_LIST_SENDER, 'sendername', $setSort->orderDir, $setSort->orderValue) . '</center> </th>';
        }
        if ($show['sender_email']) {
            echo ' <th width="15%" class="title"><center>' . _JNEWS_SENDER_EMAIL . '</center></th>';
        }
        if ($show['mailings_link']) {
            echo '<th width="17%" class="title"><center>' . _JNEWS_MENU_MAILING_TITLE . '</center></th>';
        }
        if ($show['mailings_sub']) {
            echo '<th width="17%" class="title"><center>' . _JNEWS_SUBSCRIBER_CONFIG . '</center></th>';
            echo '<th width="17%" class="title"><center>' . _JNEWS_UNSUBSCRIBER_CONFIG . '</center></th>';
        }
        if ($show['visible']) {
            echo '<th width="5%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_VISIBLE, 'hidden', $setSort->orderDir, $setSort->orderValue) . '</center></th>';
        }
        if ($show['published']) {
            echo '<th width="5%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_PUBLISHED, 'published', $setSort->orderDir, $setSort->orderValue) . '</center></th>';
        }
        if ($show['buttons']) {
            if ($GLOBALS[JNEWS . 'allow_unregistered'] or $loggedin) {
                echo '<th class="title" width="90"><center>' . _JNEWS_SUBSCRIB . '</center></th>';
            }
            if ($GLOBALS[JNEWS . 'show_archive'] == '1') {
                echo '<th class="title" width="90"><center>' . _JNEWS_VIEW_ARCHIVE . '</center></th>';
            }
        }
        if ($show['id']) {
            echo '<th width="2%" class="title">' . jnews::HTML_GridSort('ID', 'id', $setSort->orderDir, $setSort->orderValue) . '</th>';
        }
        echo '</tr></thead>';
        $i = 0;
        $ctr = 0;
        //total subs
        if (!empty($lists)) {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $onClickFct = '';
            } else {
                $onClickFct = 'Joomla.';
            }
            foreach ($lists as $list) {
                $i++;
                if ($list->list_type == 1 or $list->list_type == 7) {
                    //mariap
                    $linkArchive = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive' . $item;
                } else {
                    $linkArchive = '#';
                }
                ?>
		<tr class="row<?php 
                echo ($i + 2) % 2;
                ?>
">
			<?php 
                $num = isset($setLimit->start) ? $i + $setLimit->start : $i;
                echo '<td width="2%" class="title"><center>' . $num . '</center></td>';
                ?>
			<?php 
                if ($show['select']) {
                    ?>
			<td><center><input type="radio" name="listid" value="<?php 
                    echo $list->id;
                    ?>
" onclick="<?php 
                    echo $onClickFct;
                    ?>
isChecked(this.checked);" /></center></td>
			<?php 
                }
                if ($show['index'] == 'index') {
                    if ($mainframe->isAdmin()) {
                        if (jnews::checkPermissions('admin')) {
                            $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id . $item;
                        } else {
                            $link = $linkArchive;
                        }
                    } else {
                        if (jnews::checkPermissions('admin')) {
                            $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id . '&listype=' . $list->list_type . $item;
                        } else {
                            $link = $linkArchive;
                        }
                    }
                    $link = jNews_Tools::completeLink($link, false);
                } else {
                    if ($mainframe->isAdmin()) {
                        $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id;
                        $link = jNews_Tools::completeLink($link);
                    } else {
                        $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id . '&listype=' . $list->list_type;
                        $link = jNews_Tools::completeLink($link);
                    }
                }
                ?>
			<td>
				<span class="aca_letter_names" <?php 
                if ($link == "#" or $link == "administrator/#") {
                    echo " onclick='return false;' ";
                }
                ?>
>
				<?php 
                echo jNews_Tools::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, $link, 1);
                ?>
				</span>
			</td>

			<?php 
                if ($show['sender']) {
                    echo '<td>' . $list->sendername . '</td>';
                }
                if ($show['sender_email']) {
                    echo ' <td width="20%" class="title">' . $list->senderemail . '</td>';
                }
                if ($show['mailings_link']) {
                    $ltype = isset($list->list_type) && $list->list_type == 2 ? 2 : 1;
                    if ($show['index'] == 'index') {
                        $link = 'option=' . JNEWS_OPTION . '&act=mailing&task=show&listid=' . $list->id;
                        if (!empty($ltype)) {
                            $link .= '&listype=' . $ltype;
                        }
                        $link .= $item;
                        $link = jNews_Tools::completeLink($link, false);
                    } else {
                        $link = 'option=' . JNEWS_OPTION . '&act=mailing&task=show&listid=' . $list->id;
                        if (!empty($ltype)) {
                            $link .= '&listype=' . $ltype;
                        }
                        $link = jNews_Tools::completeLink($link);
                    }
                    //for autoresponder list only we need to filter the autoresponders to their associated list
                    if ($action == 'arlist') {
                        $link = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=2&listid=' . $list->id;
                    }
                    //listType to listype
                    ?>
				<td><center><a href="<?php 
                    echo $link;
                    ?>
"> <?php 
                    echo _JNEWS_MALING_EDIT_VIEW;
                    ?>
</a></center></td>
			<?php 
                }
                if ($show['mailings_sub']) {
                    if ($show['index'] == 'index') {
                        $link = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=1' . $item;
                        $link = jNews_Tools::completeLink($link, false);
                        $linkUnsubscribed = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=2' . $item;
                        $linkUnsubscribed = jNews_Tools::completeLink($linkUnsubscribed, false);
                    } else {
                        $link = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=1';
                        $link = jNews_Tools::completeLink($link);
                        $linkUnsubscribed = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=2';
                        $linkUnsubscribed = jNews_Tools::completeLink($linkUnsubscribed);
                    }
                    ?>
				<td><center><a href="<?php 
                    echo $link;
                    ?>
">
				<?php 
                    echo _JNEWS_SUBCRIBERS_VIEW . " ( {$totalSubs[$ctr]} ) ";
                    ?>
					</center>
				</td>
				<td><center><a href="<?php 
                    echo $linkUnsubscribed;
                    ?>
">
				<?php 
                    echo _JNEWS_UNSUBCRIBERS_VIEW . " ( {$totalUnSubs[$ctr]} ) ";
                    // $totalSubs[$ctr]
                    ?>
					</center>
				</td>
			<?php 
                    $ctr++;
                }
                if ($show['visible']) {
                    if ($list->hidden == 1) {
                        $img = '16/status_g.png';
                        jnews::getLegend('status_g.png', _JNEWS_VISIBLE . '/' . _JNEWS_TEMPLATE_PUBLISH);
                    } else {
                        $img = '16/status_r.png';
                        jnews::getLegend('status_r.png', _JNEWS_NOTVISIBLE . '/' . _JNEWS_UNPUBLISHED);
                    }
                    ?>
			<td height="20"><center>
			<?php 
                    if ($mainframe->isAdmin()) {
                        ?>
				<a href="<?php 
                        $act = JRequest::getVar('act', 'list', '', 'WORD');
                        echo jnews::createToggleLink($act, 'hidden', 'listid', $list->id);
                        ?>
"> <img src="<?php 
                        echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                        ?>
" width="12" height="12" border="0" alt="" /> </a>
			<?php 
                    } else {
                        ?>
				<img src="<?php 
                        echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                        ?>
" width="12" height="12" border="0" alt="" />
			<?php 
                    }
                    ?>
			</center></td>
			<?php 
                }
                if ($show['published']) {
                    ?>
			<td align="center"><center>
				<?php 
                    if ($list->published == 1) {
                        $img = '16/status_g.png';
                        $alt = 'Published';
                        jnews::getLegend('status_g.png', _JNEWS_VISIBLE . '/' . _JNEWS_TEMPLATE_PUBLISH);
                    } else {
                        if ($list->published == 2) {
                            $img = '16/status_y.png';
                            $alt = 'Scheduled';
                            jnews::getLegend('status_y.png', _JNEWS_SCHEDULED);
                        } else {
                            $img = '16/status_r.png';
                            $alt = 'Unpublished';
                            jnews::getLegend('status_r.png', _JNEWS_NOTVISIBLE . '/' . _JNEWS_UNPUBLISHED);
                        }
                    }
                    $status = !empty($list->published) && $list->published == 1 ? 'unpublish' : 'publish';
                    if ($mainframe->isAdmin()) {
                        ?>
					<a href="<?php 
                        $act = JRequest::getVar('act', 'list', '', 'WORD');
                        echo jnews::createToggleLink($act, $status, 'listid', $list->id, 'togle');
                        ?>
"> <img src="<?php 
                        echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                        ?>
" width="12" height="12" border="0" alt="<?php 
                        echo $alt;
                        ?>
" /> </a>
				<?php 
                    } else {
                        ?>
					 <img src="<?php 
                        echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                        ?>
" width="12" height="12" border="0" alt="<?php 
                        echo $alt;
                        ?>
" />
				<?php 
                    }
                    ?>
			</center></td>
			<?php 
                }
                ?>


	<?php 
                if ($show['buttons']) {
                    $backendLink = $show['index'] == 'index' ? false : true;
                    if ($GLOBALS[JNEWS . 'allow_unregistered'] or $loggedin) {
                        $link = 'index.php?option=' . JNEWS_OPTION . '&act=subone&listid=' . $list->id . $item;
                        $link = JRoute::_($link);
                        $img = 'folder_add_f2.png';
                        echo '<td align="center" height="24"><center>';
                        echo '<a href="' . $link . '" >' . "\n\r";
                        echo '<img src="' . JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/images/' . $img . '" width="20" height="20" border="0" alt="" /></a></center></td>' . "\n\r";
                    }
                    if (($list->list_type == 1 or $list->list_type == 7) && $GLOBALS[JNEWS . 'show_archive'] == '1') {
                        $linkArchive = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive' . $item;
                        $linkArchive = jNews_Tools::completeLink($linkArchive, true);
                        $img = 'move_f2.png';
                        echo '<td height="24"><center>';
                        echo '<a href="' . $linkArchive . '" >' . "\n\r";
                        echo '<img src="' . JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/images/' . $img . '" width="20" height="20" border="0" alt="' . _JNEWS_VIEW_ARCHIVE . '" /></a></center></td>' . "\n\r";
                    } elseif ($GLOBALS[JNEWS . 'show_archive'] == '1') {
                        //ifthe list is an autoresponder don't need to show the archives
                        echo '<td height="24"><center>-</center></td>' . "\n\r";
                    }
                }
                if ($show['id']) {
                    echo '<td width="2%" class="title"><center>' . $list->id . '</center></td>';
                }
                echo '	</tr>' . "\n\r";
            }
        }
        echo '</table>';
        echo '<br />';
        echo jnews::setLegend();
    }
예제 #20
0
 /**
  * This public static function displays the mailing report listing
  * @param object $results query results
  */
 public static function mailingList($results, $startDate = 0, $endDate = 0)
 {
     $mainframe = JFactory::getApplication();
     $columnHeaders = array('#', _JNEWS_LIST_SUB, _JNEWS_MAILING_SENT_HTML, _JNEWS_MAILING_SENT_TEXT, _JNEWS_VIEWS_FROM_HTML, _JNEWS_MAILING_PENDING, _JNEWS_MAILING_SENT, 'ID');
     $colNames = array('subject', 'html_sent', 'text_sent', 'html_views', 'pending', 'sent', 'id');
     $styles = array();
     $styles['html_sent'] = $styles['text_sent'] = $styles['sent'] = 'text-align:center;';
     $styles['html_views'] = $styles['pending'] = 'text-align:center;';
     $styles['id'] = 'text-align:center;';
     $links = array();
     $links['subject'] = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=statistics&task=graph', true, false, true);
     //changed the second parameter from false to true
     outputReportGraph::htmlListingOutput($columnHeaders, $colNames, $results, $styles, $links, $startDate, $endDate);
 }
예제 #21
0
/**
* <p>Templates controller</p>
* <p>This function is the controller to view the templates view</p>
* @author Joobi Limited <wwww.joobi.co>
*/
function templates($action, $task, $template_id)
{
    $my = JFactory::getUser();
    $css = '.icon-48-templates { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/templates.png)}';
    $doc = JFactory::getDocument();
    $doc->addStyleDeclaration($css, $type = 'text/css');
    $img = 'templates.png';
    $templatesearch = JRequest::getVar('templatesearch', '');
    $showTemplates = true;
    // defined toggle for publish and unpublish of mailings
    $willRedirect = false;
    $checkToggle = false;
    $cid = JRequest::getVar('cid');
    if (empty($template_id)) {
        if (!empty($cid) && is_array($cid)) {
            $template_id = $cid[key($cid)];
        }
    } else {
        if (empty($cid)) {
            $cid[] = $template_id;
        }
    }
    if (!empty($task) && $task == 'togle') {
        $checkToggle = true;
        //		$id = JRequest::getVar( 'templateid' );
        $id = $template_id;
        $col = JRequest::getVar('col');
        $template_id = !empty($id) && !empty($col) ? $id : $template_id;
        $task = !empty($template_id) && !empty($col) ? $col : $task;
        $willRedirect = true;
    }
    switch ($task) {
        case 'new':
        case 'add':
            $showTemplates = false;
            $template = null;
            $form['main'] = " <form action='index.php' method='post' name='adminForm' enctype='multipart/form-data' id=\"adminForm\"> \n";
            $message = isset($message) ? $message : '';
            backHTML::_header(_JNEWS_TEMPLATES, 'templates.png', $message, $task, $action);
            backHTML::formStart('template', 0, '');
            echo jNews_TemplatesHTML::createTemplate($template, $form);
            $go[] = jnews::makeObj('act', $action);
            backHTML::formEnd($go);
            break;
        case 'edit':
            $showTemplates = false;
            $template = jNews_Templates::loadOneTemplate('*', $template_id);
            $form['main'] = " <form action='index.php' method='post' name='adminForm' enctype='multipart/form-data' id=\"adminForm\">";
            $message = isset($message) ? $message : '';
            backHTML::_header(_JNEWS_TEMPLATES, 'templates.png', $message, $task, $action);
            backHTML::formStart('template', 0, '');
            echo jNews_TemplatesHTML::createTemplate($template, $form);
            $go[] = jnews::makeObj('act', $action);
            $go[] = jnews::makeObj('template_id', $template_id);
            backHTML::formEnd($go);
            break;
        case 'save':
            JRequest::checkToken() or die('Invalid Token');
            $message = jnews::printYN(jNews_Templates::saveTemplate($task, $template_id), _JNEWS_TEMPLATE_SAVED, _JNEWS_ERROR);
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates', $message);
            break;
        case 'apply':
            JRequest::checkToken() or die('Invalid Token');
            $message = '';
            $message .= jnews::printYN(jNews_Templates::saveTemplate($task, $template_id), _JNEWS_TEMPLATE_SAVED, _JNEWS_ERROR);
            $id = empty($template_id) ? jNews_Templates::loadOneTemplate('template_id', '', 'template_id', 'DESC') : $template_id;
            $converMessage = JRequest::getVar('message', '', '', 'string', JREQUEST_ALLOWRAW);
            if (!empty($converMessage)) {
                $message .= '<br/>';
                $message .= implode("", $converMessage);
            }
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates&task=edit&template_id=' . $id, $message);
            break;
        case 'publish':
            if (!$checkToggle) {
                JRequest::checkToken() or die('Invalid Token');
            }
            $message = jnews::printYN(jNews_Templates::updateTemplate($cid, 'published', true), 'Successfully published template!', 'Error publishing the template!');
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates', $message);
            break;
        case 'unpublish':
            if (!$checkToggle) {
                JRequest::checkToken() or die('Invalid Token');
            }
            $condition = jNews_Templates::updateTemplate($cid, 'published', false);
            if ($condition) {
                $message = jnews::printM('ok', 'Successfully unpublished template!');
            } else {
                $message = jnews::printM('defaulterror', 'Unable to unpublished default template!');
            }
            //	   		$message = jnews::defaultYN( jNews_Templates::updateTemplate($template_id,'published', false) ,  'Successfully unpublished template!' , 'Unable to unpublished default  template!' );
            if ($willRedirect) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates', $message);
            }
            break;
        case 'copy':
            JRequest::checkToken() or die('Invalid Token');
            $message = jnews::printYN(jNews_Templates::copyTemplate($template_id), _JNEWS_TEMPLATE . _JNEWS_SUCCESS_COPIED, _JNEWS_ERROR);
            $showTemplates = true;
            break;
        case 'default':
            $success = false;
            //set all the templates to premium = 0
            if (jNews_Templates::updateTemplate($template_id, 'default', false, false)) {
                $success = true;
            }
            //set the template published and premium
            if ($success) {
                jNews_Templates::updateTemplate($template_id, 'default', true, true);
            }
            $message = jnews::printYN($success, 'Successfully set the template to default!', 'Unable to set template to default!');
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates', $message);
            break;
        case 'delete':
            JRequest::checkToken() or die('Invalid Token');
            $showTemplates = true;
            $isDefault = jNews_Templates::loadOneTemplate('premium', $template_id);
            if (!$isDefault) {
                $message = jnews::printYN(jNews_Templates::deleteTemplate($cid), _JNEWS_TEMPLATE . _JNEWS_SUCCESS_DELETED, _JNEWS_ERROR);
            } else {
                $message = jnews::printM('red', _JNEWS_TEMPLATE_DEFAULT_NODEL);
            }
            break;
        case 'cpanel':
            backHTML::controlPanel();
            return true;
            break;
        case 'toggle':
            JRequest::checkToken() or die('Invalid Token');
            // main toggle for all usage
            $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);
            }
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates');
            break;
        case 'tempupload':
            // HTML for upload template
            //			JRequest::checkToken() or die( 'Invalid Token' );
            $html = '<form action="index.php?option=' . JNEWS_OPTION . '&act=templates&task=upload" method="post" name="adminForm" enctype="multipart/form-data" id="adminForm">';
            $html .= '<table style="width:100%;padding:100px;">';
            $html .= '<tr>';
            $html .= '<td style="text-align:center;"> <input type="FILE" name="tempupload"> </td>';
            $html .= '</tr><tr">';
            $html .= '<td style="text-align:center;padding:20px;"> <input type="submit" value="Upload Template" style="width:130px;height:25px;"> </td>';
            $html .= '</tr>';
            $html .= '</table>';
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $html .= JHTML::_('form.token');
            } else {
                $html .= JHtml::_('form.token');
            }
            $html .= '</form><br/><br/>';
            echo $html;
            $showTemplates = false;
            break;
        case 'sendtest':
            JRequest::checkToken() or die('Invalid Token');
            //we save first the template
            $saveStatus = jNews_Templates::saveTemplate($task, $template_id);
            //then we send it if the template is successfully saved
            if ($saveStatus) {
                $message = jnews::printM('ok', _JNEWS_TEMPLATE_SAVED);
                $my = JFactory::getUser();
                $mailing = new stdClass();
                $receiver = new stdClass();
                $status = false;
                $mailing->id = 1;
                $mailing->html = 1;
                $mailing->images = '';
                $mailing->attachments = '';
                $mailing->subject = jNews_Templates::loadOneTemplate('name', $template_id);
                $mailing->htmlcontent = jNews_Templates::loadOneTemplate('body', $template_id);
                $mailing->template_id = $template_id;
                $receiver->name = $my->name;
                $receiver->email = $my->email;
                $receiver->receive_html = 1;
                $receiver->user_id = $my->id;
                $mailerC = new jNews_ProcessMail();
                $sendStatus = $mailerC->send($mailing, $receiver);
                $success = 'Template ' . $mailing->subject . ' successfully sent to ' . $receiver->email;
                $error = 'There is a problem in sending the template ' . $mailing->subject . ' <br/>' . _JNEWS_SENDTEST_CONFIGERROR;
                $message = $sendStatus ? jnews::printM('ok', $success) : jnews::printM('error', $error);
            } else {
                //otherwise we give an error message
                $message = jnews::printM('error', _JNEWS_ERROR);
            }
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates&task=edit&template_id=' . $template_id, $message);
            break;
        case 'upload':
            JRequest::checkToken() or die('Invalid Token');
            $db = JFactory::getDBO();
            $fileName = $_FILES['tempupload']['name'];
            $folderName = substr($fileName, 0, -4);
            // explode to array to compare and check if the uploaded file is a zip file
            $type = $_FILES['tempupload']['type'];
            // if zip is not found then return to previous upload page
            if (strtolower($type) != 'application/zip') {
                if (strtolower(substr($fileName, -4)) != '.zip') {
                    if (version_compare(JVERSION, '1.6.0', '<')) {
                        //j15
                        echo "<script> alert('" . addslashes(_JNEWS_UPLOAD_ZIP_INVALID) . "'); document.location.href='index.php?option='.JNEWS_OPTION.'&act=templates';</script>";
                    } else {
                        if (version_compare(JVERSION, '3.0.0', '<')) {
                            echo "<script> alert('" . addslashes(_JNEWS_UPLOAD_ZIP_INVALID) . "'); window.parent.SqueezeBox.close();</script>";
                        } else {
                            echo "<script> alert('" . addslashes(_JNEWS_UPLOAD_ZIP_INVALID) . "');   jQuery(window.top.document).find(\"div.modal-backdrop\").click(); </script>";
                        }
                    }
                    break;
                }
            }
            $result = jNews_Templates::uploadTemplate();
            if ($result) {
                // if success
                // read index.html of file for template body content
                $tempPath = JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'templates' . DS;
                $file = fopen($tempPath . $folderName . DS . 'index.html', "r") or exit("Unable to open file!");
                $tempbody = array();
                while (!feof($file)) {
                    $tempbody[] = fgets($file);
                }
                //endwhile
                fclose($file);
                $tempbody = implode(' ', $tempbody);
                $standardCSSA = array();
                $extraCSSStyles = '';
                if (is_file($tempPath . $folderName . DS . 'css' . DS . 'style.css')) {
                    //new template package with style.css file
                    //we get here the css codes from the uploaded template
                    $cssfile = fopen($tempPath . $folderName . DS . 'css' . DS . 'style.css', "r") or exit("Unable to open file!");
                    $cssstyle = array();
                    while (!feof($cssfile)) {
                        $cssstyle[] = fgets($cssfile);
                    }
                    //endwhile
                    fclose($cssfile);
                    $cssstyle = implode(' ', $cssstyle);
                    $cleanCSSstyle = jNews_Templates::cleanCSSComments($cssstyle);
                    //cleancsscomments
                    @(require_once JNEWSPATH_CLASS . 'class.cssinlinestyles.php');
                    if (class_exists('CSSToInlineStyles')) {
                        $newCSSProcess = new CSSToInlineStyles();
                        $newCSSProcess->setCSS($cleanCSSstyle);
                        $newCSSProcess->processCSS();
                        //we define the predefined selectors for the css
                        $standardSelectorsA = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'a', 'ul', 'li', '.unsubscribe', '.subscriptions', '.content', '.title', '.readmore', '.online', '.aca_content', '.aca_title', '.aca_readmore', '.aca_online', '.aca_subscribe', '.aca_unsubscribe', '.aca_subscriptions');
                        $standardCSSA = $newCSSProcess->getStandardCSSTag($newCSSProcess->cssRules, $standardSelectorsA);
                        $extraCSSStyles = $newCSSProcess->getExtraCSSTag($newCSSProcess->cssRules, $standardSelectorsA);
                    }
                }
                // replace source image paths from 'images/' to 'media/.../templates/$FOLDERNAME/'
                $bodyImgA = JRequest::getVar('bodyImg');
                if (is_file($tempPath . $folderName . DS . 'css' . DS . 'style.css')) {
                    //new template package
                    //					$body = preg_replace('#images\/#', JNEWS_JPATH_LIVE . '/media/'. JNEWS_OPTION . '/templates/' . $folderName .'/images/', $tempbody);
                    $origin = '"images/';
                    $destination = '"' . JNEWS_JPATH_LIVE . '/media/' . JNEWS_OPTION . '/templates/' . $folderName . '/images/';
                    $body = str_replace($origin, $destination, $tempbody);
                } else {
                    //					$body = preg_replace('#images\/#', JNEWS_JPATH_LIVE . '/media/'. JNEWS_OPTION . '/templates/'. $folderName.'/' , $tempbody);
                    $origin = 'media/' . JNEWS_OPTION . '/templates/' . $folderName . '/';
                    $destination = JNEWS_JPATH_LIVE . '/media/' . JNEWS_OPTION . '/templates/' . $folderName . '/';
                    $body = str_replace($origin, $destination, $tempbody);
                }
                $template = null;
                $template->name = ucfirst($folderName);
                $template->description = '';
                $template->created = time();
                $template->body = addslashes($body);
                $template->altbody = '';
                $template->premium = 0;
                $template->namekey = $folderName;
                $template->published = 1;
                $template->styles = addslashes(serialize($standardCSSA));
                $template->csstyle = addslashes($extraCSSStyles);
                $template->thumbnail = '';
                $templateA = (array) $template;
                $query = 'SELECT * FROM `#__jnews_templates` WHERE `namekey` = \'' . $template->namekey . '\' ';
                $db->setQuery($query);
                $findresult = $db->loadObject();
                if (empty($findresult)) {
                    // store template
                    $status = jNews_Templates::storeTemplate($templateA);
                } else {
                    //update template
                    $query = 'UPDATE `#__jnews_templates` SET `body` = \'' . $template->body . '\' , `availability` = 1 WHERE `namekey`= \'' . $template->namekey . '\'  AND `template_id`=' . $findresult->template_id;
                    $db->setQuery($query);
                    $status = $db->query();
                }
                // upload success
                // display success message
                if ($status) {
                    if (version_compare(JVERSION, '1.6.0', '<')) {
                        //j15
                        echo "<script> alert('" . addslashes(_JNEWS_TEMPLATE_UPLOAD_SUCCESS) . "'); document.location.href='index.php?option=" . JNEWS_OPTION . "&act=templates';</script>";
                    } else {
                        //j16
                        echo "<script> alert('" . addslashes(_JNEWS_TEMPLATE_UPLOAD_SUCCESS) . "'); window.parent.location.reload();</script>";
                    }
                }
            } else {
                // failed uploading
                // display an error message
                if (version_compare(JVERSION, '1.6.0', '<')) {
                    //j15
                    echo "<script> alert('" . addslashes(_JNEWS_TEMPLATE_UPLOAD_FAIL) . "'); document.location.href='index.php?option=" . JNEWS_OPTION . "&act=templates';</script>";
                } else {
                    if (version_compare(JVERSION, '3.0.0', '<')) {
                        echo "<script> alert('" . addslashes(_JNEWS_TEMPLATE_UPLOAD_FAIL) . "'); window.parent.SqueezeBox.close();</script>";
                    } else {
                        echo "<script> alert('" . addslashes(_JNEWS_TEMPLATE_UPLOAD_FAIL) . "');   jQuery(window.top.document).find(\"div.modal-backdrop\").click(); </script>";
                    }
                }
            }
            $showTemplates = false;
            break;
        case 'preview':
            $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
            $forms['filter'] = " <form name='jnewsFilterForm' method='POST' action='index.php'> \n";
            $id = JRequest::getInt('template_id', 0, 'request');
            $body = jNews_Templates::loadOneTemplate('body', $id);
            jNews_Templates::includeStyles($body, $id);
            jNews_TemplatesHTML::previewTemplate($body, $forms);
            $showTemplates = false;
            break;
        case 'assign':
            $templatesearch = JRequest::getVar('templatesearch', '');
            $linkTh = jNews_Tools::completeLink('option=' . JNEWS_OPTION, true, false, true);
            $forms['main'] = "<form action=" . $linkTh . " method='post' name='adminForm' id=\"adminForm\">";
            $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_Templates::countTemplates(1, 1);
            $setLimit = new stdClass();
            $setLimit->total = !empty($limittotal) ? $limittotal : 0;
            $setLimit->start = !empty($limitstart) ? $limitstart : 0;
            $setLimit->end = !empty($limitend) ? $limitend : 20;
            $templates = jNews_Templates::getTemplates(true, false, $templatesearch, $setLimit->start, $setLimit->end, null, 1);
            //first param to true to show only the published
            jNews_TemplatesHTML::assignTemplate($templates, $forms, $setLimit, $templatesearch);
            $showTemplates = false;
            break;
    }
    if ($showTemplates) {
        $start = JRequest::getVar('start', '0');
        $templatesearch = JRequest::getVar('templatesearch', '');
        $limit = -1;
        $message = isset($message) ? $message : '';
        backHTML::_header(_JNEWS_TEMPLATES, $img, $message, $task, $action);
        $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
        $forms['filter'] = " <form name='jnewsFilterForm' method='POST' action='index.php'> \n";
        backHTML::formStart('show_template', '', '');
        // added this code for pagination ===========================
        $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');
        }
        $setSort = new stdClass();
        $setSort->orderValue = $app->getUserStateFromRequest(JNEWS_OPTION . '.templates.filter_order', 'filter_order', 'premium', 'cmd');
        $setSort->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.templates.filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
        $limittotal = jNews_Templates::countTemplates();
        $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;
        }
        $templates = jNews_Templates::getTemplates(false, false, $templatesearch, $setLimit->start, $setLimit->end, $setSort);
        //recheck limit total [pagination]
        if (isset($setLimit->total) && !empty($templatesearch)) {
            $setLimit->total = !empty($temps) ? count($templates) : $setLimit->total;
        }
        jNews_TemplatesHTML::displayTemplateList($templates, $forms, $setLimit->start, $setLimit->end, $templatesearch, $action, $setLimit, $setSort);
        $go[] = jnews::makeObj('act', 'templates');
        $go[] = jnews::makeObj('filter_order', $setSort->orderValue);
        $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir);
        backHTML::formEnd($go);
    }
    return true;
}
예제 #22
0
파일: tagsite.php 프로젝트: naka211/kkvn
function jnewsbot_viewonline_transformall(&$html, &$text, &$subject, $queueInfo = null)
{
    $db = JFactory::getDBO();
    $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
    $viewonlinehtml = '';
    $viewonlinetext = '';
    // catches all the viewonline tags on the newsletter html and text body
    preg_match_all('#\\{tag:viewonline.{3,}?\\}#', $html, $tags);
    $replace = array();
    $replacebyHTML = array();
    $replacebyText = array();
    if (!empty($tags[0])) {
        foreach ($tags[0] as $tag) {
            $isolate = explode('tag:viewonline name=', $tag);
            $themeEx = explode('theme=', $isolate[1]);
            if (!empty($themeEx[1])) {
                $themURL = '&format=raw';
                $themeEx[0] .= '}';
            } else {
                $themURL = '';
            }
            $details = explode('}', $themeEx[0]);
            if (!empty($replace[$tag])) {
                continue;
            }
            $replace[$tag] = $tag;
            $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
            $mailingId = JRequest::getInt('mailingid', 0);
            if ($mailingId == 0) {
                if (isset($queueInfo->id)) {
                    $mailingId = $queueInfo->id;
                }
            }
            $listId = JRequest::getInt('listid', 0);
            //create the link
            $link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=view&mailingid=' . $mailingId . $themURL, false, $GLOBALS[JNEWS . 'use_sef']);
            $viewonlinehtml = '<a href="' . $link . '"><span class="aca_online">' . $details[0] . '</span></a>';
            $viewonlinetext = "" . ' * ' . $details[0] . ' ( ' . $link . ' )';
            $task = JRequest::getVar('task', '', '', 'WORD');
            $act = JRequest::getVar('act', '', '', 'WORD');
            $mainframe = JFactory::getApplication();
            if (!$mainframe->isAdmin() && $task == 'view' && $act == 'mailing') {
                $replacebyHTML[$tag] = '';
                $replacebyText[$tag] = '';
            } else {
                $replacebyHTML[$tag] = $viewonlinehtml;
                $replacebyText[$tag] = $viewonlinetext;
            }
        }
    }
    //replace the tag with the exact link
    $html = str_replace($replace, $replacebyHTML, $html);
    $text = str_replace($replace, $replacebyText, $text);
}
예제 #23
0
/**
* <p>Tags Controller</p>
* <p>This function is the controller to view the tags view</p>
* @author Joobi Limited <wwww.joobi.co>
*/
function fwdtofriend($action, $task)
{
    $doc = JFactory::getDocument();
    $doc->addStyleSheet(JNEWS_URL_ADMIN . 'cssadmin/jnews.css');
    $mailing = new stdClass();
    if ($GLOBALS[JNEWS . 'level'] > 2) {
        $mailing->delay_max = JRequest::getInt('delay_max', 0, 'request');
        $mailing->notify_id = JRequest::getInt('notify_id', 0, 'request');
        $mailing->cat_id = JRequest::getVar('cat_id', 0, 'request');
    }
    jNews_TagsHTML::menuTags($mailing);
    switch ($task) {
        case 'datetime':
            jNews_TagsHTML::datetimeTags();
            break;
        case 'subscription':
            jNews_TagsHTML::subscriptionTags();
            break;
        case 'subscriber':
            jNews_TagsHTML::subscriberTags();
            break;
        case 'mod':
            //joomla module
            if ($GLOBALS[JNEWS . 'level'] > 1) {
                $linkFriendd = jNews_Tools::completeLink('option=' . JNEWS_OPTION, false, false, true);
                $forms['main'] = "<form action=" . $linkFriendd . " method='post' name='adminForm' id=\"adminForm\">";
                jNews_TagsHTML::modTags($forms);
            } else {
                echo 'This functionality in only available for Plus and PRO version.';
            }
            break;
        case 'content':
            //joomla content
            jNews_TagsHTML::contentTags();
            break;
        case 'smart':
            //smart news
            if ($GLOBALS[JNEWS . 'level'] > 2) {
                jNews_Autonews::selectCat($mailing);
            } else {
                echo 'This functionality in only available for PRO version.';
            }
            break;
        case 'smartk2':
            //smart news
            if ($GLOBALS[JNEWS . 'level'] > 2) {
                jNews_Autonews::selectCatK2($mailing);
            } else {
                echo 'This functionality in only available for PRO version.';
            }
            break;
        case 'site':
            $linkFriendd = jNews_Tools::completeLink('option=' . JNEWS_OPTION, false, false, true);
            $forms['main'] = "<form action=" . $linkFriendd . " method='post' name='adminForm' id=\"adminForm\">";
            jNews_TagsHTML::siteTags($forms);
            break;
        default:
            $linkFriendd = jNews_Tools::completeLink('option=' . JNEWS_OPTION, false, false, true);
            $forms['main'] = "<form action=" . $linkFriendd . " method='post' name='adminForm' id=\"adminForm\">";
            jNews_TagsHTML::subscriptionTags($forms);
    }
    return true;
}
예제 #24
0
    public static function EDITTEMPLATE()
    {
        if (class_exists('jNews_TemplatesHTML')) {
            $script = 'function getTemplate() {
var form = form = document.adminForm;
template_id = form.template_id.value;
	 		}';
            $doc = JFactory::getDocument();
            $doc->addScriptDeclaration($script);
            $template_id = JRequest::getVar('template_id');
            JToolBarHelper::custom('apply', 'apply.png', 'apply.png', 'JTOOLBAR_APPLY', false);
            JToolBarHelper::custom('save', 'save.png', 'save.png', 'JTOOLBAR_SAVE', false);
            JToolBarHelper::divider();
            JToolBarHelper::custom('cancel', 'cancel.png', 'cancel.png', 'JTOOLBAR_CANCEL', false);
            JToolBarHelper::divider();
            JToolBarHelper::custom('sendtest', 'mail.png', 'mail.png', _JNEWS_SENDTEST_TEMP, false);
            JToolBarHelper::divider();
            $bar = JToolBar::getInstance('toolbar');
            $html1 = '<a class="modal btn btn-small" onclick="getTemplate()" title="' . _JNEWS_MENU_PREVIEW . '" href="' . jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=templates&task=preview&template_id=' . $template_id, true, false, true) . '" rel="{handler: \'iframe\', size: {x: 850, y: 500}}"><span style="float:left;"><img width=16 height=16 src="' . JNEWS_PATH_ADMIN_IMAGES2 . 'toolbar/preview_template.png"></span><span style="float:left; margin-left:8px;">' . _JNEWS_MENU_PREVIEW . '</span></a>';
            $bar->appendButton('Custom', $html1);
            $HTML = '<a class="modal btn btn-small" title="' . _JNEWS_MAILING_TAG . '" href="' . jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags', true, false, true) . '" rel="{handler: \'iframe\', size: {x: 850, y: 500}}"><span style="float:left;"><img width=16 height=16 src="' . JNEWS_PATH_ADMIN_IMAGES2 . 'toolbar/tag.png"/></span><span style="float:left; margin-left:8px;">' . _JNEWS_MAILING_TAG . '</span></a>';
            $bar->appendButton('Custom', $HTML);
            JToolBarHelper::divider();
            jNews_Menu::_wizardBtn('edit-template');
        }
    }
예제 #25
0
 /**
  * function to add the script for the mootools modal
  */
 function _addMootoolsModal()
 {
     $HTML = '';
     if (version_compare(JVERSION, '3.0.0', '<')) {
         JHTML::_('behavior.modal');
     } else {
         JHtml::_('behavior.modal');
     }
     if (version_compare(JVERSION, '1.6.0', '<')) {
         //j15
         $link = "rel=\"{handler: 'adopt', adopt:'acapop" . $this->num . "', size: {x:{$this->mootools_boxw}, y:{$this->mootools_boxh}}}\" class=\"modal aca_clicklink" . $this->num . "\"";
         $url = '#';
     } else {
         //j16
         $link = "rel=\"{handler: 'iframe', adopt:'acapop" . $this->num . "', size: {x:{$this->mootools_boxw}, y:{$this->mootools_boxh}}}\" class=\"modal aca_clicklink" . $this->num . "\"";
         $url = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=module&modid=' . $this->moduleID, false, true, true);
     }
     $HTML .= '<center>';
     $HTML .= '<a ' . $link;
     $HTML .= ' style="text-decoration: none;" href="' . $url . '">';
     if (isset($this->mootools_btntext)) {
         $HTML .= '<div id="aca_clickcontainer" style="padding:4px;"><center><span>' . $this->mootools_btntext . '</center></span></div></a></center>';
     } else {
         $HTML .= '<div id="aca_clickcontainer" style="padding:4px;"><center><span>' . _JNEWS_MOOTOOLS_BTNTEXT . '</span></center></div></a></center>';
     }
     $HTML .= '<div style="margin: 0px; overflow: hidden; height: 0px;">';
     $HTML .= '<div class="jnews_module' . $this->num . '" style="display: none;">';
     $HTML .= '<div id="acapop' . $this->num . '" style="padding: 15px;">';
     return $HTML;
 }
예제 #26
0
    /**
     * This public static function is used to process the queue manually
     */
    public static function processQueueHTML($queuedMails = null, $nextQueuedMails = null, $scheduledMails = null, $mailingid = null, $sendButton = false, $SmartNewsMessageHTML = '')
    {
        $doc = JFactory::getDocument();
        $doc->addStyleSheet(JNEWS_URL_ADMIN . 'cssadmin/jnews.css');
        ?>
		<form action="<?php 
        echo jNews_Tools::completeLink('option=' . JNEWS_OPTION, true, false, true);
        ?>
" method="post" name="adminForm" autocomplete="off" id="adminForm">
		<div><fieldset class="adminform">
		<legend><?php 
        echo _JNEWS_QUEUE_STATUSSEND;
        ?>
</legend>
		<?php 
        if (empty($queuedMails) && empty($nextQueuedMails) && empty($scheduledMails)) {
            jnews::displayInfo(_JNEWS_QUEUE_EMPTYINFO, 'info');
        }
        if (!empty($queuedMails)) {
            ?>
		<fieldset class="adminform">
			<legend><?php 
            echo _JNEWS_QUEUE_READYTOSEND;
            ?>
</legend>
			<table class="adminlist" cellspacing="1" align="center">
			<tbody>
			<?php 
            $k = 0;
            $total = 0;
            foreach ($queuedMails as $key => $queuedMail) {
                $total += $queuedMail->totalSubs;
                ?>
					<tr class="<?php 
                echo "row{$k}";
                ?>
">
						<td>
							<?php 
                echo '<strong><i>' . $queuedMail->subject . '</i></strong> ' . _JNEWS_NEWSLETTER_BE_READY_SENT . ' <strong><i>' . $queuedMail->totalSubs . ' ' . _JNEWS_NEWSLETTER_BE_SUBCRIBERS . '</i></strong>';
                ?>
						</td>
					</tr>
					<?php 
                $k = 1 - $k;
            }
            ?>
				</tbody>
			</table>
			<br/>
			<input type="hidden" name="totalsend" value="<?php 
            echo $total;
            ?>
" />
			<input type="submit" onclick="document.adminForm.task.value = 'continuesend';" value="<?php 
            echo _JNEWS_MENU_SEND;
            ?>
">
		</fieldset>
		<?php 
        }
        if (!empty($scheduledMails)) {
            $sendButton = true;
            ?>
		<fieldset class="adminform">
			<legend><?php 
            echo _JNEWS_QUEUE_SCHEDULED;
            ?>
</legend>
			<table class="adminlist" cellspacing="1" align="center">
			<tbody>
			<?php 
            $k = 0;
            $mailingids = array();
            foreach ($scheduledMails as $scheduledMail) {
                if ($scheduledMail->send_date < time()) {
                    $sendButton = true;
                }
                ?>
					<tr class="<?php 
                echo "row{$k}";
                ?>
">
						<td>
							<?php 
                echo '<strong><i>' . $scheduledMail->subject . '</i></strong> will be processed after <strong><i>' . date('D, d M Y H:i:s', jnews::getNow(0, true, $scheduledMail->send_date)) . '</i></strong>';
                ?>
						</td>
					</tr>
					<?php 
                $k = 1 - $k;
                $mailingids[] = $scheduledMail->id;
            }
            ?>
				</tbody>
			</table>
			<?php 
            if ($sendButton) {
                ?>
<br/><input onclick="document.adminForm.task.value = 'generate';" type="submit" value="<?php 
                echo 'Generate';
                ?>
"><?php 
            }
            ?>
		</fieldset>
	<?php 
        }
        if (!empty($nextQueuedMails)) {
            ?>

		<fieldset class="adminform">
			<legend><?php 
            echo _JNEWS_QUEUE_SCHEDULED . ' ' . date('D, d M Y H:i:s', jnews::getNow(0, true));
            ?>
</legend>
			<table class="adminlist" cellspacing="1" align="center">
			<tbody>
			<?php 
            $k = 0;
            foreach ($nextQueuedMails as $mailingid => $nextQueuedMail) {
                ?>
					<tr class="<?php 
                echo "row{$k}";
                ?>
">
						<td>
							<?php 
                echo '<strong><i>' . $nextQueuedMail->subject . '</i></strong> ' . _JNEWS_NEWSLETTER_BE_SENT;
                echo ' <strong><i>' . $nextQueuedMail->totalSubs . ' ' . _JNEWS_NEWSLETTER_BE_SUBCRIBERS . '</i></strong>';
                echo '<br/>';
                echo JText::sprintf(_JNEWS_NEWSLETTER_BE_NEXT, date('D, d M Y H:i:s', jnews::getNow(0, true, $nextQueuedMail->send_date)));
                ?>
						</td>
					</tr>
					<?php 
                $k = 1 - $k;
            }
            ?>
				</tbody>
			</table>
		</fieldset>
	<?php 
        }
        if (!empty($SmartNewsMessageHTML)) {
            ?>
		<fieldset class="adminform">
			<legend><?php 
            echo 'Smart-Newsletter Status';
            ?>
</legend>
			<table class="adminlist" cellspacing="1" align="center">
			<tbody>
					<tr class="<?php 
            echo "row0";
            ?>
">
						<td>
							<?php 
            echo $SmartNewsMessageHTML;
            ?>
						</td>
					</tr>
				</tbody>
			</table>
			<br/>
		</fieldset>
		<?php 
        }
        ?>
	</fieldset>
	</div>
	<div class="clr"></div>
	<input type="hidden" name="mailingid" value="<?php 
        echo $mailingid;
        ?>
" />
	<input type="hidden" name="option" value="<?php 
        echo JNEWS_OPTION;
        ?>
" />
	<input type="hidden" name="task" value="continuesend" />
	<input type="hidden" name="act" value="mailing" />
<?php 
        if (version_compare(JVERSION, '3.0.0', '<')) {
            echo JHTML::_('form.token');
        } else {
            echo JHtml::_('form.token');
        }
        ?>
</form>
<?php 
    }