예제 #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 edit($listEdit, $lists, $show, $html)
    {
        ?>
	<fieldset class="jnewscss">
	<legend><?php 
        echo _JNEWS_AUTO_RESP_OPTION;
        ?>
</legend>
	<table class="jnewstable" cellspacing="1">
		<tbody>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
        $tip = _JNEWS_INFO_LIST_FOLLOW_UP;
        $title = _JNEWS_FOLLOW_UP;
        echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        ?>
				</span>
			</td>
			<td>
				<input type="text" name="follow_up" class="inputbox" size="6" maxlength="10" value="<?php 
        if (isset($listEdit->follow_up)) {
            echo $listEdit->follow_up;
        } else {
            echo '';
        }
        ?>
" />
			<?php 
        if (!jNews_Auto::good()) {
            echo jnews::printM('no', _JNEWS_NOTSO_GOOD_LIC);
            echo _JNEWS_PLEASE_LIC;
        }
        ?>
			</td>
		</tr>
		</tbody>
	</table>
	</fieldset>
	<?php 
    }
예제 #3
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;
 }
예제 #4
0
    public static function notification($listEdit, $lists, $show, $html)
    {
        $editor = JFactory::getEditor();
        ?>
		<fieldset class="jnewscss">
		<legend><span class="editlinktip"><?php 
        echo _JNEWS_SUBSCRIPTION_SETTINGS;
        ?>
</span></legend>
		<table class="jnewstable" width="100%"  cellspacing="1">
			<tbody>
			<tr>
				<td width="185" class="key">
					<span class="editlinktip">
					<?php 
        $tip = _JNEWS_SUBSCRIPTION_NOTIFY_TIPS;
        $title = _JNEWS_SUBSCRIPTION_NOTIFY;
        echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        ?>
					</span>
				</td>
				<td>
					<?php 
        echo $lists['subnotifysend'];
        ?>
					<br /><br />
				</td>
			</tr>
			<tr>
				<td width="185" class="key" style="vertical-align: top;">
				<span class="editlinktip">
					<?php 
        $tip = _JNEWS_SUBNOTIFY_MSG_TIPS;
        $title = _JNEWS_SUBNOTIFY_MSG;
        ?>
					<?php 
        echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        ?>
					</span><br />
				</td>
				<td>
					<?php 
        if ($html) {
            echo $editor->display('subnotifymsg', $listEdit->subnotifymsg, '100%', '110', '75', '20');
        }
        ?>
				</td>
			</tr>
			</tbody>
		</table>
		</fieldset>

		<?php 
        if (true || $show['unsusbcribe']) {
            ?>
		<fieldset class="jnewscss">
		<legend><span class="editlinktip"><?php 
            echo _JNEWS_UNSUB_SETTINGS;
            ?>
</span></legend>
		<table class="jnewstable" width="100%" cellspacing="1">
			<tbody>
			<tr>
				<td width="185" class="key">
					<span class="editlinktip">
					<?php 
            $tip = _JNEWS_SEND_UNSUBNOTIFY_TIPS;
            $title = _JNEWS_UNSUB_NOTIFYMSG;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
					</span>
				</td>
				<td>
					<?php 
            echo $lists['unsubscribenotifyadmin'];
            ?>
					<br /><br />
				</td>
			</tr>
			<tr>
				<td width="185" class="key" style="vertical-align: top;">
				<span class="editlinktip">
					<?php 
            $tip = _JNEWS_INFO_AMIN_UNSUB_NOTIFY;
            $title = _JNEWS_UNSUB_ADMINMESSAGE;
            ?>
					<?php 
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
					</span><br />
				</td>
				<td>
					<?php 
            if ($html) {
                echo $editor->display('notifyadminmsg', $listEdit->notifyadminmsg, '100%', '110', '75', '20');
            }
            ?>
				</td>
			</tr>
			</tbody>
		</table>
		</fieldset>
		<?php 
        }
    }
예제 #5
0
function update($action, $task)
{
    require_once JNEWSPATH_CLASS . 'class.update.php';
    $update = new jNews_Update();
    $showListing = true;
    $showComplete = false;
    $message = JRequest::getVar('message', '');
    if (!ini_get('safe_mode')) {
        @set_time_limit(60 * $GLOBALS[JNEWS . 'script_timeout']);
    }
    //css injection for the images
    $doc = JFactory::getDocument();
    $css = '.icon-48-import { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/import.png)}';
    $doc->addStyleDeclaration($css, $type = 'text/css');
    switch ($task) {
        case 'doUpdate':
            backHTML::_header(_JNEWS_MENU_UPDATE, 'update', $message, $task, $action);
            $update->doUpdate();
            $showListing = false;
            $showComplete = false;
            break;
        case 'version':
            $update->getVersion();
            break;
        case 'complete':
            $showComplete = true;
            $showListing = false;
            break;
        case 'cancel':
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=update');
            $showListing = false;
            break;
        case 'cpanel':
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION);
            $showListing = false;
            break;
        case 'new1':
            backHTML::_header(_JNEWS_MENU_UPDATE, 'import.png', $message, $task, $action);
            $message = jnews::printYN(jnews::upgrade_News1(), '<br />' . _JNEWS_IMPORT_SUCCESS . ' Anjel data', _JNEWS_ERROR);
            jnews::resetUpgrade(1);
            echo '<br />' . $message;
            break;
        case 'new2':
            backHTML::_header(_JNEWS_MENU_UPDATE, 'import.png', $message, $task, $action);
            $message = jnews::printYN(jnews::upgrade_News2(), '<br />' . _JNEWS_IMPORT_SUCCESS . ' Letterman data', _JNEWS_ERROR);
            jnews::resetUpgrade(2);
            echo '<br />' . $message;
            break;
        case 'new3':
            backHTML::_header(_JNEWS_MENU_UPDATE, 'import.png', $message, $task, $action);
            $message = jnews::printYN(jnews::upgrade_News3(), '<br />' . _JNEWS_IMPORT_SUCCESS . ' YaNC data', _JNEWS_ERROR);
            jnews::resetUpgrade(3);
            echo '<br />' . $message;
            break;
    }
    if ($showListing) {
        backHTML::_header(_JNEWS_MENU_UPDATE, 'import.png', $message, $task, $action);
        backHTML::_upgrade();
        $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
        echo $forms['main'];
        backHTML::formStart('', '', '');
        backHTML::showCompsList($update);
        $go[] = jnews::makeObj('act', $action);
        backHTML::formEnd($go);
    } elseif ($showComplete) {
        backHTML::_header(_JNEWS_MENU_UPDATE, 'import.png', $message, $task, $action);
        $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
        echo $forms['main'];
        backHTML::formStart('', '', '');
        backHTML::showUpdateOptions($update);
        $go[] = jnews::makeObj('act', $action);
        backHTML::formEnd($go);
    }
}
예제 #6
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;
 }
