Ejemplo n.º 1
0
/**
 * Generate astierks configs
 */
function logfiles_get_config($engine)
{
    global $ext, $amp_conf;
    $logfiles_conf = logfiles_conf::create();
    $has_security_option = version_compare($amp_conf['ASTVERSION'], '11.0', 'ge');
    switch ($engine) {
        case 'asterisk':
            $opts = logfiles_get_opts();
            //set logfile data to be generated
            //dbug('here', (isset($logfiles_conf) && ($logfiles_conf instanceof logfiles_conf)), 1);
            if (!isset($logfiles_conf) || !$logfiles_conf instanceof logfiles_conf) {
                dbug('NOT GENERATING LOGGER CONFIGS AS $logfiles_conf IS NOT SET!');
                return false;
            }
            foreach ($opts as $k => $v) {
                switch ($k) {
                    case 'appendhostname':
                    case 'dateformat':
                    case 'queue_log':
                    case 'rotatestrategy':
                        if ($v) {
                            $logfiles_conf->addLoggerGeneral($k, $v);
                        }
                        break;
                    default:
                        break;
                }
            }
            foreach ($opts['logfiles'] as $k => $v) {
                $name = $v['name'];
                unset($v['name']);
                foreach ($v as $opt => $set) {
                    if ($set == 'on') {
                        if ($has_security_option || $opt != 'security') {
                            $name_opt[] = $opt;
                        }
                    }
                }
                //dbug($name, $name_opt);
                $logfiles_conf->addLoggerLogfiles($name, implode(',', $name_opt));
                if (isset($name_opt)) {
                    unset($name_opt);
                }
            }
            break;
    }
}
<?php

require_once dirname(__FILE__) . '/header.php';
$opts = logfiles_get_opts();
$opts['logfiles'][] = $logfiles[] = array('name' => '', 'debug' => '', 'dtmf' => 'off', 'error' => '', 'fax' => 'off', 'notice' => '', 'verbose' => '', 'warning' => '', 'security' => 'off');
$var = array_merge($var, $opts);
//dbug('passing to view', $var);
echo load_view(dirname(__FILE__) . '/views/settings.php', $var);