Beispiel #1
0
session_start();
require 'guiconfig.inc';
require 'appliancebone.lib.php';
require 'libs-php/cfgform.class.php';
define('INCLUDE_FORMSTYLE', true);
$form = new cfgForm('sys_logs.php', 'method=post|name=iform|id=iform');
// set a pointer to the actual configuration variables
$cfgPtr =& $config['system']['syslog'];
// set session name
$sessionName = 'frmSyslogCfg';
if ($_POST) {
    $form->wake($_SESSION[$sessionName]);
    $form->validForm();
    $input_errors = $form->get_errQueue();
    if (count($input_errors) == 0) {
        $cfgPtr['mode'] = $form->getFieldSelectedOpts('mode');
        $cfgPtr['buffer'] = $form->getFieldSelectedOpts('buffer');
        $host = $form->getTextFld('remotehost');
        unset($cfgPtr['remotehost'], $cfgPtr['remoteport']);
        if ($host != '') {
            $cfgPtr['remotehost'] = $form->getTextFld('remotehost');
            $cfgPtr['remoteport'] = $form->getTextFld('remoteport');
        }
        // save configuration
        $retval = 0;
        write_config();
        if (!file_exists($d_sysrebootreqd_path)) {
            config_lock();
            $retval |= restartSyslog($config);
            config_unlock();
        }