예제 #7
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);
}
예제 #8
0
파일: jnewsbotk2.php 프로젝트: naka211/kkvn
function jnewsbot_k2_editab()
{
    $limit = 5;
    $limittotal = countK2Items();
    $setLimitk2 = jnews::setLimitPagination($limittotal);
    $task = JRequest::getVar('task');
    //filter
    if (isset($_POST['contentsearchk2'])) {
        $contentsearch = JRequest::getVar('contentsearchk2', 'post', '', 'string');
    } else {
        $contentsearch = "";
    }
    $toSearch = new stdClass();
    $toSearch->forms = '';
    //$toSearch->hidden = $hidden;
    $toSearch->listsearch = $contentsearch;
    $toSearch->id = 'contentsearchk2';
    $app = JFactory::getApplication();
    $setSortk2 = new stdClass();
    if (!isset($_POST['k2_filter_order'])) {
        $setSortk2->orderValue = "a.id";
    } else {
        $setSortk2->orderValue = $_POST['filter_order'];
    }
    $setSortk2->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.k2content.filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
    $sort_select = JRequest::getVar('filter_category_id_k2', '', 'POST', 'int');
    $k2contentitems = jnewsbot_k2_getitems($contentsearch, $setLimitk2, $setSortk2, $sort_select);
    ob_start();
    $js = "var id_global, content_type, hide_title_global;\n            function setContentTag(id, hide_title_or_rendering)\n            {\n                if(id != null) {\n\n                    if(document.getElementById('for_disabled').checked === false)\n                    {\n                         document.getElementById('hide_title_yes').disabled=false;\n                    }\n\n                    if(hide_title_or_rendering ==undefined && hide_title_global == undefined)\n                    {\n                         hide_title_global = 0;\n                    }\n                    if(hide_title_or_rendering ==undefined && content_type == undefined)\n                    {\n                        content_type = 0;\n                    }\n                    if(id ==='rendering')\n                    {\n                        content_type = hide_title_or_rendering;\n                        if(id_global == undefined)  id_global = 0;\n                        if(hide_title_global == undefined) hide_title_global = 0;\n                        if(hide_title_or_rendering == 2)\n                        {\n                           // hide_title_global = 0;\n                            document.getElementById('hide_title_no').click();\n                            document.getElementById('hide_title_yes').disabled=true;\n\n                        }\n                    }\n                    if(id == 'hide_title')\n                    {\n                        hide_title_global = hide_title_or_rendering;\n                        if(id_global == undefined) id_global = 0;\n                        if(content_type == undefined) content_type = 0;\n                    }\n                    if( id % 1 === 0)\n                    {\n                        id_global = id;\n                        if(content_type == undefined) content_type = 0;\n                        if(hide_title_global == undefined) hide_title_global = 0;\n                    }\n\n                    var form = document.adminForm;\n                    if(!form){\n                            form = document.mosForm;\n                    }\n                    var tag = '{k2item:' + id_global + '|' + content_type +'|'+hide_title_global+ '}';\n                    form.k2tag.value = tag;\n\n                }\n                else\n                {           var form = document.adminForm;\n                            if(!form){\n                                    form = document.mosForm;\n                            }\n                            var tag = form.k2tag.value;     ";
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //1.5
        $js .= " if(window.top.insertTag(tag)){window.top.document.getElementById('sbox-window').close();}";
    } else {
        if (version_compare(JVERSION, '3.0.0', '<')) {
            $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}';
        } else {
            $js .= ' if(window.top.insertTag(tag)) {
                    var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                    if(need_click.length == 0) window.parent.SqueezeBox.close();
                    else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
        }
    }
    $js .= "}\n\t}";
    //if(window.top.insertTag(tag)){window.top.document.getElementById('sbox-window').close();}
    $doc = JFactory::getDocument();
    $doc->addScriptDeclaration($js);
    ?>


<style type="text/css">
table.smartcontent {
	border: 1px solid #D5D5D5;
	background-color: #F6F6F6;
	width: 100%;
	margin-bottom: 10px;
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	padding: 5px;
}
table.smartcontent td.key {
	background-color: #f6f6f6;
	text-align: left;
	width: 140px;
	color: #666;
	font-weight: bold;
	border-bottom: 1px solid #e9e9e9;
	border-right: 1px solid #e9e9e9;
}
</style>
<div id="element-box">
<div class="t">
    <div class="t">
        <div class="t"></div>
    </div>
</div>
<div class="m">



<form id="adminForm" name="adminForm" method="post" action="index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&tmpl=component&act=tags&task=k2content">



<table class="smartcontent" width="100%">
<tr>
<td width="185" class="key">
<span class="editlinktip">
<?php 
    $tip = _JNEWS_AUTONEWS_TYPE_TIPS;
    $title = _JNEWS_AUTONEWS_TYPE;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
</span>
</td>
<td style="vertical-align: top;">
<span class="editlinktip">
<?php 
    $tip = _JNEWS_TITLE_ONLY_TIPS;
    $title = _JNEWS_TITLE_ONLY;
    $title_only = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    $tip = _JNEWS_INTRO_ONLY_TIPS;
    $title = _JNEWS_INTRO_ONLY;
    $intro_only = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    $tip = _JNEWS_FULL_ARTICLE_TIPS;
    $title = _JNEWS_FULL_ARTICLE;
    $full_article = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    ?>
</span>
<span class="editlinktip">
    <input type="radio" onclick="setContentTag('rendering', 0)" name="content_type" value="0" checked="checked" /><?php 
    echo $full_article;
    ?>
    <input type="radio"  onclick="setContentTag('rendering', 1)" name="content_type" value="1" /><?php 
    echo $intro_only;
    ?>
    <input id="for_disabled" type="radio" onclick="setContentTag('rendering', 2)" name="content_type" value="2" /><?php 
    echo $title_only;
    ?>
</span>

</td>
<td rowspan="2">
        <input onclick="setContentTag(null)" class="inserttag" type="button" label="Insert Tag" name="Insert Tag" value="<?php 
    echo _JNEWS_TAG_INSERT_TAG;
    ?>
"/>
</td>
</tr>

<tr>
	<td width="185" class="key">
		<span class="editlinktip">
			Tag
		</span>
	</td>
	<td style="vertical-align: top;">
		<!-- 	<input type="text" onchange="setCaptionTags();" size="60px" name="jnewstagcaption"> -->
			<input type="text" size="60px" name="k2tag">
	</td>
</tr>
<tr>
	<td width="185" class="key">
		<span class="editlinktip">
                    <?php 
    $tip = _JNEWS_HIDE_TITTLE_ARTICLE_TIPS;
    $title = _JNEWS_HIDE_TITLE;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
		</span>
	</td>
	<td style="vertical-align: top;">
            <span class="hide_title" >
                <input id="hide_title_no" onclick="setContentTag('hide_title', 0);" type="radio" name="hide_title" value="0" checked="checked" /><?php 
    echo 'No';
    ?>
                <input id="hide_title_yes" onclick="setContentTag('hide_title', 1);" type="radio" name="hide_title" value="1" /><?php 
    echo 'Yes';
    ?>
            </span>
        </td>
</tr>
</table>
<div id="element-box">
    <div class="t">
        <div class="t">
            <div class="t"></div>
        </div>
    </div>


    <div class="m"  style="position:relative;">


    <input type="hidden" name="option" value="<?php 
    echo JNEWS_OPTION;
    ?>
" />
    <input type="hidden" name="limit" value="<?php 
    echo $limit;
    ?>
" />
<!--////////////////////////////////////////////////////-->
        <?php 
    echo jnews::setTop($toSearch, null);
    $category_list_k2 = getAllCategoriesK2();
    ?>
        <div style="position:absolute;top:5px; left:55%;">
            <select name="filter_category_id_k2" class="inputbox" onchange="this.form.submit()">
                <option value=""><?php 
    echo JText::_('JOPTION_SELECT_CATEGORY');
    ?>
</option>
                <?php 
    for ($i = 0; $i < count($category_list_k2); $i++) {
        ?>
                <option value="<?php 
        echo $category_list_k2[$i]->id;
        ?>
"  <?php 
        if ($sort_select == $category_list_k2[$i]->id) {
            echo "selected";
        }
        ?>
>
                    <?php 
        echo $category_list_k2[$i]->name;
        ?>
                </option>
               <?php 
    }
    ?>
            </select>
        </div>
        <table class="<?php 
    echo jnews::myTheme();
    ?>
