Esempio n. 1
0
 public static function chooseType($task, $action, $listType, $actionType, $message = '', $title = '')
 {
     //css injection
     $mainPath = JNEWS_PATH_ADMIN_IMAGES2 . 'header/';
     $doc = JFactory::getDocument();
     $css = '.icon-48-newsletter { background-image:url(' . $mainPath . 'newsletter.png)}';
     $css .= '.icon-48-autoresponder { background-image:url(' . $mainPath . 'autoresponder.png)}';
     $css .= '.icon-48-smartnewsletter { background-image:url(' . $mainPath . 'smartnewsletter.png)}';
     $doc->addStyleDeclaration($css, $type = 'text/css');
     $results = '';
     switch ($actionType) {
         case 'titles':
             if ($listType > 0) {
                 $results = $title . _JNEWS_ALL . ' ' . @constant($GLOBALS[JNEWS . 'listnames' . $listType]);
             } else {
                 $results = _JNEWS_MAILING_ALL;
             }
             break;
         case 'mailing_header':
             if ($listType > 0) {
                 backHTML::_header(@constant($GLOBALS[JNEWS . 'listnames' . $listType]), $GLOBALS[JNEWS . 'listlogo' . $listType], $message, $task, $action);
             } else {
                 backHTML::_header(_JNEWS_MAILING_ALL, 'newsletter.png', $message, $task, $action);
             }
             break;
         case 'mailing_edit_header':
             backHTML::_header(_JNEWS_EDIT_A . @constant($GLOBALS[JNEWS . 'listname' . $listType]), 'newsletter', $message, $task, $action);
             break;
         default:
             $results = 'not prossible case , or not yet implemented';
             break;
     }
     return $results;
 }
Esempio n. 2
0
 function chooseType($task, $action, $listType, $actionType, $message = '', $title = '')
 {
     $results = '';
     switch ($actionType) {
         case 'titles':
             if ($listType > 0) {
                 $results = $title . _ACA_ALL . ' ' . @constant($GLOBALS[ACA . 'listnames' . $listType]);
             } else {
                 $results = _ACA_MAILING_ALL;
             }
             break;
         case 'mailing_header':
             if ($listType > 0) {
                 backHTML::_header(@constant($GLOBALS[ACA . 'listnames' . $listType]), $GLOBALS[ACA . 'listlogo' . $listType], $message, $task, $action);
             } else {
                 backHTML::_header(_ACA_MAILING_ALL, $GLOBALS[ACA . 'listlogo' . $listType], $message, $task, $action);
             }
             break;
         case 'mailing_edit_header':
             backHTML::_header(_ACA_EDIT_A . @constant($GLOBALS[ACA . 'listname' . $listType]), $GLOBALS[ACA . 'listlogo' . $listType], $message, $task, $action);
             break;
         default:
             $results = 'not prossible case , or not yet implemented';
             break;
     }
     return $results;
 }
