示例#1
0
function configuration($action, $task)
{
    global $database;
    $config = array();
    $redirect = true;
    $xf = new xonfig();
    $message = mosGetParam($_REQUEST, 'message', '');
    switch ($task) {
        case 'sendQueue':
            if (class_exists('auto')) {
                echo acajoom::printYN(auto::processQueue(true, true), _ACA_QUEUE_SENT_SUCCESS, _ACA_ERROR);
            }
            backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action);
            configHTML::showConfigEdit($GLOBALS);
            break;
        case 'reset':
            $xf->update('next_autonews', '');
            $xf->update('last_cron', '');
            $xf->update('last_sub_update', '');
            $query = "UPDATE #__acajoom_lists SET `next_date` = '0' WHERE list_type = 7";
            $database->setQuery($query);
            $database->query();
            echo acajoom::printYN(true, ' Smart-Newsletter counter reset successful! ', _ACA_ERROR);
            backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action);
            configHTML::showConfigEdit($GLOBALS);
        case 'syncUsers':
            echo acajoom::printYN(subscribers::syncSubscribers(), _ACA_SYNC_USERS_SUCCESS, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action);
            configHTML::showConfigEdit($GLOBALS);
        case 'apply':
            $clear_log = mosGetParam($_REQUEST, 'clear_log', 0);
            if ($clear_log != 0) {
                unlink($GLOBALS['save_log_file']);
            }
            if (empty($config)) {
                $config = $_REQUEST['config'];
            }
            $message = acajoom::printYN($xf->saveConfig($config), _ACA_CONFIG_UPDATED, _ACA_ERROR);
            $xf->updateActiveList();
            compa::redirect('index2.php?option=com_acajoom&act=configuration&message=' . $message);
            break;
        case 'save':
            $clear_log = mosGetParam($_REQUEST, 'clear_log', 0);
            if ($clear_log != 0) {
                @unlink($GLOBALS['save_log_file']);
            }
            if (empty($config)) {
                $config = $_REQUEST['config'];
            }
            $message = acajoom::printYN($xf->saveConfig($config), _ACA_CONFIG_UPDATED, _ACA_ERROR);
            $xf->updateActiveList();
            backHTML::controlPanel();
            break;
        case 'cancel':
            compa::redirect('index2.php?option=com_acajoom');
            break;
        case 'cpanel':
            backHTML::controlPanel();
            break;
        default:
            backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action);
            configHTML::showConfigEdit($GLOBALS);
            break;
    }
    return true;
}
示例#2
0
function configuration($action, $task)
{
    if (ACA_CMSTYPE) {
        $database =& JFactory::getDBO();
    } else {
        global $database;
    }
    //endif
    $config = array();
    $redirect = true;
    $xf = new xonfig();
    if (ACA_CMSTYPE) {
        // joomla 15
        $message = JRequest::getVar('message', '');
    } else {
        //joomla 1x
        $message = mosGetParam($_REQUEST, 'message', '');
    }
    //endif
    switch ($task) {
        case 'sendQueue':
            if (class_exists('auto')) {
                echo acajoom::printYN(auto::processQueue(true, true), 'Queue processed', _ACA_ERROR);
            }
            auto::displayStatus();
            backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action);
            configHTML::showConfigEdit($GLOBALS);
            break;
        case 'reset':
            $xf->update('next_autonews', '');
            $xf->update('last_cron', '');
            $xf->update('last_sub_update', '');
            $query = "UPDATE #__acajoom_lists SET `next_date` = '0' WHERE list_type = 7";
            $database->setQuery($query);
            $database->query();
            echo acajoom::printYN(true, ' Smart-Newsletter counter reset successful! ', _ACA_ERROR);
            backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action);
            configHTML::showConfigEdit($GLOBALS);
            break;
        case 'syncUsers':
            echo acajoom::printYN(subscribers::syncSubscribers(), _ACA_SYNC_USERS_SUCCESS, _ACA_ERROR);
            backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action);
            configHTML::showConfigEdit($GLOBALS);
            break;
        case 'apply':
            if (ACA_CMSTYPE) {
                // joomla 15
                $clear_log = JRequest::getVar('clear_log', '0');
            } else {
                //joomla 1x
                $clear_log = mosGetParam($_REQUEST, 'clear_log', 0);
            }
            //endif
            if ($clear_log != 0) {
                unlink(ACA_JPATH_ROOT_NO_ADMIN . $GLOBALS[ACA . 'save_log_file']);
            }
            if (empty($config)) {
                $config = $_REQUEST['config'];
            }
            $message = strip_tags(acajoom::printYN($xf->saveConfig($config), _ACA_CONFIG_UPDATED, _ACA_ERROR));
            $xf->updateActiveList();
            compa::redirect('index2.php?option=com_acajoom&act=configuration&message=' . $message);
            break;
        case 'save':
            if (ACA_CMSTYPE) {
                // joomla 15
                $clear_log = JRequest::getVar('clear_log', '0');
            } else {
                //joomla 1x
                $clear_log = mosGetParam($_REQUEST, 'clear_log', 0);
            }
            //endif
            if ($clear_log != 0) {
                @unlink(ACA_JPATH_ROOT_NO_ADMIN . $GLOBALS[ACA . 'save_log_file']);
            }
            if (empty($config)) {
                $config = $_REQUEST['config'];
            }
            $message = acajoom::printYN($xf->saveConfig($config), _ACA_CONFIG_UPDATED, _ACA_ERROR);
            $xf->updateActiveList();
            backHTML::controlPanel();
            break;
        case 'cancel':
            compa::redirect('index2.php?option=com_acajoom');
            break;
        case 'cpanel':
            backHTML::controlPanel();
            break;
        default:
            backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action);
            configHTML::showConfigEdit($GLOBALS);
            break;
    }
    return true;
}