" cellpadding="0" cellspacing="0">
            <tbody>
                <thead>
                    <tr>
                        <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.title','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                       <?php 
    echo _JNEWS_TAGPICKLIST_TITLE;
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.title') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>
                           <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.title_2','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                        <?php 
    echo _JNEWS_TAG_ARTICLESECTION;
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.title_2') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>
                        <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.catid','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                        <?php 
    echo _JNEWS_TAG_ARTICLECATEGORY;
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.catid') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>
                        <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.id','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                       <?php 
    echo "  ID";
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.id') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>

                    </tr>
                </thead>
                <?php 
    if (sizeof($k2contentitems) > 0) {
        $k = 0;
        foreach ($k2contentitems as $k2contentitem) {
            if (empty($k2contentitem->section)) {
                $k2contentitem->section = JText::_('Uncategorised');
            }
            if (empty($k2contentitem->category)) {
                $k2contentitem->category = JText::_('Uncategorised');
            }
            echo '<tr style="cursor:pointer" class="row' . $k . '" onclick="setContentTag(\'' . $k2contentitem->id . '\');" ><td>' . $k2contentitem->title . '</td><td nowrap="nowrap" align="center">' . $k2contentitem->section . '</td><td nowrap="nowrap" align="center">' . $k2contentitem->category . '</td><td nowrap="nowrap" align="center">' . $k2contentitem->id . '</td></tr>';
            $k = 1 - $k;
        }
    }
    ?>
            </tbody>
        </table>
   <?php 
    echo jnews::setPaginationBot($setLimitk2, 'margin:auto;');
    ?>

</div>
<div class="b">
<div class="b">
<div class="b"></div>
</div>
</div>
</div>
                <input type="hidden" value="<?php 
    echo $task;
    ?>
" name="task"/>
                <input type="hidden" value="<?php 
    echo $setSortk2->orderValue;
    ?>
" name="k2_filter_order"/>
                  <input type="hidden" value="<?php 
    echo $setSortk2->orderValue;
    ?>
" name="filter_order"/>
                <input type="hidden" value="<?php 
    echo $setSortk2->orderDir;
    ?>
" name="filter_order_Dir"/>
</form>
</div>
<div class="b">
<div class="b">
<div class="b"></div>
</div>
</div>
</div>
<?php 
    $return = ob_get_contents();
    ob_end_clean();
    return array(_JNEWS_CONTENT_ITEM, $return);
}
예제 #9
0
파일: jnewsshare.php 프로젝트: naka211/kkvn
function jnewsbot_share_editab()
{
    ob_start();
    $js = "function setShareTag(changed){\n\t\tvar form = document.adminForm;\n\t\tif(!form){\n\t\t\tform = document.mosForm;\n\t\t}\n\t\tif(changed!=null){\n\t\t\tvar tag = '{tag:share name=';\n\t\t\tvar media = '';\n\t\t\tvar facebook = 0;\n\t\t\tvar linkedin = 0;\n\t\t\tvar twitter = 0;\n\t\t\n\t\t\tfor (i=0;i<form.facebook.length;i++) {\n\t\t\t\tif (form.facebook[i].checked) {\n\t\t\t\t\tfacebook = form.facebook[i].value;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor (i=0;i<form.linkedin.length;i++) {\n\t\t\t\tif (form.linkedin[i].checked) {\n\t\t\t\t\tlinkedin = form.linkedin[i].value;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor (i=0;i<form.twitter.length;i++) {\n\t\t\t\tif (form.twitter[i].checked) {\n\t\t\t\t\ttwitter = form.twitter[i].value;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(facebook == 1) media = media + 'facebook';\n\t\t\t\n\t\t\tif((facebook==1 && linkedin==1)) media = media + ','; \n\t\t\t\n\t\t\tif(linkedin == 1) media = media + 'linkedin';\t\n\t\t\t\n\t\t\tif((facebook==1 || linkedin==1) && twitter == 1) media = media + ','; \n\t\t\t\n\t\t\tif(twitter == 1) media = media + 'twitter';\t\n\t\t\t\n\t\t\tif(media == '') tag = media;\n\t\t\telse tag = tag + media + '}';\n\t\t\t\n\t\t\t\n\t\t\tform.sharetag.value= tag;\n\t\t\t\n\t\t}else{\n\t\t\tvar sharetag = form.sharetag.value;";
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //1.5
        $js .= " if(window.top.insertTag(sharetag)){window.top.document.getElementById('sbox-window').close();}";
    } else {
        if (version_compare(JVERSION, '3.0.0', '<')) {
            $js .= ' if(window.top.insertTag(sharetag)) {window.parent.SqueezeBox.close();}';
        } else {
            $js .= ' if(window.top.insertTag(sharetag)) {           
                     var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                    if(need_click.length == 0) window.parent.SqueezeBox.close();
                    else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
        }
    }
    $js .= "}\n\t}";
    $doc = JFactory::getDocument();
    $doc->addScriptDeclaration($js);
    ?>


<style type="text/css">
table.smartcontent {
	border: 1px solid #D5D5D5;
	background-color: #F6F6F6;
	width: 100%;
	margin-bottom: 10px;
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	padding: 5px;
}
table.smartcontent td.key {
	background-color: #f6f6f6;
	text-align: left;
	width: 140px;
	color: #666;
	font-weight: bold;
	border-bottom: 1px solid #e9e9e9;
	border-right: 1px solid #e9e9e9;
}
</style>
<div id="element-box">
<div class="t">
<div class="t">
<div class="t"></div>
</div>
</div>
<div class="m">
<form name="adminForm" method="post" action="index.php" id="adminForm">
<div id="element-box">
<table class="smartcontent" width="100%">

<tr>
	<td width="185" class="key">
		<span class="editlinktip">
			<?php 
    $tip = 'Select yes to add Facebook tag)';
    $title = 'Facebook';
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
		</span>
	</td>
	<td style="vertical-align: top;">
		<input type="radio" name="facebook" value="1" checked="checked" onclick="setShareTag(1)"/><?php 
    echo 'Yes';
    ?>
        <input type="radio" name="facebook" value="0" onclick="setShareTag(1)"/><?php 
    echo 'No';
    ?>
	</td>
</tr>

<tr>
	<td width="185" class="key">
		<span class="editlinktip">
			<?php 
    $tip = 'Select yes to add LinkedIn tag)';
    $title = 'LinkedIn';
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
		</span>
	</td>
	<td style="vertical-align: top;">
		<input type="radio" name="linkedin" value="1" checked="checked" onclick="setShareTag(1)"/><?php 
    echo 'Yes';
    ?>
        <input type="radio" name="linkedin" value="0" onclick="setShareTag(1)"/><?php 
    echo 'No';
    ?>
	</td>
</tr>

<tr>
	<td width="185" class="key">
		<span class="editlinktip">
			<?php 
    $tip = 'Select yes to add Twitter tag)';
    $title = 'Twitter';
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
		</span>
	</td>
	<td style="vertical-align: top;">
		<input type="radio" name="twitter" value="1" checked="checked" onclick="setShareTag(1)"/><?php 
    echo 'Yes';
    ?>
        <input type="radio" name="twitter" value="0" onclick="setShareTag(1)"/><?php 
    echo 'No';
    ?>
	</td>
</tr>
</table>
<table class="smartcontent" width="100%">
<tr>
	<td width="185" class="key">
		<span class="editlinktip">
			Tag
		</span>
	</td>
	<td style="vertical-align: top;">
		<input type="text" size="70px" name="sharetag" readonly="true" value="{tag:share name=facebook,linkedin,twitter}">
	</td>
	<td rowspan="2">
		<input onclick="setShareTag(null)" class="sharetag" type="button" label="Insert Tag" name="Insert Tag" value="<?php 
    echo _JNEWS_TAG_INSERT_TAG;
    ?>
" />
	</td>
</tr>
</table>
</form>
</div>
</div>
<div class="b">
<div class="b">
<div class="b"></div>


