Ejemplo n.º 1
0
     $mySess->clear('flexi_industries', 'JNEWLSETTER');
     $mySess->clear('modjnewsflexi_listid', 'JNEWLSETTER');
     echo '<div id=mod_message><span style="color:green;">You have been successfully subscribed to smartflexi articles.</span></div>';
     //echo jnews::printM('green','Successfully subscribed to smartflexi articles.');
     //		break;
 //echo jnews::printM('green','Successfully subscribed to smartflexi articles.');
 //		break;
 default:
     if (class_exists('jNews_Auto')) {
         $showPanel = false;
         switch ($action) {
             case 'cron':
                 //we save here the time the cron has been launched
                 $config['lasttime_cron_triggerred'] = time();
                 $jNewsConfig = new jNews_Config();
                 $jNewsConfig->saveConfig($config);
                 if (!empty($GLOBALS[JNEWS . 'j_cron']) || $GLOBALS[JNEWS . 'j_cron'] != '0') {
                     //No Cron
                     $password = JRequest::getVar('password', '', '', 'string');
                     if (!empty($password)) {
                         $decodepass = base64_decode($password);
                         if ($decodepass == $GLOBALS[JNEWS . 'cron_pass']) {
                             echo "<br/>jNews Cron launched";
                             $status = jNews_Auto::execute(false);
                             if ($status) {
                                 echo "<br/>Successfully processed queue!";
                             }
                         } else {
                             return false;
                         }
                     } else {
Ejemplo n.º 2
0
 public static function resetUpgrade($index = 0)
 {
     $xf = new jNews_Config();
     $config = array();
     if ($index == 0) {
         $config['news1'] = '0';
         $config['news2'] = '0';
         $config['news3'] = '0';
     } else {
         $config['news' . $index] = '0';
     }
     return $xf->saveConfig($config);
 }
Ejemplo n.º 3
0
function setupMaiOptions($data)
{
    $xf = new jNews_Config();
    $return = '<br />' . _JNEWS_INSTALL_CONFIG . ' : ';
    $config = array();
    $exist = jnews::checkExisting();
    if ($exist['news1'] == 0) {
        $config['news1'] = '0';
    }
    if ($exist['news2'] == 0) {
        $config['news2'] = '0';
    }
    if ($exist['news3'] == 0) {
        $config['news3'] = '0';
    }
    $conf = JFactory::getConfig();
    $config['emailmethod'] = $conf->get('config.mailer');
    $config['sendmail_path'] = $conf->get('config.sendmail');
    $config['sendmail_from'] = $conf->get('config.mailfrom');
    $config['sendmail_email'] = $conf->get('config.mailfrom');
    $config['sendmail_name'] = $conf->get('config.fromname');
    $config['smtp_host'] = $conf->get('config.smtphost');
    $config['smtp_auth_required'] = $conf->get('config.smtpauth');
    $config['smtp_secure'] = $conf->get('config.smtpsecure');
    $config['smtp_username'] = $conf->get('config.smtpuser');
    $config['smtp_password'] = $conf->get('config.smtppass');
    $config['confirm_fromname'] = $conf->get('config.fromname');
    $config['confirm_fromemail'] = $conf->get('config.mailfrom');
    //		$config['confirm_return'] = $conf->get('config.mailfrom');
    $config['max_queue'] = $conf->get('max_queue');
    $config['max_attempts'] = $conf->get('max_attempts');
    $config['date_update'] = jnews::getNow();
    for ($index = 0; $index < $data['nblist']; $index++) {
        $xf->insert('listname' . $index, '', 0);
        $xf->insert('listnames' . $index, '', 0);
        $xf->insert('listype' . $index, '', 0);
        $xf->insert('listshow' . $index, '', 0);
        $xf->insert('classes' . $index, '', 0);
        $xf->insert('listlogo' . $index, '', 0);
        $xf->insert('totallist' . $index, '', 0);
        $xf->insert('act_totallist' . $index, '', 0);
        $xf->insert('totalmailing' . $index, '', 0);
        $xf->insert('totalmailingsent' . $index, '', 0);
        $xf->insert('act_totalmailing' . $index, '', 0);
        $xf->insert('totalsubcribers' . $index, '', 0);
        $xf->insert('act_totalsubcribers' . $index, '', 0);
    }
    //line to be changed code #73099111
    $activeList = '1';
    $config['classes1'] = 'jNews_Newsletter';
    $config['classes2'] = 'jNews_Autoresponder';
    $config['classes7'] = 'jNews_Autonews';
    $xf->insert('activelist', $activeList, 0, true);
    $config['listype0'] = '1';
    $config['listname0'] = '';
    $config['listnames0'] = _JNEWS_MAILING_ALL;
    $config['listshow0'] = '1';
    $config['listlogo0'] = 'subscribers.png';
    $config['classes0'] = '';
    $config['listype1'] = '1';
    $config['listname1'] = '_JNEWS_NEWSLETTER';
    $config['listnames1'] = '_JNEWS_MENU_NEWSLETTERS';
    $config['listshow1'] = '1';
    $config['listlogo1'] = 'newsletter.png';
    $nb = explode(',', $activeList);
    $size = sizeof($nb);
    for ($k = 0; $k < $size; $k++) {
        $index = $nb[$k];
        if (class_exists($config['classes' . $index])) {
            $classConfig = new $config['classes' . $index]();
            $config = array_merge($config, $classConfig->getActive());
        }
    }
    if ($xf->saveConfig($config)) {
        jnews::displayInfo(_JNEWS_INSTALL_SUCCESS, 'success');
    } else {
        jnews::displayInfo('Configuration file not updated', 'error');
    }
}
Ejemplo n.º 4
0
function configuration($action, $task)
{
    $db = JFactory::getDBO();
    $config = array();
    $redirect = true;
    $xf = new jNews_Config();
    $message = JRequest::getVar('message', '');
    $clear_log = JRequest::getVar('clear_log', '0');
    switch ($task) {
        case 'syncUsers':
            echo jnews::printYN(jNews_Subscribers::syncSubscribers(), _JNEWS_SYNC_USERS_SUCCESS, _JNEWS_ERROR);
            backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action);
            jNews_ConfigHTML::showConfigEdit();
            break;
        case 'sendtest':
            $my = JFactory::getUser();
            $mailing = new stdClass();
            $status = false;
            $mailing->id = 1;
            $mailing->images = '';
            $mailing->attachments = '';
            $mailing->fromname = trim($GLOBALS[JNEWS . 'sendmail_name']);
            $mailing->fromemail = trim($GLOBALS[JNEWS . 'sendmail_email']);
            if (empty($mailing->fromemail)) {
                $mailing->fromemail = trim($GLOBALS[JNEWS . 'sendmail_from']);
            }
            ### create the mail
            $mail = jNews_ProcessMail::getMailer($mailing);
            ### create content
            $mail->IsHTML(true);
            $mail->Body = '<p>This message has been sent at ' . date('l, j F Y h:i:s', jnews::getNow(0, true)) . ' from ' . JNEWS_JPATH_LIVE . ' to test your mail configuration.</p><br/><p style="color:green;">' . _JNEWS_SENDTEST_CONFIGSUCC . '</p>';
            $mail->AddAddress($my->email, $my->name);
            $mail->Subject = 'Test Email from ' . JNEWS_JPATH_LIVE;
            $status = $mail->Send();
            $success = 'Email "' . $mail->Subject . '" successfully sent to ' . $my->name . ' (' . $my->email . ')';
            $error = 'Failed sending "' . $mail->Subject . '" to ' . $my->name . ' (' . $my->email . '). <br/>' . _JNEWS_SENDTEST_CONFIGERROR;
            $message = is_bool($status) && $status ? jnews::printM('ok', $success) : jnews::printM('error', $error);
            backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action);
            jNews_ConfigHTML::showConfigEdit();
            echo $message;
            break;
        case 'apply':
        case 'save':
            JRequest::checkToken() or die('Invalid Token');
            if ($clear_log != 0) {
                @unlink(JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'save_log_file']);
            }
            $config = JRequest::getVar('config');
            $message = jnews::printYN($xf->saveConfig($config), _JNEWS_CONFIG_UPDATED, _JNEWS_ERROR);
            $listCreator = JRequest::getVar('list_creatorfe', '', 'post');
            if (!empty($listCreator)) {
                $xf->update('list_creatorfe', $listCreator);
            }
            //we update the active list
            $xf->updateActiveList();
            if ($GLOBALS[JNEWS . 'level'] > 1) {
                //we require the cron controller
                require_once JNEWSPATH_ADMIN . 'controllers' . DS . 'cron.jnews.php';
                //we update the published/enabld of the jnews cron plugin according to what is selected
                if (version_compare(JVERSION, '1.6.0', '<')) {
                    //j15
                    $db->setQuery("UPDATE `#__plugins` SET `published` = " . $config['jnewscronplugin'] . " WHERE `element`='jnewscron' ");
                } else {
                    //j16
                    $db->setQuery("UPDATE `#__extensions` SET `enabled` = " . $config['jnewscronplugin'] . " WHERE `type` = 'plugin' AND `element`='jnewscron' ");
                }
                $db->query();
                //Joobi Cron System
                $cron = $GLOBALS[JNEWS . 'j_cron'];
                if ($cron == 2) {
                    joobiCron('Yes');
                } else {
                    joobiCron('No');
                }
            }
            if ($task == 'apply') {
                backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action);
                jNews_ConfigHTML::showConfigEdit();
                echo $message;
            } else {
                backHTML::controlPanel();
            }
            break;
        case 'cancel':
            jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION);
            break;
        case 'cpanel':
            backHTML::controlPanel();
            break;
        case 'acaupdate':
            // update jnews datas from acajoom
            $msg = jNews_TableUpdate::executeUpdate();
            echo $msg . '<br><br>';
        default:
            backHTML::_header(_JNEWS_MENU_CONF, 'configuration.png', $message, $task, $action);
            jNews_ConfigHTML::showConfigEdit();
            break;
    }
    return true;
}