Esempio n. 3
0
    function showConfigEdit($GLOBALS)
    {
        if (ACA_CMSTYPE) {
            // joomla 15
            $mailOpt[] = JHTML::_('select.option', 'mail', 'PHP mail function');
            $mailOpt[] = JHTML::_('select.option', 'sendmail', 'Sendmail');
            $mailOpt[] = JHTML::_('select.option', 'smtp', 'SMTP Server');
            $logFormat[] = JHTML::_('select.option', '0', _ACA_DETAILED);
            $logFormat[] = JHTML::_('select.option', '1', _ACA_SIMPLE);
            $lists['mailermethod'] = JHTML::_('select.genericlist', $mailOpt, "config['emailmethod']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[ACA . 'emailmethod']);
            $lists['send_log_simple'] = JHTML::_('select.genericlist', $logFormat, "config['send_log_simple']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[ACA . 'send_log_simple']);
            $lists['save_log_simple'] = JHTML::_('select.genericlist', $logFormat, "config['save_log_simple']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[ACA . 'save_log_simple']);
            $lists['auth_required'] = JHTML::_('select.booleanlist', "config['smtp_auth_required']", 'class="inputbox"', $GLOBALS[ACA . 'smtp_auth_required']);
            $lists['allow_unregistered'] = JHTML::_('select.booleanlist', "config['allow_unregistered']", 'class="inputbox"', $GLOBALS[ACA . 'allow_unregistered']);
            $lists['require_confirmation'] = JHTML::_('select.booleanlist', "config['require_confirmation']", 'class="inputbox"', $GLOBALS[ACA . 'require_confirmation']);
            $lists['show_login'] = JHTML::_('select.booleanlist', "config['show_login']", 'class="inputbox"', $GLOBALS[ACA . 'show_login']);
            $lists['show_logout'] = JHTML::_('select.booleanlist', "config['show_logout']", 'class="inputbox"', $GLOBALS[ACA . 'show_logout']);
            $lists['confirm_html'] = JHTML::_('select.booleanlist', "config['confirm_html']", 'class="inputbox"', $GLOBALS[ACA . 'confirm_html']);
            $lists['time_zone'] = JHTML::_('select.booleanlist', "config['time_zone']", 'class="inputbox"', $GLOBALS[ACA . 'time_zone']);
            $lists['show_archive'] = JHTML::_('select.booleanlist', "config['show_archive']", 'class="inputbox"', $GLOBALS[ACA . 'show_archive']);
            $lists['enable_statistics'] = JHTML::_('select.booleanlist', "config['enable_statistics']", 'class="inputbox"', $GLOBALS[ACA . 'enable_statistics']);
            $lists['statistics_per_subscriber'] = JHTML::_('select.booleanlist', "config['statistics_per_subscriber']", 'class="inputbox"', $GLOBALS[ACA . 'statistics_per_subscriber']);
            $lists['wait_for_user'] = JHTML::_('select.booleanlist', "config['wait_for_user']", 'class="inputbox"', $GLOBALS[ACA . 'wait_for_user']);
            $lists['display_trace'] = JHTML::_('select.booleanlist', "config['display_trace']", 'class="inputbox"', $GLOBALS[ACA . 'display_trace']);
            $lists['send_data'] = JHTML::_('select.booleanlist', "config['send_data']", 'class="inputbox"', $GLOBALS[ACA . 'send_data']);
            $lists['send_auto_log'] = JHTML::_('select.booleanlist', "config['send_auto_log']", 'class="inputbox"', $GLOBALS[ACA . 'send_auto_log']);
            $lists['send_log'] = JHTML::_('select.booleanlist', "config['send_log']", 'class="inputbox"', $GLOBALS[ACA . 'send_log']);
            $lists['save_log'] = JHTML::_('select.booleanlist', "config['save_log']", 'class="inputbox"', $GLOBALS[ACA . 'save_log']);
            $lists['send_log_closed'] = JHTML::_('select.booleanlist', "config['send_log_closed']", 'class="inputbox"', $GLOBALS[ACA . 'send_log_closed']);
            $lists['clear_log'] = JHTML::_('select.booleanlist', "clear_log", 'class="inputbox"', 0);
            $lists['show_footer'] = JHTML::_('select.booleanlist', "config['show_footer']", 'class="inputbox"', $GLOBALS[ACA . 'show_footer']);
            $lists['show_jcalpro'] = JHTML::_('select.booleanlist', "config['show_jcalpro']", 'class="inputbox"', $GLOBALS[ACA . 'show_jcalpro']);
            $lists['show_signature'] = JHTML::_('select.booleanlist', "config['show_signature']", 'class="inputbox"', $GLOBALS[ACA . 'show_signature']);
            $lists['show_lists'] = JHTML::_('select.booleanlist', "config['show_lists']", 'class="inputbox"', $GLOBALS[ACA . 'show_lists']);
            $lists['embed_images'] = JHTML::_('select.booleanlist', "config['embed_images']", 'class="inputbox"', $GLOBALS[ACA . 'embed_images']);
            $lists['show_guide'] = JHTML::_('select.booleanlist', "config['show_guide']", 'class="inputbox"', $GLOBALS[ACA . 'show_guide']);
            $lists['show_author'] = JHTML::_('select.booleanlist', "config['show_author']", 'class="inputbox"', $GLOBALS[ACA . 'show_author']);
            $lists['show_tips'] = JHTML::_('select.booleanlist', "config['show_tips']", 'class="inputbox"', $GLOBALS[ACA . 'show_tips']);
            //$lists['update_notification'] = JHTML::_('select.booleanlist', "config['update_notification']" , 'class="inputbox"', $GLOBALS[ACA.'update_notification'] );
            $lists['use_sef'] = JHTML::_('select.booleanlist', "config['use_sef']", 'class="inputbox"', $GLOBALS[ACA . 'use_sef']);
            $lists['listype1'] = JHTML::_('select.booleanlist', "config['listype1']", 'class="inputbox"', $GLOBALS[ACA . 'listype1']);
            $lists['listype2'] = JHTML::_('select.booleanlist', "config['listype2']", 'class="inputbox"', $GLOBALS[ACA . 'listype2']);
            $lists['listHTMLeditor'] = JHTML::_('select.booleanlist', "config['listHTMLeditor']", 'class="inputbox"', $GLOBALS[ACA . 'listHTMLeditor']);
            $lists['send_error'] = JHTML::_('select.booleanlist', "config['send_error']", 'class="inputbox"', $GLOBALS[ACA . 'send_error']);
            $lists['report_error'] = JHTML::_('select.booleanlist', "config['report_error']", 'class="inputbox"', $GLOBALS[ACA . 'report_error']);
            $lists['fullcheck'] = JHTML::_('select.booleanlist', "config['fullcheck']", 'class="inputbox"', $GLOBALS[ACA . 'fullcheck']);
            $lists['addEmailRedLink'] = JHTML::_('select.booleanlist', "config['addEmailRedLink']", 'class="inputbox"', $GLOBALS[ACA . 'addEmailRedLink']);
            $lists['disabletooltip'] = JHTML::_('select.booleanlist', "config['disabletooltip']", 'class="inputbox"', $GLOBALS[ACA . 'disabletooltip']);
            $lists['minisendmail'] = JHTML::_('select.booleanlist', "config['minisendmail']", 'class="inputbox"', $GLOBALS[ACA . 'minisendmail']);
        } else {
            //joomla 1x
            $mailOpt[] = mosHTML::makeOption('mail', 'PHP mail function');
            $mailOpt[] = mosHTML::makeOption('sendmail', 'Sendmail');
            $mailOpt[] = mosHTML::makeOption('smtp', 'SMTP Server');
            $logFormat[] = mosHTML::makeOption('0', _ACA_DETAILED);
            $logFormat[] = mosHTML::makeOption('1', _ACA_SIMPLE);
            $lists['mailermethod'] = mosHTML::selectList($mailOpt, "config['emailmethod']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[ACA . 'emailmethod']);
            $lists['send_log_simple'] = mosHTML::selectList($logFormat, "config['send_log_simple']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[ACA . 'send_log_simple']);
            $lists['save_log_simple'] = mosHTML::selectList($logFormat, "config['save_log_simple']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[ACA . 'save_log_simple']);
            $lists['auth_required'] = mosHTML::yesnoRadioList("config['smtp_auth_required']", 'class="inputbox"', $GLOBALS[ACA . 'smtp_auth_required']);
            $lists['allow_unregistered'] = mosHTML::yesnoRadioList("config['allow_unregistered']", 'class="inputbox"', $GLOBALS[ACA . 'allow_unregistered']);
            $lists['require_confirmation'] = mosHTML::yesnoRadioList("config['require_confirmation']", 'class="inputbox"', $GLOBALS[ACA . 'require_confirmation']);
            $lists['show_login'] = mosHTML::yesnoRadioList("config['show_login']", 'class="inputbox"', $GLOBALS[ACA . 'show_login']);
            $lists['show_logout'] = mosHTML::yesnoRadioList("config['show_logout']", 'class="inputbox"', $GLOBALS[ACA . 'show_logout']);
            $lists['confirm_html'] = mosHTML::yesnoRadioList("config['confirm_html']", 'class="inputbox"', $GLOBALS[ACA . 'confirm_html']);
            $lists['time_zone'] = mosHTML::yesnoRadioList("config['time_zone']", 'class="inputbox"', $GLOBALS[ACA . 'time_zone']);
            $lists['show_archive'] = mosHTML::yesnoRadioList("config['show_archive']", 'class="inputbox"', $GLOBALS[ACA . 'show_archive']);
            $lists['enable_statistics'] = mosHTML::yesnoRadioList("config['enable_statistics']", 'class="inputbox"', $GLOBALS[ACA . 'enable_statistics']);
            $lists['statistics_per_subscriber'] = mosHTML::yesnoRadioList("config['statistics_per_subscriber']", 'class="inputbox"', $GLOBALS[ACA . 'statistics_per_subscriber']);
            $lists['wait_for_user'] = mosHTML::yesnoRadioList("config['wait_for_user']", 'class="inputbox"', $GLOBALS[ACA . 'wait_for_user']);
            $lists['display_trace'] = mosHTML::yesnoRadioList("config['display_trace']", 'class="inputbox"', $GLOBALS[ACA . 'display_trace']);
            $lists['send_data'] = mosHTML::yesnoRadioList("config['send_data']", 'class="inputbox"', $GLOBALS[ACA . 'send_data']);
            $lists['send_auto_log'] = mosHTML::yesnoRadioList("config['send_auto_log']", 'class="inputbox"', $GLOBALS[ACA . 'send_auto_log']);
            $lists['send_log'] = mosHTML::yesnoRadioList("config['send_log']", 'class="inputbox"', $GLOBALS[ACA . 'send_log']);
            $lists['save_log'] = mosHTML::yesnoRadioList("config['save_log']", 'class="inputbox"', $GLOBALS[ACA . 'save_log']);
            $lists['send_log_closed'] = mosHTML::yesnoRadioList("config['send_log_closed']", 'class="inputbox"', $GLOBALS[ACA . 'send_log_closed']);
            $lists['clear_log'] = mosHTML::yesnoRadioList("clear_log", 'class="inputbox"', 0);
            $lists['show_footer'] = mosHTML::yesnoRadioList("config['show_footer']", 'class="inputbox"', $GLOBALS[ACA . 'show_footer']);
            $lists['show_jcalpro'] = mosHTML::yesnoRadioList("config['show_jcalpro']", 'class="inputbox"', $GLOBALS[ACA . 'show_jcalpro']);
            $lists['show_signature'] = mosHTML::yesnoRadioList("config['show_signature']", 'class="inputbox"', $GLOBALS[ACA . 'show_signature']);
            $lists['show_lists'] = mosHTML::yesnoRadioList("config['show_lists']", 'class="inputbox"', $GLOBALS[ACA . 'show_lists']);
            $lists['embed_images'] = mosHTML::yesnoRadioList("config['embed_images']", 'class="inputbox"', $GLOBALS[ACA . 'embed_images']);
            $lists['show_guide'] = mosHTML::yesnoRadioList("config['show_guide']", 'class="inputbox"', $GLOBALS[ACA . 'show_guide']);
            $lists['show_author'] = mosHTML::yesnoRadioList("config['show_author']", 'class="inputbox"', $GLOBALS[ACA . 'show_author']);
            $lists['show_tips'] = mosHTML::yesnoRadioList("config['show_tips']", 'class="inputbox"', $GLOBALS[ACA . 'show_tips']);
            //$lists['update_notification'] = mosHTML::yesnoRadioList( "config['update_notification']" , 'class="inputbox"', $GLOBALS[ACA.'update_notification'] );
            $lists['use_sef'] = mosHTML::yesnoRadioList("config['use_sef']", 'class="inputbox"', $GLOBALS[ACA . 'use_sef']);
            $lists['listype1'] = mosHTML::yesnoRadioList("config['listype1']", 'class="inputbox"', $GLOBALS[ACA . 'listype1']);
            $lists['listype2'] = mosHTML::yesnoRadioList("config['listype2']", 'class="inputbox"', $GLOBALS[ACA . 'listype2']);
            $lists['listHTMLeditor'] = mosHTML::yesnoRadioList("config['listHTMLeditor']", 'class="inputbox"', $GLOBALS[ACA . 'listHTMLeditor']);
            $lists['send_error'] = mosHTML::yesnoRadioList("config['send_error']", 'class="inputbox"', $GLOBALS[ACA . 'send_error']);
            $lists['report_error'] = mosHTML::yesnoRadioList("config['report_error']", 'class="inputbox"', $GLOBALS[ACA . 'report_error']);
            $lists['fullcheck'] = mosHTML::yesnoRadioList("config['fullcheck']", 'class="inputbox"', $GLOBALS[ACA . 'fullcheck']);
            $lists['addEmailRedLink'] = mosHTML::yesnoRadioList("config['addEmailRedLink']", 'class="inputbox"', $GLOBALS[ACA . 'addEmailRedLink']);
            $lists['disabletooltip'] = mosHTML::yesnoRadioList("config['disabletooltip']", 'class="inputbox"', $GLOBALS[ACA . 'disabletooltip']);
            $lists['minisendmail'] = mosHTML::yesnoRadioList("config['minisendmail']", 'class="inputbox"', $GLOBALS[ACA . 'minisendmail']);
        }
        //endif
        if (class_exists('aca_archive')) {
            if (ACA_CMSTYPE) {
                // joomla 15
                $jour = array();
                $jour[] = JHTML::_('select.option', '0', _FREQ_OPT_0);
                $jour[] = JHTML::_('select.option', '1', _FREQ_OPT_1);
                $jour[] = JHTML::_('select.option', '2', _FREQ_OPT_2);
                $jour[] = JHTML::_('select.option', '3', _FREQ_OPT_3);
                $jour[] = JHTML::_('select.option', '4', _FREQ_OPT_4);
                $jour[] = JHTML::_('select.option', '5', _FREQ_OPT_5);
                $jour[] = JHTML::_('select.option', '6', _FREQ_OPT_6);
                $dateType = array();
                $dateType[] = JHTML::_('select.option', '1', _DATE_OPT_1);
                $dateType[] = JHTML::_('select.option', '2', _DATE_OPT_2);
                $lists['frequency'] = JHTML::_('select.genericlist', $jour, "config['frequency']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[ACA . 'frequency']);
                $lists['date_type'] = JHTML::_('select.genericlist', $dateType, "config['date_type']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[ACA . 'date_type']);
            } else {
                //joomla 1x
                $jour = array();
                $jour[] = mosHTML::makeOption('0', _FREQ_OPT_0);
                $jour[] = mosHTML::makeOption('1', _FREQ_OPT_1);
                $jour[] = mosHTML::makeOption('2', _FREQ_OPT_2);
                $jour[] = mosHTML::makeOption('3', _FREQ_OPT_3);
                $jour[] = mosHTML::makeOption('4', _FREQ_OPT_4);
                $jour[] = mosHTML::makeOption('5', _FREQ_OPT_5);
                $jour[] = mosHTML::makeOption('6', _FREQ_OPT_6);
                $dateType = array();
                $dateType[] = mosHTML::makeOption('1', _DATE_OPT_1);
                $dateType[] = mosHTML::makeOption('2', _DATE_OPT_2);
                $lists['frequency'] = mosHTML::selectList($jour, "config['frequency']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[ACA . 'frequency']);
                $lists['date_type'] = mosHTML::selectList($dateType, "config['date_type']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[ACA . 'date_type']);
            }
            //endif
        }
        if (ACA_CMSTYPE) {
            $mail_format[] = JHTML::_('select.option', '0', 'Text (8bit)');
            $mail_format[] = JHTML::_('select.option', '1', 'MIME (base64)');
            $lists['mail_format'] = JHTML::_('select.radiolist', $mail_format, "config['mail_format']", 'class="inputbox"', 'value', 'text', $GLOBALS[ACA . 'mail_format']);
        } else {
            $mail_format[] = mosHTML::makeOption('0', 'Text (8bit)');
            $mail_format[] = mosHTML::makeOption('1', 'MIME (base64)');
            $lists['mail_format'] = mosHTML::radioList($mail_format, "config['mail_format']", 'class="inputbox"', $GLOBALS[ACA . 'mail_format']);
        }
        //endif
        backHTML::formStart('configpanel', 0, '');
        ?>
	<table style="width: 100%;" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td>
	<form action="index2.php" method="post" name="adminForm">
	<?php 
        if (ACA_CMSTYPE) {
            $config_tabs = new mosTabs15(1);
        } else {
            $config_tabs = new mosTabs(1);
        }
        //endif
        $config_tabs->startPane('acaConfig');
        $config_tabs->startTab(_ACA_MAIL_CONFIG, 'mail');
        configHTML::mailSettings($lists);
        $config_tabs->endTab();
        $config_tabs->startTab(_ACA_SUBSCRIBER_CONFIG, 'subscribers');
        configHTML::subcriberSettings($lists);
        $config_tabs->endTab();
        if (class_exists('auto')) {
            $flag = auto::viewCron();
        } else {
            $flag = false;
        }
        if ($flag) {
            $config_tabs->startTab(_ACA_SCHEDULER, 'scheduler');
            configHTML::cronSettings($lists);
            $config_tabs->endTab();
        }
        $config_tabs->startTab(_ACA_LOGGING_CONFIG, 'logging');
        configHTML::logsSettings($lists);
        $config_tabs->endTab();
        if ($GLOBALS[ACA . 'integration'] and ($GLOBALS[ACA . 'cb_integration'] or class_exists('aca_virtuemart') && $GLOBALS[ACA . 'virtuemart'])) {
            $config_tabs->startTab(_ACA_CONFIG_INTEGRATION, 'integration');
            if ($GLOBALS[ACA . 'cb_integration']) {
                configHTML::cbSettings();
            }
            if (class_exists('aca_virtuemart') && isset($GLOBALS[ACA . 'virtuemart']) && $GLOBALS[ACA . 'virtuemart']) {
                aca_virtuemart::tab();
            }
            $config_tabs->endTab();
        }
        if (class_exists('aca_archive')) {
            $config_tabs->startTab(_ACA_MENU_TAB_ARCHIVE, 'archive');
            aca_archive::showArchive($lists);
            $config_tabs->endTab();
        }
        $config_tabs->startTab(_ACA_MISC_CONFIG, 'misc');
        configHTML::miscSettings($lists);
        $config_tabs->endTab();
        if (class_exists('auto')) {
            $config_tabs->startTab(_ACA_LICENSE_CONFIG, 'licence');
            auto::licenseSettings($lists);
            $config_tabs->endTab();
        }
        $config_tabs->endPane();
        ?>
		<input type="hidden" name="option" value="com_acajoom" />
		<input type="hidden" name="act" value="configuration" />
    	<input type="hidden" name="boxchecked" value="0" />
    	<input type="hidden" name="task" value="" />
	</form>
	</td></tr></tbody></table>
	<?php 
    }
Esempio n. 4
0
 function showMailings($task, $action, $listId, $listType, $message, $showHeader, $title)
 {
     $start = mosGetParam($_REQUEST, 'start', 0);
     //ADRIEN
     //$limit = mosGetParam($_REQUEST, 'limit', $GLOBALS['mosConfig_list_limit']);
     $limit = -1;
     $emailsearch = mosGetParam($_REQUEST, 'emailsearch', '');
     $dropList = mosGetParam($_REQUEST, 'droplist', 'ZZZZ');
     if ($dropList == 'ZZZZ') {
         $dropList = $listType . '-' . $listId;
     }
     $total = 0;
     $dropListValues = explode('-', $dropList);
     $listType = $dropListValues[0];
     $listId = $dropListValues[1];
     if ($listId > 0) {
         $listTypeM = 0;
     } else {
         $listTypeM = $listType;
     }
     $orddef = 'idD';
     if ($listType == 2) {
         $orddef = 'idA';
     }
     $order = mosGetParam($_REQUEST, 'order', $orddef);
     if ($listId == 0) {
         $lists['title'] = lisType::chooseType($task, $action, $listType, 'titles', '', $title);
     } else {
         $listing = lists::getLists($listId, 0, 1, '', false, false, true);
         $lists['title'] = $title . "<span style='color: rgb(51, 51, 51);'>" . $listing[0]->list_name . "</span>";
     }
     $dropDownList = lisType::getMailingDropList($listId, $listType, $order);
     $lists['droplist'] = mosHTML::selectList($dropDownList, 'droplist', 'class="inputbox" size="1" onchange="document.AcajoomFilterForm.submit();"', 'id', 'name', $dropList);
     $mailings = xmailing::getMailings($listId, $listTypeM, $start, $limit, $emailsearch, $total, $order, false, false);
     $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
     $forms['select'] = " <form action='index2.php' method='post' name='AcajoomFilterForm'> \n\r";
     $show = lisType::showType($listType, 'showMailings');
     if ($showHeader) {
         xmailing::_header($task, $action, $listType, $message, '');
     }
     backHTML::formStart('show_mailing', 0, '');
     mailingsHTML::showMailingList($mailings, $lists, $start, $limit, $total, $emailsearch, $listId, $listType, $forms, $show, $action);
     backHTML::formEnd();
 }
Esempio n. 5
0
 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;
 }
Esempio n. 6
0
function lists($action, $task, $listId, $listType)
{
    global $database, $my;
    $message = '';
    $xf = new xonfig();
    $erro = new xerr(__FILE__, __FUNCTION__);
    $erro->show();
    $showLists = true;
    switch ($task) {
        case 'new':
            if ($listType < 1) {
                $listType = 1;
            }
            $filename = $GLOBALS['mosConfig_absolute_path'] . '/components/com_acajoom/templates/default/default.html';
            $handle = fopen($filename, "rb");
            $template = fread($handle, filesize($filename));
            fclose($handle);
            $template = str_replace('src="', 'src="' . $GLOBALS['mosConfig_live_site'] . '/', $template);
            $subscriber = subscribers::getSubscriberInfoFromUserId($my->id);
            $showLists = false;
            $newList->id = '';
            $newList->html = 1;
            $newList->new_letter = 1;
            $newList->list_name = '';
            $newList->list_desc = '';
            $newList->sendername = $subscriber->name;
            $newList->senderemail = $subscriber->email;
            $newList->bounceadres = $subscriber->email;
            $newList->layout = $template;
            $newList->template = 0;
            $newList->hidden = 1;
            $newList->auto_add = 0;
            $newList->list_type = $listType;
            $newList->delay_min = 1;
            $newList->delay_max = 7;
            $newList->user_choose = 0;
            $newList->cat_id = 0;
            $newList->follow_up = '';
            $newList->notify_id = 0;
            $newList->owner = $my->id;
            $newList->acc_level = 25;
            $newList->acc_id = 29;
            $newList->published = 0;
            $newList->start_date = date('Y-m-d', time());
            $newList->next_date = time();
            $newList->subscribemessage = _ACA_DEFAULT_SUBSCRIBE_MESS;
            $newList->unsubscribemessage = _ACA_DEFAULT_UNSUBSCRIBE_MESS;
            $newList->unsubscribesend = 1;
            $newList->footer = 1;
            $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n ";
            $show = lisType::showType($newList->list_type, 'editlist');
            backHTML::_header(_ACA_NEW . ' ' . _ACA_LIST, $GLOBALS[ACA . 'listlogo0'], $message, $task, $action);
            backHTML::formStart('listedit', $newList->html, '');
            listsHTML::editList($newList, $forms, $show);
            $go[] = acajoom::makeObj('act', $action);
            $go[] = acajoom::makeObj('listid', $newList->id);
            backHTML::formEnd($go);
            break;
        case 'doNew':
            $listname = mosGetParam($_REQUEST, 'list_name', '');
            $listType = mosGetParam($_REQUEST, 'list_type', 0);
            $now = acajoom::getNow();
            $query = "SELECT `id` FROM `#__acajoom_lists` WHERE `list_name`= '{$listname}' ";
            $database->setQuery($query);
            $lId = $database->loadResult();
            $erro->err = $database->getErrorMsg();
            $erro->E(__LINE__, '1091', $database);
            if ($lId > 0) {
                echo "<script> alert(' This list already exist, please choose another name. '); window.history.go(-1);</script>\n";
                return false;
            } else {
                $query = "INSERT INTO `#__acajoom_lists` (`list_name`,`createdate`) VALUES ( '" . addslashes($listname) . "'  , '{$now}' )";
                $database->setQuery($query);
                $database->query();
                $erro->err = $database->getErrorMsg();
            }
            if ($erro->E(__LINE__, '1001', $database)) {
                $query = "SELECT * FROM `#__acajoom_lists` WHERE `list_name`= '{$listname}' ";
                $database->setQuery($query);
                $database->loadObject($mynewlist);
                $mynewlist->list_name = stripslashes($mynewlist->list_name);
                $mynewlist->list_desc = stripslashes($mynewlist->list_desc);
                $mynewlist->layout = stripslashes($mynewlist->layout);
                $mynewlist->subscribemessage = stripslashes($mynewlist->subscribemessage);
                $mynewlist->unsubscribemessage = stripslashes($mynewlist->unsubscribemessage);
                $erro->err = $database->getErrorMsg();
                $erro->E(__LINE__, '1005');
                $listId = $mynewlist->id;
                $message = acajoom::printYN(lists::updateListFromEdit($listId, '', true), _ACA_LIST_ADDED, _ACA_ERROR);
                $xf->plus('totallist0', 1);
                $xf->plus('act_totallist0', 1);
                $xf->plus('totallist' . $listType, 1);
                $xf->plus('act_totallist' . $listType, 1);
            }
            break;
        case 'edit':
            if ($listId == 0) {
                echo "<script> alert('" . addslashes(_ACA_SELECT_LIST) . "'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $showLists = false;
                $query = 'SELECT * FROM `#__acajoom_lists` WHERE `id` = ' . intval($listId);
                $database->setQuery($query);
                $database->loadObject($listEdit);
                $erro->err = $database->getErrorMsg();
                if (!$erro->E(__LINE__, '1002')) {
                    return false;
                } else {
                    $listEdit->list_name = stripslashes($listEdit->list_name);
                    $listEdit->list_desc = stripslashes($listEdit->list_desc);
                    $listEdit->layout = stripslashes($listEdit->layout);
                    $listEdit->subscribemessage = stripslashes($listEdit->subscribemessage);
                    $listEdit->unsubscribemessage = stripslashes($listEdit->unsubscribemessage);
                    $listEdit->new_letter = 0;
                    $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n ";
                    $show = lisType::showType($listEdit->list_type, 'editlist');
                    backHTML::_header(_ACA_EDIT_A . @constant($GLOBALS[ACA . 'listname' . $listEdit->list_type]) . ' ' . _ACA_LIST, $GLOBALS[ACA . 'listlogo0'], $message, $task, $action);
                    backHTML::formStart('listedit', $listEdit->html, '');
                    listsHTML::editList($listEdit, $forms, $show);
                    $go[] = acajoom::makeObj('act', $action);
                    $go[] = acajoom::makeObj('listid', $listEdit->id);
                    backHTML::formEnd($go);
                }
            }
            break;
        case 'update':
            $message = acajoom::printYN(lists::updateListFromEdit($listId, '', false), _ACA_LIST_UPDATED, _ACA_ERROR);
            break;
        case 'delete':
            $message = acajoom::printYN(lists::deleteList($listId), _ACA_LIST . _ACA_SUCCESS_DELETED, _ACA_ERROR);
            break;
        case 'copy':
            $message = acajoom::printYN(lists::copyList($listId), _ACA_LIST_COPY, _ACA_ERROR);
            break;
        case 'publish':
            $message = acajoom::printYN(lists::updateListFromList($listId, true, false), _ACA_PUBLISHED, _ACA_ERROR);
            break;
        case 'unpublish':
            $message = acajoom::printYN(lists::updateListFromList($listId, false, false), _ACA_UNPUBLISHED, _ACA_ERROR);
            break;
        case 'forms':
        case 'make':
            if (class_exists('createForm')) {
                createForm::taskOptions($task);
                $showLists = false;
            } else {
                $showLists = true;
            }
            break;
        case 'cpanel':
            backHTML::controlPanel();
            return true;
            break;
    }
    if ($showLists) {
        backHTML::_header(_ACA_MENU_LIST, $GLOBALS[ACA . 'listlogo0'], $message, $task, $action);
        $show = lisType::showType(0, 'showListsBack');
        $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n";
        backHTML::formStart('show_mailing', '', '');
        $listing = lists::getLists(0, 0, 1, '', false, false, false);
        if ($show['list_type']) {
            $show['list_type'] = lisType::checkOthers();
        }
        listsHTML::showListingLists($listing, $action, 'edit', $forms, $show);
        $go[] = acajoom::makeObj('act', $action);
        backHTML::formEnd($go);
        return true;
    }
}
Esempio n. 7
0
    public static function editMailing($mailingEdit, $new, $listId, $forms, $show, $isEdit = false)
    {
        $lists = array();
        $mainframe = JFactory::getApplication();
        if (!class_exists('JHtmlBehavior')) {
            jimport('joomla.html.html.behavior');
        }
        $mailingIdchk = JRequest::getVar('mailingid', 0);
        $folders = array();
        $my = JFactory::getUser();
        $folders[] = jnews::HTML_SelectOption('/');
        $lists['published'] = jnews::HTML_BooleanList('published', 'class="inputbox"', $mailingEdit->published);
        $lists['visible'] = jnews::HTML_BooleanList('visible', 'class="inputbox"', $mailingEdit->visible);
        if ($mailingIdchk == 0) {
            $mailingEdit->html = 1;
        }
        //for default value of HTML mailing?
        $lists['html_mailings'] = jnews::HTML_BooleanList('html_mailings', 'onchange="updateEditor(this.value)"', $mailingEdit->html);
        $images = $mailingEdit->images;
        if (!isset($mailingEdit->list_id)) {
            $mailingEdit->list_id = $listId;
        }
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //j15
            $imgfolders = '/images/stories';
        } else {
            //j16
            $imgfolders = '/images/sampledata';
        }
        $pathA = JNEWS_JPATH_ROOT_NO_ADMIN . $imgfolders;
        $pathL = JNEWS_JPATH_LIVE . $imgfolders;
        $images = array();
        jNews_MailingsHTML::ReadImages($pathA, '/', $folders, $images);
        if (!isset($images['/'])) {
            $images['/'][] = jnews::HTML_SelectOption('');
        }
        $javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '{$pathL}/' )\"";
        $lists['imagefiles'] = jnews::HTML_GenericList($images['/'], 'imagefiles', 'class="inputbox" size="10" multiple="multiple" ' . $javascript, 'value', 'text', null);
        $javascript = "onchange=\"changeDynaList( 'imagefiles', folderimages, document.adminForm.folders.options[document.adminForm.folders.selectedIndex].value, 0, 0);  previewImage( 'imagefiles', 'view_imagefiles', '{$pathL}/' );\"";
        $lists['folders'] = jnews::HTML_GenericList($folders, 'folders', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', '/');
        $images2 = array();
        foreach ($mailingEdit->images as $file) {
            $temp = explode('|', $file);
            if (strrchr($temp[0], '/')) {
                $filename = substr(strrchr($temp[0], '/'), 1);
            } else {
                $filename = $temp[0];
            }
            $images2[] = jnews::HTML_SelectOption($file, $filename);
        }
        $javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '{$pathL}/' ); showImageProps( '{$pathL}/' ); \"";
        $lists['imagelist'] = jnews::HTML_GenericList($images2, 'imagelist', 'class="inputbox" size="10" ' . $javascript, 'value', 'text');
        $lists['_align'] = JHTML::_('list.positions', '_align');
        $lists['_caption_align'] = JHTML::_('list.positions', '_caption_align');
        $pos[] = jnews::HTML_SelectOption('bottom', _CMN_BOTTOM);
        $pos[] = jnews::HTML_SelectOption('top', _CMN_TOP);
        $lists['_caption_position'] = jnews::HTML_GenericList($pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
        backHTML::formStart('edit_mailing', $mailingEdit->html, $images);
        echo $forms['main'];
        if ($mainframe->isAdmin()) {
            jNews_MailingsHTML::layoutBE($mailingEdit, $lists, $show, $isEdit);
        } else {
            jNews_MailingsHTML::layoutFE($mailingEdit, $lists, $show, $isEdit);
        }
        echo JHTML::_('behavior.keepalive');
        ?>
		<input type="hidden" name="images" value="" />
		<input type="hidden" name="html" value="<?php 
        echo $mailingEdit->html;
        ?>
" />
		<input type="hidden" name="new_list" value="<?php 
        echo $new;
        ?>
" />
		<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
		<input type="hidden" name="listype" value="<?php 
        echo $mailingEdit->mailing_type;
        ?>
" />
		<input type="hidden" name="mailingid" value="<?php 
        echo $mailingEdit->id;
        ?>
" />
		<input type="hidden" name="issue_nb" value="<?php 
        echo $mailingEdit->issue_nb;
        ?>
" />
	    <input type="hidden" name="userid" value="<?php 
        echo $my->id;
        ?>
" />
	    <?php 
    }
Esempio n. 8
0
 public static function showMailingsFront($task, $action, $subscriberId, $listId, $listType = '', $viewArchive, $pageTile)
 {
     $Itemid = JRequest::getInt('Itemid');
     if (empty($Itemid)) {
         $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
     }
     $gidAdmins = array(24, 25, 7, 8);
     $my = JFactory::getUser();
     if (version_compare(JVERSION, '1.6.0', '>=')) {
         //j16
         $usergid = JAccess::getGroupsByUser($my->id, false);
         $my->gid = $usergid[0];
     }
     $start = JRequest::getVar('start', '0');
     if (!$start) {
         $start = JRequest::getVar('limitstart', '0');
     }
     JRequest::setVar('limitstart', $start);
     $emailsearch = JRequest::getVar('emailsearch', '', '', 'STRING');
     $emailsearch = htmlentities($emailsearch, ENT_COMPAT, "UTF-8");
     $obj_for_order = new stdClass();
     if (version_compare(JVERSION, '3.0.0', '>=')) {
         //j16
         //alex filter
         if ($action === 'mailing') {
             $order = JRequest::getVar('filter_order', 'send_date');
             $obj_for_order->orderValue = $order;
             $obj_for_order->orderDir = JRequest::getVar('filter_order_Dir', 'desc');
         } else {
             $order = JRequest::getVar('filter_order', 'id');
             $obj_for_order->orderValue = $order;
             $obj_for_order->orderDir = JRequest::getVar('filter_order_Dir', 'asc');
         }
     } else {
         $order = JRequest::getVar('order', 'sendDateD');
     }
     $dropList = JRequest::getVar('droplist', 'ZZZZ');
     $my = JFactory::getUser();
     $accessGrant = false;
     $limit = JRequest::getInt('limit');
     if (empty($limit) || $limit > 100) {
         $limit = 20;
     }
     $total = 0;
     if ($dropList == 'ZZZZ') {
         $dropList = $listType . '-' . $listId;
     }
     $total = 0;
     $dropListValues = explode('-', $dropList);
     $listType = $dropListValues[0];
     $listId = $dropListValues[1];
     $id = 0;
     if ($GLOBALS[JNEWS . 'enable_jsub']) {
         if (!empty($my->id)) {
             $ownedlists = jNews_Lists::getOwnedlists($my->id);
         }
         if (!empty($ownedlists)) {
             $id = $my->id;
         }
     }
     $allowed = false;
     if (class_exists('jNews_Pro') && $listId > 0) {
         $list = jNews_Lists::getOneList($listId);
         $allowed = jnews::checkPermissions($list->acc_level);
     } elseif (class_exists('jNews_Pro') && empty($listId)) {
         //check all list
         $myQ = 'SELECT `acc_level` FROM `#__jnews_lists` ';
         $db = JFactory::getDBO();
         $db->setQuery($myQ);
         $listsAccessHere = $db->loadObjectList();
         $allowed = false;
         if (!empty($listsAccessHere)) {
             foreach ($listsAccessHere as $oneAcessL) {
                 if (jnews::checkPermissions($oneAcessL->acc_level)) {
                     $allowed = true;
                     break;
                 }
             }
             //endfoerach
         }
     } else {
         $allowed = in_array($my->gid, $gidAdmins);
     }
     if (!empty($my->id)) {
         $ownedlists = jNews_Lists::getOwnedlists($my->id);
     }
     $accessGrant = !empty($ownedlists) ? true : $allowed;
     if ($accessGrant || $GLOBALS[JNEWS . 'level'] > 2) {
         //we don't filter the newsletters by lists yet - 8889955
         if ($task === "archive") {
             $listType_old = $listType;
             $listType = 1;
         }
         if (empty($listType)) {
             $listType = 1;
         }
         $mailings = jNews_Mailing::getMailings($listId, $listType, $start, $limit, $emailsearch, $order, false, $viewArchive, $obj_for_order);
         $total = count(jNews_Mailing::getMailings($listId, $listType, '0', '100000000', $emailsearch, $order, false, $viewArchive, $obj_for_order));
         if ($task === "archive") {
             $listType = $listType_old;
         }
     } else {
         if ($listType == 1 || $listType == 2 || $listType == 7) {
             $mailings = jNews_Mailing::getMailings($listId, $listType, $start, $limit, $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $total = count(jNews_Mailing::getMailings($listId, $listType, '0', '100000000', $emailsearch, $order, true, $viewArchive, $obj_for_order));
         } elseif ($listType == 0) {
             $mailings1 = jNews_Mailing::getMailings($listId, 1, $start, $limit, $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $mailings2 = jNews_Mailing::getMailings($listId, 2, $start, $limit, $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $mailings7 = jNews_Mailing::getMailings($listId, 7, $start, $limit, $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $mailings = array_merge($mailings1, $mailings2, $mailings7);
             $totalmailings1 = jNews_Mailing::getMailings($listId, 1, '0', '100000000', $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $totalmailings2 = jNews_Mailing::getMailings($listId, 2, '0', '100000000', $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $totalmailings7 = jNews_Mailing::getMailings($listId, 7, '0', '100000000', $emailsearch, $order, true, $viewArchive, $obj_for_order);
             $totalmailings = array_merge($totalmailings1, $totalmailings2, $totalmailings7);
             $total = count($totalmailings);
         } else {
             $mailings = '';
         }
     }
     if ($listId == 0) {
         $lists['title'] = jNews_ListType::chooseType($task, $action, $listType, 'titles', '', _JNEWS_MENU_MAILING);
     } else {
         $listing = jNews_Lists::getLists($listId, 0, $subscriberId, '', false, false, true);
         $listType = $listType > 0 ? $listType : '0';
         $lists['title'] = _JNEWS_NEWSLETTER_ARCHIVE;
     }
     //we check if the user has access to addedit mailing to a list
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $listsAddEdit = jNews_Lists::getIDswithacclevel($my->gid, $listId);
     } else {
         $groups = JAccess::getGroupsByUser($my->id);
         $listsAddEdit = jNews_Lists::getIDswithacclevel($groups, $listId);
     }
     $haveaccesstoList = true;
     $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0;
     if (!$allowed && empty($listsAddEdit) && !empty($my->id) && !jnews::checkPermissions('admin') && !jnews::checkPermissions($gid)) {
         $haveaccesstoList = false;
     }
     if ($haveaccesstoList) {
         $dropDownList = jNews_ListType::getMailingDropList($listId, $listType, 'idA');
         // $order
         if (!empty($dropDownList)) {
             $lists['droplist'] = jnews::HTML_GenericList($dropDownList, 'droplist', 'class="inputbox" size="1" onchange="document.jNewsFilterForm.submit();"', 'id', 'name', $dropList);
         }
     }
     $linkMain = 'index.php?option=' . JNEWS_OPTION . '&act=' . $action;
     $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION);
     //alex pagination
     if (!empty($task)) {
         $mainLink .= '&task=' . $task;
     }
     if (!empty($action)) {
         $mainLink .= '&act=' . $action;
     }
     if (!empty($listType)) {
         $mainLink .= '&listype=' . $listType;
     }
     if (!empty($listId)) {
         $mainLink .= '&listid=' . $listId;
     }
     $forms['main'] = '<form method="post" action="' . $mainLink . '" enctype="multipart/form-data" onsubmit="submitbutton();return false;" name="adminForm" id="adminForm">' . "\n\r";
     $forms['select'] = '<form method="post" action="' . $linkMain . '"  name="jNewsFilterForm">' . "\n\r";
     $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
     $forms['select'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
     $show = jNews_ListType::showType($listType, 'showMailings');
     $show['index'] = 'index';
     $show['select'] = false;
     $show['send'] = false;
     $show['buttons'] = true;
     if (class_exists('jNews_Pro') && !$viewArchive) {
         $show['admin'] = true;
         $show['status'] = true;
     }
     $mailingType = $listType == 7 ? 1 : $listType;
     $db = JFactory::getDBO();
     $query = 'SELECT * FROM `#__jnews_lists` WHERE `hidden` = 1 AND `published` = 1 AND ';
     if (is_array($mailingType)) {
         $query .= '  `list_type` IN (' . jnews::implode(',', $mailingType) . ') ';
     } else {
         $query .= ' `list_type`=' . intval($mailingType);
     }
     $db->setQuery($query);
     $lists = $db->loadObjectList();
     $access = false;
     foreach ($lists as $list) {
         $bit = jnews::checkPermissions($list->acc_level);
         if ($bit) {
             $access = true;
             break;
         }
     }
     $menuA = null;
     if ($my->id > 0 && jnews::checkPermissions('all') && $haveaccesstoList) {
         if ($GLOBALS[JNEWS . 'level'] > 2) {
             if ((empty($ownedlists) || !in_array($my->gid, $gidAdmins)) && !$access) {
                 $accessGrant = false;
             } else {
                 $accessGrant = true;
             }
             if ($accessGrant) {
                 $show['select'] = true;
                 $show['send'] = true;
                 // menu new
                 $link = 'option=' . JNEWS_OPTION . '&act=mailing&task=new&listid=' . $listId . '&listype=' . $listType . '&Itemid=' . $Itemid;
                 $link = jNews_Tools::completeLink($link, false);
                 $menuNew = new stdClass();
                 $menuNew->popup = new stdClass();
                 $menuNew->popup->isPop = false;
                 $menuNew->link = '#';
                 $menuNew->action = 'new';
                 $menuNew->onclick = new stdClass();
                 $menuNew->onclick->custom = false;
                 $menuNew->onclick->js = '';
                 $menuNew->title = _JNEWS_NEW;
                 //menu edit
                 $menuEdit = new stdClass();
                 $menuEdit->popup = new stdClass();
                 $menuEdit->popup->isPop = false;
                 $menuEdit->link = '#';
                 $menuEdit->action = 'edit';
                 $menuEdit->onclick = new stdClass();
                 $menuEdit->onclick->custom = false;
                 $menuEdit->onclick->js = '';
                 $menuEdit->title = _JNEWS_MENU_EDIT;
                 //menu delete
                 $menuDelete = new stdClass();
                 $menuDelete->popup = new stdClass();
                 $menuDelete->popup->isPop = false;
                 $menuDelete->link = '#';
                 $menuDelete->action = 'delete';
                 $menuDelete->onclick = new stdClass();
                 $menuDelete->onclick->custom = false;
                 $menuDelete->onclick->js = '';
                 $menuDelete->title = _JNEWS_DELETE;
                 $menuPreview = new stdClass();
                 $menuPreview->popup = new stdClass();
                 $menuPreview->popup->isPop = false;
                 $menuPreview->link = '#';
                 $menuPreview->action = 'preview';
                 $menuPreview->onclick = new stdClass();
                 $menuPreview->onclick->custom = true;
                 $menuPreview->onclick->js = 'javascript:if(document.adminForm.boxchecked.value==0){alert(\'Please make a selection from the mailings to preview\');}else{  submitbutton(\'preview\')}';
                 $menuPreview->title = 'Preview';
                 $menuCopy = new stdClass();
                 $menuCopy->popup = new stdClass();
                 $menuCopy->popup->isPop = false;
                 $menuCopy->link = '#';
                 $menuCopy->action = 'copy';
                 $menuCopy->onclick = new stdClass();
                 $menuCopy->onclick->custom = false;
                 $menuCopy->onclick->js = '';
                 $menuCopy->title = 'Copy';
                 $menuUnpub = new stdClass();
                 $menuUnpub->popup = new stdClass();
                 $menuUnpub->popup->isPop = false;
                 $menuUnpub->link = '#';
                 $menuUnpub->action = 'unpublished';
                 $menuUnpub->onclick = new stdClass();
                 $menuCopy->onclick->custom = false;
                 $menuUnpub->onclick->js = '';
                 $menuUnpub->title = 'Unpublished';
                 $menuDivider = new stdClass();
                 $menuDivider->divider = true;
             } else {
                 $menuNew = new stdClass();
                 $menuEdit = new stdClass();
                 $menuDelete = new stdClass();
                 $menuCopy = new stdClass();
                 $menuUnpub = new stdClass();
                 $menuSend = new stdClass();
                 $menuPreview = new stdClass();
                 $menuDivider = new stdClass();
             }
         } else {
             $menuNew = new stdClass();
             $menuEdit = new stdClass();
             $menuDelete = new stdClass();
             $menuCopy = new stdClass();
             $menuUnpub = new stdClass();
             $menuSend = new stdClass();
             $menuPreview = new stdClass();
             $menuDivider = new stdClass();
         }
         // menu cpanel
         $link = 'option=' . JNEWS_OPTION;
         $link = jNews_Tools::completeLink($link, false);
         $menuCpanel = new stdClass();
         $menuCpanel->popup = new stdClass();
         $menuCpanel->popup->isPop = false;
         $menuCpanel->popup->isPop = false;
         $menuCpanel->link = $link;
         $menuCpanel->action = 'cpanel';
         $menuCpanel->onclick = new stdClass();
         $menuCpanel->onclick->custom = true;
         $menuCpanel->onclick->js = "javascript: submitbutton('cpanel')";
         $menuCpanel->title = _JNEWS_MENU_CPANEL;
         $menuA = array();
         if ($listType != 7) {
             $menuA['unpublished'] = $menuUnpub;
         }
         $menuA['preview'] = $menuPreview;
         $menuA['new'] = $menuNew;
         $menuA['edit'] = $menuEdit;
         if ($listType != 7) {
             $menuA['copy'] = $menuCopy;
         }
         $menuA['delete'] = $menuDelete;
         //			$menuA['divider1'] = $menuDivider;
     }
     //menu back
     if ($listType == 2) {
         $link = 'option=' . JNEWS_OPTION . '&act=list&Itemid=' . $Itemid;
     }
     $link = 'option=' . JNEWS_OPTION . '&Itemid=' . $Itemid;
     $link = jNews_Tools::completeLink($link, false, false);
     $menuBack = new stdClass();
     $menuBack->popup = new stdClass();
     $menuBack->popup = new stdClass();
     $menuBack->popup->isPop = false;
     $menuBack->link = $link;
     $menuBack->action = 'back';
     $menuBack->onclick = new stdClass();
     $menuBack->onclick->custom = false;
     $menuBack->onclick->js = '';
     $menuBack->title = _JNEWS_MENU_BACK;
     $menuBack = new stdClass();
     $menuA['cpanel'] = $menuBack;
     $title = !empty($lists['title']) ? $lists['title'] : '';
     if (in_array($my->gid, $gidAdmins) or !empty($ownedlists) or $accessGrant) {
         if ($listType == 1) {
             $title = 'Newsletters';
         }
         if ($listType == 7) {
             $title = 'Smart-Newsletters';
         }
         if ($listType == 2) {
             $title = 'Auto-responders';
         }
     }
     $app = JFactory::getApplication();
     $setSort = new stdClass();
     if ($listType == '2') {
         //autoresponder
         $key = JNEWS_OPTION . '.mailing2';
         $column = 'delay';
         $direction = 'asc';
     } elseif ($listType == '7') {
         //smartnewsletter
         $key = JNEWS_OPTION . '.mailing7';
         $column = 'id';
         $direction = 'desc';
     } else {
         //newsletter
         $key = JNEWS_OPTION . '.mailing1';
         $column = 'send_date';
         $direction = 'desc';
     }
     $setSort->orderValue = $app->getUserStateFromRequest($key . 'filter_order', 'filter_order', $column, 'cmd');
     $setSort->orderDir = $app->getUserStateFromRequest($key . 'filter_order_Dir', 'filter_order_Dir', $direction, 'word');
     $setLimit = new stdClass();
     $setLimit->start = $start;
     $setLimit->end = $limit;
     $setLimit->total = $total;
     frontHTML::formStart($title, 0, 'show_mailing', $menuA);
     frontHTML::FEmenu();
     jNews_MailingsHTML::showMailingList($mailings, $lists, $start, $limit, $total, $emailsearch, $listId, $listType, $forms, $show, $action, $setLimit, $setSort);
     $go[] = jnews::makeObj('filter_order', $setSort->orderValue);
     $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir);
     backHTML::formEnd($go);
     return true;
 }
Esempio n. 9
0
 function showPanel()
 {
     global $Itemid;
     if (ACA_CMSTYPE) {
         $database =& JFactory::getDBO();
         $acl =& JFactory::getACL();
         $my =& JFactory::getUser();
     } else {
         global $my, $database, $acl;
     }
     //endif
     if (isset($my->id) && $my->id > 0) {
         if (!empty($my->username)) {
             $greeting_message = _HI . ' ' . $my->username;
         } else {
             $greeting_message = '';
         }
         backHTML::controlPanelBottonStart(_UCP_USER_MENU, 'cpanel.png');
         $link = '.php?option=com_acajoom&act=show&Itemid=' . $Itemid;
         compa::completeLink($link, false);
         backHTML::quickiconButton($link, 'addusers.png', _UCP_USER_CONTACT, false, 'Registered', false);
         if (class_exists('pro')) {
             $aro_id = isset($my->id) && $my->id > 0 ? $acl->get_object_id('users', $my->id, 'ARO') : 1;
             $qacl = "SELECT `group_id` FROM `#__core_acl_groups_aro_map` WHERE `aro_id` =" . $aro_id;
             $database->setQuery($qacl);
             $usergid = $database->loadResult();
             $gidAdmin = $acl->get_group_id('Administrator', 'ARO');
             $ex_groups = $acl->get_group_children($gidAdmin, 'ARO', 'RECURSE');
             $ex_groups[] = $gidAdmin;
             if (in_array($usergid, $ex_groups)) {
                 $link = '.php?option=com_acajoom&act=list&Itemid=' . $Itemid;
                 compa::completeLink($link, false);
                 backHTML::quickiconButton($link, 'addedit.png', _ACA_MENU_LIST, false, 'admin', false);
             } else {
                 $lists = lists::getLists(0, 0, true);
                 $access = false;
                 foreach ($lists as $list) {
                     $bit = acajoom::checkPermissions('hello', 0, $list->acc_level);
                     if ($bit) {
                         $access = true;
                         break;
                     }
                 }
                 $link = '.php?option=com_acajoom&act=list&Itemid=' . $Itemid;
                 compa::completeLink($link, false);
                 if ($access) {
                     backHTML::quickiconButton($link, 'addedit.png', _ACA_MENU_LIST, false, 'Registered', false);
                 }
             }
         } else {
             $link = '.php?option=com_acajoom&act=list&Itemid=' . $Itemid;
             compa::completeLink($link, false);
             backHTML::quickiconButton($link, 'addedit.png', _ACA_MENU_LIST, false, 'admin', false);
         }
         backHTML::controlPanelBottomEnd();
         if (class_exists('auto')) {
             auto::otherPanel();
         }
     }
 }
Esempio n. 10
0
function about($message, $task, $action)
{
    switch ($task) {
        case 'cpanel':
            backHTML::controlPanel();
            break;
        default:
            backHTML::_header(_JNEWS_MENU_ABOUT . ' jNews', 'about.png', $message, $task, $action);
            backHTML::about();
    }
}
Esempio n. 11
0
 public static function showMailings($task, $action, $listId, $listType, $message, $showHeader, $title, $setLimit = null)
 {
     $start = JRequest::getVar('start', '0');
     $emailsearch = JRequest::getVar('emailsearch', '', '', 'STRING');
     $emailsearch = htmlentities($emailsearch, ENT_COMPAT, "UTF-8");
     $dropList = JRequest::getVar('droplist', 'ZZZZ');
     $limit = -1;
     if ($dropList == 'ZZZZ') {
         $dropList = $listType . '-' . $listId;
     }
     $total = 0;
     $dropListValues = explode('-', $dropList);
     $listType = $dropListValues[0];
     $listId = $dropListValues[1];
     //		if ( $listId>0 ) $listTypeM = 0;
     //		else $listTypeM = $listType;
     $listTypeM = $listType;
     $orddef = 'idD';
     if ($listType == 2) {
         $orddef = 'idA';
     }
     $order = JRequest::getVar('order', $orddef);
     if ($listId == 0) {
         $lists['title'] = jNews_ListType::chooseType($task, $action, $listType, 'titles', '', $title);
     } else {
         $listing = jNews_Lists::getLists($listId, 0, 1, '', false, false, true);
         $lists['title'] = $title . "<span style='color: rgb(51, 51, 51);'>" . $listing[0]->list_name . "</span>";
     }
     $app = JFactory::getApplication();
     if ($listType == '2') {
         //autoresponder
         $key = JNEWS_OPTION . '.mailing2';
         $column = 'id';
         $direction = 'desc';
     } elseif ($listType == '7') {
         //smartnewsletter
         $key = JNEWS_OPTION . '.mailing7';
         $column = 'id';
         $direction = 'desc';
     } else {
         //newsletter
         $key = JNEWS_OPTION . '.mailing1';
         $column = 'id';
         $direction = 'desc';
     }
     $setSort = new stdClass();
     $setSort->orderValue = $app->getUserStateFromRequest($key . 'filter_order', 'filter_order', $column, 'cmd');
     $setSort->orderDir = $app->getUserStateFromRequest($key . 'filter_order_Dir', 'filter_order_Dir', $direction, 'word');
     $dropDownList = jNews_ListType::getMailingDropList($listId, $listType, $order);
     if (!empty($dropDownList)) {
         $lists['droplist'] = jnews::HTML_GenericList($dropDownList, 'droplist', 'class="inputbox" size="1" onchange="document.jNewsFilterForm.submit();"', 'id', 'name', $dropList);
     }
     $mailings = jNews_Mailing::getMailings($listId, $listTypeM, $setLimit->start, $setLimit->end, $emailsearch, $order, false, false, $setSort);
     //recheck limit total [pagination]
     if (isset($setLimit->total) && !empty($emailsearch)) {
         $mails = jNews_Mailing::getMailings($listId, $listTypeM, 0, 0, $emailsearch, $order, false, false);
         $setLimit->total = !empty($mails) ? count($mails) : $setLimit->total;
     }
     $forms['main'] = "<form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
     $forms['select'] = "<form action='index.php' method='post' name='jNewsFilterForm'>";
     $show = jNews_ListType::showType($listType, 'showMailings');
     if ($showHeader) {
         jNews_Mailing::_header($task, $action, $listType, $message, '');
     }
     backHTML::formStart('show_mailing', 0, '');
     jNews_MailingsHTML::showMailingList($mailings, $lists, $setLimit->start, $setLimit->end, $setLimit->total, $emailsearch, $listId, $listType, $forms, $show, $action, $setLimit, $setSort);
     $go[] = jnews::makeObj('act', 'mailing');
     $go[] = jnews::makeObj('filter_order', $setSort->orderValue);
     $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir);
     backHTML::formEnd($go);
 }
Esempio n. 12
0
 public static function about()
 {
     echo '<table width="100%" align="left"><tr>';
     echo '<td>';
     echo '<form action="index.php" method="post" name="adminForm" id="adminForm">';
     jnews::beginingOfTable('jnewstable');
     jnews::miseEnPage('Description', '', constant('_JNEWS_DESC_' . strtoupper($GLOBALS[JNEWS . 'type'])));
     jnews::miseEnPage('Developers', '', 'Evelyn Lopez, Mary Michelle Piquero, Gerald R. Zalsos, Ebony Grace Ursua, Mary Grace Arabis, Gino Tayo, <br/>Glenn Jaime Chan, Adel Fomar Dulanas, Lalene Cababat, Jhen Bontilao');
     jnews::miseEnPage('Contributor', '', 'Amir Ben Avraham, Christelle Gesset & Adrien Baborier');
     jnews::miseEnPage('Captcha Contributor', '', 'Sorin Rosen');
     jnews::miseEnPage('Designer', '', 'Rochel Abrasaldo');
     jnews::miseEnPage('CB Integration', '', 'Mikko R&ouml;nkk&ouml;');
     jnews::miseEnPage('Add-ons', '', 'Kyle Witt');
     jnews::miseEnPage('Language Translation', '', '');
     jnews::miseEnPage('Brazilian_portuguese', '', 'Navsoft');
     jnews::miseEnPage('Danish', '', 'Joergen Floes');
     jnews::miseEnPage('Dutch', '', 'Tromp Wezelman & Bart Bevers');
     jnews::miseEnPage('Finnish', '', 'Tero Kankaanperä');
     jnews::miseEnPage('French', '', 'Christelle Gesset');
     jnews::miseEnPage('German', '', 'David Freund & Frank Jansen');
     jnews::miseEnPage('Hebrew', '', 'Eszter Somos & Adam Segev');
     jnews::miseEnPage('Hungarian', '', 'Zolt&aacute;n Varanka');
     jnews::miseEnPage('Italian', '', 'Maria Luisa Rossari');
     jnews::miseEnPage('Norwegian', '', '<a href="http://www.timeoffice.com" target="_blank">Irma Rustad</a>');
     jnews::miseEnPage('Polish', '', 'Andrzej Herzberg');
     jnews::miseEnPage('Portuguese', '', 'Ricardo Sim&otilde;es');
     jnews::miseEnPage('Simplified Chinese', '', '<a href="http://www.joomlagate.com" target="_blank">Baijianpeng</a>');
     jnews::miseEnPage('Spanish', '', '<a href="http://www.eaid.org" target="_blank">Jorge Pasco</a>');
     jnews::miseEnPage('Swedish', '', 'Janne Karlsson');
     jnews::miseEnPage('Turkish', '', 'Anonymous');
     jnews::miseEnPage('CSS class to style attribute', '', '<a href="http://classes.verkoyen.eu/css_to_inline_styles" target="_NEW">http://classes.verkoyen.eu/css_to_inline_styles</a>');
     jnews::miseEnPage(' ', '', '   ');
     jnews::miseEnPage(_JNEWS_VERSION, '', jnews::version());
     jnews::miseEnPage(' ', '', '   ');
     jnews::miseEnPage(_JNEWS_DESC_HOME, '', '<a href="' . $GLOBALS[JNEWS . 'homesite'] . '" target="_blank">' . JNEWS_HOME_SITE . '</a>');
     jnews::miseEnPage(_JNEWS_MENU_HELP, '', '<a href="' . JNEWS_HOME_SITE . '/index.php?option=com_content&Itemid=67&catid=93&id=8241&lang=en&view=article" target="_blank">Documentation</a>');
     jnews::miseEnPage(_JNEWS_MENU_LIVE_SUPPORT, '', '<a href="' . JNEWS_HOME_SITE . '/live-support" target="_blank">Help</a>');
     jnews::miseEnPage(_JNEWS_MENU_LEARN, '', '<a href="http://demo.joobi.co/" target="_blank">Education Center</a>');
     jnews::miseEnPage('Copyrights', '', 'jNews <i>Your Communciation Partner</i>, &copy; Joobi Limited');
     jnews::miseEnPage(_JNEWS_LICENSE, '', '<a href="http://www.joobi.co/index.php?option=com_jlinks&controller=redirect&link=single-license" target="_blank">&copy; Joobi Limited</a>');
     jnews::endOfTable();
     backHTML::formEnd();
     echo '</td>';
     echo '<td width="380px">';
     $logo = 'jnews_logo' . (!empty($GLOBALS[JNEWS . 'type']) ? '_' . strtolower($GLOBALS[JNEWS . 'type']) : '') . '.png';
     echo '<a href="http://www.joobi.co" target="_blank"><img src="http://www.joobi.co/images/' . $logo . '" alt="jNews Logo" border="0" align="center" /></a>';
     echo '</td>';
     echo '</tr></table>';
 }
Esempio n. 13
0
function lists($action, $task, $listId, $listType)
{
    $db = JFactory::getDBO();
    $my = JFactory::getUser();
    $css = '.icon-48-lists { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/lists.png)}';
    $doc = JFactory::getDocument();
    $doc->addStyleDeclaration($css, $type = 'text/css');
    $img = 'lists.png';
    $listsearch = JRequest::getVar('listsearch', '');
    $message = '';
    $xf = new jNews_Config();
    $showLists = true;
    $checkToggle = false;
    // defined toggle for publish and unpublish of mailings
    if (!empty($task) && $task == 'togle') {
        $checkToggle = true;
        $id = JRequest::getVar('listid');
        $col = JRequest::getVar('col');
        $listId = !empty($id) && !empty($col) ? $id : $listId;
        $task = !empty($listId) && !empty($col) ? $col : $task;
    }
    switch ($task) {
        case 'new':
        case 'add':
            $subscriber = jNews_Subscribers::getSubscriberInfoFromUserId($my->id);
            if (version_compare(JVERSION, '1.6.0', '<')) {
                //j15
                $acl = JFactory::getACL();
                $groups = $acl->get_group_children_tree(null, 'USERS', false);
            } else {
                //j16
                $db = JFactory::getDBO();
                $db->setQuery('SELECT a.*, a.title as text, a.id as value  FROM #__usergroups AS a ORDER BY a.lft ASC');
                $groups = $db->loadObjectList();
            }
            $allGroupIds = array();
            foreach ($groups as $oneGroup) {
                $allGroupIds[] = $oneGroup->value;
            }
            $newList = new stdClass();
            $showLists = false;
            $newList->id = '';
            $newList->html = 1;
            $newList->new_letter = 1;
            $newList->list_name = '';
            $newList->list_desc = '';
            $newList->template = '';
            if (empty($subscriber)) {
                $newList->sendername = '';
                $newList->senderemail = '';
                $newList->bounceadres = '';
            } else {
                $newList->sendername = '';
                $newList->senderemail = '';
                $newList->bounceadres = '';
            }
            $newList->hidden = 1;
            $newList->auto_add = 0;
            $newList->list_type = $listType;
            $newList->delay_min = 1;
            $newList->delay_max = 7;
            $newList->user_choose = 0;
            $newList->cat_id = '0:0';
            $newList->follow_up = '';
            $newList->notify_id = 0;
            $newList->owner = $my->id;
            $newList->acc_level = '24,25,7,8';
            $newList->acc_id = implode(',', $allGroupIds);
            $newList->published = 1;
            $newList->start_date = date('Y-m-d', time());
            $newList->next_date = jnews::getNow();
            $newList->subscribemessage = _JNEWS_DEFAULT_SUBSCRIBE_MESS;
            $newList->unsubscribemessage = _JNEWS_DEFAULT_UNSUBSCRIBE_MESS;
            $newList->notifyadminmsg = _JNEWS_UNSUBSCRIBE_ADMIN_NOTIFICATION;
            $newList->subnotifymsg = _JNEWS_SUBSDEFAULT_NOTIFYMSG;
            $newList->subnotifysend = 1;
            $newList->unsubscribesend = 1;
            $newList->unsubscribenotifyadmin = 1;
            $newList->footer = 1;
            $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
            $show = jNews_ListType::showType($newList->list_type, 'editlist');
            if ($listType == 1) {
                backHTML::_header(_JNEWS_NEW . ' ' . _JNEWS_LIST, $img, $message, $task, $action);
            } else {
                backHTML::_header(_JNEWS_NEW . ' ' . _JNEWS_AUTORESP . ' ' . _JNEWS_LIST, $img, $message, $task, $action);
            }
            backHTML::formStart('editlist', $newList->html, '');
            jNews_ListsHTML::editList($newList, $forms, $show, $listType);
            $go[] = jnews::makeObj('act', $action);
            $go[] = jnews::makeObj('listid', $newList->id);
            backHTML::formEnd($go);
            break;
        case 'doNew':
            JRequest::checkToken() or die('Invalid Token');
            $listname = JRequest::getVar('list_name', '');
            if (empty($listname)) {
                echo "<script> alert(' List name must be filled out. '); window.history.go(-1);</script>\n";
                return false;
            }
            $now = jnews::getNow();
            $query = "SELECT `id` FROM `#__jnews_lists` WHERE `list_name`= '" . addslashes($listname) . "' ";
            $db->setQuery($query);
            $lId = $db->loadResult();
            if ($lId > 0) {
                echo "<script> alert(' This list already exist, please choose another name. '); window.history.go(-1);</script>\n";
                return false;
            } else {
                $query = "INSERT INTO `#__jnews_lists` (`list_name`,`createdate`) VALUES ( '" . addslashes($listname) . "'  , '{$now}' )";
                $db->setQuery($query);
                $db->query();
            }
            $query = "SELECT * FROM `#__jnews_lists` WHERE `list_name`= '" . addslashes($listname) . "' ";
            $db->setQuery($query);
            $mynewlist = $db->loadObject();
            $mynewlist->list_name = stripslashes($mynewlist->list_name);
            $mynewlist->list_desc = stripslashes($mynewlist->list_desc);
            $mynewlist->template = $mynewlist->template;
            $mynewlist->layout = stripslashes($mynewlist->layout);
            $mynewlist->subscribemessage = stripslashes($mynewlist->subscribemessage);
            $mynewlist->unsubscribemessage = stripslashes($mynewlist->unsubscribemessage);
            $mynewlist->notifyadminmsg = stripslashes($mynewlist->notifyadminmsg);
            $mynewlist->subnotifysend = stripslashes($mynewlist->subnotifysend);
            $mynewlist->subnotifymsg = stripslashes($mynewlist->subnotifymsg);
            $listId = $mynewlist->id;
            $message = jnews::printYN(jNews_Lists::updateListFromEdit($listId, '', true, $listType), _JNEWS_LIST_ADDED, _JNEWS_ERROR);
            $xf->plus('totallist0', 1);
            $xf->plus('act_totallist0', 1);
            $xf->plus('totallist' . $listType, 1);
            $xf->plus('act_totallist' . $listType, 1);
            break;
        case 'edit':
            if ($listId == 0) {
                echo "<script> alert('" . addslashes(_JNEWS_SELECT_LIST) . "'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $showLists = false;
                $query = 'SELECT * FROM `#__jnews_lists` WHERE `id` = ' . intval($listId);
                $db->setQuery($query);
                $listEdit = $db->loadObject();
                if ($listEdit->acc_id == 'all') {
                    if (version_compare(JVERSION, '1.6.0', '<')) {
                        //j15
                        $acl = JFactory::getACL();
                        $groups = $acl->get_group_children_tree(null, 'USERS', false);
                    } else {
                        //j16
                        $db = JFactory::getDBO();
                        $db->setQuery('SELECT a.*, a.title as text, a.id as value  FROM #__usergroups AS a ORDER BY a.lft ASC');
                        $groups = $db->loadObjectList();
                    }
                    $allGroupIds = array();
                    foreach ($groups as $oneGroup) {
                        $allGroupIds[] = $oneGroup->value;
                    }
                    $listEdit->acc_id = implode(',', $allGroupIds);
                }
                $listEdit->list_name = stripslashes($listEdit->list_name);
                $listEdit->list_desc = stripslashes($listEdit->list_desc);
                $listEdit->template = $listEdit->template;
                $listEdit->layout = stripslashes($listEdit->layout);
                $listEdit->subscribemessage = stripslashes($listEdit->subscribemessage);
                $listEdit->unsubscribemessage = stripslashes($listEdit->unsubscribemessage);
                $listEdit->notifyadminmsg = stripslashes($listEdit->notifyadminmsg);
                $listEdit->subnotifysend = stripslashes($listEdit->subnotifysend);
                $listEdit->subnotifymsg = stripslashes($listEdit->subnotifymsg);
                $listEdit->new_letter = 0;
                $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
                $show = jNews_ListType::showType($listEdit->list_type, 'editlist');
                backHTML::_header(_JNEWS_EDIT_A . @constant($GLOBALS[JNEWS . 'listname' . $listEdit->list_type]) . ' ' . _JNEWS_LIST, $img, $message, $task, $action);
                backHTML::formStart('listedit', $listEdit->html, '');
                jNews_ListsHTML::editList($listEdit, $forms, $show, $listType);
                $go[] = jnews::makeObj('act', $action);
                $go[] = jnews::makeObj('listid', $listEdit->id);
                backHTML::formEnd($go);
            }
            break;
        case 'update':
            JRequest::checkToken() or die('Invalid Token');
            $message = jnews::printYN(jNews_Lists::updateListFromEdit($listId, '', false, $listType), _JNEWS_LIST_UPDATED, _JNEWS_ERROR);
            break;
        case 'delete':
            JRequest::checkToken() or die('Invalid Token');
            $query = "SELECT list_name FROM #__jnews_lists WHERE id = {$listId}";
            $db->setQuery($query);
            $listName = $db->loadResult();
            $message = jnews::printYN(jNews_Lists::deleteList($listId), '"' . $listName . '"' . _JNEWS_LIST . _JNEWS_SUCCESS_DELETED, _JNEWS_ERROR);
            break;
        case 'copy':
            JRequest::checkToken() or die('Invalid Token');
            $message = jnews::printYN(jNews_Lists::copyList($listId), _JNEWS_LIST_COPY, _JNEWS_ERROR);
            break;
        case 'publish':
            if (!$checkToggle) {
                JRequest::checkToken() or die('Invalid Token');
            }
            $message = jnews::printYN(jNews_Lists::updateListFromList($listId, true, false), _JNEWS_PUBLISHED, _JNEWS_ERROR);
            if ($listType == 1) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $listType);
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=' . $listType);
            }
            break;
        case 'unpublish':
            if (!$checkToggle) {
                JRequest::checkToken() or die('Invalid Token');
            }
            $message = jnews::printYN(jNews_Lists::updateListFromList($listId, false, false), _JNEWS_UNPUBLISHED, _JNEWS_ERROR);
            if ($listType == 1) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $listType . '&listid=' . $listId);
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=' . $listType . '&listid=' . $listId);
            }
            break;
        case 'forms':
        case 'make':
            if (class_exists('jNews_CreateForm')) {
                jNews_CreateForm::taskOptions($task);
                $showLists = false;
            } else {
                $showLists = true;
            }
            break;
        case 'cpanel':
            backHTML::controlPanel();
            return true;
            break;
        case 'toggle':
            $listid = JRequest::getVar('listid');
            $column = JRequest::getVar('col');
            if (!empty($listid) && !empty($column)) {
                $passObj = new stdClass();
                $passObj->tableName = '#__jnews_lists';
                $passObj->columnName = $column;
                $passObj->whereColumn = 'id';
                $passObj->whereColumnValue = $listid;
                jnews::toggle($passObj);
            }
            if ($listType == 1) {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=1');
            } else {
                jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=2');
            }
            break;
    }
    if ($showLists) {
        $limit = -1;
        //Title header
        if ($listType == 1) {
            backHTML::_header(_JNEWS_MENU_LIST, $img, $message, $task, $action);
        } else {
            backHTML::_header(_JNEWS_ARLIST, $img, $message, $task, $action);
        }
        $show = jNews_ListType::showType(0, 'showListsBack');
        $forms['main'] = "<form action='index.php' method='post' name='adminForm' id=\"adminForm\">";
        backHTML::formStart('show_mailing', '', '');
        $paginationStart = JRequest::getVar('pg');
        $app = JFactory::getApplication();
        if (!empty($paginationStart)) {
            $limitstart = 0;
            $limitend = $paginationStart;
        } else {
            $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int');
            $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int');
        }
        $limittotal = jNews_Lists::getListCount($listType);
        $limittotal = $limittotal[0];
        $setLimit = new stdClass();
        $setLimit->total = !empty($limittotal) ? $limittotal : 0;
        $setLimit->start = !empty($limitstart) ? $limitstart : 0;
        $setLimit->end = !empty($limitend) ? $limitend : $limittotal;
        // recheck start
        if ($setLimit->total == $setLimit->end) {
            $setLimit->start = 0;
        }
        $setSort = new stdClass();
        if ($listType == '2') {
            //autoresponder
            $key = JNEWS_OPTION . '.arlist';
            $column = 'id';
            $direction = 'desc';
        } else {
            //newsletter
            $key = JNEWS_OPTION . '.list';
            $column = 'list_name';
            $direction = 'asc';
        }
        $setSort->orderValue = $app->getUserStateFromRequest($key . 'filter_order', 'filter_order', $column, 'cmd');
        $setSort->orderDir = $app->getUserStateFromRequest($key . 'filter_order_Dir', 'filter_order_Dir', $direction, 'word');
        if ($listType == 2) {
            ?>
<script language="javascript" type="text/javascript">
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'delete') {
			var $ok = confirm('Are you sure you want to delete?\r\nAll of the mailings attached in this auto-responder will be deleted as well.');
			if ( $ok == true ){
				form.action = 'index.php?option=<?php 
            echo JNEWS_OPTION;
            ?>
&act=arlist&task=delete';
			}else{
				return;
			}
		}
		submitform( pressbutton );
	}
</script>
<?php 
        }
        $listing = jNews_Lists::getLists(0, $listType, 1, '', false, false, false, false, false, $listsearch, $setLimit, $setSort);
        if (isset($setLimit->total) && !empty($listsearch)) {
            $lists = jNews_Lists::getLists(0, $listType, 1, '', false, false, false, false, false, $listsearch, $setSort);
            $setLimit->total = !empty($lists) ? count($lists) : $setLimit->total;
        }
        $totalSubs = array();
        $totalUnSubs = array();
        $db = JFactory::getDBO();
        if (!empty($listing)) {
            foreach ($listing as $list) {
                $totalSubs[] = jNews_Subscribers::getSubscribersCount($list->id, true);
                $totalUnSubs[] = jNews_Subscribers::getSubscribersCount($list->id, 2);
            }
        }
        jNews_ListsHTML::showListingLists($listing, $action, 'edit', $forms, $show, $listsearch, $setLimit->end, $setLimit, $totalSubs, $setSort, $totalUnSubs);
        $go[] = jnews::makeObj('act', $action);
        $go[] = jnews::makeObj('filter_order', $setSort->orderValue);
        $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir);
        backHTML::formEnd($go);
        return true;
    }
}
    function editMailing($mailingEdit, $new, $listId, $forms, $show)
    {
        global $my, $_VERSION;
        $lists = array();
        $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $mailingEdit->published);
        $lists['visible'] = mosHTML::yesnoRadioList('visible', 'class="inputbox"', $mailingEdit->visible);
        $images = $mailingEdit->images;
        if (!isset($mailingEdit->list_id)) {
            $mailingEdit->list_id = $listId;
        }
        $pathA = $GLOBALS['mosConfig_absolute_path'] . '/images/stories';
        $pathL = $GLOBALS['mosConfig_live_site'] . '/images/stories';
        $images = array();
        $folders = array();
        $folders[] = mosHTML::makeOption('/');
        mosAdminMenus::ReadImages($pathA, '/', $folders, $images);
        $joomAca15 = $_VERSION->RELEASE != '1.0' && class_exists('JFactory') ? true : false;
        if (!$joomAca15) {
            $lists['folders'] = mosAdminMenus::GetImageFolders($folders, $pathL);
            $lists['imagefiles'] = mosAdminMenus::GetImages($images, $pathL);
            $lists['imagelist'] = mosAdminMenus::GetSavedImages($mailingEdit, $pathL);
        }
        $lists['_align'] = mosAdminMenus::Positions('_align');
        $lists['_caption_align'] = mosAdminMenus::Positions('_caption_align');
        $pos[] = mosHTML::makeOption('bottom', _CMN_BOTTOM);
        $pos[] = mosHTML::makeOption('top', _CMN_TOP);
        $lists['_caption_position'] = mosHTML::selectList($pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
        backHTML::formStart('edit_mailing', $mailingEdit->html, $images);
        echo $forms['main'];
        if ($new and $mailingEdit->list_type == 7) {
            $mailingEdit->issue_nb = 0;
        }
        mailingsHTML::layout($mailingEdit, $lists, $show);
        ?>
		<input type="hidden" name="images" value="" />
		<input type="hidden" name="html" value="<?php 
        echo $mailingEdit->html;
        ?>
" />
		<input type="hidden" name="new_list" value="<?php 
        echo $new;
        ?>
" />
		<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
		<input type="hidden" name="listype" value="<?php 
        echo $mailingEdit->list_type;
        ?>
" />
		<input type="hidden" name="mailingid" value="<?php 
        echo $mailingEdit->id;
        ?>
" />
		<input type="hidden" name="issue_nb" value="<?php 
        echo $mailingEdit->issue_nb;
        ?>
" />
	    <input type="hidden" name="userid" value="<?php 
        echo $my->id;
        ?>
" />
		<?php 
    }
Esempio n. 15
0
    public static function showConfigEdit()
    {
        $mailOpt = array();
        $mailOpt[] = jnews::HTML_SelectOption('mail', 'PHP mail function');
        $mailOpt[] = jnews::HTML_SelectOption('sendmail', 'Sendmail');
        $mailOpt[] = jnews::HTML_SelectOption('smtp', 'SMTP Server');
        $logFormat = array();
        $logFormat[] = jnews::HTML_SelectOption('0', _JNEWS_DETAILED);
        $logFormat[] = jnews::HTML_SelectOption('1', _JNEWS_SIMPLE);
        $themeOption = array();
        $themeOption[] = jnews::HTML_SelectOption('joobilist', 'jNews Look');
        $themeOption[] = jnews::HTML_SelectOption('adminlist', 'Joomla look');
        $lists = array();
        $lists['component_theme'] = jnews::HTML_GenericList($themeOption, "config['component_theme']", 'class="inputbox" size="1"', 'value', 'text', jnews::myTheme());
        $lists['mailermethod'] = jnews::HTML_GenericList($mailOpt, "config['emailmethod']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'emailmethod']);
        $lists['send_log_simple'] = jnews::HTML_GenericList($logFormat, "config['send_log_simple']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'send_log_simple']);
        $lists['save_log_simple'] = jnews::HTML_GenericList($logFormat, "config['save_log_simple']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'save_log_simple']);
        $mailSecure[] = jnews::HTML_SelectOption('', '---');
        $mailSecure[] = jnews::HTML_SelectOption('ssl', 'SSL');
        $mailSecure[] = jnews::HTML_SelectOption('tls', 'TLS');
        $lists['smtp_secure'] = jnews::HTML_GenericList($mailSecure, "config['smtp_secure']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'smtp_secure']);
        $lists['auth_required'] = jnews::HTML_BooleanList("config['smtp_auth_required']", 'class="inputbox"', $GLOBALS[JNEWS . 'smtp_auth_required']);
        $lists['allow_unregistered'] = jnews::HTML_BooleanList("config['allow_unregistered']", 'class="inputbox"', $GLOBALS[JNEWS . 'allow_unregistered']);
        $lists['require_confirmation'] = jnews::HTML_BooleanList("config['require_confirmation']", 'class="inputbox"', $GLOBALS[JNEWS . 'require_confirmation']);
        // DKIM code addition by Amod begins
        $GLOBALS[JNEWS . 'dkim_activated'] = !empty($GLOBALS[JNEWS . 'dkim_activated']) ? $GLOBALS[JNEWS . 'dkim_activated'] : null;
        $lists['dkim_activated'] = jnews::HTML_BooleanList("config['dkim_activated']", 'class="inputbox"', $GLOBALS[JNEWS . 'dkim_activated']);
        // DKIM code addition by Amod ends
        //These options are transfered from lists to configuration
        $lists['show_unsubscribelink'] = jnews::HTML_BooleanList("config['show_unsubscribelink']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_unsubscribelink']);
        $lists['show_subscriptionlink'] = jnews::HTML_BooleanList("config['show_subscriptionlink']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_subscriptionlink']);
        //Queue Settings for queue status
        $queuestatus = array();
        $queuestatus[] = jnews::HTML_SelectOption('1', _JNEWS_QUEUESTATS_ON);
        $queuestatus[] = jnews::HTML_SelectOption('0', _JNEWS_QUEUESTATS_OF);
        $lists['queue_status'] = jnews::HTML_RadioList($queuestatus, "config['queue_status']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'queue_status']);
        $archiveLink = array();
        $archiveLink[] = jnews::HTML_SelectOption('standard', _JNEWS_ARCHIVELINK_STANDARD);
        $archiveLink[] = jnews::HTML_SelectOption('popup', _JNEWS_ARCHIVELINK_POPUP);
        $archiveLink[] = jnews::HTML_SelectOption('newpage', _JNEWS_ARCHIVELINK_PAGE);
        $lists['archive_link'] = jnews::HTML_RadioList($archiveLink, "config['archive_link']", 'class="inputbox" size="1"', 'value', 'text', @$GLOBALS[JNEWS . 'archive_link']);
        $joobicron = array();
        $joobicron[] = jnews::HTML_SelectOption('1', _JNEWS_JOOBICRON_NO);
        $joobicron[] = jnews::HTML_SelectOption('2', _JNEWS_JOOBICRON_YES);
        if ($GLOBALS[JNEWS . 'j_cron'] != 2) {
            $GLOBALS[JNEWS . 'j_cron'] = 1;
        }
        //set to no
        $lists['j_cron'] = jnews::HTML_RadioList($joobicron, "config['j_cron']", 'class="inputbox" size="1"', 'value', 'text', @$GLOBALS[JNEWS . 'j_cron']);
        //Queue Settings for Queue Process
        //$queueprocess=array();
        //$queueprocess[]=jnews::HTML_SelectOption('1', _JNEWS_QUEUESTATS_ON);
        //$queueprocess[]=jnews::HTML_SelectOption('0', _JNEWS_QUEUESTATS_OF);
        //$lists['queue_process'] = jnews::HTML_RadioList( $queueprocess, "config['queue_process']" , 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS.'queue_process'] );
        //Queue Settings for Smart Queue
        $smartqueue = array();
        $smartqueue[] = jnews::HTML_SelectOption('1', _JNEWS_SMARTQ_ON);
        $smartqueue[] = jnews::HTML_SelectOption('0', _JNEWS_SMARTQ_OF);
        $lists['smart_queue'] = jnews::HTML_RadioList($smartqueue, "config['smart_queue']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'smart_queue']);
        $lists['show_login'] = jnews::HTML_BooleanList("config['show_login']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_login']);
        $lists['show_logout'] = jnews::HTML_BooleanList("config['show_logout']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_logout']);
        $lists['confirm_html'] = jnews::HTML_BooleanList("config['confirm_html']", 'class="inputbox"', $GLOBALS[JNEWS . 'confirm_html']);
        $lists['time_zone'] = jnews::HTML_BooleanList("config['time_zone']", 'class="inputbox"', $GLOBALS[JNEWS . 'time_zone']);
        $lists['sub_info_fields'] = jnews::HTML_BooleanList("config['sub_info_fields']", 'class="inputbox"', $GLOBALS[JNEWS . 'sub_info_fields']);
        $lists['show_archive'] = jnews::HTML_BooleanList("config['show_archive']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_archive']);
        $lists['enable_statistics'] = jnews::HTML_BooleanList("config['enable_statistics']", 'class="inputbox"', $GLOBALS[JNEWS . 'enable_statistics']);
        $lists['statistics_per_subscriber'] = jnews::HTML_BooleanList("config['statistics_per_subscriber']", 'class="inputbox"', $GLOBALS[JNEWS . 'statistics_per_subscriber']);
        //Send only HTML Mailin
        $lists['forced_html'] = jnews::HTML_BooleanList("config['forced_html']", 'class="inputbox"', $GLOBALS[JNEWS . 'forced_html']);
        $lists['wait_for_user'] = jnews::HTML_BooleanList("config['wait_for_user']", 'class="inputbox"', $GLOBALS[JNEWS . 'wait_for_user']);
        $lists['display_trace'] = jnews::HTML_BooleanList("config['display_trace']", 'class="inputbox"', $GLOBALS[JNEWS . 'display_trace']);
        $lists['send_data'] = jnews::HTML_BooleanList("config['send_data']", 'class="inputbox"', $GLOBALS[JNEWS . 'send_data']);
        $lists['send_auto_log'] = jnews::HTML_BooleanList("config['send_auto_log']", 'class="inputbox"', $GLOBALS[JNEWS . 'send_auto_log']);
        $lists['send_log'] = jnews::HTML_BooleanList("config['send_log']", 'class="inputbox"', $GLOBALS[JNEWS . 'send_log']);
        $lists['save_log'] = jnews::HTML_BooleanList("config['save_log']", 'class="inputbox"', $GLOBALS[JNEWS . 'save_log']);
        $lists['send_log_closed'] = jnews::HTML_BooleanList("config['send_log_closed']", 'class="inputbox"', $GLOBALS[JNEWS . 'send_log_closed']);
        $lists['clear_log'] = jnews::HTML_BooleanList("clear_log", 'class="inputbox"', 0);
        $lists['show_footer'] = jnews::HTML_BooleanList("config['show_footer']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_footer']);
        $lists['show_jcalpro'] = jnews::HTML_BooleanList("config['show_jcalpro']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_jcalpro']);
        $lists['show_jlinks'] = jnews::HTML_BooleanList("config['show_jlinks']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_jlinks']);
        // $lists['enable_jsub'] = jnews::HTML_BooleanList( "config['enable_jsub']" , 'class="inputbox"', $GLOBALS[JNEWS.'enable_jsub'] );
        $lists['allow_sn'] = jnews::HTML_BooleanList("config['allow_sn']", 'class="inputbox"', $GLOBALS[JNEWS . 'allow_sn']);
        $lists['sntag_norequired'] = jnews::HTML_BooleanList("config['sntag_norequired']", 'class="inputbox"', $GLOBALS[JNEWS . 'sntag_norequired']);
        $lists['show_unsubscribe_all'] = jnews::HTML_BooleanList("config['show_unsubscribe_all']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_unsubscribe_all']);
        $lists['show_terms'] = jnews::HTML_BooleanList("config['show_terms']", 'class="inputbox"', @$GLOBALS[JNEWS . 'show_terms']);
        $lists['check_terms'] = jnews::HTML_BooleanList("config['check_terms']", 'class="inputbox"', @$GLOBALS[JNEWS . 'check_terms']);
        //column1
        $lists['show_column1'] = jnews::HTML_BooleanList("config['show_column1']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_column1']);
        $lists['show_column2'] = jnews::HTML_BooleanList("config['show_column2']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_column2']);
        $lists['show_column3'] = jnews::HTML_BooleanList("config['show_column3']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_column3']);
        $lists['show_column4'] = jnews::HTML_BooleanList("config['show_column4']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_column4']);
        $lists['show_column5'] = jnews::HTML_BooleanList("config['show_column5']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_column5']);
        //end of columns
        //captcha
        //			 $lists['enable_captcha'] = jnews::HTML_BooleanList( "config['enable_captcha']" , 'class="inputbox"', $GLOBALS[JNEWS.'enable_captcha'] );
        //$lists['use_cron_pass'] = jnews::HTML_BooleanList( "config['use_cron_pass']" , 'class="inputbox"', $GLOBALS[JNEWS.'use_cron_pass'] );
        $lists['show_signature'] = jnews::HTML_BooleanList("config['show_signature']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_signature']);
        $lists['show_lists'] = jnews::HTML_BooleanList("config['show_lists']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_lists']);
        $lists['embed_images'] = jnews::HTML_BooleanList("config['embed_images']", 'class="inputbox"', $GLOBALS[JNEWS . 'embed_images']);
        $lists['use_tags'] = jnews::HTML_BooleanList("config['use_tags']", 'class="inputbox"', $GLOBALS[JNEWS . 'use_tags']);
        $lists['show_guide'] = jnews::HTML_BooleanList("config['show_guide']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_guide']);
        $lists['show_author'] = jnews::HTML_BooleanList("config['show_author']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_author']);
        $lists['show_tips'] = jnews::HTML_BooleanList("config['show_tips']", 'class="inputbox"', $GLOBALS[JNEWS . 'show_tips']);
        //$lists['update_notification'] = jnews::HTML_BooleanList( "config['update_notification']" , 'class="inputbox"', $GLOBALS[JNEWS.'update_notification'] );
        $lists['use_sef'] = jnews::HTML_BooleanList("config['use_sef']", 'class="inputbox"', $GLOBALS[JNEWS . 'use_sef']);
        $lists['listype1'] = jnews::HTML_BooleanList("config['listype1']", 'class="inputbox"', $GLOBALS[JNEWS . 'listype1']);
        $lists['listype2'] = jnews::HTML_BooleanList("config['listype2']", 'class="inputbox"', $GLOBALS[JNEWS . 'listype2']);
        $lists['listHTMLeditor'] = jnews::HTML_BooleanList("config['listHTMLeditor']", 'class="inputbox"', $GLOBALS[JNEWS . 'listHTMLeditor']);
        //for social version
        if ($GLOBALS[JNEWS . 'level'] > 2) {
            if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) {
                if (class_exists('jNews_Social')) {
                    $lists['use_masterlists'] = jnews::HTML_BooleanList("config['use_masterlists']", 'class="inputbox"', $GLOBALS[JNEWS . 'use_masterlists']);
                    $lists['allow_fe_autoresponder'] = jnews::HTML_BooleanList("config['allow_fe_autoresponder']", 'class="inputbox"', $GLOBALS[JNEWS . 'allow_fe_autoresponder']);
                }
            }
        }
        if (empty($lists['allow_fe_autoresponder'])) {
            $lists['allow_fe_autoresponder'] = 'jNews Social Only';
        }
        $lists['send_error'] = jnews::HTML_BooleanList("config['send_error']", 'class="inputbox"', $GLOBALS[JNEWS . 'send_error']);
        $lists['report_error'] = jnews::HTML_BooleanList("config['report_error']", 'class="inputbox"', $GLOBALS[JNEWS . 'report_error']);
        $lists['fullcheck'] = jnews::HTML_BooleanList("config['fullcheck']", 'class="inputbox"', $GLOBALS[JNEWS . 'fullcheck']);
        $lists['addEmailRedLink'] = jnews::HTML_BooleanList("config['addEmailRedLink']", 'class="inputbox"', $GLOBALS[JNEWS . 'addEmailRedLink']);
        $lists['disabletooltip'] = jnews::HTML_BooleanList("config['disabletooltip']", 'class="inputbox"', $GLOBALS[JNEWS . 'disabletooltip']);
        $lists['minisendmail'] = jnews::HTML_BooleanList("config['minisendmail']", 'class="inputbox"', $GLOBALS[JNEWS . 'minisendmail']);
        //<!-- content ordering -->
        $sortContent[] = jnews::HTML_SelectOption('0', _JNEWS_SORT_DATE);
        $sortContent[] = jnews::HTML_SelectOption('1', _JNEWS_SORT_SECTION);
        $sortContent[] = jnews::HTML_SelectOption('2', _JNEWS_SORT_CATEGORY);
        //$lists['content_order'] = jnews::HTML_GenericList( $sortContent, "config['content_order']" , 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS.'content_order'] );
        $schedPrior = array();
        $schedPrior[] = jnews::HTML_SelectOption('1', '1');
        $schedPrior[] = jnews::HTML_SelectOption('2', '2');
        $schedPrior[] = jnews::HTML_SelectOption('3', '3');
        $enable_jsub = array();
        $enable_jsub[] = jnews::HTML_SelectOption('0', _JNEWS_LIST_ACESS);
        $enable_jsub[] = jnews::HTML_SelectOption('1', _JNEWS_BYOWNER);
        $lists['enable_jsub'] = jnews::HTML_RadioList($enable_jsub, "config['enable_jsub']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'enable_jsub']);
        $GLOBALS[JNEWS . 'sched_prior'] = isset($GLOBALS[JNEWS . 'sched_prior']) ? $GLOBALS[JNEWS . 'sched_prior'] : 3;
        $lists['sched_prior'] = jnews::HTML_RadioList($schedPrior, "config['sched_prior']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'sched_prior']);
        $arPrior = array();
        $arPrior[] = jnews::HTML_SelectOption('1', '1');
        $arPrior[] = jnews::HTML_SelectOption('2', '2');
        $arPrior[] = jnews::HTML_SelectOption('3', '3');
        $GLOBALS[JNEWS . 'ar_prior'] = isset($GLOBALS[JNEWS . 'ar_prior']) ? $GLOBALS[JNEWS . 'ar_prior'] : '';
        $lists['ar_prior'] = jnews::HTML_RadioList($arPrior, "config['ar_prior']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'ar_prior']);
        $smPrior = array();
        $smPrior[] = jnews::HTML_SelectOption('1', '1');
        $smPrior[] = jnews::HTML_SelectOption('2', '2');
        $smPrior[] = jnews::HTML_SelectOption('3', '3');
        $GLOBALS[JNEWS . 'sm_prior'] = isset($GLOBALS[JNEWS . 'sm_prior']) ? $GLOBALS[JNEWS . 'sm_prior'] : '';
        $lists['sm_prior'] = jnews::HTML_RadioList($arPrior, "config['sm_prior']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'sm_prior']);
        $priord_list = array();
        $priord_list[] = jnews::HTML_SelectOption('0', _JNEWS_AUTORESP);
        $priord_list[] = jnews::HTML_SelectOption('1', _JNEWS_LIST);
        $GLOBALS[JNEWS . 'priord_list'] = isset($GLOBALS[JNEWS . 'priord_list']) ? $GLOBALS[JNEWS . 'priord_list'] : '';
        $lists['priord_list'] = jnews::HTML_RadioList($priord_list, "config['priord_list']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'priord_list']);
        $priord_subs = array();
        $priord_subs[] = jnews::HTML_SelectOption('0', _JNEWS_REMAIN_SUBS);
        $priord_subs[] = jnews::HTML_SelectOption('1', _JNEWS_LIST_T_SUBSCRIPTION);
        $priord_subs[] = jnews::HTML_SelectOption('2', _JNEWS_UNSUBS);
        $GLOBALS[JNEWS . 'priord_subs'] = isset($GLOBALS[JNEWS . 'priord_subs']) ? $GLOBALS[JNEWS . 'priord_subs'] : '';
        $lists['priord_subs'] = jnews::HTML_RadioList($priord_subs, "config['priord_subs']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'priord_subs']);
        if (class_exists('jNews_Social')) {
            $lists['list_creatorfe'] = jnews::displayAccessRoles('list_creatorfe', $GLOBALS[JNEWS . 'list_creatorfe']);
            //since 6.1.0
            $lists['use_backendview'] = jnews::HTML_BooleanList("config['use_backendview']", 'class="inputbox"', $GLOBALS[JNEWS . 'use_backendview']);
        }
        if (class_exists('aca_archive')) {
            $jour = array();
            $jour[] = jnews::HTML_SelectOption('0', _JNEWS_FREQ_OPT_0);
            $jour[] = jnews::HTML_SelectOption('1', _JNEWS_FREQ_OPT_1);
            $jour[] = jnews::HTML_SelectOption('2', _JNEWS_FREQ_OPT_2);
            $jour[] = jnews::HTML_SelectOption('3', _JNEWS_FREQ_OPT_3);
            $jour[] = jnews::HTML_SelectOption('4', _JNEWS_FREQ_OPT_4);
            $jour[] = jnews::HTML_SelectOption('5', _JNEWS_FREQ_OPT_5);
            $jour[] = jnews::HTML_SelectOption('6', _JNEWS_FREQ_OPT_6);
            $dateType = array();
            $dateType[] = jnews::HTML_SelectOption('1', _JNEWS_DATE_OPT_1);
            $dateType[] = jnews::HTML_SelectOption('2', _JNEWS_DATE_OPT_2);
            $lists['frequency'] = jnews::HTML_GenericList($jour, "config['frequency']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'frequency']);
            $lists['date_type'] = jnews::HTML_GenericList($dateType, "config['date_type']", 'class="inputbox" size="1"', 'value', 'text', $GLOBALS[JNEWS . 'date_type']);
        }
        //encoding format
        $mail_format[] = jnews::HTML_SelectOption('0', 'Text (8bit)');
        $mail_format[] = jnews::HTML_SelectOption('1', 'MIME (base64)');
        $lists['mail_format'] = jnews::HTML_RadioList($mail_format, "config['mail_format']", 'class="inputbox"', 'value', 'text', $GLOBALS[JNEWS . 'mail_format']);
        //encoding formart
        $mail_encoding[] = jnews::HTML_SelectOption('0', 'UTF-8');
        $mail_encoding[] = jnews::HTML_SelectOption('1', 'ISO-8859-2');
        $lists['mail_encoding'] = jnews::HTML_RadioList($mail_encoding, "config['mail_encoding']", 'class="inputbox"', 'value', 'text', $GLOBALS[JNEWS . 'mail_encoding']);
        backHTML::formStart('configpanel', 0, '');
        ?>
	<table style="width: 100%;" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td>
	<form action="index.php" method="post" name="adminForm" id="adminForm">
	<?php 
        $config_tabs = new MosTabsjNews(1);
        $config_tabs->startPane('acaConfig');
        $config_tabs->startTab(_JNEWS_MAIL_CONFIG, 'mail');
        jNews_ConfigHTML::mailSettings($lists);
        $config_tabs->endTab();
        $config_tabs->startTab(_JNEWS_SUBSCRIBER_CONFIG, 'subscribers');
        jNews_ConfigHTML::subcriberSettings($lists);
        $config_tabs->endTab();
        if (class_exists('jNews_Auto')) {
            $config_tabs->startTab(_JNEWS_SCHEDULER, 'scheduler');
            jNews_ConfigHTML::cronSettings($lists);
            $config_tabs->endTab();
        }
        $config_tabs->startTab(_JNEWS_LOGGING_CONFIG, 'logging');
        jNews_ConfigHTML::logsSettings($lists);
        $config_tabs->endTab();
        if ($GLOBALS[JNEWS . 'integration'] and ($GLOBALS[JNEWS . 'cb_integration'] or class_exists('aca_virtuemart') && $GLOBALS[JNEWS . 'virtuemart'])) {
            $config_tabs->startTab(_JNEWS_CONFIG_INTEGRATION, 'integration');
            if ($GLOBALS[JNEWS . 'cb_integration']) {
                jNews_ConfigHTML::cbSettings();
            }
            if (class_exists('aca_virtuemart') && isset($GLOBALS[JNEWS . 'virtuemart']) && $GLOBALS[JNEWS . 'virtuemart']) {
                aca_virtuemart::tab();
            }
            $config_tabs->endTab();
        }
        $config_tabs->startTab(_JNEWS_MISC_CONFIG, 'misc');
        jNews_ConfigHTML::miscSettings($lists);
        $config_tabs->endTab();
        if (class_exists('jNews_Auto')) {
            $config_tabs->startTab(_JNEWS_LICENSE_CONFIG, 'licence');
            jNews_Auto::licenseSettings($lists);
            $config_tabs->endTab();
        }
        $config_tabs->endPane();
        if (version_compare(JVERSION, '3.0.0', '<')) {
            echo JHTML::_('form.token');
        } else {
            echo JHtml::_('form.token');
        }
        ?>
		<input type="hidden" name="option" value="<?php 
        echo JNEWS_OPTION;
        ?>
" />
		<input type="hidden" name="act" value="configuration" />
    	<input type="hidden" name="boxchecked" value="0" />
    	<input type="hidden" name="task" value="" />
	</form>
	</td></tr></tbody></table>
	<?php 
    }
Esempio n. 16
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);
    }
}
Esempio n. 17
0
/**
* @copyright Copyright (C) 2009 Joobi Limited All rights reserved.
* @license This file is released under the GPL license (http://www.gnu.org/licenses )
* @link http://www.ijoobi.com
*/
function mailing($action, $task, $listId, $listType, $mailingId, $message)
{
    $showMailings = false;
    switch ($task) {
        case 'edit':
            if (ACA_CMSTYPE) {
                // joomla 15
                $issue_nb = intval(JRequest::getVar('issue_nb', 1));
            } else {
                //joomla 1x
                $issue_nb = intval(mosGetParam($_REQUEST, 'issue_nb', 1));
            }
            //endif
            $list = lists::getOneList($listId);
            $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new);
            $show = lisType::showType($mailing->list_type, 'editmailing');
            if ($mailing->published != 1 or $mailing->list_type != 1 or isset($show['admin']) and $show['admin']) {
                $forms['main'] = " <form action='index2.php' method='post' enctype='multipart/form-data' name='adminForm'> \n ";
                xmailing::_header($task, $action, $mailing->list_type, $message, 'edit');
                mailingsHTML::editMailing($mailing, $new, $listId, $forms, $show);
                $go[] = acajoom::makeObj('act', $action);
                backHTML::formEnd($go);
            } else {
                $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
                xmailing::_header($task, $action, $mailing->list_type, $message);
                //backHTML::formStart();
                mailingsHTML::viewMailing($mailing, $forms);
                $go[] = acajoom::makeObj('act', 'mailing');
                $go[] = acajoom::makeObj('task', 'viewmailing');
                $go[] = acajoom::makeObj('listid', $mailing->list_id);
                backHTML::formEnd($go);
            }
            break;
        case 'new':
        case 'add':
            if ($listId == 0) {
                echo "<script> alert('" . addslashes(_ACA_SELCT_MAILING) . "'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $total = xmailing::countMailings($listId, '');
                $total++;
                compa::redirect('index2.php?option=com_acajoom&act=mailing&task=edit&mailingid=0&issue_nb=' . $total . '&listid=' . $listId);
            }
            break;
        case 'saveSend':
            xmailing::saveMailing($mailingId, $listId);
        case 'sendNewsletter':
            if ($listId < 1 or $listType < 0) {
                $mailing = xmailing::getOneMailing('', $mailingId, '', $new, true);
                $listId = $mailing->list_id;
                $listType = $mailing->list_type;
            }
            if (lisType::sendType($listType)) {
                $checkStatus = lists::checkStatus($listId);
                if ($checkStatus == false) {
                    $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NOT_PUBLISHED);
                    $showMailings = true;
                } else {
                    $receivers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, 'sub_emailA');
                    if (empty($receivers)) {
                        $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NO_SUSCRIBERS);
                        $showMailings = true;
                    } else {
                        $status = queue::sendNewsletter(true, $mailingId, $listId, $receivers, $message);
                        $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message);
                        $showMailings = true;
                        flush();
                        sleep(5);
                        compa::redirect('index2.php?option=com_acajoom&act=mailing&listype=' . $listType, $message);
                    }
                }
            } else {
                if (class_exists('auto')) {
                    $message = acajoom::printYN(auto::processQueue(true), _ACA_QUEUE_SENT_SUCCESS, _ACA_ERROR);
                }
                $showMailings = true;
            }
            break;
        case 'savePreview':
            xmailing::saveMailing($mailingId, $listId);
        case 'preview':
            if (ACA_CMSTYPE) {
                // joomla 15
                $emailaddress = JRequest::getVar('emailaddress', '');
            } else {
                //joomla 1x
                $emailaddress = mosGetParam($_REQUEST, 'emailaddress', '');
            }
            //endif
            if (!empty($emailaddress)) {
                $status = xmailing::preview($mailingId, $listId, $message);
                $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message);
            }
            backHTML::_header(_ACA_PREVIEW_TITLE, 'preview_f2.png', $message, $task, $action);
            mailingsHTML::previewMailingHTML($mailingId, $listId, $listType);
            if ($listId > 0) {
                $archivemailing = xmailing::getMailingView($mailingId, $listId);
            } else {
                $archivemailing = xmailing::getMailingView($mailingId);
            }
            $forms['main'] = '';
            $list = lists::getOneList($archivemailing->list_id);
            $textonly = '';
            acajoom_mail::getContent($archivemailing->images, $list->layout, $archivemailing->htmlcontent, $textonly);
            acajoom_mail::replaceClass($archivemailing->htmlcontent, $textonly);
            mailingsHTML::viewMailing($archivemailing, $forms);
            break;
        case 'view':
            if ($mailingId != 0) {
                if ($listId > 0) {
                    $archivemailing = xmailing::getMailingView($mailingId, $listId);
                } else {
                    $archivemailing = xmailing::getMailingView($mailingId);
                }
                $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
                xmailing::_header($task, $action, $listType, $message);
                backHTML::formStart('', 0, '');
                mailingsHTML::viewMailing($archivemailing, $forms);
                $go[] = acajoom::makeObj('act', 'mailing');
                $go[] = acajoom::makeObj('task', 'viewmailing');
                $go[] = acajoom::makeObj('listid', $archivemailing->list_id);
                backHTML::formEnd($go);
            }
            break;
        case 'deleteMailing':
            $d['mailing'] = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::delete($d), @constant($GLOBALS[ACA . 'listname' . $d['mailing']->list_type]) . _ACA_SUCCESS_DELETED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cancel':
            compa::redirect('index2.php?option=com_acajoom');
            break;
        case 'copy':
            $message = acajoom::printYN(xmailing::copyMailing($mailingId), _ACA_MAILING_COPY, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cancelMailing':
            $showMailings = true;
            break;
        case 'publishMailing':
            $mailing = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::publishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_PUBLISHED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'unpublishMailing':
            $mailing = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::unpublishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_UNPUBLISHED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cpanel':
            backHTML::controlPanel();
            break;
        case 'save':
            $message = acajoom::printYN(xmailing::saveMailing($mailingId, $listId), _ACA_MAILING_SAVED, _ACA_ERROR);
            $showMailings = true;
            unset($GLOBALS["task"]);
            unset($_REQUEST["task"]);
            break;
        case 'show':
        default:
            $showMailings = true;
            break;
    }
    if ($showMailings) {
        xmailing::showMailings($task, $action, $listId, $listType, $message, true, _ACA_MENU_MAILING);
    }
    return true;
}
Esempio n. 18
0
function com_install()
{
    if (defined('JPATH_ROOT') and class_exists('JFactory')) {
        define('JNEWS_JPATH_ROOT', JPATH_ROOT);
    }
    if (!defined('DS')) {
        define('DS', DIRECTORY_SEPARATOR);
    }
    if (is_dir(JNEWS_JPATH_ROOT . DS . "administrator" . DS . "components" . DS . "com_jnews" . DS)) {
        $filename_for_del = JNEWS_JPATH_ROOT . DS . "administrator" . DS . "components" . DS . "com_jnews" . DS . "admin.jnews.php";
        if (file_exists($filename_for_del)) {
            if (is_writable($filename_for_del)) {
                unlink($filename_for_del);
            }
        }
    }
    if (!defined('DS')) {
        define('DS', DIRECTORY_SEPARATOR);
    }
    require_once JNEWS_JPATH_ROOT . DS . 'components' . DS . 'com_jnews' . DS . 'defines.php';
    require_once JNEWSPATH_ADMIN . 'classes' . DS . 'config.php';
    require_once JNEWSPATH_ADMIN . 'admin.jnews.html.php';
    require_once JNEWSPATH_CLASS . DS . 'class.jnews.php';
    @ini_set('max_execution_time', 0);
    //If memory_limit less than 128M
    $limit = jnews::convertToBytes(@ini_get('memory_limit'));
    if ($limit < jnews::convertToBytes('128M')) {
        @ini_set('memory_limit', '128M');
    }
    $xf = new jNews_Config();
    $return = '';
    //we install the jNews Menus
    installMenu();
    $database = JFactory::getDBO();
    $q = " SELECT `text` FROM `#__jnews_xonfig` WHERE `akey` = 'version' ";
    $database->setQuery($q);
    $vers = $database->loadResult();
    $err = $database->getErrorMsg();
    $version = jnews::getVersion();
    //we check if availability column exists in jnews_templates
    $q = "SHOW FIELDS FROM `#__jnews_templates`";
    $database->setQuery($q);
    $templateFields = $database->loadObjectList('Field');
    if (!empty($version) and $version < '7.3.0') {
        $query[] = "ALTER TABLE `#__jnews_listssubscribers` ADD `params` TEXT NOT NULL";
        $query[] = "ALTER TABLE `#__jnews_queue` ADD `params` TEXT NOT NULL";
    }
    if (!empty($version) and $version < '7.2.0') {
        $query[] = "UPDATE `#__jnews_xonfig` SET `text`='jNews_Newsletter' WHERE `text`='newsletter' AND `akey`='classes1' ";
        $query[] = "UPDATE `#__jnews_xonfig` SET `text`='jNews_Autoresponder' WHERE `text`='autoresponder' AND `akey`='classes2' ";
        $query[] = "UPDATE `#__jnews_xonfig` SET `text`='jNews_Autonews' WHERE `text`='autonews' AND `akey`='classes7' ";
    }
    if (!empty($version) && $version < '7.1.0') {
        $query[] = "ALTER TABLE `#__jnews_lists` ADD `subnotifysend` TINYINT(1) NOT NULL DEFAULT '1', ADD `subnotifymsg` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL";
        $query[] = "ALTER TABLE `#__jnews_templates` ADD `csstyle` TEXT NOT NULL";
        $query[] = "UPDATE `#__jnews_templates` SET `body` = REPLACE(`body`,'components/com_jnews/templates/','media/com_jnews/templates/')";
    }
    if (!empty($version) && $version < '7.0.2') {
        $xf->insert('cron_pass', 'ibHrqqFb');
        $xf->insert('nextdate', '0');
        $xf->insert('lastdate', '0');
    }
    if (!empty($version) && $version < '6.1.2') {
        $xf->insert('url_pass', 'xfr1tyh6', 0);
        $xf->insert('create_newsubsrows', '5', 0);
        $xf->insert('use_backendview', '0', 0);
        $xf->insert('terms_condition', '0', 0);
        $xf->insert('show_terms', '0', 0);
        $xf->insert('check_terms', '0', 0);
    }
    if (empty($err) and !empty($version) and $version < '6.0.2') {
        if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) {
            if (class_exists('jNews_Social')) {
                $query[] = "ALTER TABLE `#__jnews_lists` ADD `siteend` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0'";
            }
        }
        $query[] = "ALTER TABLE `#__jnews_lists` CHANGE `acc_id` `acc_id` VARCHAR( 200 ) NOT NULL DEFAULT 'all'";
        $query[] = "ALTER TABLE `#__jnews_lists` CHANGE `acc_level` `acc_level` VARCHAR( 200 ) NOT NULL DEFAULT '24,25,7,8'";
        $query[] = "UPDATE `#__jnews_lists` SET `acc_id`= 'all' WHERE `acc_id`= 29";
        $query[] = "UPDATE `#__jnews_lists` SET `acc_level`='24,25,7,8' WHERE `acc_level`=25";
        $xf->insert('use_tags', '1', 0);
        $xf->insert('allow_sn', '0', 0);
        $xf->insert('show_sub_email', '0', 0);
        $xf->insert('red_subscription', '0', 0);
        $xf->insert('module_message', '0', 0);
        $xf->update('upload_url', '/components/com_jnews/upload');
    }
    if (empty($err) && !empty($version) && $version <= '4.2.2') {
        //alter the table template with the column availabiltity
        if (is_array($templateFields) && array_key_exists('availability', $templateFields) == false) {
            $query[] = "ALTER TABLE `#__jnews_templates` ADD `availability` TINYINT( 1 ) NOT NULL DEFAULT '1' ";
        }
        $xf->insert('captcha_width', '80', 0);
        $xf->insert('captcha_height', '25', 0);
    }
    if (empty($err) and !empty($version) and $version < '5.1.0') {
        //alter the table queue, we also add the type in the unique key
        $query[] = 'ALTER TABLE `#__jnews_queue` DROP INDEX `sub_mail` ,
					ADD UNIQUE `sub_mail` ( `subscriber_id` , `mailing_id` , `type` )';
        $xf->insert('forced_html', '1', 0);
    }
    if (empty($err) and !empty($version) and $version >= '1.2.0' and $version < '2.2.2') {
        $query[] = 'ALTER TABLE `#__jnews_lists` ADD `notifyadminmsg` text NOT NULL';
        $xf->insert('j_cron', '1', 0);
    }
    if (empty($err) and !empty($version) and $version < '4.0.2') {
        //delete the params column
        $q = "SHOW FIELDS FROM `#__jnews_queue`";
        $database->setQuery($q);
        $queueFields = $database->loadObjectList('Field');
        $q = "SHOW FIELDS FROM `#__jnews_lists`";
        $database->setQuery($q);
        $listFields = $database->loadObjectList('Field');
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //j15
            //for the update in the jos_components table for the menu auto-responder
            $query[] = 'UPDATE `#__components`' . ' SET admin_menu_link = \'option=' . JNEWS_OPTION . '&act=arlist&listype=2\'' . ' WHERE `option`=\'com_jnews\'' . ' AND `name`=\'Auto-responders\'';
            //delete the name import in the _components table
            $query[] = 'DELETE FROM `#__components` WHERE `name`=\'Import\' AND `option`=\'com_jnews\'';
        }
        //update max_attempts to 5
        $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 5 WHERE `akey`=\'max_attempts\'';
        //update sched_prior to 5
        $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 5 WHERE `akey`=\'sched_prior\'';
        //update ar_prior
        $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 1 WHERE `akey`=\'ar_prior\'';
        //update sm_prior
        $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 5 WHERE `akey`=\'sm_prior\'';
        $xf->insert('priord_list', '0', 0);
        $xf->insert('priord_subs', '0', 0);
        $xf->insert('show_unsubscribe', '0', 0);
        $xf->insert('show_unsubscribelink', '1', 0);
        $xf->insert('show_subscriptionlink', '1', 0);
        $xf->insert('queue_status', '1', 0);
    }
    if (empty($err) and !empty($version) and $version <= '4.1.2') {
        $xf->insert('smtp_port', '25', 0);
        $xf->insert('smart_queue', '0', 0);
        $xf->insert('sub_info_fields', '0', 0);
        $xf->insert('enable_jsub', '0', 0);
    }
    if (!empty($version) && $version <= '7.2.2') {
        //add params column if not exists
        $q = "SHOW FIELDS FROM `#__jnews_mailings`";
        $database->setQuery($q);
        $queueFields = $database->loadObjectList('Field');
        //we drop the column params in the table jnews_queue
        if (!array_key_exists('params', $queueFields)) {
            $query[] = 'ALTER TABLE `#__jnews_mailings` ADD `params` TEXT NOT NULL';
        }
        $q = "SHOW FIELDS FROM `#__jnews_lists`";
        $database->setQuery($q);
        $queueFields = $database->loadObjectList('Field');
        //we drop the column params in the table jnews_queue
        if (!array_key_exists('params', $queueFields)) {
            $query[] = 'ALTER TABLE `#__jnews_lists` ADD `params` TEXT NOT NULL';
        }
        $xf->insert('smtp_secure', '', 0);
    }
    if (!empty($version) && $version <= '7.3.9') {
        $xf->insert('lasttime_cron_triggerred', '0', 0);
        $xf->insert('show_unsubscribe_all', '1', 0);
        $xf->insert('send_log_email', '0', 0);
        $query[] = 'ALTER TABLE `#__jnews_queue` ADD `block` TINYINT NOT NULL DEFAULT 0';
        //add block column in the queue table
        //we get the values of red_subscription, module_message, enable_captcha, captcha_width, captcha_height, show_terms, check_terms, terms_condition from config table to be able to insert it the module params
        $red_subscription = $xf->getKeyValues("red_subscripition");
        $module_message = $xf->getKeyValues("module_message");
        $enable_captcha = $xf->getKeyValues("enable_captcha");
        $captcha_width = $xf->getKeyValues("captcha_width");
        $captcha_height = $xf->getKeyValues("captcha_height");
        $show_terms = $xf->getKeyValues("show_terms");
        $check_terms = $xf->getKeyValues("check_terms");
        $terms_condition = $xf->getKeyValues("terms_condition");
        $additionalParams = '';
        $additionalParams .= "use_new=0" . "\n";
        $additionalParams .= "red_subscripition=" . $red_subscription . "\n";
        $additionalParams .= "module_message=" . $module_message . "\n";
        $additionalParams .= "enable_captcha=" . $enable_captcha . "\n";
        $additionalParams .= "captcha_width=" . $captcha_width . "\n";
        $additionalParams .= "captcha_height=" . $captcha_height . "\n";
        $additionalParams .= "show_terms=" . $show_terms . "\n";
        $additionalParams .= "check_terms=" . $check_terms . "\n";
        $additionalParams .= "terms_condition=" . $terms_condition . "\n";
        //we get the module params from the modules table and append with the values we get from above
        $db = JFactory::getDBO();
        $queryParam = "SELECT `id`,`params` FROM `#__modules` WHERE `module`='mod_jnews'";
        $db->setQuery($queryParam);
        $db->query();
        $jnewsModuleParamsO = $db->loadObjectList('id');
        if (!empty($jnewsModuleParamsO)) {
            foreach ($jnewsModuleParamsO as $key => $value) {
                $params = '';
                $params .= $value->params;
                $params .= $additionalParams;
                //we update the params of the module
                $queryUpdateParam = "UPDATE `#__modules` SET `params`='" . $params . "' WHERE `id`=" . $key;
                $db->setQuery($queryUpdateParam);
                $db->query();
            }
        }
        //we insert here the simplicity template
        $templatessql = 'simplicitytemplate.sql';
        //to be changed if we packaged the superpack
        $buffer = file_get_contents(JNEWSPATH_ADMIN . DS . $templatessql);
        // Graceful exit and rollback if read not successful
        if ($buffer) {
            // Create an array of queries from the sql file
            jimport('joomla.installer.helper');
            $queries = JInstallerHelper::splitSql($buffer);
            // No queries to process
            if (count($queries) != 0) {
                // Process each query in the $queries array (split out of sql file).
                foreach ($queries as $simplicityquery) {
                    $simplicityquery = trim($simplicityquery);
                    if ($simplicityquery != '' && $simplicityquery[0] != '#') {
                        $database->setQuery($simplicityquery);
                        if (!$database->query()) {
                            JError::raiseWarning(1, 'JInstaller::install: ' . JText::_('SQL Error') . " " . $database->stderr(true));
                        }
                    }
                }
                //endfoearch
            }
        }
    }
    if (!empty($version) && $version <= '7.4.5') {
        if (version_compare(JVERSION, '1.6.0', '>=')) {
            //j16
            $query[] = 'UPDATE `#__assets` SET `rules`=\'{"core.admin":{"1":1},"core.manage":{"1":1}}\' WHERE `name`=\'com_jnews\'';
        }
    }
    // ALTER TABLE `jos_jnews_mailings` CHANGE `cat_id` `cat_id` VARCHAR( 250 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0:0'
    if (empty($version) || $version < '7.5.0') {
        $xf->update('show_unsubscribelink', '1');
        $xf->update('show_subscriptionlink', '1');
        $xf->update('upload_url', '/media/com_jnews/upload');
        $q = "SHOW FIELDS FROM `#__jnews_mailings`";
        $database->setQuery($q);
        $queueFields = $database->loadObjectList('Field');
        if (!array_key_exists('smart_date', $queueFields)) {
            $query[] = 'ALTER TABLE `#__jnews_mailings` ADD `smart_date` TINYINT UNSIGNED NOT NULL DEFAULT 0';
        }
        $q = "SHOW FIELDS FROM `#__jnews_queue`";
        $database->setQuery($q);
        $queueFields = $database->loadObjectList('Field');
        if (!array_key_exists('params', $queueFields)) {
            $query[] = 'ALTER TABLE `#__jnews_queue` ADD `params` TEXT NOT NULL';
        }
        if (!array_key_exists('block', $queueFields)) {
            $query[] = 'ALTER TABLE `#__jnews_queue` ADD `block` TINYINT NOT NULL DEFAULT 0';
        }
    }
    if (empty($version) || version_compare($version, '7.6.0', '<')) {
        $xf->insert('sntag_norequired', '1');
        $conf = JFactory::getConfig();
        $xf->insert('sendmail_email', $conf->get('config.mailfrom'));
        $xf->insert('subs_redirect_url', '');
        $xf->insert('subscribe_notification', '');
        $xf->insert('unsubscribe_notification', '');
        $xf->insert('component_theme', 'joobilist');
        $xf->insert('allow_fe_autoresponder', '0');
    }
    if (empty($version) || version_compare($version, '7.7.0', '<')) {
        $xf->insert('archive_link', 'standard');
    }
    //Query to quickly synchronise all your subscribers during the install!
    $query[] = "INSERT IGNORE INTO `#__jnews_subscribers` ( `user_id` , `name` , `email` , `receive_html` , `confirmed` , `blacklist` , `subscribe_date` )" . "SELECT U.id, U.name, U.email, '1', '1', U.block , UNIX_TIMESTAMP(U.registerDate) from `#__users` as U;";
    if (empty($vers)) {
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //j15
            $query[] = "UPDATE #__components SET ordering = -2147483800 WHERE admin_menu_link='option=com_jnews'";
            //		}else{ //j16
            //			$query[] = "UPDATE #__extensions SET ordering = -2147483800 WHERE element='option=com_jnews'";
        }
    }
    //We publish back the module
    $query[] = "UPDATE `#__modules` SET `published`= 1 WHERE `module` LIKE '%jnews%' ";
    $size = sizeof($query);
    for ($index = 0; $index < $size; $index++) {
        $database->setQuery($query[$index]);
        $database->query();
    }
    if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) {
        if (class_exists('jNews_Social')) {
            if (!empty($version) && $version < '6.0.2') {
                $xf->insert('use_masterlists', '1', 0);
                $xf->insert('list_creatorfe', '24,25,7,8', 0);
            }
            jNews_Social::createMasterList(1);
            jNews_Social::createMasterList(2);
            jNews_Social::createMasterList(3);
            jNews_Social::createMasterList(4);
        }
    }
    //we call sql file for the additional templates
    if (is_array($templateFields) && array_key_exists('availability', $templateFields)) {
        //line to be removed code #7321011
        $templatessql = 'dwntemplates.sql';
        //to be changed if we packaged the superpack
        $buffer = file_get_contents(JNEWSPATH_ADMIN . DS . $templatessql);
        // Graceful exit and rollback if read not successful
        if ($buffer) {
            // Create an array of queries from the sql file
            jimport('joomla.installer.helper');
            $queries = JInstallerHelper::splitSql($buffer);
            // No queries to process
            if (count($queries) != 0) {
                // Process each query in the $queries array (split out of sql file).
                foreach ($queries as $query) {
                    $query = trim($query);
                    if ($query != '' && $query[0] != '#') {
                        $database->setQuery($query);
                        if (!$database->query()) {
                            JError::raiseWarning(1, 'JInstaller::install: ' . JText::_('SQL Error') . " " . $database->stderr(true));
                            //return false;
                        }
                    }
                }
                //endfoearch
            }
        }
    }
    if (empty($vers)) {
        $xf->filetoDatabase($confiX);
    }
    //create the upload directory
    jnews::createDirectory(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'upload' . DS);
    //check if CSS file exist if not move it
    jimport('joomla.filesystem.folder');
    $cssLocation = JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'modules' . DS;
    if (!JFolder::exists($cssLocation)) {
        JFolder::copy(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'components' . DS . JNEWS_OPTION . DS . 'modules' . DS, $cssLocation);
    }
    if (empty($vers)) {
        setupMaiOptions($confiX);
    }
    //we install the default templates
    installDefTemplate();
    //we install the extensions
    installExtensions();
    //we send a welcome message to the admin/logged in user of the site that jNews is successfully installed
    //we will only send email at fresh install
    if (empty($version)) {
        sendWelcomeEmail();
    }
    if (jnews::checkCB()) {
        installPlugin();
    }
    jNews_Subscribers::updateCBSubscribers(true, true);
    $xf->update('component', $confiX['component']);
    $xf->update('type', $confiX['type']);
    $xf->update('version', $confiX['version']);
    $xf->update('level', $confiX['level']);
    if (!($confiX['type'] == 'GPL' || $confiX['type'] == 'CORE')) {
        $message = jnews::M('noimage', _JNEWS_THANKYOU, false);
    }
    if (empty($message)) {
        $message = '';
    }
    backHTML::_header(_JNEWS_MENU_INSTALL, 'install.png', $message, '', '');
    $html = '';
    $link = 'index.php?option=' . JNEWS_OPTION . '&act=start';
    $docuLink = 'http://www.joobi.co/index.php?option=com_content&view=article&id=7871:installation-errors&catid=29:jnews&Itemid=72';
    $html .= '&nbsp;' . _JNEWS_INSTALL_ERRORN . ' <a href="' . $docuLink . '">' . _JNEWS_INSTALL_DOC . '</a>';
    // if acajoom component exist... means this would be an update
    // display an update button
    require_once JNEWSPATH_CLASS . 'class.update.php';
    if (jNews_Update::checkAcajoom()) {
        //check if acajoom data are already transferred to jnews tables
        if (!jNews_Update::checkAcaUpdate()) {
            $html .= '<div style="border: 5px groove #F0F8FF; padding: 10px; position: fixed; right: 1px; top: 150px; background-color: #F0F8FF;">';
            $html .= '<img border="0" align="right" alt="jNews Logo" src="components/' . JNEWS_OPTION . '/images/jnewsletter.png" width="25">';
            $html .= '<br><br><span style="font-size:15px;text-decoration:none;">' . _JNEWS_INSTALL_ACAUPDATEMSG . '</span></b>';
            $html .= '<a href="index.php?option=' . JNEWS_OPTION . '&amp;act=acaupdate">';
            $html .= '<div style="background-image: url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'btn_orange.png); background-repeat:no-repeat; height: 15px; width: 170px; border:none; padding:13px 40px 15px; position:relative; left:50px; top:10px;">';
            $html .= '<span style="color: #FFF; font-weight: bold; padding-right:30px; margin-top: 5px; text-decoration: none;"> ' . _JNEWS_INSTALL_ACAUPDATEBTN . ' </span>';
            $html .= '</div></a>';
            $html .= '<br><br>';
            $html .= '<b>' . _JNEWS_INSTALL_ACAUPDATENOTE . '</b>';
            $html .= '<br><br>';
            $html .= '</div>';
        }
    }
    $html .= '<div style="float:center;padding: 20px; width:470px; margin-right: 10px;"><center>' . '<a href="index.php?option=' . JNEWS_OPTION . '&amp;act=start">
				<div style="background-image: url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'btn_orange.png); background-repeat:no-repeat; height: 40px; width: 232px; border:none; padding:12px 0 15px 0;">
				<span style="color: #FFF; font-weight: bold; padding-right:30px; margin-top: 5px; text-decoration: none;">' . _JNEWS_INSTALL_CLICKSTART . '</span></div>
				</a></center></div><div style="clear:both;"></div>';
    if ($confiX['level'] > 2) {
        backHTML::about();
        echo '<center>' . $html;
        echo $return . '</center>';
    } elseif ($confiX['level'] > 1) {
        backHTML::installPRO($html, $return);
    } else {
        backHTML::installPlus($html, $return);
    }
    return $return;
}
Esempio n. 19
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;
}
    function showSubscribers($subscribers, $action, $listId, &$lists, $start, $limit, $total, $showAdmin, $theLetterId, $emailsearch, $forms)
    {
        global $my;
        echo $forms['select'];
        ?>
		<input type="hidden" name="option" value="com_acajoom" />
		<input type="hidden" name="act" value="<?php 
        echo $action;
        ?>
" />
		<input type="hidden" name="task" value="" />
    	<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
		<input type="hidden" name="limit" value="<?php 
        echo $limit;
        ?>
" />

		<table style="text-align: left; width: 100%;" border="0"
	 cellpadding="2" cellspacing="0"><tbody><tr>
	 <td style="text-align: left; padding-left: 20px;"><span class="sectionname">
	 <?php 
        if ($listId == 0) {
            echo _ACA_SUSCRIB_LIST;
        } else {
            $lt_name = lists::getLists($listId, 0, null, '', false, false, true);
            echo _ACA_SUSCRIB_LIST_UNIQUE . "<span style='color: rgb(51, 51, 51);'>" . $lt_name[0]->list_name . "</span>";
        }
        ?>
	 </span>
	 </td>
	 <td style="text-align: right;">
	 <?php 
        echo _ACA_SEL_LIST . ' : ' . $lists['listid'] . " ";
        ?>
 <?php 
        echo _ACA_FILTER;
        ?>
 :
	<input type="text" name="emailsearch" value="<?php 
        echo $emailsearch;
        ?>
" class="inputbox" onChange="document.AcajoomFilterForm.submit();" />
	</td></tr></tbody></table>
	</form>

	<?php 
        echo $forms['main'];
        ?>
		<input type="hidden" name="option" value="com_acajoom" />
		<input type="hidden" name="act" value="<?php 
        echo $action;
        ?>
" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="userid" value="" />
    	<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
		<input type="hidden" name="start" value="<?php 
        echo $start;
        ?>
" />
		<input type="hidden" name="limit" value="<?php 
        echo $limit;
        ?>
" />
		<input type="hidden" name="emailsearch" value="<?php 
        echo $emailsearch;
        ?>
" />
	<table width="100%"  border="0" cellspacing="0" cellpadding="4" class="adminlist">
		<tr>
			<th class="title">#</th>
			<th class="title">&nbsp;</th>
			<th class="title"><?php 
        echo _ACA_INPUT_NAME;
        ?>
</th>
			<th class="title"><?php 
        echo _ACA_INPUT_EMAIL;
        ?>
</th>
			<th class="title"><?php 
        echo _ACA_SIGNUP_DATE;
        ?>
</th>
			<th class="title"><center><?php 
        echo _ACA_REGISTERED;
        ?>
?</center></th>
			<th class="title"><center><?php 
        echo _ACA_CONFIRMED;
        ?>
?</center></th>
			<th class="title"><center><?php 
        echo _ACA_HTML;
        ?>
?</center></th>
	<?php 
        if ($my->usertype == 'Administrator' or $my->usertype == 'Super Administrator') {
            ?>
			<th class="title">id#</th>
	<?php 
        }
        ?>
		</tr>
		<?php 
        $i = 0;
        if (!empty($subscribers)) {
            foreach ($subscribers as $subscriber) {
                if ($subscriber->user_id != 0) {
                    $img = 'tick.png';
                    $alt = 'Registered';
                } else {
                    $img = 'publish_x.png';
                    $alt = 'Unregistered';
                }
                if ($subscriber->confirmed == 1) {
                    $imgC = 'tick.png';
                    $altC = 'Confirmed';
                } else {
                    $imgC = 'publish_x.png';
                    $altC = 'Not confirmed';
                }
                if ($subscriber->receive_html == 1) {
                    $imgH = 'tick.png';
                    $altH = 'HTML';
                } else {
                    $imgH = 'publish_x.png';
                    $altH = 'TEXT';
                }
                ?>
				<tr class="row<?php 
                echo ($i + 1) % 2;
                ?>
">
					<td><?php 
                echo $i + 1 + $start;
                ?>
</td>
					<td>
						<input type="checkbox" name="cid[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo $subscriber->id;
                ?>
" onclick="isChecked(this.checked);" />
					</td>
					<td>
					<a href="index2.php?option=com_acajoom&act=<?php 
                echo $action;
                ?>
&task=show&userid=<?php 
                echo $subscriber->id;
                ?>
" >
					<?php 
                echo $subscriber->name;
                ?>
</a></td>
					<td><?php 
                echo $subscriber->email;
                ?>
</td>
					<td><?php 
                echo $subscriber->subscribe_date;
                ?>
</td>
					<td align="center">
						<img src="images/<?php 
                echo $img;
                ?>
" width="12" height="12" border="0" alt="<?php 
                echo $alt;
                ?>
" />
					</td>

					<td align="center">
						<img src="images/<?php 
                echo $imgC;
                ?>
" width="12" height="12" border="0" alt="<?php 
                echo $altC;
                ?>
" />
					</td>
					<td align="center">
						<img src="images/<?php 
                echo $imgH;
                ?>
" width="12" height="12" border="0" alt="<?php 
                echo $altH;
                ?>
" />
					</td>
					<?php 
                $i++;
                if ($my->usertype == 'Administrator' or $my->usertype == 'Super Administrator') {
                    echo '<td align="center">' . $subscriber->id . '</td>';
                }
            }
        }
        ?>
			</tr>
	</table>
	</form>
	<?php 
        backHTML::footerCounts($start, $limit, $emailsearch, $total, 9, $action, $listId, '');
    }
Esempio n. 21
0
/**
* @copyright Copyright (C) 2009 Joobi Limited All rights reserved.
* @license This file is released under the GPL license (http://www.gnu.org/licenses )
* @link http://www.ijoobi.com
*/
function subscribers($action, $task, $userid, $listId, $cid)
{
    $erro = new xerr(__FILE__, __FUNCTION__);
    if (ACA_CMSTYPE) {
        // joomla 15
        $subscriberId = intval(JRequest::getVar('subscriber_id', ''));
        $message = JRequest::getVar('message', '');
    } else {
        //joomla 1x
        $subscriberId = intval(mosGetParam($_REQUEST, 'subscriber_id', ''));
        $message = mosGetParam($_REQUEST, 'message', '');
    }
    //endif
    $doShowSubscribers = true;
    subscribers::updateSubscribers();
    switch ($task) {
        case 'updateOneSub':
            $doShowSubscribers = true;
            $message = acajoom::printYN(subscribers::updateOneSubscriber(), _ACA_UPDATED_SUCCESSFULLY, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'deleteOneSub':
            $doShowSubscribers = true;
            $message = acajoom::printYN(subscribers::deleteOneSubscriber($subscriberId), _ACA_SUBSCRIBER_DELETED, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'cancelSub':
            $doShowSubscribers = true;
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'edit':
            foreach ($cid as $id) {
                compa::redirect('index2.php?option=com_acajoom&act=subscribers&task=show&userid=' . $id);
            }
            break;
        case 'show':
            $doShowSubscribers = false;
            $qid[0] = $userid;
            $subscriber = subscribers::getSubscribersFromId($qid, false);
            $lists = lists::getLists(0, 0, 1, '', false, false);
            $queues = queue::getSubscriberLists($userid);
            $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n";
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            backHTML::formStart('', 0, '');
            echo subscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, acajoom::checkPermissions('admin'), false, false);
            $go[] = acajoom::makeObj('act', $action);
            $go[] = acajoom::makeObj('subscriber_id', $subscriber->id);
            $go[] = acajoom::makeObj('user_id', $subscriber->user_id);
            backHTML::formEnd($go);
            break;
        case 'new':
        case 'add':
            $doShowSubscribers = false;
            $newSubscriber->id = '';
            $newSubscriber->user_id = 0;
            $newSubscriber->name = '';
            $newSubscriber->email = '';
            $newSubscriber->receive_html = 1;
            $newSubscriber->confirmed = 1;
            $newSubscriber->blacklist = 0;
            $newSubscriber->timezone = '00:00:00';
            $newSubscriber->language_iso = 'eng';
            $newSubscriber->params = '';
            $newSubscriber->subscribe_date = acajoom::getNow();
            $lists = lists::getLists(0, 0, 1, '', false, false);
            $queues = '';
            $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n";
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            backHTML::formStart('', 0, '');
            echo subscribersHTML::editSubscriber($newSubscriber, $lists, $queues, $forms, acajoom::checkPermissions('admin'), false, false);
            $go[] = acajoom::makeObj('act', $action);
            $go[] = acajoom::makeObj('subscriber_id', $newSubscriber->id);
            $go[] = acajoom::makeObj('user_id', $newSubscriber->user_id);
            backHTML::formEnd($go);
            break;
        case 'doNew':
            $doShowSubscribers = true;
            $message = acajoom::printYN(subscribers::insertOneSubscriber(), _ACA_UPDATED_SUCCESSFULLY, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'delete':
            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) {
                    $erro->ck = subscribers::deleteOneSubscriber($id);
                    if (!$erro->ck) {
                        $status = false;
                    }
                }
                $message = acajoom::printYN($status, _ACA_SUBSCRIBER_DELETED, _ACA_ERROR);
                backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            }
            break;
        case 'update':
            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) {
                    if (ACA_CMSTYPE) {
                        // joomla 15
                        $changes = JRequest::getVar($id, array(0));
                    } else {
                        //joomla 1x
                        $changes = mosGetParam($_REQUEST, $id, array(0));
                    }
                    //endif
                    if (!isset($changes['receive_html'])) {
                        $changes['receive_html'] = 0;
                    }
                    if (!isset($changes['confirmed'])) {
                        $changes['confirmed'] = 0;
                    }
                }
            }
            $message = acajoom::print_message(_ACA_UPDATED_SUCCESSFULLY, 1);
            break;
        case 'export':
            $doShowSubscribers = false;
            subscribersHTML::export($action, $listId);
            break;
        case 'doExport':
            $message = acajoom::printYN(subscribers::export($listId), _EXPORT, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'import':
            $doShowSubscribers = false;
            $lists = lists::getLists(0, 0, 1, 'listnameA', false, false, true);
            subscribersHTML::import($action, $lists);
            break;
        case 'doImport':
            $message = acajoom::printYN(subscribers::import($listId), _ACA_IMPORT_FINISHED, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
            break;
        case 'subscribeAll':
            break;
        case 'unsubscribeAll':
            break;
        case 'cancel':
            if ($listId != 0) {
                $listId = 0;
            } else {
                compa::redirect('index2.php?option=com_acajoom');
            }
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
        case 'cpanel':
            backHTML::controlPanel();
            $doShowSubscribers = 0;
            break;
        default:
            backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action);
            break;
    }
    if ($doShowSubscribers) {
        if (ACA_CMSTYPE) {
            // joomla 15
            $start = intval(JRequest::getVar('start', 0));
            $conf =& JFactory::getConfig();
            $mail->Mailer = $conf->getValue('config.mailer');
            // $GLOBALS['mosConfig_mailer'];
            $limit = intval(JRequest::getVar('limit', $conf->getValue('config.list_limit')));
            $emailsearch = JRequest::getVar('emailsearch', '');
        } else {
            //joomla 1x
            $mail->Mailer = $GLOBALS['mosConfig_mailer'];
            $start = intval(mosGetParam($_REQUEST, 'start', 0));
            $limit = intval(mosGetParam($_REQUEST, 'limit', $GLOBALS['mosConfig_list_limit']));
            $emailsearch = mosGetParam($_REQUEST, 'emailsearch', '');
        }
        //endif
        $total = 0;
        $subscribers = subscribers::getSubscribers($start, $limit, $emailsearch, $total, $listId, '', '', '', 'sub_dateD');
        if ($listId != 0) {
            $showAdmin = true;
        } else {
            $showAdmin = false;
        }
        $dropDownList = lisType::getListsDropList(0, '', '');
        if (ACA_CMSTYPE) {
            // joomla 15
            $lists['listid'] = JHTML::_('select.genericlist', $dropDownList, 'listid', 'class="inputbox" size="1" onchange="document.AcajoomFilterForm.submit();"', 'id', 'list_name', $listId);
        } else {
            //joomla 1x
            $lists['listid'] = mosHTML::selectList($dropDownList, 'listid', 'class="inputbox" size="1" onchange="document.AcajoomFilterForm.submit();"', 'id', 'list_name', $listId);
        }
        //endif
        $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n";
        $forms['select'] = " <form action='index2.php' method='post' name='AcajoomFilterForm'> \n";
        backHTML::formStart('show_mailing', 0, '');
        subscribersHTML::showSubscribers($subscribers, $action, $listId, $lists, $start, $limit, $total, $showAdmin, $listId, $emailsearch, $forms);
    }
    return true;
}
Esempio n. 22
0
function about($message, $task, $action)
{
    switch ($task) {
        case 'cpanel':
            backHTML::controlPanel();
            break;
        default:
            backHTML::_header(_ACA_MENU_ABOUT . ' Acajoom', 'credits.png', $message, $task, $action);
            backHTML::about();
    }
}
Esempio n. 23
0
/**
* @copyright Copyright (C) 2009 Joobi Limited All rights reserved.
* @license This file is released under the GPL license (http://www.gnu.org/licenses )
* @link http://www.ijoobi.com
*/
function update($action, $task)
{
    $update = new wupdate();
    $showListing = true;
    $showComplete = false;
    if (ACA_CMSTYPE) {
        // joomla 15
        $message = JRequest::getVar('message', '');
    } else {
        //joomla 1x
        $message = mosGetParam($_REQUEST, 'message', '');
    }
    //endif
    if (ini_get('safe_mode')) {
    } else {
        @set_time_limit(60 * $GLOBALS[ACA . 'script_timeout']);
    }
    /*if ((ini_get('allow_url_fopen') == false && !in_array('curl', get_loaded_extensions())) || ini_get('safe_mode') == true) {
    		 echo _ACA_WARNING_1011;
    		 return;
    	 }*/
    switch ($task) {
        case 'doUpdate':
            backHTML::_header(_ACA_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':
            compa::redirect('index2.php?option=com_acajoom&act=update');
            $showListing = false;
            break;
        case 'cpanel':
            compa::redirect('index2.php?option=com_acajoom');
            $showListing = false;
            break;
        case 'new1':
            backHTML::_header(_ACA_MENU_UPDATE, 'backup.png', $message, $task, $action);
            $message = acajoom::printYN(acajoom::upgrade_News1(), '<br />' . _ACA_IMPORT_SUCCESS . ' Anjel data', _ACA_ERROR);
            acajoom::resetUpgrade(1);
            echo '<br />' . $message;
            break;
        case 'new2':
            backHTML::_header(_ACA_MENU_UPDATE, 'backup.png', $message, $task, $action);
            $message = acajoom::printYN(acajoom::upgrade_News2(), '<br />' . _ACA_IMPORT_SUCCESS . ' Letterman data', _ACA_ERROR);
            acajoom::resetUpgrade(2);
            echo '<br />' . $message;
            break;
        case 'new3':
            backHTML::_header(_ACA_MENU_UPDATE, 'backup.png', $message, $task, $action);
            $message = acajoom::printYN(acajoom::upgrade_News3(), '<br />' . _ACA_IMPORT_SUCCESS . ' YaNC data', _ACA_ERROR);
            acajoom::resetUpgrade(3);
            echo '<br />' . $message;
            break;
    }
    if ($showListing) {
        backHTML::_header(_ACA_MENU_UPDATE, 'backup.png', $message, $task, $action);
        backHTML::_upgrade();
        $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n";
        echo $forms['main'];
        backHTML::formStart('', '', '');
        backHTML::showCompsList($update);
        $go[] = acajoom::makeObj('act', $action);
        backHTML::formEnd($go);
    } elseif ($showComplete) {
        backHTML::_header(_ACA_MENU_UPDATE, 'backup.png', $message, $task, $action);
        $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n";
        echo $forms['main'];
        backHTML::formStart('', '', '');
        backHTML::showUpdateOptions($update);
        $go[] = acajoom::makeObj('act', $action);
        backHTML::formEnd($go);
    }
}
 function about()
 {
     echo '<table width="100%" align="left"><tr>';
     echo '<td>';
     echo '<form action="index2.php" method="post" name="adminForm">';
     acajoom::beginingOfTable('acajoomtable');
     acajoom::miseEnPage('Description', '', constant('_ACA_DESC_' . strtoupper($GLOBALS[ACA . 'type'])));
     acajoom::miseEnPage('Project Manager', '', 'Adrien Baborier');
     acajoom::miseEnPage('Contributor', '', 'Christelle Gesset');
     acajoom::miseEnPage('Logo design', '', '<a href="http://www.gaboink.com" target="_blank">George Jones</a>');
     acajoom::miseEnPage('Template design', '', '<a href="http://www.72dpi.net.au" target="_blank">Ryan Scott</a>');
     acajoom::miseEnPage('Video tutorials', '', '<a href="http://www.wisewomengroup.com" target="_blank">Lisa Egan</a>');
     acajoom::miseEnPage('CB Integration', '', 'Mikko R&ouml;nkk&ouml;');
     acajoom::miseEnPage('Add-ons', '', 'Kyle Witt');
     acajoom::miseEnPage('Language Translation', '', '');
     acajoom::miseEnPage('Danish', '', 'Joergen Floes');
     acajoom::miseEnPage('Dutch', '', 'Tromp Wezelman & Bart Bevers');
     acajoom::miseEnPage('French', '', 'Christelle Gesset');
     acajoom::miseEnPage('German', '', 'David Freund & Frank Jansen');
     acajoom::miseEnPage('Hungarian', '', 'Zolt&aacute;n Varanka');
     acajoom::miseEnPage('Italian', '', 'Maria Luisa Rossari');
     acajoom::miseEnPage('Norwegian', '', '<a href="http://www.timeoffice.com" target="_blank">Irma Rustad</a>');
     acajoom::miseEnPage('Polish', '', 'Andrzej Herzberg');
     acajoom::miseEnPage('Portuguese', '', 'Ricardo Sim&otilde;es');
     acajoom::miseEnPage('Russian', '', 'Salikhov Ilyas');
     acajoom::miseEnPage('Simplified Chinese', '', '<a href="http://www.joomlagate.com" target="_blank">Baijianpeng</a>');
     acajoom::miseEnPage('Spanish', '', '<a href="http://www.eaid.org" target="_blank">Jorge Pasco</a>');
     acajoom::miseEnPage('Swedish', '', 'Janne Karlsson');
     acajoom::miseEnPage(' ', '', '   ');
     acajoom::miseEnPage(_ACA_VERSION, '', acajoom::version());
     acajoom::miseEnPage(' ', '', '   ');
     acajoom::miseEnPage(_ACA_DESC_HOME, '', '<a href="' . $GLOBALS[ACA . 'homesite'] . '" target="_blank">www.Acajoom.com</a>');
     acajoom::miseEnPage(_ACA_MENU_HELP, '', '<a href="http://www.acajoom.com/content/blogcategory/29/93/" target="_blank">Documentation</a>');
     acajoom::miseEnPage(_ACA_MENU_HELP, '', '<a href="http://www.acajoom.com/index.php?option=com_joomlaboard&Itemid=26&task=listcat&catid=22" target="_blank">Forum</a>');
     acajoom::miseEnPage(_ACA_MENU_LEARN, '', '<a href="' . $GLOBALS[ACA . 'homesite'] . 'index.php?option=com_content&task=blogsection&id=5&Itemid=68" target="_blank">Education Center</a>');
     acajoom::miseEnPage('Copyrights', '', 'Acajoom <i>Your Communciation Partner</i>, &copy; Acajoom Services');
     ### http://www.acajoom.com/license.php
     ### http://www.acajoom.com/license.php
     acajoom::miseEnPage(_ACA_LICENSE, '', '<a href="http://www.acajoom.com/index.php?option=com_content&task=view&id=2282&Itemid=84" target="_blank">&copy; Acajoom Services</a>');
     acajoom::endOfTable();
     backHTML::formEnd();
     echo '</td>';
     echo '<td width="380px">';
     $logo = 'acajoom_slog_' . strtolower($GLOBALS[ACA . 'type']) . '.png';
     echo '<a href="http://www.acajoom.com" target="_blank"><img src="components/com_acajoom/images/' . $logo . '" alt="Acajoom Logo" border="0" align="center" /></a>';
     echo '</td>';
     echo '</tr></table>';
 }
Esempio n. 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;
}
Esempio n. 26
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;
}
Esempio n. 27
0
    function editMailing($mailingEdit, $new, $listId, $forms, $show)
    {
        $lists = array();
        $folders = array();
        if (ACA_CMSTYPE) {
            $my =& JFactory::getUser();
            $folders[] = JHTML::_('select.option', '/');
            $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $mailingEdit->published);
            $lists['visible'] = JHTML::_('select.booleanlist', 'visible', 'class="inputbox"', $mailingEdit->visible);
        } else {
            global $my;
            $folders[] = mosHTML::makeOption('/');
            $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $mailingEdit->published);
            $lists['visible'] = mosHTML::yesnoRadioList('visible', 'class="inputbox"', $mailingEdit->visible);
        }
        //endif
        $images = $mailingEdit->images;
        if (!isset($mailingEdit->list_id)) {
            $mailingEdit->list_id = $listId;
        }
        $pathA = ACA_JPATH_ROOT_NO_ADMIN . '/images/stories';
        $pathL = ACA_JPATH_LIVE . '/images/stories';
        $images = array();
        if (ACA_CMSTYPE) {
            mailingsHTML::ReadImages($pathA, '/', $folders, $images);
            if (!isset($images['/'])) {
                $images['/'][] = JHTML::_('select.option', '');
            }
            $javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '{$pathL}/' )\"";
            $lists['imagefiles'] = JHTML::_('select.genericlist', $images['/'], 'imagefiles', 'class="inputbox" size="10" multiple="multiple" ' . $javascript, 'value', 'text', null);
            $javascript = "onchange=\"changeDynaList( 'imagefiles', folderimages, document.adminForm.folders.options[document.adminForm.folders.selectedIndex].value, 0, 0);  previewImage( 'imagefiles', 'view_imagefiles', '{$pathL}/' );\"";
            $lists['folders'] = JHTML::_('select.genericlist', $folders, 'folders', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', '/');
            $images2 = array();
            foreach ($mailingEdit->images as $file) {
                $temp = explode('|', $file);
                if (strrchr($temp[0], '/')) {
                    $filename = substr(strrchr($temp[0], '/'), 1);
                } else {
                    $filename = $temp[0];
                }
                $images2[] = JHTML::_('select.option', $file, $filename);
            }
            //$javascript	= "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \" onfocus=\"previewImage( 'imagelist', 'view_imagelist', '$path/' )\"";
            $javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '{$pathL}/' ); showImageProps( '{$pathL}/' ); \"";
            $lists['imagelist'] = JHTML::_('select.genericlist', $images2, 'imagelist', 'class="inputbox" size="10" ' . $javascript, 'value', 'text');
            $lists['_align'] = JHTML::_('list.positions', '_align');
            $lists['_caption_align'] = JHTML::_('list.positions', '_caption_align');
        } else {
            mosAdminMenus::ReadImages($pathA, '/', $folders, $images);
            $lists['folders'] = mosAdminMenus::GetImageFolders($folders, $pathL);
            $lists['imagefiles'] = mosAdminMenus::GetImages($images, $pathL);
            $lists['imagelist'] = mosAdminMenus::GetSavedImages($mailingEdit, $pathL);
            $lists['_align'] = mosAdminMenus::Positions('_align');
            $lists['_caption_align'] = mosAdminMenus::Positions('_caption_align');
        }
        //endif
        if (ACA_CMSTYPE) {
            // joomla 15
            $pos[] = JHTML::_('select.option', 'bottom', _CMN_BOTTOM);
            $pos[] = JHTML::_('select.option', 'top', _CMN_TOP);
            $lists['_caption_position'] = JHTML::_('select.genericlist', $pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
        } else {
            //joomla 1x
            $pos[] = mosHTML::makeOption('bottom', _CMN_BOTTOM);
            $pos[] = mosHTML::makeOption('top', _CMN_TOP);
            $lists['_caption_position'] = mosHTML::selectList($pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
        }
        //endif
        backHTML::formStart('edit_mailing', $mailingEdit->html, $images);
        echo $forms['main'];
        if ($new and $mailingEdit->list_type == 7) {
            $mailingEdit->issue_nb = 0;
        }
        mailingsHTML::layout($mailingEdit, $lists, $show);
        ?>
		<input type="hidden" name="images" value="" />
		<input type="hidden" name="html" value="<?php 
        echo $mailingEdit->html;
        ?>
" />
		<input type="hidden" name="new_list" value="<?php 
        echo $new;
        ?>
" />
		<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
		<input type="hidden" name="listype" value="<?php 
        echo $mailingEdit->list_type;
        ?>
" />
		<input type="hidden" name="mailingid" value="<?php 
        echo $mailingEdit->id;
        ?>
" />
		<input type="hidden" name="issue_nb" value="<?php 
        echo $mailingEdit->issue_nb;
        ?>
" />
	    <input type="hidden" name="userid" value="<?php 
        echo $my->id;
        ?>
" />
		<?php 
    }
Esempio n. 28
0
/**
* @copyright Copyright (C) 2009 Joobi Limited All rights reserved.
* @license This file is released under the GPL license (http://www.gnu.org/licenses )
* @link http://www.ijoobi.com
*/
function com_install()
{
    @ini_set('max_execution_time', 0);
    @ini_set('memory_limit', '128M');
    if (defined('JPATH_ROOT') and class_exists('JFactory')) {
        // joomla 15
        define('ACA_JPATH_ROOT', JPATH_ROOT);
    } else {
        define('ACA_JPATH_ROOT', $GLOBALS['mosConfig_absolute_path']);
    }
    //endif
    require_once ACA_JPATH_ROOT . '/components/com_acajoom/defines.php';
    require_once WPATH_ADMIN . 'config.acajoom.php';
    require_once WPATH_ADMIN . 'admin.acajoom.html.php';
    require_once WPATH_CLASS . 'class.acajoom.php';
    $update = new wupdate();
    $xf = new xonfig();
    $return = '';
    if (ACA_CMSTYPE) {
        $database =& JFactory::getDBO();
    } else {
        global $database;
    }
    //endif
    if (!is_writable(ACA_JPATH_ROOT_NO_ADMIN . $acajoomConfigFile['upload_url'])) {
        @chmod(ACA_JPATH_ROOT_NO_ADMIN . $acajoomConfigFile['upload_url'], 0777);
    }
    $query[] = "UPDATE #__components\n\t  SET admin_menu_img='../administrator/components/com_acajoom/images/acajoom_icon.png'\n\t  WHERE admin_menu_link='option=com_acajoom'";
    $query[] = "UPDATE #__components\n\t  SET admin_menu_img='../includes/js/ThemeOffice/edit.png',\n\t  name='" . _ACA_MENU_LIST . "',\n\t  admin_menu_alt='" . _ACA_MENU_LIST . "'\n\t  WHERE admin_menu_link='option=com_acajoom&act=list'";
    $query[] = "UPDATE #__components\n\t  SET admin_menu_img='../includes/js/ThemeOffice/users_add.png' ,\n\t  name='" . _ACA_MENU_SUBSCRIBERS . "',\n\t  admin_menu_alt='" . _ACA_MENU_SUBSCRIBERS . "'\n\t  WHERE admin_menu_link='option=com_acajoom&act=subscribers'";
    $query[] = "UPDATE #__components\n\t  SET admin_menu_img='../includes/js/ThemeOffice/messaging_inbox.png' ,\n\t  name='" . _ACA_MENU_NEWSLETTERS . "',\n\t  admin_menu_alt='" . _ACA_MENU_NEWSLETTERS . "'\n\t  WHERE admin_menu_link='option=com_acajoom&act=mailing&listype=1'";
    $query[] = "UPDATE #__components\n\t  SET admin_menu_img='../includes/js/ThemeOffice/messaging_config.png' ,\n\t  name='" . _ACA_MENU_AUTOS . "',\n\t  admin_menu_alt='" . _ACA_MENU_AUTOS . "'\n\t  WHERE admin_menu_link='option=com_acajoom&act=mailing&listype=2'";
    $query[] = "UPDATE #__components\n\t  SET admin_menu_img='../includes/js/ThemeOffice/query.png' ,\n\t   name='" . _ACA_MENU_STATS . "',\n\t   admin_menu_alt='" . _ACA_MENU_STATS . "'\n\t  WHERE admin_menu_link='option=com_acajoom&act=statistics'";
    $query[] = "UPDATE #__components\n\t  SET admin_menu_img='../includes/js/ThemeOffice/menus.png' ,\n\t   name='" . _ACA_MENU_CONF . "',\n\t   admin_menu_alt='" . _ACA_MENU_CONF . "'\n\t  WHERE admin_menu_link='option=com_acajoom&act=configuration'";
    $query[] = "UPDATE #__components\n\t  SET admin_menu_img='../includes/js/ThemeOffice/restore.png' ,\n\t  name='" . _ACA_MENU_UPDATE . "',\n\t  admin_menu_alt='" . _ACA_MENU_UPDATE . "'\n\t  WHERE admin_menu_link='option=com_acajoom&act=update'";
    $query[] = "UPDATE #__components\n\t  SET admin_menu_img='../includes/js/ThemeOffice/credits.png' ,\n\t  name='" . _ACA_MENU_ABOUT . "',\n\t  admin_menu_alt='" . _ACA_MENU_ABOUT . "'\n\t  WHERE admin_menu_link='option=com_acajoom&act=about'";
    $q = " SELECT `text` FROM `#__acajoom_xonfig` WHERE `akey` = 'version' ";
    $database->setQuery($q);
    $vers = $database->loadResult();
    $err = $database->getErrorMsg();
    if (!empty($err)) {
        $q = " SELECT `text` FROM `#__acajoom_xonfig` WHERE `key` = 'version' ";
        $database->setQuery($q);
        $vers = $database->loadResult();
        if (!empty($vers) and $update->checkVersion($vers, '1.0.6')) {
            ### UPDATE database if before 1.0.7
            $query[] = "ALTER TABLE `#__acajoom_mailings` CHANGE `images` `images` TEXT NOT NULL ";
            $query[] = "ALTER TABLE `#__acajoom_lists` ADD `footer` TINYINT( 1 ) NOT NULL DEFAULT '1' ";
            $query[] = "ALTER TABLE `#__acajoom_lists` ADD `notify_id` INT( 10 ) NOT NULL DEFAULT '0' ";
            $query[] = "ALTER TABLE `#__acajoom_xonfig` DROP INDEX `key` ";
            $query[] = "ALTER TABLE `#__acajoom_xonfig` CHANGE `key` `akey` VARCHAR( 32 ) NOT NULL ";
            $query[] = "ALTER TABLE `#__acajoom_xonfig` CHANGE `value` `value` INT( 11 ) NOT NULL ";
            $query[] = "ALTER TABLE `#__acajoom_stats_global` DROP `listid`  ";
            $query[] = "ALTER TABLE `#__acajoom_stats_global` DROP INDEX `listid` ";
            $query[] = "ALTER TABLE `#__acajoom_stats_global` ADD PRIMARY KEY ( `mailing_id` ) ";
            $query[] = "ALTER TABLE `#__acajoom_stats_details` DROP `listid` ";
            $query[] = "ALTER TABLE `#__acajoom_stats_details` DROP INDEX `listid` ";
            $query[] = "ALTER TABLE `#__acajoom_stats_details` ADD PRIMARY KEY ( `mailing_id` , `subscriber_id` ) ";
            ### 1.0.9
            $query[] = " ALTER TABLE `#__acajoom_mailings` CHANGE `fromname` `fromname` VARCHAR( 64 ) NOT NULL  ";
            $query[] = " ALTER TABLE `#__acajoom_lists` CHANGE `sendername` `sendername` VARCHAR( 64 ) NOT NULL  ";
        }
    }
    if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.0.8')) {
        $query[] = " ALTER TABLE `#__acajoom_mailings` CHANGE `fromname` `fromname` VARCHAR( 64 ) NOT NULL  ";
        $query[] = " ALTER TABLE `#__acajoom_lists` CHANGE `sendername` `sendername` VARCHAR( 64 ) NOT NULL  ";
        ### upgrade path for new versions
        $xf->insert('wait_for_user', '0', 0);
        $xf->insert('report_site', 'http://www.ijoobi.com', 0);
        $xf->insert('use_sef', '0', 0);
        $xf->insert('send_error', '1', 0);
        $xf->insert('report_error', '1', 0);
        $xf->insert('wait_for_user', '0', 0);
        $xf->insert('show_archive', '1', 0);
        $xf->insert('update_notification', '1', 0);
        $xf->update('send_log_address', '@ijoobi.com');
        $xf->update('update_url', 'http://www.ijoobi.com/update/');
    }
    if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.1.0')) {
        $query[] = "ALTER TABLE `#__acajoom_lists` ADD `notification` INT( 10 ) NOT NULL DEFAULT '0' ";
        $xf->update('listname1', '_ACA_NEWSLETTER');
        $xf->update('listnames1', '_ACA_MENU_NEWSLETTERS');
    }
    if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.1.4')) {
        $xf->insert('last_sub_update', '', 0);
        $xf->insert('level', '1', 0);
    }
    if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.3.0')) {
        $xf->insert('show_author', '0', 0);
    }
    if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.5.5')) {
        $xf->insert('addEmailRedLink', '0', 0);
    }
    if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.5.5')) {
        $query[] = " ALTER TABLE `#__acajoom_subscribers` ADD INDEX `subscribe_date` ( `subscribe_date` )   ";
        $query[] = " ALTER TABLE `#__acajoom_queue` CHANGE `subscriber_id` `subscriber_id` INT( 11 ) DEFAULT '0' NOT NULL  ";
    }
    if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.6.4')) {
        $xf->insert('show_jcalpro', '0', 0);
        $xf->insert('redirectconfirm', '', 0);
        $xf->insert('itemidAca', '99', 0);
    }
    if (empty($err) and !empty($vers) and $update->checkVersion($vers, '3.2.0')) {
        $xf->insert('fullcheck', '0', 0);
    }
    $query2 = "SHOW COLUMNS FROM `#__acajoom_lists` ";
    $database->setQuery($query2);
    $columns = $database->loadResultArray();
    if (!in_array('cat_id', $columns)) {
        $query[] = "ALTER TABLE `#__acajoom_lists` CHANGE `choose_time` `cat_id` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'";
    }
    if (!in_array('next_date', $columns)) {
        $query[] = "ALTER TABLE `#__acajoom_lists` ADD `next_date` INT( 11 ) NOT NULL AFTER `notify_id` ";
    }
    if (!in_array('start_date', $columns)) {
        $query[] = "ALTER TABLE `#__acajoom_lists` ADD `start_date` DATE NOT NULL AFTER `next_date`";
    }
    $query[] = 'UPDATE `#__acajoom_lists` SET `acc_level` = 24 WHERE `acc_level` = 0';
    foreach ($acajoomConfigFile as $key => $val) {
        if (!isset($GLOBALS[ACA . $key])) {
            $xf->insert($key, $val, 0);
        }
    }
    if (!empty($vers) and $update->checkVersion($vers, '1.2.2')) {
        $query[] = "UPDATE `#__acajoom_lists` SET `acc_id` = '29' WHERE `acc_id` = '25' ";
    }
    if (empty($err) and !empty($vers) and $update->checkVersion($vers, '3.0.0')) {
        $xf->insert('disabletooltip', '0', 0);
        $xf->insert('minisendmail', '0', 0);
    }
    $query[] = "ALTER TABLE `#__acajoom_lists` CHANGE `cat_id` `cat_id` VARCHAR( 250 ) NOT NULL DEFAULT ''";
    if (empty($err) and !empty($vers) and $update->checkVersion($vers, '3.2.3')) {
        $xf->insert('embed_images', '0', 0);
        $xf->insert('clean_stats', '90', 0);
        $xf->insert('word_wrap', '0', 0);
        $query[] = "UPDATE `#__acajoom_lists` SET `cat_id`  = CONCAT(`cat_id`,':',`notify_id`), `notify_id`= 0 WHERE `list_type` = 7 AND `notify_id` > 0";
    }
    //Query to quickly synchronise all your subscribers during the install!
    $query[] = "INSERT IGNORE INTO `#__acajoom_subscribers` ( `user_id` , `name` , `email` , `receive_html` , `confirmed` , `blacklist` , `subscribe_date` )" . "SELECT U.id, U.name, U.email, '1', '1', U.block , U.registerDate from `#__users` as U;";
    if (!defined('WADMIN')) {
        define('WADMIN', 'administrator' . DS . 'components' . DS . 'com_acajoom' . DS);
    }
    if (!defined('WFRONT')) {
        define('WFRONT', 'components' . DS . 'com_acajoom' . DS);
    }
    $file[] = 'templates';
    $file[] = 'templates/default';
    $file[] = 'templates/index.html';
    $file[] = 'templates/default/default.html';
    $file[] = 'templates/default/tpl0_abovefooter.jpg';
    $file[] = 'templates/default/tpl0_powered_by.gif';
    $file[] = 'templates/default/tpl0_spacer.gif';
    $file[] = 'templates/default/tpl0_top_header.jpg';
    $file[] = 'templates/default/tpl0_underban.jpg';
    $file[] = 'templates/default/index.html';
    foreach ($file as $key5 => $ins) {
        if (!file_exists(ACA_JPATH_ROOT . DS . WFRONT . $ins) && file_exists(ACA_JPATH_ROOT . DS . WADMIN . $ins)) {
            @rename(ACA_JPATH_ROOT . DS . WADMIN . $ins, ACA_JPATH_ROOT . DS . WFRONT . $ins);
        }
    }
    $size = sizeof($query);
    for ($index = 0; $index < $size; $index++) {
        $database->setQuery($query[$index]);
        $database->query();
    }
    if (empty($vers)) {
        $xf->filetoDatabase($acajoomConfigFile);
    }
    $return .= setupMaiOptions($acajoomConfigFile);
    $return .= installBots();
    $return .= installModule();
    if (acajoom::checkCB()) {
        $return .= installPlugin();
    }
    subscribers::updateSubscribers(true, true);
    require_once WPATH_ADMIN . 'version.php';
    $xf->update('component', $localVersion['component']);
    $xf->update('type', $localVersion['type']);
    $xf->update('version', $localVersion['version']);
    $xf->update('level', $localVersion['level']);
    $message = acajoom::printM('noimage', _ACA_THANKYOU);
    backHTML::_header(_ACA_MENU_INSTALL, 'install.png', $message, '', '');
    if ($acajoomConfigFile['type'] == 'PRO') {
        backHTML::about();
    } elseif ($acajoomConfigFile['type'] == 'Plus') {
        backHTML::installPRO();
    } else {
        backHTML::installPlus();
    }
    $link = 'index2.php?option=com_acajoom&act=start';
    echo '<table style="width: 100%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="0"><tbody><tr>' . '<td style=" width: 140px;">&nbsp;</td><td style="text-align: center; vertical-align: middle; width: 140px;"><div id="cpanel">';
    backHTML::quickiconButton($link, 'inbox.png', _ACA_GET_STARTED, false, 'admin');
    echo '</div><td></td></td></tr></tbody></table>' . '<div style="clear:both;"></div>';
    echo '<br/><br/><br/><br/>';
    echo '<a href="http://www.ijoobi.com/index.php?option=com_content&view=article&id=7871:installation-errors&catid=29:acajoom&Itemid=72" target="_blank">If you have any error during the install process, please refer to our documentation at http://www.ijoobi.com/index.php?option=com_content&view=article&id=7871:installation-errors&catid=29:acajoom&Itemid=72</a>';
    echo '<br/><br/>';
    echo $return;
    return $return;
}
Esempio n. 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;
}
Esempio n. 30
0
function queue($action, $task, $listid, $mailingid, $lists, $cid)
{
    $db = JFactory::getDBO();
    $my = JFactory::getUser();
    $start = JRequest::getInt('start');
    $css = '.icon-48-queue { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/queue.png)}';
    $doc = JFactory::getDocument();
    $doc->addStyleDeclaration($css, $type = 'text/css');
    $img = 'queue.png';
    $message = '';
    $xf = new jNews_Config();
    $conf = JFactory::getConfig();
    $mail = new stdClass();
    $mail->Mailer = $conf->get('config.mailer');
    $mailingsearch = JRequest::getVar('mailingsearch', '');
    $start = JRequest::getInt('start');
    $limit = JRequest::getInt('limit', $conf->get('config.list_limit'));
    ?>

<script language="javascript" type="text/javascript">
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if (pressbutton == 'cpanel') {
		form.action = 'index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&act=queue&task=cpanel';
	}else if (pressbutton == 'pqueue') {
		var $ok = confirm('Are you sure you want to process queue?');
		if ( $ok == true ){
			form.action = 'index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&act=queue&task=pqueue';
		}else{
			return;
		}
	}else if (pressbutton == 'stopqueue') {
		var $ok = confirm('Are you sure you want to stop the queue?');
		if ( $ok == true ){
			form.action = 'index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&act=queue&task=stopqueue';
		}else{
			return;
		}
	}else if (pressbutton == 'startqueue') {
		var $ok = confirm('Are you sure you want to start the queue?');
		if ( $ok == true ){
			form.action = 'index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&act=queue&task=startqueue';
		}else{
			return;
		}
	}else if (pressbutton == 'delq') {
		var $ok = confirm('Are you sure you want to delete?');
		if ( $ok == true ){
			form.action = 'index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&act=queue&task=delq';
		}else{
			return;
		}
	}else if (pressbutton == 'cleanq') {
		var $ok = confirm('Are you sure you want to clear the queue?');
		if ( $ok == true ){
			form.action = 'index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&act=queue&task=cleanq';
		}else{
			return;
		}
	}else if (pressbutton == 'block') {
		var $ok = confirm('Are you sure you want to block selected entries?');
		if ( $ok == true ){
			form.action = 'index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&act=queue&task=block';
		}else{
			return;
		}
	}else if (pressbutton == 'unblock') {
		var $ok = confirm('Are you sure you want to unblock selected entries?');
		if ( $ok == true ){
			form.action = 'index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&act=queue&task=unblock';
		}else{
			return;
		}
	}
	submitform( pressbutton );
}
</script>
	<?php 
    $message = JRequest::getVar('message', '');
    $showqueue = true;
    switch ($task) {
        case 'pqueue':
            if (!$GLOBALS[JNEWS . 'queue_status']) {
                //we start the processing of queue
                $xf->update('queue_status', 1);
                $GLOBALS[JNEWS . 'queue_status'] = 1;
            }
            //create smart-newsletter if necessary
            if (class_exists('jNews_Autonews')) {
                $SmartNewsMessageHTML = jNews_Autonews::createSmartNewsletters();
            } else {
                $SmartNewsMessageHTML = '';
            }
            $queueC = new jNews_Queue();
            $queuedMails = $queueC->queueStatus($mailingid);
            $nextQueuedMails = $queueC->queueStatus($mailingid);
            // , true
            if ($GLOBALS[JNEWS . 'level'] > 1) {
                $scheduledMails = $queueC->getScheduled();
            } else {
                $scheduledMails = null;
            }
            jNews_QueueHTML::processQueueHTML($queuedMails, $nextQueuedMails, $scheduledMails, $mailingid, false, $SmartNewsMessageHTML);
            return;
            break;
        case 'stopqueue':
            //we need to implement here how we can stop the queue
            $xf->update('queue_status', 0);
            //we start the processing of queue
            $GLOBALS[JNEWS . 'queue_status'] = 0;
            //we turn off the queue_process to make sure we only have one process going on
            //$xf->update('queue_process', 0);
            //$GLOBALS[JNEWS.'queue_process']=0;
            JToolBarHelper::custom('startqueue', 'start-queue.png', 'start-queue.png', _JNEWS_MENU_STARTQ, false);
            JToolBarHelper::spacer();
            $message = jnews::printYN(true, _JNEWS_MENU_STOPQ_MSG, $message);
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=queue' . $message);
            break;
        case 'startqueue':
            //we need to implement here how we can start back the queue
            $xf->update('queue_status', 1);
            //we stop the processing of queue
            $GLOBALS[JNEWS . 'queue_status'] = 1;
            //we turn off the queue_process to make sure we only have one process going on
            //$xf->update('queue_process', 0);
            //$GLOBALS[JNEWS.'queue_process']=0;
            JToolBarHelper::custom('stopqueue', 'stop-queue.png', 'stop-queue.png', _JNEWS_MENU_STOPQ, false);
            JToolBarHelper::spacer();
            $message = jnews::printYN(true, _JNEWS_MENU_STARTQ_MSG, $message);
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=queue' . $message);
            break;
        case 'cpanel':
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION);
            break;
        case 'delq':
            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;
                if (!empty($cid)) {
                    $db = JFactory::getDBO();
                    $query = 'DELETE from `#__jnews_queue` where `qid` IN (' . implode(',', $cid) . ')';
                    $db->setQuery($query);
                    $db->query();
                }
                $message = jnews::printYN(true, 'Successfully deleted the mailing(s) in the queue.', _JNEWS_ERROR);
            }
            break;
        case 'block':
            JRequest::checkToken() or die('Invalid Token');
            if (!is_array($cid) || count($cid) < 1) {
                echo "<script> alert('Select an item to block'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $status = true;
                if (!empty($cid)) {
                    $message = jnews::printYN(jNews_Queue::updateQueueBlock($cid, 1), 'Successfully blocked the mailing(s) in the queue.', _JNEWS_ERROR);
                }
            }
            break;
        case 'unblock':
            JRequest::checkToken() or die('Invalid Token');
            if (!is_array($cid) || count($cid) < 1) {
                echo "<script> alert('Select an item to unblock'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $status = true;
                if (!empty($cid)) {
                    $message = jnews::printYN(jNews_Queue::updateQueueBlock($cid, 0), 'Successfully blocked the mailing(s) in the queue.', _JNEWS_ERROR);
                }
            }
            break;
        case 'cleanq':
            JRequest::checkToken() or die('Invalid Token');
            $db = JFactory::getDBO();
            $query = 'DELETE from `#__jnews_queue` WHERE `type` < 7';
            //do not delete the smartnewsletter type 7 and type 8
            $db->setQuery($query);
            $db->query();
            $message = jnews::printYN(true, ' Successfully cleared the mailings in the queue! ', _JNEWS_ERROR);
            break;
        default:
            if ($GLOBALS[JNEWS . 'queue_status'] == 1) {
                JToolBarHelper::custom('stopqueue', 'stop-queue.png', 'stop-queue.png', _JNEWS_MENU_STOPQ, false);
            } else {
                JToolBarHelper::custom('startqueue', 'start-queue.png', 'start-queue.png', _JNEWS_MENU_STARTQ, false);
            }
            JToolBarHelper::spacer();
    }
    if ($showqueue) {
        $paginationStart = JRequest::getVar('pg');
        $app = JFactory::getApplication();
        if (!empty($paginationStart)) {
            $limitstart = 0;
            $limitend = $paginationStart;
        } else {
            $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int');
            $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int');
        }
        $limittotal = jNews_Queue::getQueueCount($mailingid);
        $setLimit = new stdClass();
        $setLimit->total = !empty($limittotal) ? $limittotal : 0;
        $setLimit->start = !empty($limitstart) ? $limitstart : 0;
        $setLimit->end = !empty($limitend) ? $limitend : $limittotal;
        $setSort = new stdClass();
        $setSort->orderValue = $app->getUserStateFromRequest(JNEWS_OPTION . '.queue.filter_order', 'filter_order', 'q.send_date', 'cmd');
        $setSort->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.queue.filter_order_Dir', 'filter_order_Dir', 'asc', 'word');
        //count only the search result
        if (!empty($mailingsearch)) {
            $mailingq = jNews_Queue::getMailingqueue($mailingsearch, $mailingid, 0, 0, $setSort);
            $setLimit->total = count($mailingq);
        }
        // recheck start
        if ($setLimit->total <= $setLimit->start) {
            $setLimit->start = 0;
        }
        //perform query for all or specific search
        $mailingq = jNews_Queue::getMailingqueue($mailingsearch, $mailingid, $setLimit->start, $setLimit->end, $setSort);
        $form['main'] = " <form  name='adminForm' method='POST' action='index.php'  id=\"adminForm\">";
        $form['select'] = " <form name='jnewsFilterForm' method='POST' action='index.php'> \n";
        backHTML::_header('Mailing Queue', $img, $message, $task, $action);
        jNews_QueueHTML::showMailingQueue($mailingq, $lists, $form, $setLimit->start, $setLimit->end, $mailingsearch, $setLimit, $setSort);
        $go[] = jnews::makeObj('act', $action);
        $go[] = jnews::makeObj('filter_order', $setSort->orderValue);
        $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir);
        backHTML::formEnd($go);
    }
    return true;
}