</div>
</div>
</div>
<?php 
    $return = ob_get_contents();
    ob_end_clean();
    return array(_JNEWS_TAGMENU_MEDIA_SHARE, $return);
}
예제 #10
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;
}
예제 #11
0
파일: jnews.php 프로젝트: naka211/kkvn
function configuration($action, $task)
{
    $db = JFactory::getDBO();
    $config = array();
    $redirect = true;
    $xf = new jNews_Config();
    $message = JRequest::getVar('message', '');
    $clear_log = JRequest::getVar('clear_log', '0');
    switch ($task) {
        case 'syncUsers':
            echo jnews::printYN(jNews_Subscribers::syncSubscribers(), _JNEWS_SYNC_USERS_SUCCESS, _JNEWS_ERROR);
            backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action);
            jNews_ConfigHTML::showConfigEdit();
            break;
        case 'sendtest':
            $my = JFactory::getUser();
            $mailing = new stdClass();
            $status = false;
            $mailing->id = 1;
            $mailing->images = '';
            $mailing->attachments = '';
            $mailing->fromname = trim($GLOBALS[JNEWS . 'sendmail_name']);
            $mailing->fromemail = trim($GLOBALS[JNEWS . 'sendmail_email']);
            if (empty($mailing->fromemail)) {
                $mailing->fromemail = trim($GLOBALS[JNEWS . 'sendmail_from']);
            }
            ### create the mail
            $mail = jNews_ProcessMail::getMailer($mailing);
            ### create content
            $mail->IsHTML(true);
            $mail->Body = '<p>This message has been sent at ' . date('l, j F Y h:i:s', jnews::getNow(0, true)) . ' from ' . JNEWS_JPATH_LIVE . ' to test your mail configuration.</p><br/><p style="color:green;">' . _JNEWS_SENDTEST_CONFIGSUCC . '</p>';
            $mail->AddAddress($my->email, $my->name);
            $mail->Subject = 'Test Email from ' . JNEWS_JPATH_LIVE;
            $status = $mail->Send();
            $success = 'Email "' . $mail->Subject . '" successfully sent to ' . $my->name . ' (' . $my->email . ')';
            $error = 'Failed sending "' . $mail->Subject . '" to ' . $my->name . ' (' . $my->email . '). <br/>' . _JNEWS_SENDTEST_CONFIGERROR;
            $message = is_bool($status) && $status ? jnews::printM('ok', $success) : jnews::printM('error', $error);
            backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action);
            jNews_ConfigHTML::showConfigEdit();
            echo $message;
            break;
        case 'apply':
        case 'save':
            JRequest::checkToken() or die('Invalid Token');
            if ($clear_log != 0) {
                @unlink(JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'save_log_file']);
            }
            $config = JRequest::getVar('config');
            $message = jnews::printYN($xf->saveConfig($config), _JNEWS_CONFIG_UPDATED, _JNEWS_ERROR);
            $listCreator = JRequest::getVar('list_creatorfe', '', 'post');
            if (!empty($listCreator)) {
                $xf->update('list_creatorfe', $listCreator);
            }
            //we update the active list
            $xf->updateActiveList();
            if ($GLOBALS[JNEWS . 'level'] > 1) {
                //we require the cron controller
                require_once JNEWSPATH_ADMIN . 'controllers' . DS . 'cron.jnews.php';
                //we update the published/enabld of the jnews cron plugin according to what is selected
                if (version_compare(JVERSION, '1.6.0', '<')) {
                    //j15
                    $db->setQuery("UPDATE `#__plugins` SET `published` = " . $config['jnewscronplugin'] . " WHERE `element`='jnewscron' ");
                } else {
                    //j16
                    $db->setQuery("UPDATE `#__extensions` SET `enabled` = " . $config['jnewscronplugin'] . " WHERE `type` = 'plugin' AND `element`='jnewscron' ");
                }
                $db->query();
                //Joobi Cron System
                $cron = $GLOBALS[JNEWS . 'j_cron'];
                if ($cron == 2) {
                    joobiCron('Yes');
                } else {
                    joobiCron('No');
                }
            }
            if ($task == 'apply') {
                backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action);
                jNews_ConfigHTML::showConfigEdit();
                echo $message;
            } else {
                backHTML::controlPanel();
            }
            break;
        case 'cancel':
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION);
            break;
        case 'cpanel':
            backHTML::controlPanel();
            break;
        case 'acaupdate':
            // update jnews datas from acajoom
            $msg = jNews_TableUpdate::executeUpdate();
            echo $msg . '<br><br>';
        default:
            backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action);
            jNews_ConfigHTML::showConfigEdit();
            break;
    }
    return true;
}
예제 #12
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);
}
예제 #13
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');
        }
    }
예제 #14
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);
 }
예제 #15
0
 public static function miseEnHTML($title, $tip, $compoment)
 {
     $html = '<tr>' . "\n\r";
     $html .= ' <td width="185" class="key">' . "\n\r";
     $html .= '  <span class="editlinktip">' . "\n\r";
     $html .= jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
     $html .= '  </span>' . "\n\r";
     $html .= ' </td>' . "\n\r";
     $html .= ' <td>' . $compoment . ' ' . "\n\r";
     $html .= ' </td>' . "\n\r";
     $html .= '</tr>' . "\n\r";
     return $html;
 }
예제 #16
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;
 }
예제 #17
0
파일: jnews.php 프로젝트: naka211/kkvn
         frontEnd::newSubscriberContinue($message_arr['newsubscriber']);
     }
     if ($GLOBALS[JNEWS . 'addEmailRedLink']) {
         if (strpos($redirectlink, '?')) {
             $redirectlink .= '&email=' . $email;
         } else {
             $redirectlink .= '?email=' . $email;
         }
         //endelse
     }
     $showMessage = JRequest::getVar('listname', 0);
     if (!empty($redirectlink)) {
         if (!$showMessage) {
             $message = '';
         }
         jNews_Tools::redirect($redirectlink, $message);
     } else {
         $showPanel = true;
     }
     break;
 case 'list':
     if (empty($listId)) {
         $listId = JRequest::getVar('list_id');
     }
     frontEnd::showLists($subscriberId, $listId, $lisType, $action, $task);
     break;
 case 'statistics':
     if (empty($listType)) {
         $listType = 1;
     }
     frontend::statisticsFE($action, $task, $listId, $listType, $mailingId, $message, $Itemid);
예제 #18
0
    public static function quickiconButton($link, $image, $text, $external = false, $accessLevel = '', $frontEnd = false)
    {
        if (jnews::checkPermissions($accessLevel)) {
            if ($frontEnd) {
                $link = JRoute::_($link);
            }
            ?>
		<div style="float:left;">
			<div class="icon">                         
                            
				<a href="<?php 
            echo $link;
            ?>
" <?php 
            if ($external) {
                echo 'target="_blank"';
            }
            ?>
>
				<?php 
            jNews_Tools::showIcon($image, $text);
            ?>
					<span><?php 
            echo $text;
            ?>
</span>
				</a>
                            
			</div>
		</div>
		<?php 
        }
    }
예제 #19
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;
 }
예제 #20
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;
 }
