Exemplo n.º 1
0
function setupMaiOptions($acajoomConfigFile)
{
    $xf = new xonfig();
    $return = '<br />' . _ACA_INSTALL_CONFIG . ' : ';
    $config = array();
    $exist = acajoom::checkExisting();
    if ($exist['news1'] == 0) {
        $config['news1'] = '0';
    }
    if ($exist['news2'] == 0) {
        $config['news2'] = '0';
    }
    if ($exist['news3'] == 0) {
        $config['news3'] = '0';
    }
    if (ACA_CMSTYPE) {
        // joomla 15
        $conf =& JFactory::getConfig();
        $config['emailmethod'] = $conf->getValue('config.mailer');
        $config['sendmail_path'] = $conf->getValue('config.sendmail');
        $config['sendmail_from'] = $conf->getValue('config.mailfrom');
        $config['sendmail_name'] = $conf->getValue('config.fromname');
        $config['smtp_host'] = $conf->getValue('config.smtphost');
        $config['smtp_auth_required'] = $conf->getValue('config.smtpauth');
        $config['smtp_username'] = $conf->getValue('config.smtpuser');
        $config['smtp_password'] = $conf->getValue('config.smtppass');
        $config['confirm_fromname'] = $conf->getValue('config.fromname');
        $config['confirm_fromemail'] = $conf->getValue('config.mailfrom');
        $config['confirm_return'] = $conf->getValue('config.mailfrom');
    } else {
        //joomla 1x
        $config['emailmethod'] = $GLOBALS['mosConfig_mailer'];
        $config['sendmail_path'] = $GLOBALS['mosConfig_sendmail'];
        $config['sendmail_from'] = $GLOBALS['mosConfig_mailfrom'];
        $config['sendmail_name'] = $GLOBALS['mosConfig_fromname'];
        $config['smtp_host'] = $GLOBALS['mosConfig_smtphost'];
        $config['smtp_auth_required'] = $GLOBALS['mosConfig_smtpauth'];
        $config['smtp_username'] = $GLOBALS['mosConfig_smtpuser'];
        $config['smtp_password'] = $GLOBALS['mosConfig_smtppass'];
        $config['confirm_fromname'] = $GLOBALS['mosConfig_fromname'];
        $config['confirm_fromemail'] = $GLOBALS['mosConfig_mailfrom'];
        $config['confirm_return'] = $GLOBALS['mosConfig_mailfrom'];
    }
    //endif
    $config['date_update'] = acajoom::getNow();
    for ($index = 0; $index < $acajoomConfigFile['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);
    }
    $activeList = '1';
    $config['classes1'] = 'newsletter';
    $config['classes2'] = 'autoresponder';
    $config['classes7'] = 'autonews';
    $xf->insert('activelist', $activeList, 0, true);
    $xf->insert('option', 'com_sdonkey', 0, true);
    $config['listype0'] = '1';
    $config['listname0'] = '';
    $config['listnames0'] = _ACA_MAILING_ALL;
    $config['listshow0'] = '1';
    $config['listlogo0'] = 'addedit.png';
    $config['classes0'] = '';
    $config['listype1'] = '1';
    $config['listname1'] = '_ACA_NEWSLETTER';
    $config['listnames1'] = '_ACA_MENU_NEWSLETTERS';
    $config['listshow1'] = '1';
    $config['listlogo1'] = 'inbox.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());
        }
    }
    wupdate::queue2();
    if ($xf->saveConfig($config)) {
        $return .= acajoom::printM('green', _ACA_INSTALL_SUCCESS) . '<br />';
    } else {
        $return .= 'Configuration file not updated.<br />';
    }
    return $return;
}