예제 #21
0
    public static function jcalpro()
    {
        $db = JFactory::getDBO();
        $tip = _JNEWS_JCALTAGS_DESC_TIPS;
        $title = _JNEWS_JCALTAGS_DESC;
        $desc = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
        $tip = _JNEWS_JCALTAGS_START_TIPS;
        $title = _JNEWS_JCALTAGS_START;
        $start = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
        $tip = _JNEWS_JCALTAGS_READMORE_TIPS;
        $title = _JNEWS_JCALTAGS_READMORE;
        $read = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
        $query = "SELECT `cat_id`,`cat_name` FROM #__jcalpro2_categories";
        $db->setQuery($query);
        $jcalcats = $db->loadObjectList();
        $events = array();
        $year = intval(date('Y'));
        if (!empty($jcalcats)) {
            foreach ($jcalcats as $jcalcat) {
                $query = "SELECT `extid`, `title` ,`start_date` FROM #__jcalpro2_events where `cat` = " . $jcalcat->cat_id . " AND (`start_date` >= '" . $year . "' OR `end_date` >= '" . $year . "' ) ORDER BY `start_date` DESC";
                $db->setQuery($query);
                $events[$jcalcat->cat_id] = $db->loadObjectList();
            }
        }
        ?>
<script type="text/javascript">
<!--

var events = new Array;

<?php 
        if (!empty($events)) {
            $i = 0;
            foreach ($events as $cat => $eventcat) {
                if (!empty($eventcat)) {
                    foreach ($eventcat as $event) {
                        echo 'events[' . $i . '] = new Array(\'' . $cat . '\',\'' . $event->extid . '\',\'' . addslashes($event->title) . ' (' . $event->start_date . ')\');' . "\n";
                        $i++;
                    }
                }
            }
        }
        ?>
var formname = 'adminForm';
if(!document.adminForm){
	formname = 'mosForm';
}

function updatejCalCat(){

	var catid = eval('document.'+formname+'.jcal_cat.value');
	var list = eval( 'document.'+formname+'.jcal_event');

	var i = 0;
	// empty the list
	for (i in list.options.length) {
		list.options[i] = null;
	}
	i = 0;
	for (a in events) {
		if (events[a][0] == catid) {
			opt = new Option();
			opt.value = events[a][1];
			opt.text = events[a][2];
			list.options[i++] = opt;
		}
	}
	list.length = i;

}

function updatejCaltag(){
	var eventid = eval('document.'+formname+'.jcal_event.value');
	var start = eval('document.'+formname+'.jcal_start');
	var desc = eval('document.'+formname+'.jcal_desc');
	var read = eval('document.'+formname+'.jcal_read');
	var tag = eval('document.'+formname+'.jcal_tag');

	for (i=0;i<start.length;i++) {
        if (start[i].checked) {
             var start_value = start[i].value;
        }
    }
	for (i=0;i<desc.length;i++) {
        if (desc[i].checked) {
             var desc_value = desc[i].value;
        }
    }
	for (i=0;i<read.length;i++) {
        if (read[i].checked) {
             var read_value = read[i].value;
        }
    }

	tag.value = "{jcalevent:" + eventid + "|" + start_value + "|" + desc_value + "|" + read_value + "}";
}
//-->
</script>

		<table class="jnewscss_bots" width="100%">
			<tr>
				<td style="vertical-align: top;" colspan="2">
				<?php 
        $tip = _JNEWS_JCALTAGS_TITLE_TIPS;
        $title = _JNEWS_JCALTAGS_TITLE;
        echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        ?>
					<input class="inputbox" type="text" onfocus="this.select();" size="20" name="jcal_tag"/>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
        echo $start;
        ?>
				</td>
				<td>
	                <input type="radio" name="jcal_start" value="0" onclick="updatejCaltag();" />
	                <img src="<?php 
        echo JNEWS_PATH_ADMIN_IMAGES2;
        ?>
16/status_r.png" width="12" height="12" border="0" alt="No" />
	                <input type="radio" name="jcal_start" value="1" checked="checked" onclick="updatejCaltag();" />
	                <img src="<?php 
        echo JNEWS_PATH_ADMIN_IMAGES2;
        ?>
16/status_g.png" width="12" height="12" border="0" alt="Yes" />
	             </td>
			</tr>
			<tr>
				<td>
					<?php 
        echo $desc;
        ?>
				</td>
				<td>
					<input type="radio" name="jcal_desc" value="0"  onclick="updatejCaltag();" />
	                <img src="<?php 
        echo JNEWS_PATH_ADMIN_IMAGES2;
        ?>
16/status_r.png" width="12" height="12" border="0" alt="No" />
	                <input type="radio" name="jcal_desc" value="1"  checked="checked" onclick="updatejCaltag();" />
	                <img src="<?php 
        echo JNEWS_PATH_ADMIN_IMAGES2;
        ?>
16/status_g.png" width="12" height="12" border="0" alt="Yes" />
				</td>
			</tr>
			<tr>
				<td>
					<?php 
        echo $read;
        ?>
				</td>
				<td>
					<input type="radio" name="jcal_read" value="0" onclick="updatejCaltag();" />
	                <img src="<?php 
        echo JNEWS_JPATH_LIVE;
        ?>
/administrator/images/publish_x.png" width="12" height="12" border="0" alt="No" />
	                <input type="radio" name="jcal_read" value="1" checked="checked" onclick="updatejCaltag();" />
	                <img src="<?php 
        echo JNEWS_JPATH_LIVE;
        ?>
/administrator/images/tick.png" width="12" height="12" border="0" alt="Yes" />
				</td>
			</tr>
			<tr>
				<td colspan="2">
<?php 
        echo '<select class="inputbox" onchange="updatejCalCat();" size="1" name="jcal_cat">';
        if (!empty($jcalcats)) {
            foreach ($jcalcats as $jcalcat) {
                echo '<option value="' . $jcalcat->cat_id . '">' . $jcalcat->cat_name . '</option>';
            }
        }
        echo '</select>';
        ?>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<select name="jcal_event" class="inputbox" size="30" onchange="updatejCaltag();">
					<?php 
        if (!empty($jcalcats)) {
            if (!empty($events[$jcalcats[0]->cat_id])) {
                foreach ($events[$jcalcats[0]->cat_id] as $event) {
                    echo '<option value="' . $event->extid . '">' . $event->title . ' (' . $event->start_date . ') </option>' . "\n";
                }
            }
        }
        ?>
					</select>
				</td>
			</tr>
		</table>
<?php 
    }
예제 #22
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 
    }
예제 #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
파일: 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;
}
예제 #25
0
function statistics($listId, $listType, $mailingId, $message, $task, $action)
{
    //From Specified fieldset
    $sDate = JRequest::getVar('startdate');
    $eDate = JRequest::getVar('enddate');
    if ($task == 'cpanel') {
        jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION);
    }
    //Predefined fieldset
    $currentInterval = JRequest::getVar('rptinterval');
    $currentRange = JRequest::getVar('rptrange');
    if (empty($currentRange)) {
        $currentRange = 'this-month';
    }
    if (empty($currentInterval)) {
        $currentInterval = 'weekly';
    }
    if ($sDate == '0000-00-00' && $eDate == '0000-00-00') {
        $sDate = 0;
        $eDate = 0;
    }
    if (!empty($sDate) && !empty($eDate)) {
        if ($sDate != '0000-00-00' && $eDate != '0000-00-00') {
            $sDate = strtotime($sDate);
            $sDate = $sDate - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z');
            $eDate = strtotime($eDate);
            $eDate = $eDate - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z');
        } elseif ($sDate != '0000-00-00' && $eDate == '0000-00-00') {
            $sDate = strtotime($sDate);
            $sDate = $sDate - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z');
            $eDate = time();
            // - JNEWS_TIME_OFFSET * 3600 ;
        } elseif ($sDate == '0000-00-00' && $eDate != '0000-00-00') {
            echo jnews::printM('warning', _JNEWS_REPORT_WARN_MESSAGE);
            $sDate = 0;
            $eDate = 0;
        }
    } else {
        //Set the correct startDateTime and endDateTime
        //Set also the correct intervals appropriate for each range
        //current datetime base on the website setting configuration
        $currDate = $eDate = time();
        // - JNEWS_TIME_OFFSET * 3600 ;
        switch ($currentRange) {
            case 'today':
                //today
                $sDate = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
                $eDate = mktime(23, 59, 59, date('m'), date('d'), date('Y'));
                $currentInterval = 'daily';
                break;
            case 'yesterday':
                //yesterday
                $sDate = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
                $eDate = mktime(23, 59, 59, date('m'), date('d') - 1, date('Y'));
                $currentInterval = 'daily';
                break;
            case 'this-week':
                //this week
                $sDate = mktime(0, 0, 0, date('n'), date('j'), date('Y')) - (date('N') - 1) * 3600 * 24;
                //if selected intervals is monthly or yearly
                if ($currentInterval == 'monthly' || $currentInterval == 'yearly') {
                    $currentInterval = 'weekly';
                }
                break;
            case 'last-week':
                //last week..start of the week is Monday at 00:00:00 and will end on Sunday at 23:59:59:
                $sDate = mktime(0, 0, 0, date('n'), date('j') - 6, date('Y')) - date('N') * 3600 * 24;
                $eDate = mktime(23, 59, 59, date('n'), date('j'), date('Y')) - date('N') * 3600 * 24;
                //if selected intervals is monthly or yearly
                if ($currentInterval == 'monthly' || $currentInterval == 'yearly') {
                    $currentInterval = 'weekly';
                }
                break;
            case 'last-2-weeks':
                //last 2 weeks
                $sDate = mktime(0, 0, 0, date('n'), date('j') - 13, date('Y')) - date('N') * 3600 * 24;
                $eDate = mktime(23, 59, 59, date('n'), date('j'), date('Y')) - date('N') * 3600 * 24;
                //if selected intervals is monthly or yearly
                if ($currentInterval == 'monthly' || $currentInterval == 'yearly') {
                    $currentInterval = 'weekly';
                }
                break;
            case 'last-month':
                //last month..starts at the first day to the last day
                $sDate = strtotime(date('m') - 1 . '/01/' . date('Y'), $currDate);
                $eDate = $sDate + 30 * 24 * 3600;
                //mktime(23, 59, 59, date('m'));
                if ($currentInterval == 'yearly') {
                    $currentInterval = 'weekly';
                }
                break;
            case 'this-year':
                //this year..starts
                $sDate = strtotime('01/01/' . date('Y'), $currDate);
                break;
            case 'last-year':
                //last year...starts jan 1 and ends dec 31
                $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 1);
                $eDate = mktime(23, 59, 59, 12, 31, date('Y') - 1);
                break;
            case '2-years-ago':
                //2 Years ago
                if ($currentInterval == 'yearly') {
                    //if the interval is yearly
                    $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 2);
                    //starts jan 1
                } else {
                    $eDate = mktime(23, 59, 59, 12, 31, date('Y') - 2);
                    //ends dec 31
                    $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 2);
                    //starts jan 1
                }
                break;
            case '3-years-ago':
                //3 Years ago
                if ($currentInterval == 'yearly') {
                    //if the interval is yearly
                    $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 3);
                    //starts jan 1
                } else {
                    $eDate = mktime(23, 59, 59, 12, 31, date('Y') - 3);
                    //ends dec 31
                    $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 3);
                    //starts jan 1
                }
                break;
            case 'this-month':
                //this month
            //this month
            default:
                $sDate = strtotime(date('m') . '/01/' . date('Y'), $currDate);
                if ($currentInterval == 'yearly') {
                    $currentInterval = 'weekly';
                }
                break;
        }
    }
    //Still need to double check if there's really values on the start and end date
    if (!empty($sDate) && !empty($eDate)) {
        //Title header
        $doc = JFactory::getDocument();
        $css = '.icon-48-statistics_header { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/statistics.png)}';
        $doc->addStyleDeclaration($css, $type = 'text/css');
        $img = 'statistics_header.png';
        $message = '';
        $start = date('F j, Y', jnews::getNow(0, true, $sDate));
        $end = date('F j, Y', jnews::getNow(0, true, $eDate));
        if ($currentRange == 'today' || $currentRange == 'yesterday') {
            $title = _JNEWS_REPORT_HEADER . ': ' . $start;
            $fileNameExport = $start;
        } else {
            $title = _JNEWS_REPORT_HEADER . ': ' . $start . ' ' . _JNEWS_REPORT_HEADER_TO . ' ' . $end;
            $fileNameExport = $start . ' ' . _JNEWS_REPORT_HEADER_TO . ' ' . $end;
        }
        backHTML::_header($title, $img, $message, $task, $action);
    }
    $dateFormat = 'FROM_UNIXTIME(';
    switch ($currentInterval) {
        case 'yearly':
            //yearly
            $specialFormat = ',\'%Y\'';
            $dateFormat4DateNumber = 'FROM_UNIXTIME(';
            //.$columnModif.', \'' .substr($special, 10).'\'))';
            $specialNo = ',\'%Y\')';
            break;
        case 'weekly':
            //weekly
            $specialFormat = ',\'%M %d, %Y\'';
            $dateFormat4DateNumber = 'WEEK(' . $dateFormat;
            $dateFormat4DateNumber = 'WEEK(FROM_UNIXTIME(';
            //'dtfrmtweek%Y-%m-%d';	// WEEK(DATE_FORMAT(cdate, '%Y-%m-%d'))
            $specialNo = ',\'%Y-%m-%d\'))';
            break;
        case 'daily':
            //daily
            $specialFormat = ',\'%M %d, %Y\'';
            $dateFormat4DateNumber = 'FROM_UNIXTIME(';
            //'dateformat%Y%m%d';
            $specialNo = ',\'%Y%m%d\')';
            break;
        case 'monthly':
            //monthly
        //monthly
        default:
            $specialFormat = ',\'%M, %Y\'';
            $dateFormat4DateNumber = 'FROM_UNIXTIME(';
            //'dateformat%Y%m%d';
            $specialNo = ',\'%Y%m\')';
            break;
    }
    $queryfilters = array();
    $queryfilters['enddate'] = '\'' . $eDate . '\'';
    $queryfilters['startdate'] = '\'' . $sDate . '\'';
    $queryfilters['dateFormat'] = $dateFormat;
    $queryfilters['specialFormat'] = $specialFormat;
    $queryfilters['dateFormat4DateNumber'] = $dateFormat4DateNumber;
    $queryfilters['specialNo'] = $specialNo;
    $queryfilters['mailingId'] = $mailingId;
    $queryfilters['task'] = $task;
    //go to class.stats to display the view of stats
    require_once JNEWSPATH_CLASS . 'class.statistics.php';
    outputReportGraph::initIncludes();
    echo '<form action="index.php" method="post" name="adminForm" id="adminForm">';
    if ($task == 'graph') {
        $results = array();
        $results['subject'] = JRequest::getVar('subject', '');
        $results['html_sent'] = JRequest::getVar('html_sent', '0');
        $results['text_sent'] = JRequest::getVar('text_sent', '0');
        $results['html_views'] = JRequest::getVar('html_views', '0');
        $results['html_unread'] = JRequest::getVar('html_unread', '0');
        $results['pending'] = JRequest::getVar('pending', '0');
        //		$results['failed'] = JRequest::getVar( 'failed', '0' );
        //		$results['bounces'] = JRequest::getVar( 'bounces', '0' );
        $results['sent'] = JRequest::getVar('sent', '0');
        //		$results['sent'] = intval( $results['html_sent'] + $results['text_sent'] ); //fixed
        $results['id'] = JRequest::getVar('id');
        $queryfilters['startdate'] = '\'' . JRequest::getInt('startdate') . '\'';
        $queryfilters['enddate'] = '\'' . JRequest::getVar('enddate') . '\'';
        outputReportGraph::mailingSpecificGraph($results, $queryfilters);
    } else {
        outputReportGraph::headerFilter($currentInterval);
        if (empty($fileNameExport)) {
            $fileNameExport = null;
        }
        outputReportGraph::tabReports($queryfilters, $task, $fileNameExport);
    }
    echo '</form>';
    return true;
}
예제 #26
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);
}
예제 #27
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;
 }
예제 #28
0
    public static function import($action, $lists, $listId)
    {
        ?>
		<script language="javascript" type="text/javascript">
			function submitbutton(pressbutton) {
				var form = document.adminForm;


				if (form.importfile.value == "") {
					alert( "<?php 
        echo addslashes(_JNEWS_SELECT_FILE) . ' ' . addslashes(_JNEWS_MENU_IMPORT) . '!';
        ?>
" );
				} else {
					submitform(pressbutton);
				}
			}
		</script>
		<form action="index.php?option=<?php 
        echo JNEWS_OPTION;
        ?>
&act=<?php 
        echo $action;
        ?>
&listid=<?php 
        echo $listId;
        ?>
" method="post" name="adminForm" enctype="multipart/form-data" id="adminForm">
			<input type="hidden" name="task" value="<?php 
        $task = JRequest::getVar('task', 'import');
        echo $task;
        ?>
" />
			<input type="hidden" name="action" value="<?php 
        echo $action;
        ?>
" />
		<table border="0" width="100%" cellpadding="1" cellspacing="1" class="<?php 
        echo jnews::myTheme();
        ?>
">
			<tbody>
		<?php 
        if (!$GLOBALS[JNEWS . 'disabletooltip']) {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                JHTML::_('behavior.tooltip');
            } else {
                JHtml::_('behavior.tooltip');
            }
        }
        echo _JNEWS_LIST_IMPORT;
        $i = 0;
        $k = 0;
        foreach ($lists as $list) {
            $i++;
            echo '<tr class=row' . $k . '><td width="40px">';
            echo "\n" . '<input type="checkbox" class="inputbox" value="1" name="subscribed[' . $i . ']" />';
            echo "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />';
            echo '</td><td>';
            echo "\n" . '<span class="aca_list_name  onclick=\'return false;\'">' . jNews_Tools::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, '#', 1) . '</span>';
            echo "\n" . '<input type="hidden" name="acc_level[' . $i . ']" value="0" />';
            echo '</td></tr>';
            $k = 1 - $k;
        }
        ?>
		<tr>
			<td colspan="2">
				<br/>
				<?php 
        echo _JNEWS_IMPORTSUB_TIPS;
        ?>
				<div style="border: 1px solid #D5D5D5; padding: 5px; margin: 2px; background-color: #F9F9F9">
					<?php 
        echo _JNEWS_SELECT_IMPORT_FILE . ' :';
        ?>
					<input type="file" name="importfile" size="57" class="inputbox" />
					<input type="button" value="Import" class="button" onclick="submitbutton('doImport')" />
				</div>
			</td>
		</tr>
	</table>
<?php 
        if (version_compare(JVERSION, '3.0.0', '<')) {
            echo JHTML::_('form.token');
        } else {
            echo JHtml::_('form.token');
        }
        ?>
	</form><?php 
    }
예제 #29
0
function subscribers($action, $task, $userid, $listId, $cid, $front = false)
{
    $Itemid = JRequest::getInt('Itemid');
    $mainframe = JFactory::getApplication();
    $newSubscriber = null;
    $subscriberId = JRequest::getInt('subscriber_id');
    $message = JRequest::getVar('message', '');
    $css = '.icon-48-subscribers { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/subscribers.png)}';
    $doc = JFactory::getDocument();
    $doc->addStyleDeclaration($css, $type = 'text/css');
    $img = 'subscribers.png';
    $emailField = JRequest::getVar('email', '');
    $new = true;
    //new subscriber
    $my = JFactory::getUser();
    //START OF DATA FROM REQUEST
    $subscriber = new stdClass();
    $subscriber->user_id = JRequest::getInt('user_id');
    $subscriber->name = JRequest::getVar('name', '');
    $subscriber->email = JRequest::getVar('email', '', '', 'STRING');
    if (!jNews_Subscribers::validEmail($subscriber->email)) {
        $subscriber->email = '';
    }
    $subscriber->receive_html = JRequest::getInt('receive_html', 0);
    if (empty($subscriberId)) {
        //if it is a new user the confirmed depends if the require confirmation is turned on
        if ($GLOBALS[JNEWS . 'require_confirmation'] == '1') {
            $subscriber->confirmed = 0;
        } else {
            $subscriber->confirmed = JRequest::getInt('confirmed');
        }
    } else {
        $subscriber->confirmed = JRequest::getInt('confirmed');
    }
    $subscriber->blacklist = JRequest::getVar('blacklist', 0);
    $subscriber->timezone = JRequest::getVar('timezone', '');
    $subscriber->language_iso = JRequest::getVar('language_iso', '');
    if (empty($subscriber->ip)) {
        $subscriber->ip = jNews_Subscribers::getIP();
    }
    if ($subscriber->ip == '0.0.0.0') {
        $subscriber->ip = '0';
    }
    $subscriber->subscribe_date = time();
    $subscriber->params = JRequest::getVar('params', '');
    //column
    if ($GLOBALS[JNEWS . 'level'] > 2) {
        $subscriber->column1 = JRequest::getVar('column1', '');
        $subscriber->column2 = JRequest::getVar('column2', '');
        $subscriber->column3 = JRequest::getVar('column3', '');
        $subscriber->column4 = JRequest::getVar('column4', '');
        $subscriber->column5 = JRequest::getVar('column5', '');
    }
    //end check of version pro
    //END OF DATA FROM REQUEST
    $doShowSubscribers = true;
    switch ($task) {
        case 'updateOneSub':
            JRequest::checkToken() or die('Invalid Token');
            $doShowSubscribers = true;
            $new = false;
            //we addslashes the name incase an ' is entered in the name
            $subscriber->name = addslashes($subscriber->name);
            $message = jnews::printYN(jNews_Subscribers::saveSubscriber($subscriber, $subscriberId, $new), _JNEWS_UPDATED_SUCCESSFULLY, _JNEWS_ERROR);
            backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            break;
        case 'deleteOneSub':
            JRequest::checkToken() or die('Invalid Token');
            $doShowSubscribers = true;
            $message = jnews::printYN(jNews_Subscribers::deleteSubscriber($subscriberId), _JNEWS_SUBSCRIBER_DELETED, _JNEWS_ERROR);
            backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            break;
        case 'cancelSub':
            $doShowSubscribers = true;
            backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            break;
        case 'edit':
            foreach ($cid as $id) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers&task=show&userid=' . $id);
            }
            break;
        case 'show':
            $doShowSubscribers = false;
            $qid[0] = $userid;
            $subscriber = jNews_Subscribers::getSubscribersFromId($qid, false);
            $lists = jNews_Lists::getLists(0, 0, 1, '', false, false);
            $queues = jNews_ListsSubs::getSubscriberLists($userid);
            $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
            backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            backHTML::formStart('', 0, '');
            echo jNews_SubscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, jnews::checkPermissions('admin'), false, false);
            $go[] = jnews::makeObj('act', $action);
            $go[] = jnews::makeObj('subscriber_id', $subscriber->id);
            $go[] = jnews::makeObj('user_id', $subscriber->user_id);
            backHTML::formEnd($go);
            break;
        case 'new':
        case 'add':
            $doShowSubscribers = false;
            $newSubscriber = new stdClass();
            $newSubscriber->id = '';
            $newSubscriber->user_id = 0;
            $newSubscriber->name = '';
            $newSubscriber->email = '';
            $newSubscriber->ip = jNews_Subscribers::getIP();
            $newSubscriber->receive_html = 1;
            $newSubscriber->confirmed = 1;
            $newSubscriber->blacklist = 0;
            $newSubscriber->timezone = '00:00:00';
            $newSubscriber->language_iso = 'eng';
            $newSubscriber->params = '';
            $newSubscriber->subscribe_date = time();
            //column
            if ($GLOBALS[JNEWS . 'level'] > 2) {
                //check if the version of jnews is pro
                $newSubscriber->column1 = '';
                $newSubscriber->column2 = '';
                $newSubscriber->column3 = '';
                $newSubscriber->column4 = '';
                $newSubscriber->column5 = '';
            }
            $lists = jNews_Lists::getLists(0, 0, 1, '', false, false);
            $queues = '';
            $forms['main'] = " <form action='index.php' method='post' name=\"adminForm\" id=\"adminForm\">";
            if ($mainframe->isAdmin() || $GLOBALS[JNEWS . 'use_backendview']) {
                backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
                backHTML::formStart('addsubsback', 0, '');
                echo jNews_SubscribersHTML::editSubscriber($newSubscriber, $lists, $queues, $forms, jnews::checkPermissions('admin'), false, false);
            } else {
                backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
                backHTML::formStart('addsubsfront', 0, '');
                echo jNews_SubscribersHTML::editSubscriberFE($newSubscriber, $lists, $queues, $forms, jnews::checkPermissions('admin'), false, false);
            }
            $go[] = jnews::makeObj('act', $action);
            $go[] = jnews::makeObj('subscriber_id', $newSubscriber->id);
            $go[] = jnews::makeObj('user_id', $newSubscriber->user_id);
            backHTML::formEnd($go);
            break;
        case 'doNew':
            JRequest::checkToken() or die('Invalid Token');
            $doShowSubscribers = true;
            if ($mainframe->isAdmin() || $GLOBALS[JNEWS . 'use_backendview']) {
                $message = jnews::printYN(jNews_Subscribers::saveSubscriber($subscriber, $subscriberId, $new), _JNEWS_NEW_SUBSCRIBER, _JNEWS_ERROR);
                backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            } else {
                $status = jNews_Subscribers::importBis();
                if ($mainframe->isAdmin()) {
                    jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers&mid=2');
                } else {
                    $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION . '&act=subscribers&mid=2');
                    jNews_Tools::redirect($mainLink);
                }
            }
            break;
        case 'delete':
            JRequest::checkToken() or die('Invalid Token');
            if (!is_array($cid) || count($cid) < 1) {
                echo "<script> alert('Select an item to delete'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $status = true;
                foreach ($cid as $id) {
                    if (!jNews_Subscribers::deleteSubscriber($id)) {
                        $status = false;
                    }
                }
                $message = jnews::printYN($status, _JNEWS_SUBSCRIBER_DELETED, _JNEWS_ERROR);
                backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            }
            break;
        case 'update':
            JRequest::checkToken() or die('Invalid Token');
            if (!is_array($cid) || count($cid) < 1) {
                echo "<script> alert('Select an item to update'); window.history.go(-1);</script>\n";
                return false;
            } else {
                foreach ($cid as $id) {
                    $changes = JRequest::getVar($id, array(0));
                    if (!isset($changes['receive_html'])) {
                        $changes['receive_html'] = 0;
                    }
                    if (!isset($changes['confirmed'])) {
                        $changes['confirmed'] = 0;
                    }
                }
            }
            $message = jnews::print_message(_JNEWS_UPDATED_SUCCESSFULLY, 1);
            break;
        case 'export':
            $doShowSubscribers = false;
            backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            jNews_SubscribersHTML::export($action, $listId);
            break;
        case 'doExport':
            $message = jnews::printYN(jNews_Subscribers::export($listId), _EXPORT, _JNEWS_ERROR);
            backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            break;
        case 'import':
            $doShowSubscribers = false;
            backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            $lists = jNews_Lists::getLists('', 0, '', '', false, true, true, false, false);
            jNews_SubscribersHTML::import($action, $lists, $listId);
            break;
        case 'doImport':
            JRequest::checkToken() or die('Invalid Token');
            $message = jNews_Subscribers::importBis();
            backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            $message = !empty($message) && $message !== true ? $message : ($message === false ? 'Import failed' : _JNEWS_IMPORT_FINISHED);
            if ($mainframe->isAdmin()) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers', $message);
            } else {
                $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION . '&act=subscribers&mid=2');
                jNews_Tools::redirect($mainLink);
            }
            break;
        case 'subscribeAll':
        case 'unsubscribeAll':
            JRequest::checkToken() or die('Invalid Token');
            break;
        case 'cancel':
            if ($listId != 0) {
                $listId = 0;
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION);
            }
            backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            break;
        case 'cpanel':
            $mainframe = JFactory::getApplication();
            if ($mainframe->isAdmin()) {
                backHTML::controlPanel();
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION);
            }
            $doShowSubscribers = 0;
            break;
        case 'toggle':
            $subid = JRequest::getVar('subid');
            $column = JRequest::getVar('col');
            if (!empty($subid) && !empty($column)) {
                $passObj = new stdClass();
                $passObj->tableName = '#__jnews_subscribers';
                $passObj->columnName = $column;
                $passObj->whereColumn = 'id';
                $passObj->whereColumnValue = $subid;
                jnews::toggle($passObj);
                // change suspend status if column toggled is confirmed
                if ($column == 'confirmed') {
                    $passObj = new stdClass();
                    $passObj->tableName = '#__jnews_queue';
                    $passObj->columnName = 'suspend';
                    $passObj->whereColumn = 'subscriber_id';
                    $passObj->whereColumnValue = $subid;
                    jnews::toggle($passObj);
                }
            }
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $listId);
            break;
        default:
            backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action);
            break;
    }
    if ($doShowSubscribers) {
        $limit = -1;
        $emailsearch = JRequest::getVar('emailsearch', '', '', 'STRING');
        $emailsearch = htmlentities($emailsearch, ENT_COMPAT, "UTF-8");
        $paginationStart = JRequest::getVar('pg');
        $lll = JRequest::getVar('limitstart');
        if (empty($lll)) {
            JRequest::setVar('limitstart', 0, 'int');
        }
        $app = JFactory::getApplication();
        $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int');
        $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int');
        $subscirberTypeID = JRequest::getVar('subtype', 1);
        if (empty($listId) && in_array($subscirberTypeID, array(1, 2))) {
            $subscirberTypeID = 0;
        }
        if (!empty($listId) && in_array($subscirberTypeID, array(3, 4))) {
            $subscirberTypeID = 0;
        }
        if (!empty($my->id)) {
            $ownedlists = jNews_Lists::getOwnedlists($my->id);
        }
        $ztozto = null;
        $limittotal = jNews_Subscribers::getSubscribers(0, 0, $emailsearch, $ztozto, $listId, '', '', '', 'sub_dateD', '', $ownedlists, '', $subscirberTypeID, true);
        //added one parameter for mailid
        $setLimit = new stdClass();
        $setLimit->total = !empty($limittotal) ? $limittotal : 0;
        $setLimit->start = !empty($limitstart) ? $limitstart : 0;
        $setLimit->end = !empty($limitend) ? $limitend : 20;
        $setSort = new stdClass();
        $setSort->orderValue = $app->getUserStateFromRequest(JNEWS_OPTION . '.subscribers.filter_order', 'filter_order', 'subscribe_date', 'cmd');
        $setSort->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.subscribers.filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
        if (empty($limitstart)) {
            $limitstart = 0;
        }
        if ($setLimit->end > 200) {
            $setLimit->end = 200;
        }
        if ($setLimit->total == $setLimit->end) {
            $setLimit->start = 0;
        }
        $subscribers = jNews_Subscribers::getSubscribers($setLimit->start, $setLimit->end, $emailsearch, $setLimit->total, $listId, '', '', '', 'sub_dateD', '', $ownedlists, $setSort, $subscirberTypeID);
        //added one parameter for mailid
        if ($listId != 0) {
            $showAdmin = true;
        } else {
            $showAdmin = false;
        }
        $dropDownList = jNews_ListType::getListsDropList(0, '', '');
        $subTypeA = array();
        $subTypeA[0] = new stdClass();
        $subTypeA[0]->id = 0;
        $subTypeA[0]->subtype = _JNEWS_SUB_LISTTYPE_ALL;
        if ($listId != 0) {
            $subTypeA[1] = new stdClass();
            $subTypeA[1]->id = 1;
            $subTypeA[1]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_SUBCRIBED;
            $subTypeA[2] = new stdClass();
            $subTypeA[2]->id = 2;
            $subTypeA[2]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_UNSUBCRIBED;
        } else {
            $subTypeA[3] = new stdClass();
            $subTypeA[3]->id = 3;
            $subTypeA[3]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_WAITINGCONF;
            $subTypeA[4] = new stdClass();
            $subTypeA[4]->id = 4;
            $subTypeA[4]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_BLOCKED;
        }
        $lists['listid'] = jnews::HTML_GenericList($dropDownList, 'listid', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'id', 'list_name', $listId);
        $lists['subscirberType'] = jnews::HTML_GenericList($subTypeA, 'subtype', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'id', 'subtype', $subscirberTypeID);
        if ($mainframe->isAdmin()) {
            $forms['main'] = " <form action='index.php' method='post' name=\"adminForm\" id=\"adminForm\">";
        } else {
            if (empty($setLimit->start)) {
                $setLimit->start = 0;
            }
            $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION);
            $forms['main'] = "<form action='" . $mainLink . "' method='post' name=\"adminForm\" id=\"adminForm\">";
        }
        $forms['select'] = " <form method='post' name='jNewsFilterForm'> \n";
        backHTML::formStart('show_mailing', 0, '');
        jNews_SubscribersHTML::showSubscribers($subscribers, $action, $listId, $lists, $setLimit->start, $setLimit->end, $setLimit->total, $showAdmin, $listId, $emailsearch, $forms, $setLimit, $front, $setSort);
    }
    return true;
}
예제 #30
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;
}